12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500 |
- #include <precomp.h>
- #include <bfc/wasabi_std.h>
- #include <bfc/wasabi_std_wnd.h>
- #include <api/script/script.h>
- #include <api/script/scriptmgr.h>
- #include <api/script/scriptobj.h>
- #include <api/script/scriptguid.h>
- #include <api/script/objects/systemobj.h>
- #include <api/service/svcs/svc_action.h>
- #include <api/util/selectfile.h>
- #include <api/script/vcpu.h> // for getAtom, CUT
- #ifdef WASABI_COMPILE_WNDMGR
- #include <api/wnd/wndclass/wndholder.h>
- #include <api/wndmgr/skinembed.h>
- #endif
- #include <api/script/objects/timer.h>
- #include <time.h>
- #include <api.h>
- #ifdef WASABI_COMPILE_SKIN
- #include <api/skin/skinparse.h>
- #include <api/skin/skin.h>
- #endif
- #include <math.h>
- #include <shlobj.h>
- #include <bfc/string/url.h>
- #include <bfc/parse/pathparse.h>
- #include <bfc/tlist.h>
- #ifdef WASABI_COMPILE_WNDMGR
- #include <api/util/varmgr.h>
- #endif
- #include <bfc/nsguid.h>
- #include <api/script/objecttable.h>
- #include <api/skin/groupmgr.h>
- #ifdef WA3COMPATIBILITY
- #include <api/skin/widgets/mb/xuibrowser.h>
- #include <api/skin/widgets/mb/mainminibrowser.h>
- #include <api/util/dde.h>
- #include <api/wac/main.h>//CUT!!
- #endif
- #ifdef WASABI_COMPILE_MEDIACORE
- #include <api/service/svcs/svc_player.h>
- #include <api/core/buttons.h>
- #include <api/core/api_core.h>
- #include <api/core/corehandle.h> // safe to include even if core isn't there
- #endif
- #ifdef WASABI_COMPILE_CONFIG
- #include <api/config/items/attrbool.h>
- #endif
- #include <api/locales/xlatstr.h>
- #include "../Agave/Language/api_language.h"
- #include <api/syscb/callbacks/consolecb.h>
- #include "../nu/AutoChar.h"
- #include "../nu/AutoUrl.h"
- #include "../nu/AutoWide.h"
- #ifdef _WIN32
- #include <shlwapi.h>
- extern HINSTANCE hInstance;
- #endif
- #ifdef GEN_FF
- #include "../../../../Plugins/General/gen_ff/wa2frontend.h"
- #endif
- SystemScriptObjectController _systemController;
- SystemScriptObjectController *systemController = &_systemController;
- #define MAKI_RUNTIME_VERSION 2
- // -- Functions table -------------------------------------
- function_descriptor_struct SystemScriptObjectController::exportedFunction[] =
- {
- {L"getRuntimeVersion", 0, (void*)SystemObject::vcpu_getVersion},
- {L"onScriptLoaded", 0, (void*)SystemObject::vcpu_onScriptLoaded},
- {L"onScriptUnloading", 0, (void*)SystemObject::vcpu_onScriptUnloading},
- {L"onQuit", 0, (void*)SystemObject::vcpu_onQuit},
- {L"onKeyDown", 1, (void*)SystemObject::vcpu_onKeyDown},
- {L"onKeyUp", 1, (void*)SystemObject::vcpu_onKeyUp},
- {L"onAccelerator", 3, (void*)SystemObject::vcpu_onAccelerator},
- {L"getMousePosX", 0, (void*)SystemObject::vcpu_getMousePosX},
- {L"getMousePosY", 0, (void*)SystemObject::vcpu_getMousePosY},
- {L"isMinimized", 0, (void*)SystemObject::vcpu_isMinimized},
- {L"restoreApplication", 0, (void*)SystemObject::vcpu_restoreApplication},
- {L"activateApplication", 0, (void*)SystemObject::vcpu_activateApplication},
- {L"minimizeApplication", 0, (void*)SystemObject::vcpu_minimizeApplication},
- {L"isDesktopAlphaAvailable", 0, (void*)SystemObject::vcpu_isDesktopAlphaAvailable},
- {L"isTransparencyAvailable", 0, (void*)SystemObject::vcpu_isTransparencyAvailable},
- //-----
- {L"integerToString", 1, (void*)SystemObject::vcpu_integerToString},
- {L"stringToInteger", 1, (void*)SystemObject::vcpu_stringToInteger},
- {L"floatToString", 2, (void*)SystemObject::vcpu_floatToString},
- {L"stringToFloat", 1, (void*)SystemObject::vcpu_stringToFloat},
- {L"integerToTime", 1, (void*)SystemObject::vcpu_integerToTime},
- {L"integerToLongTime", 1, (void*)SystemObject::vcpu_integerToLongTime},
- {L"dateToTime", 1, (void*)SystemObject::vcpu_dateToTime},
- {L"dateToLongTime", 1, (void*)SystemObject::vcpu_dateToLongTime},
- {L"formatDate", 1, (void*)SystemObject::vcpu_formatDate},
- {L"formatLongDate", 1, (void*)SystemObject::vcpu_formatLongDate},
- {L"getDateYear", 1, (void*)SystemObject::vcpu_getDateYear},
- {L"getDateMonth", 1, (void*)SystemObject::vcpu_getDateMonth},
- {L"getDateDay", 1, (void*)SystemObject::vcpu_getDateDay},
- {L"getDateDow", 1, (void*)SystemObject::vcpu_getDateDow},
- {L"getDateDoy", 1, (void*)SystemObject::vcpu_getDateDoy},
- {L"getDateHour", 1, (void*)SystemObject::vcpu_getDateHour},
- {L"getDateMin", 1, (void*)SystemObject::vcpu_getDateMin},
- {L"getDateSec", 1, (void*)SystemObject::vcpu_getDateSec},
- {L"getDateDst", 1, (void*)SystemObject::vcpu_getDateDst},
- {L"getDate", 0, (void*)SystemObject::vcpu_getDate},
- {L"StrMid", 3, (void*)SystemObject::vcpu_strmid},
- {L"StrLeft", 2, (void*)SystemObject::vcpu_strleft},
- {L"StrRight", 2, (void*)SystemObject::vcpu_strright},
- {L"StrSearch", 2, (void*)SystemObject::vcpu_strsearch},
- {L"StrLen", 1, (void*)SystemObject::vcpu_strlen},
- {L"StrUpper", 1, (void*)SystemObject::vcpu_strupper},
- {L"StrLower", 1, (void*)SystemObject::vcpu_strlower},
- {L"UrlEncode", 1, (void*)SystemObject::vcpu_urlencode},
- {L"UrlDecode", 1, (void*)SystemObject::vcpu_urldecode},
- {L"RemovePath", 1, (void*)SystemObject::vcpu_removepath},
- {L"GetPath", 1, (void*)SystemObject::vcpu_getpath},
- {L"GetExtension", 1, (void*)SystemObject::vcpu_getextension},
- {L"getToken", 3, (void*)SystemObject::vcpu_gettoken},
- //-----
- {L"sin", 1, (void*)SystemObject::vcpu_sin},
- {L"cos", 1, (void*)SystemObject::vcpu_cos},
- {L"tan", 1, (void*)SystemObject::vcpu_tan},
- {L"asin", 1, (void*)SystemObject::vcpu_asin},
- {L"acos", 1, (void*)SystemObject::vcpu_acos},
- {L"atan", 1, (void*)SystemObject::vcpu_atan},
- {L"atan2", 2, (void*)SystemObject::vcpu_atan2},
- {L"pow", 2, (void*)SystemObject::vcpu_pow},
- {L"sqr", 1, (void*)SystemObject::vcpu_sqr},
- {L"sqrt", 1, (void*)SystemObject::vcpu_sqrt},
- {L"random", 1, (void*)SystemObject::vcpu_random},
- {L"integer", 1, (void*)SystemObject::vcpu_integer},
- {L"frac", 1, (void*)SystemObject::vcpu_frac},
- {L"ln", 1, (void*)SystemObject::vcpu_log},
- {L"log10", 1, (void*)SystemObject::vcpu_log10},
- //-----
- {L"getParam", 0, (void*)SystemObject::vcpu_getParam},
- {L"getViewportWidth", 0, (void*)SystemObject::vcpu_getViewportWidth},
- {L"getViewportHeight", 0, (void*)SystemObject::vcpu_getViewportHeight},
- {L"getViewportLeft", 0, (void*)SystemObject::vcpu_getViewportLeft},
- {L"getViewportTop", 0, (void*)SystemObject::vcpu_getViewportTop},
- {L"getViewportWidthFromPoint", 2, (void*)SystemObject::vcpu_getViewportWidthFP},
- {L"getViewportHeightFromPoint",2, (void*)SystemObject::vcpu_getViewportHeightFP},
- {L"getViewportLeftFromPoint", 2, (void*)SystemObject::vcpu_getViewportLeftFP},
- {L"getViewportTopFromPoint", 2, (void*)SystemObject::vcpu_getViewportTopFP},
- {L"getViewportWidthFromGuiObject", 1, (void*)SystemObject::vcpu_getViewportWidthGO},
- {L"getViewportHeightFromGuiObject", 1, (void*)SystemObject::vcpu_getViewportHeightGO},
- {L"getViewportLeftFromGuiObject", 1, (void*)SystemObject::vcpu_getViewportLeftGO},
- {L"getViewportTopFromGuiObject", 1, (void*)SystemObject::vcpu_getViewportTopGO},
- {L"onViewPortChanged", 2, (void*)SystemObject::vcpu_onViewPortChanged},
- {L"debugString", 2, (void*)SystemObject::vcpu_debugString},
- {L"isObjectValid", 1, (void*)SystemObject::vcpu_isObjectValid},
- {L"getTimeOfDay", 0, (void*)SystemObject::vcpu_getTimeOfDay},
- {L"navigateUrl", 1, (void*)SystemObject::vcpu_navigateUrl},
- {L"navigateUrlBrowser", 1, (void*)SystemObject::vcpu_navigateUrlBrowser},
- {L"isKeyDown", 1, (void*)SystemObject::vcpu_isKeyDown},
- {L"setClipboardText", 1, (void*)SystemObject::vcpu_setClipboard},
- {L"Chr", 1, (void*)SystemObject::vcpu_chr},
- {L"triggerAction", 3, (void*)SystemObject::vcpu_triggerAction},
- {L"messageBox", 4, (void*)SystemObject::vcpu_messageBox},
- {L"setAtom", 2, (void*)SystemObject::vcpu_setAtom},
- {L"getAtom", 1, (void*)SystemObject::vcpu_getAtom},
- #ifdef WASABI_COMPILE_MAKIDEBUG
- {L"invokeDebugger", 0, (void*)SystemObject::vcpu_invokeDebugger},
- #endif
- #ifdef WASABI_COMPILE_SKIN
- {L"newGroup", 1, (void*)SystemObject::vcpu_newGroup},
- {L"onSetXuiParam", 2, (void*)SystemObject::vcpu_onSetXuiParam},
- {L"getScriptGroup", 0, (void*)SystemObject::vcpu_getScriptGroup},
- {L"getSkinName", 0, (void*)SystemObject::vcpu_getSkinName},
- {L"newGroupAsLayout", 1, (void*)SystemObject::vcpu_newGroupAsLayout},
- {L"getNumContainers", 0, (void*)SystemObject::vcpu_getNumContainers},
- {L"enumContainer", 1, (void*)SystemObject::vcpu_enumContainer},
- {L"onCreateLayout", 1, (void*)SystemObject::vcpu_onCreateLayout},
- {L"onShowLayout", 1, (void*)SystemObject::vcpu_onShowLayout},
- {L"onHideLayout", 1, (void*)SystemObject::vcpu_onHideLayout},
- {L"switchSkin", 1, (void*)SystemObject::vcpu_switchSkin},
- {L"isLoadingSkin", 0, (void*)SystemObject::vcpu_isLoadingSkin},
- {L"lockUI", 0, (void*)SystemObject::vcpu_lockUI},
- {L"unlockUI", 0, (void*)SystemObject::vcpu_unlockUI},
- #endif
- #if defined(WASABI_COMPILE_WNDMGR) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- {
- L"getContainer", 1, (void*)SystemObject::vcpu_getContainer
- },
- {L"newDynamicContainer", 1, (void*)SystemObject::vcpu_newDynamicContainer},
- {L"onGetCancelComponent", 2, (void*)SystemObject::vcpu_onGetCancelComponent},
- {L"onLookForComponent", 1, (void*)SystemObject::vcpu_onLookForComponent},
- {L"isAppActive", 0, (void*)SystemObject::vcpu_isAppActive},
- {L"showWindow", 3, (void*)SystemObject::vcpu_showWindow},
- {L"hideWindow", 1, (void*)SystemObject::vcpu_hideWindow},
- {L"hideNamedWindow", 1, (void*)SystemObject::vcpu_hideNamedWindow},
- {L"isNamedWindowVisible", 1, (void*)SystemObject::vcpu_isNamedWindowVisible},
- {L"getCurAppLeft", 0, (void*)SystemObject::vcpu_getCurAppLeft},
- {L"getCurAppTop", 0, (void*)SystemObject::vcpu_getCurAppTop},
- {L"getCurAppWidth", 0, (void*)SystemObject::vcpu_getCurAppWidth},
- {L"getCurAppHeight", 0, (void*)SystemObject::vcpu_getCurAppHeight},
- #endif
- #if defined (WASABI_COMPILE_CONFIG) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- {
- L"setPrivateString", 3, (void*)SystemObject::vcpu_setPrivateString
- },
- {L"setPrivateInt", 3, (void*)SystemObject::vcpu_setPrivateInt},
- {L"getPrivateString", 3, (void*)SystemObject::vcpu_getPrivateString},
- {L"getPrivateInt", 3, (void*)SystemObject::vcpu_getPrivateInt},
- {L"setPublicString", 2, (void*)SystemObject::vcpu_setPublicString},
- {L"setPublicInt", 2, (void*)SystemObject::vcpu_setPublicInt},
- {L"getPublicString", 2, (void*)SystemObject::vcpu_getPublicString},
- {L"getPublicInt", 2, (void*)SystemObject::vcpu_getPublicInt},
- #endif
- #if defined (WASABI_COMPILE_MEDIACORE) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- {
- L"getPlayItemString", 0, (void*)SystemObject::vcpu_getPlayItemString
- },
- {L"getPlayItemLength", 0, (void*)SystemObject::vcpu_getPlayItemLength},
- {L"getPlayItemMetadataString", 1, (void*)SystemObject::vcpu_getPlayItemMetadataString},
- {L"getMetadataString", 2, (void*)SystemObject::vcpu_getMetadataString},
- {L"getPlayItemDisplayTitle", 0, (void*)SystemObject::vcpu_getPlayItemDisplayTitle},
- {L"getExtFamily", 1, (void*)SystemObject::vcpu_getExtFamily},
- {L"getDecoderName", 1, (void*)SystemObject::vcpu_getDecoderName},
- {L"playFile", 1, (void*)SystemObject::vcpu_playFile},
- {L"enqueueFile", 1, (void*)SystemObject::vcpu_enqueueFile},
- {L"clearPlaylist", 0, (void*)SystemObject::vcpu_clearPlaylist},
- {L"onStop", 0, (void*)SystemObject::vcpu_onStop},
- {L"onPlay", 0, (void*)SystemObject::vcpu_onPlay},
- {L"onPause", 0, (void*)SystemObject::vcpu_onPause},
- {L"onResume", 0, (void*)SystemObject::vcpu_onResume},
- {L"onTitleChange", 1, (void*)SystemObject::vcpu_onTitleChange},
- {L"onTitle2Change", 1, (void*)SystemObject::vcpu_onTitle2Change},
- {L"onUrlChange", 1, (void*)SystemObject::vcpu_onUrlChange},
- {L"onInfoChange", 1, (void*)SystemObject::vcpu_onInfoChange},
- {L"onStatusMsg", 1, (void*)SystemObject::vcpu_onStatusMsg},
- {L"getLeftVuMeter", 0, (void*)SystemObject::vcpu_getLeftVuMeter},
- {L"getRightVuMeter", 0, (void*)SystemObject::vcpu_getRightVuMeter},
- {L"getVisBand", 2, (void*)SystemObject::vcpu_getVisBand},
- {L"getVolume", 0, (void*)SystemObject::vcpu_getVolume},
- {L"setVolume", 1, (void*)SystemObject::vcpu_setVolume},
- {L"play", 0, (void*)SystemObject::vcpu_play},
- {L"stop", 0, (void*)SystemObject::vcpu_stop},
- {L"pause", 0, (void*)SystemObject::vcpu_pause},
- {L"next", 0, (void*)SystemObject::vcpu_next},
- {L"previous", 0, (void*)SystemObject::vcpu_previous},
- {L"eject", 0, (void*)SystemObject::vcpu_eject},
- {L"seekTo", 1, (void*)SystemObject::vcpu_seekTo},
- {L"getPosition", 0, (void*)SystemObject::vcpu_getPosition},
- {L"setEqBand", 2, (void*)SystemObject::vcpu_setEqBand},
- {L"setEqPreAmp", 1, (void*)SystemObject::vcpu_setEqPreAmp},
- {L"setEq", 1, (void*)SystemObject::vcpu_setEq},
- {L"getEqBand", 1, (void*)SystemObject::vcpu_getEqBand},
- {L"getEqPreAmp", 0, (void*)SystemObject::vcpu_getEqPreAmp},
- {L"getEq", 0, (void*)SystemObject::vcpu_getEq},
- {L"onEqBandChanged", 2, (void*)SystemObject::vcpu_onEqBandChanged},
- {L"onEqFreqChanged", 1, (void*)SystemObject::vcpu_onEqFreqChanged},
- {L"onEqPreAmpChanged", 1, (void*)SystemObject::vcpu_onEqPreAmpChanged},
- {L"onEqChanged", 1, (void*)SystemObject::vcpu_onEqChanged},
- {L"onVolumeChanged", 1, (void*)SystemObject::vcpu_onVolumeChanged},
- {L"onSeek", 1, (void*)SystemObject::vcpu_onSeeked},
- {L"getStatus", 0, (void*)SystemObject::vcpu_getStatus},
- {L"getStatus", 0, (void*)SystemObject::vcpu_getStatus},
- {L"getSongInfoText", 0, (void*)SystemObject::vcpu_getSongInfoText},
- {L"getSongInfoTextTranslated", 0, (void*)SystemObject::vcpu_getSongInfoTextTranslated},
- {L"hasVideoSupport", 0, (void*)SystemObject::vcpu_hasVideoSupport},
- {L"isVideo", 0, (void*)SystemObject::vcpu_isVideo},
- {L"isVideoFullscreen", 0, (void*)SystemObject::vcpu_isVideoFullscreen},
- {L"setVideoFullscreen", 1, (void*)SystemObject::vcpu_setVideoFullscreen},
- {L"getIdealVideoWidth", 0, (void*)SystemObject::vcpu_getIdealVideoWidth},
- {L"getIdealVideoHeight", 0, (void*)SystemObject::vcpu_getIdealVideoHeight},
- {L"getPlaylistIndex", 0, (void*)SystemObject::vcpu_getPlaylistIndex},
- {L"onShowNotification", 0, (void*)SystemObject::vcpu_onShowNotification},
- {L"getPlaylistLength", 0, (void*)SystemObject::vcpu_getPlaylistLength},
- {L"getCurrentTrackRating", 0, (void *)SystemObject::vcpu_getRating},
- {L"setCurrentTrackRating", 1, (void *)SystemObject::vcpu_setRating},
- #endif
- #if defined(WASABI_COMPILE_COMPONENTS) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- {
- L"getWac", 1, (void*)SystemObject::vcpu_getWac
- },
- #endif
- #if defined(WA3COMPATIBILITY) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- {
- L"ddesend", 3, (void*)SystemObject::vcpu_ddeSend
- },
- {L"setMenuTransparency", 1, (void*)SystemObject::vcpu_setMenuTransparency},
- {L"popMainBrowser", 0, (void*)SystemObject::vcpu_popMb},
- {L"getMainBrowser", 0, (void*)SystemObject::vcpu_getMainMB},
- {L"windowMenu", 0, (void*)SystemObject::vcpu_windowMenu},
- {L"systemMenu", 0, (void*)SystemObject::vcpu_systemMenu},
- #endif
- #if defined (WA3COMPATIBILITY) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- {
- L"selectFile", 3, (void*)SystemObject::vcpu_selectFile
- },
- #endif
- {L"selectFolder", 3, (void*)SystemObject::vcpu_selectFolder},
- {L"onOpenURL", 1, (void*)SystemObject::vcpu_onOpenURL},
- {L"getMonitorLeft", 0, (void*)SystemObject::vcpu_getMonitorLeftGO},
- {L"getMonitorTop", 0, (void*)SystemObject::vcpu_getMonitorTopGO},
- {L"getMonitorLeftFromPoint", 2, (void*)SystemObject::vcpu_getMonitorLeftFP},
- {L"getMonitorTopFromPoint", 2, (void*)SystemObject::vcpu_getMonitorTopFP},
- {L"getMonitorLeftFromGuiObject", 1, (void*)SystemObject::vcpu_getMonitorLeftGO},
- {L"getMonitorTopFromGuiObject", 1, (void*)SystemObject::vcpu_getMonitorTopGO},
- {L"getMonitorWidth", 0, (void*)SystemObject::vcpu_getMonitorWidth},
- {L"getMonitorHeight", 0, (void*)SystemObject::vcpu_getMonitorHeight},
- {L"getMonitorWidthFromPoint", 2, (void*)SystemObject::vcpu_getMonitorWidthFP},
- {L"getMonitorHeightFromPoint",2, (void*)SystemObject::vcpu_getMonitorHeightFP},
- {L"getMonitorWidthFromGuiObject", 1, (void*)SystemObject::vcpu_getMonitorWidthGO},
- {L"getMonitorHeightFromGuiObject", 1, (void*)SystemObject::vcpu_getMonitorHeightGO},
- {L"downloadURL", 3, (void*)SystemObject::vcpu_downloadURL},
- {L"downloadMedia", 4, (void*)SystemObject::vcpu_downloadMedia},
- {L"onDownloadFinished", 3, (void*)SystemObject::vcpu_onDownloadFinished},
- {L"getDownloadPath", 0, (void*)SystemObject::vcpu_getDownloadPath},
- {L"setDownloadPath", 1, (void*)SystemObject::vcpu_setDownloadPath},
- {L"getAlbumArt", 1, (void*)SystemObject::vcpu_getAlbumArt},
- {L"isProVersion", 0, (void*)SystemObject::vcpu_isWinampPro}, // ugh, i hate putting this here but ohh well
- {L"enumEmbedGUID", 1, (void*)SystemObject::vcpu_enumEmbedGUID}, // ugh, i hate putting this here but ohh well
- {L"getWinampVersion",0, (void*)SystemObject::vcpu_getWinampVersion},
- {L"getBuildNumber",0, (void*)SystemObject::vcpu_getBuildNumber},
- {L"getFileSize",1, (void*)SystemObject::vcpu_getFileSize},
- {L"getString", 2, (void*)SystemObject::vcpu_getString},
- {L"translate", 1, (void*)SystemObject::vcpu_translate},
- {L"getLanguageId", 0, (void*)SystemObject::vcpu_getLanguageId}
- };
- // --------------------------------------------------------
- const wchar_t *SystemScriptObjectController::getClassName()
- {
- return L"SystemObject";
- }
- const wchar_t *SystemScriptObjectController::getAncestorClassName()
- {
- return L"Object";
- }
- ScriptObject *SystemScriptObjectController::instantiate()
- {
- return NULL;
- }
- void SystemScriptObjectController::destroy(ScriptObject *o)
- {
- ASSERTALWAYS("don't delete systemobject!");
- }
- void *SystemScriptObjectController::encapsulate(ScriptObject *o)
- {
- return NULL;
- }
- void SystemScriptObjectController::deencapsulate(void *o)
- {
- }
- int SystemScriptObjectController::getNumFunctions()
- {
- return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
- }
- const function_descriptor_struct *SystemScriptObjectController::getExportedFunctions()
- {
- return exportedFunction;
- }
- GUID SystemScriptObjectController::getClassGuid()
- {
- return systemObjectGuid;
- }
- int SystemScriptObjectController::getReferenceable()
- {
- return 0;
- }
- int SystemScriptObjectController::getInstantiable()
- {
- return 0;
- }
- #ifndef _NOSTUDIO
- SystemObject::SystemObject()
- {
- getScriptObject()->vcpu_setInterface( systemObjectGuid, ( void * )static_cast<SystemObject *>( this ) );
- getScriptObject()->vcpu_setClassName( L"System" );
- getScriptObject()->vcpu_setController( systemController );
- loaded = 0;
- started_up = 0;
- scriptVCPUId = -1;
- isoldformat = 0;
- parentGroup = NULL;
- #ifdef WASABI_COMPILE_SKIN
- skinpartid = WASABI_API_PALETTE->getSkinPartIterator();
- #else
- skinpartid = -1;
- #endif
- SOM::registerSystemObject( this );
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_addCallback( 0, this );
- #endif
- WASABI_API_SYSCB->syscb_registerCallback( this );
- }
- SystemObject::~SystemObject()
- {
- SOM::unregisterSystemObject( this );
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_delCallback( 0, this );
- #endif
- WASABI_API_SYSCB->syscb_deregisterCallback( this );
- }
- void SystemObject::setScriptId( int id )
- {
- scriptVCPUId = id;
- }
- int SystemObject::getScriptId()
- {
- return scriptVCPUId;
- }
- void SystemObject::setParam( const wchar_t *p )
- {
- #ifdef WASABI_COMPILE_WNDMGR
- StringW *s = PublicVarManager::translate_nocontext( p );
- if ( s )
- param.swap( s );
- else
- param = p;
- delete s;
- #else
- param = p;
- #endif
- }
- void SystemObject::setParentGroup( Group *g )
- {
- parentGroup = g;
- }
- Group *SystemObject::getParentGroup()
- {
- return parentGroup;
- }
- const wchar_t *SystemObject::getParam()
- {
- return param;
- }
- void SystemObject::onLoad()
- {
- loaded = 1;
- vcpu_onScriptLoaded( SCRIPT_CALL, getScriptObject() );
- started_up = 1;
- }
- void SystemObject::onUnload()
- {
- if ( loaded && started_up )
- vcpu_onScriptUnloading( SCRIPT_CALL, getScriptObject() );
- // that was the script's last chance to delete its stuff, now we need to garbageCollect whatever is left
- garbageCollect();
- }
- #ifdef WASABI_COMPILE_WNDMGR
- WindowHolder *SystemObject::getSuitableWindowHolderByGuid( GUID g )
- {
- wchar_t guidstr[ 256 ] = { 0 };
- nsGUID::toCharW( g, guidstr );
- scriptVar v = vcpu_onLookForComponent( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( guidstr ) );
- if ( v.type == SCRIPT_OBJECT )
- {
- ScriptObject *ret = GET_SCRIPT_OBJECT( v );
- if ( ret )
- {
- WindowHolder *co = static_cast<WindowHolder *>( ret->vcpu_getInterface( windowHolderGuid ) );
- return co;
- }
- }
- return NULL;
- }
- int SystemObject::onGetCancelComponent( GUID g, int i )
- {
- wchar_t guidstr[ 256 ] = { 0 };
- nsGUID::toCharW( g, guidstr );
- scriptVar v = vcpu_onGetCancelComponent( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( guidstr ), MAKE_SCRIPT_BOOLEAN( i ) );
- if ( v.type != SCRIPT_VOID )
- return GET_SCRIPT_INT( v );
- return 0;
- }
- void SystemObject::onViewPortChanged( int width, int height )
- {
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0; i-- )
- vcpu_onViewPortChanged( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_INT( width ), MAKE_SCRIPT_INT( height ) );
- }
- int SystemObject::onShowNotification()
- {
- WASABI_API_MAKI->vcpu_resetComplete();
- #if defined(WASABI_COMPILE_MEDIACORE) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0 && !WASABI_API_MAKI->vcpu_getComplete(); i-- )
- {
- scriptVar v = vcpu_onShowNotification( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject() );
- if ( v.type != SCRIPT_VOID )
- return GET_SCRIPT_INT( v );
- }
- #endif
- return 0;
- }
- void SystemObject::onCreateLayout( Layout *l )
- {
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0; i-- )
- vcpu_onCreateLayout( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_OBJECT( l->getGuiObject()->guiobject_getScriptObject() ) );
- }
- void SystemObject::onShowLayout( Layout *l )
- {
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0; i-- )
- vcpu_onShowLayout( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_OBJECT( l->getGuiObject()->guiobject_getScriptObject() ) );
- }
- void SystemObject::onHideLayout( Layout *l )
- {
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0; i-- )
- vcpu_onHideLayout( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_OBJECT( l->getGuiObject()->guiobject_getScriptObject() ) );
- }
- int SystemObject::getCurAppRect( RECT *r )
- {
- ASSERT( r );
- #ifdef WIN32
- HWND w = GetForegroundWindow();
- if ( !IsWindowVisible( w ) ) return 0;
- GetWindowRect( w, r );
- #else
- DebugString( "portme SystemObject::getCurAppRect\n" );
- #endif
- return 1;
- }
- void SystemObject::onQuit()
- {
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0; i-- )
- vcpu_onQuit( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject() );
- }
- #endif // wndmgr
- static bool FilterBrowserUrl( const wchar_t *url )
- {
- const wchar_t filterNowPlaying[] = L"http://client.winamp.com/nowplaying";
- size_t urlLength, filterLength;
- if ( NULL == url )
- return false;
- urlLength = wcslen( url );
- filterLength = sizeof( filterNowPlaying ) / sizeof( filterNowPlaying[ 0 ] ) - 1;
- if ( urlLength >= filterLength &&
- 0 == _wcsnicmp( url, filterNowPlaying, filterLength ) )
- {
- return true;
- }
- return false;
- }
- void SystemObject::browsercb_onOpenURL( wchar_t *url, bool *override )
- {
- if ( !*override && false == FilterBrowserUrl( url ) ) // ignore if someone else already overrode
- {
- scriptVar v = vcpu_onOpenURL( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( url ) );
- if ( v.type == SCRIPT_INT )
- {
- if ( v.data.idata == 1 )
- *override = true;
- }
- }
- }
- scriptVar SystemObject::vcpu_onOpenURL( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar url )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, url );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, url );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- void SystemObject::onKeyDown( const wchar_t *s )
- {
- WASABI_API_MAKI->vcpu_resetComplete();
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0 && !WASABI_API_MAKI->vcpu_getComplete(); i-- )
- vcpu_onKeyDown( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_STRING( s ) );
- }
- void SystemObject::onKeyUp( const wchar_t *s )
- {
- WASABI_API_MAKI->vcpu_resetComplete();
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0 && !WASABI_API_MAKI->vcpu_getComplete(); i-- )
- vcpu_onKeyUp( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_STRING( s ) );
- }
- int SystemObject::onAccelerator( const wchar_t *action, const wchar_t *section, const wchar_t *key )
- {
- int r = 0;
- WASABI_API_MAKI->vcpu_resetComplete();
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0 && !WASABI_API_MAKI->vcpu_getComplete(); i-- )
- {
- scriptVar v = vcpu_onAccelerator( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_STRING( action ), MAKE_SCRIPT_STRING( section ), MAKE_SCRIPT_STRING( key ) );
- if ( SOM::isNumeric( &v ) )
- r |= GET_SCRIPT_INT( v );
- }
- return r;
- }
- void SystemObject::onDownloadFinished( const wchar_t *url, boolean success, const wchar_t *filename )
- {
- for ( int i = SOM::getNumSystemObjects() - 1; i >= 0; i-- )
- vcpu_onDownloadFinished( SCRIPT_CALL, SOM::getSystemObject( i )->getScriptObject(), MAKE_SCRIPT_STRING( url ), MAKE_SCRIPT_BOOLEAN( success ), MAKE_SCRIPT_STRING( filename ) );
- }
- TList < int > *SystemObject::getTypesList()
- {
- return &typeslist;
- }
- void SystemObject::setIsOldFormat( int is )
- {
- isoldformat = is;
- }
- int SystemObject::isOldFormat()
- {
- return isoldformat;
- }
- #endif
- #ifdef WASABI_COMPILE_WND
- int SystemObject::isAppActive()
- {
- #ifdef WIN32
- HWND w = GetForegroundWindow();
- wchar_t classname[ 256 ] = L"";
- GetClassNameW( w, classname, 256 );
- return ( w == WASABI_API_WND->main_getRootWnd()->gethWnd() || !wcscmp( classname, BASEWNDCLASSNAME ) );
- #else
- DebugString( "portme SystemObject::isAppActive\n" );
- return 1;
- #endif
- }
- #endif
- void SystemObject::setSkinPartId( int _skinpartid )
- {
- skinpartid = _skinpartid;
- }
- int SystemObject::getSkinPartId()
- {
- return skinpartid;
- }
- void SystemObject::addInstantiatedObject( ScriptObject *obj )
- {
- ASSERT( !instantiated.haveItem( obj ) );
- instantiated.addItem( obj );
- }
- void SystemObject::removeInstantiatedObject( ScriptObject *obj )
- {
- int n = instantiated.searchItem( obj );
- if ( n < 0 ) return; //ASSERT(n >= 0);
- instantiated.removeByPos( n );
- }
- void SystemObject::garbageCollect()
- {
- foreach( instantiated )
- ObjectTable::destroy( instantiated.getfor() );
- endfor
- instantiated.removeAll();
- }
- int SystemObject::isObjectValid( ScriptObject *o )
- {
- static ScriptObject *cached = NULL;
- static int cachedn = -1;
- if ( o == cached && scriptobjects.enumItem( cachedn ) == o ) return 1;
- int is = scriptobjects.searchItem( o );
- if ( is >= 0 )
- {
- cached = o;
- cachedn = is;
- }
- return ( is > -1 );
- }
- void SystemObject::addScriptObject( ScriptObject *o )
- {
- ASSERT( !scriptobjects.haveItem( o ) );
- scriptobjects.addItem( o );
- }
- void SystemObject::removeScriptObject( ScriptObject *o )
- {
- int pos = scriptobjects.searchItem( o );
- if ( pos < 0 ) return;
- scriptobjects.removeByPos( pos );
- }
- #ifdef WASABI_COMPILE_SKIN
- void SystemObject::onSetXuiParam( const wchar_t *param, const wchar_t *value )
- {
- vcpu_onSetXuiParam( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( param ), MAKE_SCRIPT_STRING( value ) );
- }
- #endif
- void SystemObject::navigateUrl( const wchar_t *url )
- {
- #ifdef WA3COMPATIBILITY
- if ( MainMiniBrowser::getScriptObject() )
- {
- MainMiniBrowser::navigateUrl( url );
- MainMiniBrowser::popMb();
- }
- else // no minibrowser container -> launch IE
- {
- Std::shellExec( url );
- }
- #else
- Wasabi::Std::shellExec( url );
- #endif
- }
- void SystemObject::navigateUrlBrowser( const wchar_t *url )
- {
- wa2.openUrl( url );
- }
- scriptVar SystemObject::vcpu_getVersion( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- return MAKE_SCRIPT_DOUBLE( MAKI_RUNTIME_VERSION );
- }
- scriptVar SystemObject::vcpu_onScriptLoaded( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SystemObject *so = static_cast<SystemObject *>( o->vcpu_getInterface( systemObjectGuid ) );
- ASSERT( so != NULL );
- return WASABI_API_MAKI->maki_triggerEvent( o, DLF_ID, 0, so->scriptVCPUId );
- }
- scriptVar SystemObject::vcpu_onScriptUnloading( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SystemObject *so = static_cast<SystemObject *>( o->vcpu_getInterface( systemObjectGuid ) );
- ASSERT( so != NULL );
- return WASABI_API_MAKI->maki_triggerEvent( o, DLF_ID, 0, so->scriptVCPUId );
- }
- scriptVar SystemObject::vcpu_onQuit( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT0( o );
- }
- #ifdef WASABI_COMPILE_SKIN
- scriptVar SystemObject::vcpu_onSetXuiParam( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar param, scriptVar value )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS2( o, systemController, param, value );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT2( o, param, value );
- }
- scriptVar SystemObject::vcpu_getSkinName( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_STRING( WASABI_API_SKIN->getSkinName() );
- }
- scriptVar SystemObject::vcpu_switchSkin( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar skinname )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef SWITCH_SKIN
- SWITCH_SKIN( GET_SCRIPT_STRING( skinname ) );
- #else
- WASABI_API_SKIN->skin_switchSkin( GET_SCRIPT_STRING( skinname ) );
- #endif
- RETURN_SCRIPT_ZERO;
- }
- scriptVar SystemObject::vcpu_isLoadingSkin( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- int l = 0;
- #ifdef IS_SKIN_STILL_LOADING
- IS_SKIN_STILL_LOADING( l );
- #endif
- if ( !l ) return MAKE_SCRIPT_INT( Skin::isLoading() );
- return MAKE_SCRIPT_INT( l );
- }
- scriptVar SystemObject::vcpu_lockUI( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- WASABI_API_SKIN->skin_setLockUI( 1 );
- RETURN_SCRIPT_NULL;
- }
- scriptVar SystemObject::vcpu_unlockUI( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- WASABI_API_SKIN->skin_setLockUI( 0 );
- RETURN_SCRIPT_NULL;
- }
- #endif
- scriptVar SystemObject::vcpu_isObjectValid( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar o )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_BOOLEAN( SystemObject::isObjectValid( GET_SCRIPT_OBJECT( o ) ) );
- }
- scriptVar SystemObject::vcpu_getTimeOfDay( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- time_t ts = Wasabi::Std::getTimeStamp();
- struct tm *tm_now;
- tm_now = localtime( (const time_t *)&ts );
- uint32_t tcnow = Wasabi::Std::getTickCount();
- static uint32_t lasttc = 0;
- int v = tm_now->tm_hour * 3600000 + tm_now->tm_min * 60000 + tm_now->tm_sec * 1000;
- // yay milliseconds!
- static int lastv = 0;
- static int total = 0;
- int tv = v;
- if ( v == lastv )
- {
- total += tcnow - lasttc;
- v += total;
- }
- else total = 0;
- lasttc = tcnow;
- lastv = tv;
- return MAKE_SCRIPT_INT( v );
- }
- scriptVar SystemObject::vcpu_navigateUrl( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar url )
- {
- SCRIPT_FUNCTION_INIT;
- SystemObject::navigateUrl( GET_SCRIPT_STRING( url ) );
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_navigateUrlBrowser( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar url )
- {
- SCRIPT_FUNCTION_INIT;
- SystemObject::navigateUrlBrowser( GET_SCRIPT_STRING( url ) );
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_isKeyDown( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar vk_code )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT( Std::keyDown( GET_SCRIPT_INT( vk_code ) ) );
- }
- scriptVar SystemObject::vcpu_setClipboard( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar text )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef _WIN32
- const wchar_t *source = GET_SCRIPT_STRING( text );
- DebugStringW( L"%s\n", source );
- OpenClipboard( 0 );
- EmptyClipboard();
- int len = ( wcslen( source ) + 1 );
- HGLOBAL clipbuffer = GlobalAlloc( GMEM_DDESHARE, sizeof( wchar_t ) * len );
- wchar_t *buffer = (wchar_t *)GlobalLock( clipbuffer );
- wcsncpy( buffer, source, len - 1 );
- GlobalUnlock( clipbuffer );
- SetClipboardData( CF_UNICODETEXT, clipbuffer );
- CloseClipboard();
- #else
- DebugString( "portme SystemObject::vcpu_setClipboard\n" );
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_chr( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar n )
- {
- SCRIPT_FUNCTION_INIT;
- WCSCPYN( staticStr, StringPrintfW( L"%c", GET_SCRIPT_INT( n ) ), 4096 );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_onAccelerator( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar action, scriptVar section, scriptVar key )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS3( o, systemController, action, section, key );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT3( o, action, section, key );
- }
- scriptVar SystemObject::vcpu_triggerAction( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar guiobj, scriptVar actionstr, scriptVar paramstr )
- {
- SCRIPT_FUNCTION_INIT;
- ASSERT( actionstr.type == SCRIPT_STRING );
- ASSERT( paramstr.type == SCRIPT_STRING );
- const wchar_t *astr = GET_SCRIPT_STRING( actionstr );
- const wchar_t *pstr = GET_SCRIPT_STRING( paramstr );
- #ifdef WASABI_COMPILE_WNDMGR
- ScriptObject *context = guiobj.data.odata;
- if ( context != NULL )
- {
- GuiObject *go = static_cast<GuiObject *>( context->vcpu_getInterface( guiObjectGuid ) );
- if ( go != NULL )
- {
- ifc_window *wc = go->guiobject_getRootWnd();
- if ( wc != NULL )
- {
- ifc_window *lr = wc->getDesktopParent();
- if ( lr != NULL )
- {
- Layout *lay = static_cast<Layout *>( lr->getInterface( layoutGuid ) );
- if ( lay != NULL )
- {
- int ia = WASABI_API_SKIN->parse( astr, L"internal_action" );
- if ( ia == ACTION_NONE )
- {
- ActionEnum ae( astr );
- svc_action *act = ae.getFirst();
- if ( act )
- {
- act->onAction( astr, pstr, 0, 0, NULL, 0, wc );
- SvcEnum::release( act );
- }
- }
- else
- lay->runAction( ia, pstr );
- }
- }
- }
- }
- }
- else
- {
- ActionEnum ae( astr );
- svc_action *act = ae.getFirst();
- if ( act )
- {
- act->onAction( astr, pstr );
- SvcEnum::release( act );
- }
- }
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_getParam( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- SystemObject *o = static_cast<SystemObject *>( object->vcpu_getInterface( systemObjectGuid ) );
- if ( o ) return MAKE_SCRIPT_STRING( o->getParam() );
- return MAKE_SCRIPT_STRING( L"" );
- }
- #ifdef WASABI_COMPILE_SKIN
- scriptVar SystemObject::vcpu_getScriptGroup( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- SystemObject *o = static_cast<SystemObject *>( object->vcpu_getInterface( systemObjectGuid ) );
- if ( o )
- {
- Group *g = o->getParentGroup();
- return MAKE_SCRIPT_OBJECT( g ? g->getScriptObject() : NULL );
- }
- return MAKE_SCRIPT_OBJECT( NULL );
- }
- scriptVar SystemObject::vcpu_newGroup( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar groupname )
- {
- SCRIPT_FUNCTION_INIT;
- GuiObject *g = SkinParser::newDynamicGroup( GET_SCRIPT_STRING( groupname ), GROUP_GROUP );
- if ( g != NULL )
- {
- SystemObject *so = static_cast<SystemObject *>( object->vcpu_getInterface( systemObjectGuid ) );
- so->addInstantiatedObject( g->guiobject_getScriptObject() );
- }
- return MAKE_SCRIPT_OBJECT( g ? g->guiobject_getScriptObject() : NULL );
- }
- #endif
- scriptVar SystemObject::vcpu_getMousePosX( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt;
- Wasabi::Std::getMousePos( &pt );
- return MAKE_SCRIPT_INT( pt.x );
- }
- scriptVar SystemObject::vcpu_getMousePosY( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt;
- Wasabi::Std::getMousePos( &pt );
- return MAKE_SCRIPT_INT( pt.y );
- }
- scriptVar SystemObject::vcpu_minimizeApplication( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef _WIN32
- ShowWindow( WASABI_API_WND->main_getRootWnd()->gethWnd(), SW_MINIMIZE );
- #else
- #warning port me
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_activateApplication( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef _WIN32
- SetForegroundWindow( WASABI_API_WND->main_getRootWnd()->gethWnd() );
- #else
- #warning port me
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_restoreApplication( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef _WIN32
- ShowWindow( WASABI_API_WND->main_getRootWnd()->gethWnd(), SW_RESTORE );
- #else
- #warning port me
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_isDesktopAlphaAvailable( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- extern _bool cfg_uioptions_desktopalpha;
- return MAKE_SCRIPT_INT( Wasabi::Std::Wnd::isDesktopAlphaAvailable() && cfg_uioptions_desktopalpha.getValueAsInt() );
- #else
- return MAKE_SCRIPT_INT( Wasabi::Std::Wnd::isDesktopAlphaAvailable() );
- #endif
- }
- scriptVar SystemObject::vcpu_isTransparencyAvailable( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT( Wasabi::Std::Wnd::isTransparencyAvailable() );
- }
- scriptVar SystemObject::vcpu_isMinimized( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef _WIN32
- return MAKE_SCRIPT_INT( IsIconic( WASABI_API_WND->main_getRootWnd()->gethWnd() ) );
- #else
- #warning port me
- RETURN_SCRIPT_ZERO;
- #endif
- }
- // extern String System.translate(String str);
- scriptVar SystemObject::vcpu_translate( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar str )
- {
- SCRIPT_FUNCTION_INIT;
- WCSCPYN( translateStr, _( GET_SCRIPT_STRING( str ) ), ( sizeof( translateStr ) / sizeof( *translateStr ) ) );
- return MAKE_SCRIPT_STRING( translateStr );
- }
- // extern String System.getString(String table, Int id);
- scriptVar SystemObject::vcpu_getString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar table, scriptVar id )
- {
- SCRIPT_FUNCTION_INIT;
- const wchar_t *xlat = LocalesManager::GetString( GET_SCRIPT_STRING( table ), GET_SCRIPT_INT( id ) );
- if ( xlat )
- return MAKE_SCRIPT_STRING( xlat );
- else
- return MAKE_SCRIPT_STRING( L"" );
- }
- // extern String System.getString(String table, Int id);
- scriptVar SystemObject::vcpu_getLanguageId( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- const wchar_t *langId = WASABI_API_LNG->GetLanguageIdentifier( LANG_IDENT_STR );
- if ( langId )
- return MAKE_SCRIPT_STRING( langId );
- else
- return MAKE_SCRIPT_STRING( L"" );
- }
- scriptVar SystemObject::vcpu_integerToString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar i )
- {
- SCRIPT_FUNCTION_INIT;
- WCSNPRINTF( staticStr, 4096, L"%d", GET_SCRIPT_INT( i ) );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_stringToInteger( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar s )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT( WTOI( GET_SCRIPT_STRING( s ) ) );
- }
- scriptVar SystemObject::vcpu_floatToString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar f, scriptVar digits )
- {
- SCRIPT_FUNCTION_INIT;
- // to whoever made this use StringPrintf, you left out the digits param, GRRRRRR!!
- double v = GET_SCRIPT_DOUBLE( f );
- StringPrintfW tmp( v );
- WCSCPYN( staticStr, tmp, ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- wchar_t *p = wcschr( staticStr, '.' );
- if ( p )
- {
- int numdigits = GET_SCRIPT_INT( digits );
- if ( numdigits > 0 )
- {
- int n = numdigits;
- int curnumdigits = staticStr + wcslen( staticStr ) - ( p + 1 );
- n -= curnumdigits;
- if ( n > 0 )
- {
- for ( int i = 0; i < n && i < ( sizeof( staticStr ) / sizeof( *staticStr ) ) - 128; i++ )
- wcscat( staticStr, L"0" );
- }
- else if ( n < 0 )
- {
- *( p + 1 + numdigits ) = 0;
- }
- }
- else
- {
- *p = 0;
- }
- }
- else
- {
- int n = GET_SCRIPT_INT( digits );
- if ( n > 0 )
- {
- wcscat( staticStr, L"." );
- for ( int i = 0; i < n && i < ( sizeof( staticStr ) / sizeof( *staticStr ) ) - 128; i++ )
- wcscat( staticStr, L"0" );
- }
- }
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_stringToFloat( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar s )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_FLOAT( (float)WTOF( GET_SCRIPT_STRING( s ) ) );
- }
- scriptVar SystemObject::vcpu_integerToTime( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- int i = GET_SCRIPT_INT( _i );
- WCSNPRINTF( staticStr, 4096, L"%d:%02d", i / 60000, i % 60000 / 1000 );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_integerToLongTime( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- int i = GET_SCRIPT_INT( _i );
- WCSNPRINTF( staticStr, 4096, L"%d:%02d:%02d", i / 3600000, ( i % 3600000 ) / 60000, i % 60000 / 1000 );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_dateToTime( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- WCSNPRINTF( staticStr, 4096, L"%d:%02d", t->tm_hour, t->tm_min );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_dateToLongTime( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- WCSNPRINTF( staticStr, 4096, L"%d:%02d:%02d", t->tm_hour, t->tm_min, t->tm_sec );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_formatDate( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- wcsftime( staticStr, 4096, L"%c", t );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_formatLongDate( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- wcsftime( staticStr, 4096, L"%#c", t );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_getDateYear( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_year );
- }
- scriptVar SystemObject::vcpu_getDateMonth( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_mon );
- }
- scriptVar SystemObject::vcpu_getDateDay( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_mday );
- }
- scriptVar SystemObject::vcpu_getDateDow( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_wday );
- }
- scriptVar SystemObject::vcpu_getDateDoy( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_yday );
- }
- scriptVar SystemObject::vcpu_getDateHour( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_hour );
- }
- scriptVar SystemObject::vcpu_getDateMin( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_min );
- }
- scriptVar SystemObject::vcpu_getDateSec( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_sec );
- }
- scriptVar SystemObject::vcpu_getDateDst( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _i )
- {
- SCRIPT_FUNCTION_INIT;
- //CUT: int i = GET_SCRIPT_INT(_i);
- time_t tt = GET_SCRIPT_INT( _i );
- struct tm *t = localtime( &tt );
- return MAKE_SCRIPT_INT( t->tm_isdst );
- }
- scriptVar SystemObject::vcpu_getDate( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- time_t t;
- time( &t );
- return MAKE_SCRIPT_INT( (int)t );
- }
- scriptVar SystemObject::vcpu_strmid( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar str, scriptVar start, scriptVar len )
- {
- SCRIPT_FUNCTION_INIT;
- SOM::mid( staticStr, GET_SCRIPT_STRING( str ), MIN( GET_SCRIPT_INT( start ), 4096 ), MIN( GET_SCRIPT_INT( len ), 4096 ) );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_strleft( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar str, scriptVar len )
- {
- SCRIPT_FUNCTION_INIT;
- SOM::mid( staticStr, GET_SCRIPT_STRING( str ), 0, MIN( GET_SCRIPT_INT( len ), 4096 ) );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_strright( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str, scriptVar _len )
- {
- SCRIPT_FUNCTION_INIT;
- const wchar_t *str = GET_SCRIPT_STRING( _str );
- int len = GET_SCRIPT_INT( _len );
- SOM::mid( staticStr, str, MIN( (int)( wcslen( str ) - len ), 4096 ), MIN( len, 4096 ) );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_strsearch( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str, scriptVar substr )
- {
- SCRIPT_FUNCTION_INIT;
- const wchar_t *str = GET_SCRIPT_STRING( _str );
- const wchar_t *p = wcsstr( str, GET_SCRIPT_STRING( substr ) );
- return MAKE_SCRIPT_INT( p ? p - str : -1 );
- }
- scriptVar SystemObject::vcpu_strlen( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar str )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT( wcslen( GET_SCRIPT_STRING( str ) ) );
- }
- scriptVar SystemObject::vcpu_strupper( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str )
- {
- SCRIPT_FUNCTION_INIT;
- WCSCPYN( staticStr, GET_SCRIPT_STRING( _str ), ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- WCSTOUPPER( staticStr );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_strlower( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str )
- {
- SCRIPT_FUNCTION_INIT;
- WCSCPYN( staticStr, GET_SCRIPT_STRING( _str ), ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- WCSTOLOWER( staticStr );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_urlencode( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str )
- {
- SCRIPT_FUNCTION_INIT;
- StringW str( GET_SCRIPT_STRING( _str ) );
- str = AutoWide( AutoUrl( str ) );
- *staticStr = 0;
- if ( !str.isempty() ) WCSCPYN( staticStr, str, ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_urldecode( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str )
- {
- SCRIPT_FUNCTION_INIT;
- StringW str( GET_SCRIPT_STRING( _str ) );
- Url::decode( str ); // Martin> I know there might be something nicer than this, but this does at least work
- *staticStr = 0;
- if ( !str.isempty() ) WCSCPYN( staticStr, str, ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_removepath( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str )
- {
- SCRIPT_FUNCTION_INIT;
- PathParserW pp( GET_SCRIPT_STRING( _str ) );
- // ASSERT(pp.getNumStrings() >= 1); // shouldn't happen ever
- wchar_t *lastString = pp.getLastString();
- if ( lastString )
- {
- WCSCPYN( staticStr, lastString, ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- }
- else
- {
- staticStr[ 0 ] = 0;
- }
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_getpath( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str )
- {
- SCRIPT_FUNCTION_INIT;
- WCSCPYN( staticStr, GET_SCRIPT_STRING( _str ), ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- #ifdef _WIN32
- PathRemoveFileSpecW( staticStr );
- PathRemoveBackslashW( staticStr );
- #else
- #warning port me
- #endif
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_getextension( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _str )
- {
- SCRIPT_FUNCTION_INIT;
- const wchar_t *pt = Wasabi::Std::extension( GET_SCRIPT_STRING( _str ) );
- if ( pt != NULL ) WCSCPYN( staticStr, pt, ( sizeof( staticStr ) / sizeof( *staticStr ) ) );
- else *staticStr = '\0';
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_gettoken( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar tok, scriptVar sep, scriptVar num )
- {
- SCRIPT_FUNCTION_INIT;
- wchar_t *p = const_cast<wchar_t *>( GET_SCRIPT_STRING( tok ) );
- wchar_t *d = const_cast<wchar_t *>( GET_SCRIPT_STRING( sep ) );
- int i = GET_SCRIPT_INT( num );
- if ( !d ) return MAKE_SCRIPT_STRING( L"" );
- if ( !p ) return MAKE_SCRIPT_STRING( L"" );
- wchar_t c = *d;
- d = staticStr;
- int n = 0, ct = 0;
- while ( p && *p && ct < 4096 )
- {
- if ( *p == c )
- {
- n++; p++; continue;
- }
- if ( n > i ) break;
- if ( n == i )
- *d++ = *p;
- p++;
- ct++;
- }
- *d = 0;
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_sin( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::sin( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_cos( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::cos( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_tan( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::tan( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_asin( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::asin( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_acos( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::acos( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_atan( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::atan( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_atan2( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar y, scriptVar x )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::atan2( GET_SCRIPT_DOUBLE( y ), GET_SCRIPT_DOUBLE( x ) ) );
- }
- scriptVar SystemObject::vcpu_pow( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::pow( GET_SCRIPT_DOUBLE( x ), GET_SCRIPT_DOUBLE( y ) ) );
- }
- scriptVar SystemObject::vcpu_sqr( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _d )
- {
- SCRIPT_FUNCTION_INIT;
- double d = GET_SCRIPT_DOUBLE( _d );
- return MAKE_SCRIPT_DOUBLE( d * d );
- }
- scriptVar SystemObject::vcpu_sqrt( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::sqrt( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_log10( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::log10( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_log( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar d )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_DOUBLE( ::log( GET_SCRIPT_DOUBLE( d ) ) );
- }
- scriptVar SystemObject::vcpu_random( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar m )
- {
- SCRIPT_FUNCTION_INIT;
- int m_ = GET_SCRIPT_INT( m );
- return MAKE_SCRIPT_INT( m_ <= 0 ? 0 : ::rand() % m_ );
- }
- scriptVar SystemObject::vcpu_integer( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- // precision will get lost automatically
- int _v = GET_SCRIPT_INT( v );
- return MAKE_SCRIPT_INT( _v );
- }
- scriptVar SystemObject::vcpu_frac( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- double _v = GET_SCRIPT_DOUBLE( v ) - GET_SCRIPT_INT( v );
- return MAKE_SCRIPT_DOUBLE( _v );
- }
- scriptVar SystemObject::vcpu_onViewPortChanged( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar width, scriptVar height )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS2( o, systemController, width, height );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT2( o, width, height );
- }
- scriptVar SystemObject::vcpu_getViewportWidth( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- scriptVar SystemObject::vcpu_getViewportHeight( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- scriptVar SystemObject::vcpu_getViewportWidthGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle() );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getViewportHeightGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle() );
- // benski> this prevents the window from going "fullscreen" but adds a one-line space at the bottom
- RECT full = { 0 };
- Wasabi::Std::getViewport( &full, o->guiobject_getRootWnd()->getOsWindowHandle(), true );
- if (Wasabi::Std::rectEqual( &full, &r ) )
- r.bottom--;
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getMonitorLeft( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.left );
- }
- scriptVar SystemObject::vcpu_getMonitorLeftFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.left );
- }
- scriptVar SystemObject::vcpu_getMonitorLeftGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle(), 1 );
- return MAKE_SCRIPT_INT( r.left );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.left );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getMonitorTop( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.top );
- }
- scriptVar SystemObject::vcpu_getMonitorTopFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.top );
- }
- scriptVar SystemObject::vcpu_getMonitorTopGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle(), 1 );
- return MAKE_SCRIPT_INT( r.top );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.top );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getMonitorWidth( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- scriptVar SystemObject::vcpu_getMonitorHeight( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- scriptVar SystemObject::vcpu_getMonitorWidthGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle(), 1 );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getMonitorHeightGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle(), true );
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getViewportLeft( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.left );
- }
- scriptVar SystemObject::vcpu_getViewportTop( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { 0 };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.top );
- }
- scriptVar SystemObject::vcpu_getViewportLeftGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle() );
- return MAKE_SCRIPT_INT( r.left );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.left );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getViewportTopGO( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- RECT r = { 0 };
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( obj, guiObjectGuid ) );
- if ( o )
- {
- Wasabi::Std::getViewport( &r, o->guiobject_getRootWnd()->getOsWindowHandle() );
- return MAKE_SCRIPT_INT( r.top );
- }
- else
- {
- POINT pt = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.top );
- }
- return MAKE_SCRIPT_INT( 0 );
- }
- scriptVar SystemObject::vcpu_getViewportWidthFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- scriptVar SystemObject::vcpu_getMonitorHeightFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- scriptVar SystemObject::vcpu_getMonitorWidthFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt, 1 );
- return MAKE_SCRIPT_INT( r.right - r.left );
- }
- scriptVar SystemObject::vcpu_getViewportHeightFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.bottom - r.top );
- }
- scriptVar SystemObject::vcpu_getViewportLeftFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.left );
- }
- scriptVar SystemObject::vcpu_getViewportTopFP( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar x, scriptVar y )
- {
- SCRIPT_FUNCTION_INIT;
- POINT pt = { GET_SCRIPT_INT( x ),GET_SCRIPT_INT( y ) };
- RECT r = { 0 };
- Wasabi::Std::getViewport( &r, &pt );
- return MAKE_SCRIPT_INT( r.top );
- }
- scriptVar SystemObject::vcpu_getTickCount( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT(Wasabi::Std::getTickCount() );
- }
- scriptVar SystemObject::vcpu_onKeyDown( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS1( o, systemController, v );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, v );
- }
- scriptVar SystemObject::vcpu_onKeyUp( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS1( o, systemController, v );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, v );
- }
- scriptVar SystemObject::vcpu_debugString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar str, scriptVar severity )
- {
- SCRIPT_FUNCTION_INIT;
- DebugStringW( L"%s", GET_SCRIPT_STRING( str ) );
- WASABI_API_SYSCB->syscb_issueCallback( SysCallback::CONSOLE, ConsoleCallback::DEBUGMESSAGE, GET_SCRIPT_INT( severity ), reinterpret_cast<intptr_t>( GET_SCRIPT_STRING( str ) ) );
- return MAKE_SCRIPT_VOID();
- }
- scriptVar SystemObject::vcpu_messageBox( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar msg, scriptVar title, scriptVar flags, scriptVar nam )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- return MAKE_SCRIPT_INT( WASABI_API_WNDMGR->messageBox( GET_SCRIPT_STRING( msg ), GET_SCRIPT_STRING( title ), GET_SCRIPT_INT( flags ), GET_SCRIPT_STRING( nam ), NULL ) );
- #else
- return MAKE_SCRIPT_INT( MessageBox( NULL, GET_SCRIPT_STRING( msg ), GET_SCRIPT_STRING( title ), GET_SCRIPT_INT( flags ) ) );
- #endif
- }
- scriptVar SystemObject::vcpu_getAtom( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar atomname )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_OBJECT( VCPU::getAtom( GET_SCRIPT_STRING( atomname ) ) );
- }
- scriptVar SystemObject::vcpu_setAtom( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar atomname, scriptVar obj )
- {
- SCRIPT_FUNCTION_INIT;
- VCPU::setAtom( GET_SCRIPT_STRING( atomname ), GET_SCRIPT_OBJECT( obj ) );
- RETURN_SCRIPT_VOID;
- }
- #ifdef WASABI_COMPILE_MAKIDEBUG
- scriptVar SystemObject::vcpu_invokeDebugger( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- WASABI_API_MAKIDEBUG->debugger_createJITD( object->vcpu_getScriptId(), 1 );
- RETURN_SCRIPT_VOID;
- }
- #endif
- #if defined (WASABI_COMPILE_WNDMGR) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- scriptVar SystemObject::vcpu_onCreateLayout( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar l )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- PROCESS_HOOKS1( o, systemController, l );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, l );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onShowLayout( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar l )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- PROCESS_HOOKS1( o, systemController, l );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, l );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onHideLayout( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar l )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- PROCESS_HOOKS1( o, systemController, l );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, l );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_getContainer( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar contname )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- Container *c = SkinParser::script_getContainer( GET_SCRIPT_STRING( contname ) );
- return MAKE_SCRIPT_OBJECT( c ? c->getScriptObject() : NULL );
- #else
- RETURN_SCRIPT_NULL;
- #endif
- }
- scriptVar SystemObject::vcpu_newDynamicContainer( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar contname )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- Container *c = SkinParser::newDynamicContainer( GET_SCRIPT_STRING( contname ) );
- return MAKE_SCRIPT_OBJECT( c ? c->getScriptObject() : NULL );
- #else
- RETURN_SCRIPT_NULL;
- #endif
- }
- scriptVar SystemObject::vcpu_newGroupAsLayout( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar groupname )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- Group *g = GroupMgr::instantiate( GET_SCRIPT_STRING( groupname ), GROUP_LAYOUTGROUP );
- if ( g )
- {
- Layout *l = static_cast<Layout *>( g );
- ifc_window *par = l->getCustomOwner();
- if ( !par ) par = WASABI_API_WND->main_getRootWnd();
- g->setAutoResizeAfterInit( 0 );
- g->setStartHidden( 1 );
- g->setParent( par );
- #ifdef _WIN32
- g->init( hInstance, par->gethWnd(), TRUE );
- #else
- #warning port me
- g->init( 0, par->gethWnd(), TRUE );
- #endif
- SystemObject *so = SOM::getSystemObjectByScriptId( __vsd );
- if ( so != NULL ) so->addInstantiatedObject( g->getScriptObject() );
- }
- return MAKE_SCRIPT_OBJECT( g ? g->getScriptObject() : NULL );
- #else
- RETURN_SCRIPT_NULL;
- #endif
- }
- scriptVar SystemObject::vcpu_getNumContainers( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- return MAKE_SCRIPT_INT( SkinParser::getNumContainers() );
- #else
- RETURN_SCRIPT_NULL;
- #endif
- }
- scriptVar SystemObject::vcpu_enumContainer( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar n )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- Container *c = SkinParser::enumContainer( GET_SCRIPT_INT( n ) );
- return MAKE_SCRIPT_OBJECT( c ? c->getScriptObject() : NULL );
- #else
- RETURN_SCRIPT_NULL;
- #endif
- }
- scriptVar SystemObject::vcpu_onLookForComponent( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar guid )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- PROCESS_HOOKS1( o, systemController, guid );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, guid );
- #else
- RETURN_SCRIPT_VOID
- #endif
- }
- scriptVar SystemObject::vcpu_onGetCancelComponent( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar guid, scriptVar i )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- PROCESS_HOOKS2( o, systemController, guid, i );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT2( o, guid, i );
- #else
- RETURN_SCRIPT_ZERO
- #endif
- }
- scriptVar SystemObject::vcpu_getCurAppLeft( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- RECT r = { 0 };
- int s = getCurAppRect( &r );
- return MAKE_SCRIPT_INT( s ? r.left : -1 );
- #else
- RETURN_SCRIPT_ZERO
- #endif
- }
- scriptVar SystemObject::vcpu_getCurAppTop( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- RECT r = { 0 };
- int s = getCurAppRect( &r );
- return MAKE_SCRIPT_INT( s ? r.top : -1 );
- #else
- RETURN_SCRIPT_ZERO
- #endif
- }
- scriptVar SystemObject::vcpu_getCurAppWidth( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- RECT r = { 0 };
- int s = getCurAppRect( &r );
- return MAKE_SCRIPT_INT( s ? r.right - r.left : -1 );
- #else
- RETURN_SCRIPT_ZERO
- #endif
- }
- scriptVar SystemObject::vcpu_getCurAppHeight( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- RECT r = { 0 };
- int s = getCurAppRect( &r );
- return MAKE_SCRIPT_INT( s ? r.bottom - r.top : -1 );
- #else
- RETURN_SCRIPT_ZERO
- #endif
- }
- scriptVar SystemObject::vcpu_isAppActive( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- return MAKE_SCRIPT_BOOLEAN( isAppActive() );
- #else
- RETURN_SCRIPT_ZERO
- #endif
- }
- scriptVar SystemObject::vcpu_showWindow( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar wndguidorgroup, scriptVar prefcontainer, scriptVar transient )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- const wchar_t *s = GET_SCRIPT_STRING( wndguidorgroup );
- const wchar_t *p = GET_SCRIPT_STRING( prefcontainer );
- int t = GET_SCRIPT_INT( transient );
- if ( p != NULL && *p == 0 ) p = NULL;
- GUID _g = nsGUID::fromCharW( s );
- #ifdef ON_CREATE_EXTERNAL_WINDOW_GUID
- if ( _g != INVALID_GUID )
- {
- int y = 0;
- ON_CREATE_EXTERNAL_WINDOW_GUID( _g, y );
- if ( y ) RETURN_SCRIPT_NULL;
- }
- #endif
- ifc_window *ret = NULL;
- if ( _g != INVALID_GUID )
- ret = WASABI_API_WNDMGR->skinwnd_createByGuid( _g, p, 0, NULL, t );
- else
- ret = WASABI_API_WNDMGR->skinwnd_createByGroupId( s, p, 0, NULL, t );
- if ( ret )
- {
- if ( ret->getGuiObject() )
- {
- return MAKE_SCRIPT_OBJECT( ret->getGuiObject()->guiobject_getScriptObject() );
- }
- }
- #endif
- RETURN_SCRIPT_NULL;
- }
- scriptVar SystemObject::vcpu_hideWindow( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar hw )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- GuiObject *o = static_cast<GuiObject *>( GET_SCRIPT_OBJECT_AS( hw, guiObjectGuid ) );
- if ( o )
- WASABI_API_WNDMGR->skinwnd_destroy( o->guiobject_getRootWnd() );
- #endif
- RETURN_SCRIPT_NULL;
- }
- scriptVar SystemObject::vcpu_hideNamedWindow( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar guidorgroup )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_WNDMGR
- const wchar_t *s = GET_SCRIPT_STRING( guidorgroup );
- GUID _g = nsGUID::fromCharW( s );
- ifc_window *w = NULL;
- if ( _g != INVALID_GUID )
- {
- int n = WASABI_API_WNDMGR->skinwnd_getNumByGuid( _g ); // benski> CUT: int n = skinEmbedder->getNumItems(_g);
- if ( n > 0 )
- w = WASABI_API_WNDMGR->skinwnd_enumByGuid( _g, n - 1 ); // benski> CUT: w = skinEmbedder->enumItem(_g, n-1);
- }
- else
- {
- int n = WASABI_API_WNDMGR->skinwnd_getNumByGroupId( s ); // benski> CUT: int n = skinEmbedder->getNumItems(s);
- if ( n > 0 )
- w = WASABI_API_WNDMGR->skinwnd_enumByGroupId( s, n - 1 ); // benski> CUT: w = skinEmbedder->enumItem(s, n-1);
- }
- if ( w )
- {
- GuiObject *o = w->getGuiObject();
- if ( o )
- WASABI_API_WNDMGR->skinwnd_destroy( o->guiobject_getRootWnd() );
- }
- #endif
- RETURN_SCRIPT_NULL;
- }
- scriptVar SystemObject::vcpu_isNamedWindowVisible( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar guidorgroup )
- {
- SCRIPT_FUNCTION_INIT;
- const wchar_t *s = GET_SCRIPT_STRING( guidorgroup );
- GUID _g = nsGUID::fromCharW( s );
- ifc_window *w = NULL;
- if ( _g != INVALID_GUID )
- {
- int n = WASABI_API_WNDMGR->skinwnd_getNumByGuid( _g ); // benski> CUT: int n = skinEmbedder->getNumItems(_g);
- if ( n > 0 )
- w = WASABI_API_WNDMGR->skinwnd_enumByGuid( _g, n - 1 ); // benski> CUT: w = skinEmbedder->enumItem(_g, n-1);
- }
- else
- {
- int n = WASABI_API_WNDMGR->skinwnd_getNumByGroupId( s ); // benski> CUT: int n = skinEmbedder->getNumItems(s);
- if ( n > 0 )
- w = WASABI_API_WNDMGR->skinwnd_enumByGroupId( s, n - 1 ); // benski> CUT: w = skinEmbedder->enumItem(s, n-1);
- }
- if ( w )
- {
- return MAKE_SCRIPT_BOOLEAN( w->isVisible() );
- }
- RETURN_SCRIPT_ZERO;
- }
- #endif // if defined (WASABI_COMPILE_WNDMGR) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- #if defined(WASABI_COMPILE_MEDIACORE) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- scriptVar SystemObject::vcpu_getStatus( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getStatus( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getSongInfoText( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- #ifdef GET_SONG_INFO_TEXT
- const wchar_t *c;
- GET_SONG_INFO_TEXT( c );
- WCSCPYN( staticStr, c, 4096 );
- #else
- *staticStr = 0;
- #pragma CHAT("lone", "bas", "need to get the song info text, the same as would be in a text field with SONGINFO")
- #endif
- return MAKE_SCRIPT_STRING( staticStr );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getSongInfoTextTranslated( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- #ifdef GET_SONG_INFO_TEXT_TRANSLATED
- const wchar_t *c;
- GET_SONG_INFO_TEXT_TRANSLATED( c );
- WCSCPYN( staticStr, c, 4096 );
- #else
- *staticStr = 0;
- #endif
- return MAKE_SCRIPT_STRING( staticStr );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- #ifdef GEN_FF
- #include "../../../../Plugins/General/gen_ff/wa2frontend.h"
- #endif
- scriptVar SystemObject::vcpu_hasVideoSupport( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- return MAKE_SCRIPT_INT( wa2.hasVideoSupport() );
- #else
- #pragma CHAT("lone", "bas", "how can we ask if the currently playing file is video thru the core objects ?")
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_isVideo( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- return MAKE_SCRIPT_INT( wa2.isPlayingVideo() );
- #else
- #pragma CHAT("lone", "bas", "how can we ask if the currently playing file is video thru the core objects ?")
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_isVideoFullscreen( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- return MAKE_SCRIPT_INT( wa2.isPlayingVideoFullscreen() );
- #else
- #pragma CHAT("lone", "bas", "how can we ask if we are running fullscreen (either vis or video) ?")
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_setVideoFullscreen( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- const bool vidfs = GET_SCRIPT_BOOLEAN( v );
- if ( vidfs )
- {
- wa2.sendVidCmd( Winamp2FrontEnd::WA2_VIDCMD_FULLSCREEN );
- }
- else
- {
- wa2.sendVidCmd( Winamp2FrontEnd::WA2_VIDCMD_EXIT_FS );
- }
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_getPlaylistIndex( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- return MAKE_SCRIPT_INT( wa2.getCurPlaylistEntry() );
- #else
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( CoreHandle().getCurPlaybackNumber() );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- #endif
- }
- scriptVar SystemObject::vcpu_getPlaylistLength( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- return MAKE_SCRIPT_INT( wa2.getPlaylistLength() );
- #else
- #ifdef WASABI_COMPILE_MEDIACORE
- //BU CoreHandle is your friend
- return MAKE_SCRIPT_INT( CoreHandle().getNumTracks() );
- #else
- //FG not always, heh
- RETURN_SCRIPT_ZERO;
- #endif
- #endif
- }
- scriptVar SystemObject::vcpu_getIdealVideoHeight( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- int h = -1;
- wa2.getIdealVideoSize( NULL, &h );
- return MAKE_SCRIPT_INT( h );
- #else
- #pragma CHAT("lone", "bas", "how can we ask for the ideal video size thru the core objects ?")
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getIdealVideoWidth( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef GEN_FF
- int w = -1;
- wa2.getIdealVideoSize( &w, NULL );
- return MAKE_SCRIPT_INT( w );
- #else
- #pragma CHAT("lone", "bas", "how can we ask for the ideal video size thru the core objects ?")
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_onStop( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT0( o );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onShowNotification( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT0( o );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onPlay( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT0( o );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onPause( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT0( o );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onResume( SCRIPT_FUNCTION_PARAMS, ScriptObject *o )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS0( o, systemController );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT0( o );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onTitleChange( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar title )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, title );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, title );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onTitle2Change( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar title )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, title );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, title );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onUrlChange( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar title )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, title );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, title );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onInfoChange( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar info )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, info );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, info );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onStatusMsg( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar info )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, info );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, info );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onEqBandChanged( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar band, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS2( o, systemController, band, val );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT2( o, band, val );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onEqFreqChanged( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, val );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, val );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onEqPreAmpChanged( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, val );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, val );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onEqChanged( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, val );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, val );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_onVolumeChanged( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, val );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, val );
- #else
- RETURN_SCRIPT_VOID
- #endif
- }
- scriptVar SystemObject::vcpu_onSeeked( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- PROCESS_HOOKS1( o, systemController, val );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT1( o, val );
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_getPlayItemString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- const wchar_t *cur = WASABI_API_MEDIACORE->core_getCurrent( 0 );
- if ( cur == NULL ) cur = L"";
- return MAKE_SCRIPT_STRING( cur );
- #else
- return MAKE_SCRIPT_STRING( L"" );
- #endif
- }
- scriptVar SystemObject::vcpu_getPlayItemLength( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getLength( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getPlayItemDisplayTitle( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- WCSCPYN( staticStr, WASABI_API_MEDIACORE->core_getTitle( 0 ), 4096 );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_getPlayItemMetadataString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar name )
- {
- SCRIPT_FUNCTION_INIT;
- #if defined(WASABI_COMPILE_MEDIACORE) & defined(WASABI_COMPILE_METADB)
- const char *cur = WASABI_API_MEDIACORE->core_getCurrent( 0 );
- if ( cur == NULL ) return MAKE_SCRIPT_STRING( "" );
- if ( cur && WASABI_API_METADB->metadb_getMetaData( cur, GET_SCRIPT_STRING( name ), staticStr, ( sizeof( staticStr ) / sizeof( *staticStr ) ) ) <= 0 ) return MAKE_SCRIPT_STRING( "" );
- return MAKE_SCRIPT_STRING( staticStr );
- #elif defined(WASABI_CUSTOM_MINIDB)
- WASABI_CUSTOM_MINIDB( GET_SCRIPT_STRING( name ), staticStr, 4096 ); staticStr[ 4095 ] = 0;
- return MAKE_SCRIPT_STRING( staticStr );
- #elif defined(WASABI_COMPILE_MEDIACORE)
- STRNCPY( staticStr, WASABI_API_MEDIACORE->core_getCurrent( 0 ), 4095 ); staticStr[ 4095 ] = 0;
- return MAKE_SCRIPT_STRING( staticStr );
- #endif
- }
- scriptVar SystemObject::vcpu_getMetadataString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar filename, scriptVar name )
- {
- SCRIPT_FUNCTION_INIT;
- wa2.getMetaData( GET_SCRIPT_STRING( filename ), GET_SCRIPT_STRING( name ), staticStr, 4096 );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_getExtFamily( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar ext )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- const wchar_t *ps = GET_SCRIPT_STRING( ext );
- staticStr[ 0 ] = '\0';
- if ( ps != NULL )
- {
- const wchar_t *f = WASABI_API_MEDIACORE->core_getExtensionFamily( ps );
- if ( f == NULL ) f = L"";
- WCSCPYN( staticStr, f, 4096 );
- }
- return MAKE_SCRIPT_STRING( staticStr );
- #else
- return MAKE_SCRIPT_STRING( L"" );
- #endif
- }
- scriptVar SystemObject::vcpu_getDecoderName( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar ext )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- const wchar_t *ps = GET_SCRIPT_STRING( ext );
- staticStr[ 0 ] = '\0';
- if ( ps != NULL )
- {
- const wchar_t *f = WASABI_API_MEDIACORE->core_getDecoderName( ps );
- if ( f == NULL ) f = L"";
- WCSCPYN( staticStr, f, 4096 );
- }
- return MAKE_SCRIPT_STRING( staticStr );
- #else
- return MAKE_SCRIPT_STRING( L"" );
- #endif
- }
- scriptVar SystemObject::vcpu_playFile( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar file )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- #ifdef GEN_FF
- StringW _file = GET_SCRIPT_STRING( file );
- const wchar_t *f = _file.getValue();
- if ( f && *f )
- {
- if ( wcsstr( _file, L"://" ) )
- {
- wa2.playFile( _file );
- }
- else if ( f[ 1 ] != ':' && f[ 0 ] != '\\' && f[ 0 ] != '/' )
- {
- PathParserW pp( f );
- if ( WCSCASEEQLSAFE( pp.enumString( 0 ), L"skins" )
- && WCSCASEEQLSAFE( pp.enumString( 1 ), WASABI_API_SKIN->getSkinName() ) )
- {
- _file = L"";
- for ( int i = 0; i < pp.getNumStrings() - 2; i++ )
- {
- if ( i > 0 ) _file += L"\\";
- _file += pp.enumString( i + 2 );
- }
- }
- _file = StringPathCombine( WASABI_API_SKIN->getSkinPath(), _file );
- if ( !WACCESS( _file, 0 ) ) // avoid clearing playlist if file not found
- wa2.playFile( _file );
- }
- }
- #else
- svc_player *sp = SvcEnumByGuid<svc_player>();
- if ( sp ) sp->openFile( GET_SCRIPT_STRING( file ) );
- WASABI_API_SVC->service_release( sp );
- #endif
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_enqueueFile( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar file )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- #ifdef GEN_FF
- StringW _file = GET_SCRIPT_STRING( file );
- const wchar_t *f = _file.getValue();
- if ( f && *f )
- {
- if ( wcsstr( _file, L"://" ) )
- {
- wa2.enqueueFile( _file );
- }
- else if ( f[ 1 ] != ':' && f[ 0 ] != '\\' && f[ 0 ] != '/' )
- {
- PathParserW pp( f );
- if ( WCSCASEEQLSAFE( pp.enumString( 0 ), L"skins" )
- && WCSCASEEQLSAFE( pp.enumString( 1 ), WASABI_API_SKIN->getSkinName() ) )
- {
- _file = L"";
- for ( int i = 0; i < pp.getNumStrings() - 2; i++ )
- {
- if ( i > 0 ) _file += L"\\";
- _file += pp.enumString( i + 2 );
- }
- }
- _file = StringPathCombine( WASABI_API_SKIN->getSkinPath(), _file );
- wa2.enqueueFile( _file );
- }
- }
- #else
- svc_player *sp = SvcEnumByGuid<svc_player>();
- if ( sp ) sp->openFile( GET_SCRIPT_STRING( file ) );
- WASABI_API_SVC->service_release( sp );
- #endif
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_clearPlaylist( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- wa2.clearPlaylist();
- return MAKE_SCRIPT_VOID();
- }
- scriptVar SystemObject::vcpu_getLeftVuMeter( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getLeftVuMeter( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getVisBand( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar chan, scriptVar band )
- {
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- unsigned char visdata[ 576 * 2 * 2 ] = { 0 };
- int ret = WASABI_API_MEDIACORE->core_getVisData( 0, &visdata, sizeof( visdata ) );
- if ( !ret ) MEMSET( visdata, 0, sizeof( visdata ) );
- int b = MIN( MAX( 0, GET_SCRIPT_INT( band ) ), 74 );
- int a = MIN( MAX( 0, GET_SCRIPT_INT( chan ) ), 1 );
- return MAKE_SCRIPT_INT( MIN( 255, visdata[ 576 * a + b ] * 16 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- }
- scriptVar SystemObject::vcpu_getRightVuMeter( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getRightVuMeter( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getVolume( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getVolume( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_setVolume( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_setVolume( 0, GET_SCRIPT_INT( v ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_play( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_userButton( 0, UserButton::PLAY );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_stop( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_userButton( 0, UserButton::STOP );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_pause( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_userButton( 0, UserButton::PAUSE );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_next( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_userButton( 0, UserButton::NEXT );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_previous( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_userButton( 0, UserButton::PREV );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_eject( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- #ifdef GEN_FF
- wa2.openFileDialog( WASABI_API_WND->main_getRootWnd()->gethWnd() );
- #else
- svc_player *sp = SvcEnumByGuid<svc_player>();
- sp->openFiles();
- WASABI_API_SVC->service_release( sp );
- #endif
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_seekTo( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar to )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_setPosition( 0, GET_SCRIPT_INT( to ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_setEqBand( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar band, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_setEqBand( 0, MAX( 0, MIN( 9, GET_SCRIPT_INT( band ) ) ), GET_SCRIPT_INT( val ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_setEqPreAmp( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_setEqPreamp( 0, GET_SCRIPT_INT( v ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_setEq( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_setEqStatus( 0, GET_SCRIPT_INT( v ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_getPosition( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getPosition( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getEqBand( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar band )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getEqBand( 0, MAX( 0, MIN( 9, GET_SCRIPT_INT( band ) ) ) ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getEqPreAmp( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getEqPreamp( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_getEq( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getEqStatus( 0 ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- #endif // #if defined(WASABI_COMPILE_MEDIACORE) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- #if defined(WASABI_COMPILE_COMPONENTS) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- scriptVar SystemObject::vcpu_getWac( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar guid )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_COMPONENTS
- WACObject *wo = SOM::getWACObject( GET_SCRIPT_STRING( guid ) );
- return MAKE_SCRIPT_OBJECT( wo ? wo->getScriptObject() : NULL );
- #else
- RETURN_SCRIPT_NULL;
- #endif
- }
- #endif // if defined(WASABI_COMPILE_COMPONENTS) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- #if defined(WASABI_COMPILE_CONFIG) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- scriptVar SystemObject::vcpu_setPrivateString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar section, scriptVar item, scriptVar str )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- WCSNPRINTF( staticStr, 4096, L"%s_%s", GET_SCRIPT_STRING( section ), GET_SCRIPT_STRING( item ) );
- WASABI_API_CONFIG->setStringPrivate( staticStr, GET_SCRIPT_STRING( str ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_setPrivateInt( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar section, scriptVar item, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- WCSNPRINTF( staticStr, 4096, L"%s_%s", GET_SCRIPT_STRING( section ), GET_SCRIPT_STRING( item ) );
- WASABI_API_CONFIG->setIntPrivate( staticStr, GET_SCRIPT_INT( val ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_getPrivateString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar section, scriptVar item, scriptVar defstr )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- wchar_t t[ 4096 ] = { 0 };
- StringCchPrintfW( t, 4096, L"%s_%s", GET_SCRIPT_STRING( section ), GET_SCRIPT_STRING( item ) );
- WASABI_API_CONFIG->getStringPrivate( t, staticStr, 4095, GET_SCRIPT_STRING( defstr ) );
- return MAKE_SCRIPT_STRING( staticStr );
- #else
- return MAKE_SCRIPT_STRING( L"" );
- #endif
- }
- scriptVar SystemObject::vcpu_getPrivateInt( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar section, scriptVar item, scriptVar defval )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- wchar_t t[ 4096 ] = { 0 };
- StringCchPrintfW( t, 4096, L"%s_%s", GET_SCRIPT_STRING( section ), GET_SCRIPT_STRING( item ) );
- return MAKE_SCRIPT_INT( WASABI_API_CONFIG->getIntPrivate( t, GET_SCRIPT_INT( defval ) ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_setPublicString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar item, scriptVar str )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- WASABI_API_CONFIG->setStringPrivate( GET_SCRIPT_STRING( item ), GET_SCRIPT_STRING( str ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_setPublicInt( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar item, scriptVar val )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- WASABI_API_CONFIG->setIntPrivate( GET_SCRIPT_STRING( item ), GET_SCRIPT_INT( val ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_getPublicString( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar item, scriptVar defstr )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- WASABI_API_CONFIG->getStringPrivate( GET_SCRIPT_STRING( item ), staticStr, 4095, GET_SCRIPT_STRING( defstr ) );
- return MAKE_SCRIPT_STRING( staticStr );
- #else
- return MAKE_SCRIPT_STRING( L"" );
- #endif
- }
- scriptVar SystemObject::vcpu_getPublicInt( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar item, scriptVar defval )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_CONFIG
- return MAKE_SCRIPT_INT( WASABI_API_CONFIG->getIntPrivate( GET_SCRIPT_STRING( item ), GET_SCRIPT_INT( defval ) ) );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- #endif // #if defined(WASABI_COMPILE_CONFIG) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- #if defined (WA3COMPATIBILITY) || defined(WASABI_SCRIPT_SYSTEMOBJECT_WA3COMPATIBLE)
- scriptVar SystemObject::vcpu_ddeSend( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar ddetarget, scriptVar cmd, scriptVar minInterval )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WA3COMPATIBILITY
- DdeCom::sendCommand( GET_SCRIPT_STRING( ddetarget ), GET_SCRIPT_STRING( cmd ), GET_SCRIPT_INT( minInterval ) );
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_popMb( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WA3COMPATIBILITY
- MainMiniBrowser::popMb();
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_getMainMB( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WA3COMPATIBILITY
- return MAKE_SCRIPT_OBJECT( MainMiniBrowser::getScriptObject() );
- #else
- RETURN_SCRIPT_NULL;
- #endif
- }
- scriptVar SystemObject::vcpu_setMenuTransparency( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar a )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WA3COMPATIBILITY
- WASABI_API_CONFIG->setIntPublic( "Popup alpha", GET_SCRIPT_INT( a ) );
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_windowMenu( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WA3COMPATIBILITY
- Main::thingerContextMenu( NULL );
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_systemMenu( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WA3COMPATIBILITY
- Main::appContextMenu( NULL, FALSE, FALSE );
- #endif
- RETURN_SCRIPT_VOID;
- }
- scriptVar SystemObject::vcpu_selectFile( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar extlist, scriptVar id, scriptVar prevfn )
- {
- SCRIPT_FUNCTION_INIT;
- SelectFile sf( WASABI_API_WND->main_getRootWnd() );
- sf.setIdent( GET_SCRIPT_STRING( id ) );
- StringW ff = GET_SCRIPT_STRING( prevfn );
- if ( !ff.isempty() )
- {
- wchar_t *p = const_cast<wchar_t *>(Wasabi::Std::filename( ff ) );
- if ( p != NULL ) *p = 0;
- sf.setDefaultDir( ff );
- }
- StringW exts = GET_SCRIPT_STRING( extlist );
- if ( exts.isempty() )
- exts = L"All files(*.*)|*.*||";
- exts.changeChar( '|', '\0' );
- int r = sf.runSelector( L"files", FALSE, exts );
- StringW t;
- if ( !r || sf.getNumFiles() < 1 )
- {
- t = GET_SCRIPT_STRING( prevfn );
- }
- else
- {
- t = sf.enumFilename( 0 );
- }
- WCSCPYN( staticStr, t, 4096 );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- #endif
- const wchar_t *dldir;
- BOOL CALLBACK browseEnumProc( HWND hwnd, LPARAM lParam )
- {
- wchar_t cl[ 32 ] = { 0 };
- GetClassName( hwnd, cl, ARRAYSIZE( cl ) );
- if ( !lstrcmpi( cl, WC_TREEVIEW ) )
- {
- PostMessage( hwnd, TVM_ENSUREVISIBLE, 0, (LPARAM)TreeView_GetSelection( hwnd ) );
- return FALSE;
- }
- return TRUE;
- }
- static int CALLBACK BrowseCallbackProcX( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData )
- {
- switch ( uMsg )
- {
- case BFFM_INITIALIZED:
- {
- const wchar_t *wnd_title = (wchar_t *)lpData;
- //if(wnd_title) wnd_title = _(wnd_title);
- if ( WCSICMP( _( wnd_title ), L"" ) ) SetWindowTextW( hwnd, _( wnd_title ) );
- SendMessageW( hwnd, BFFM_SETSELECTIONW, 1, (LPARAM)dldir );
- // this is not nice but it fixes the selection not working correctly on all OSes
- EnumChildWindows( hwnd, browseEnumProc, 0 );
- }
- return 0;
- }
- return 0;
- }
- void Shell_Free( void *p )
- {
- IMalloc *m;
- SHGetMalloc( &m );
- m->Free( p );
- }
- scriptVar SystemObject::vcpu_selectFolder( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar title, scriptVar info, scriptVar defPath )
- {
- SCRIPT_FUNCTION_INIT;
- dldir = defPath.data.sdata;
- BROWSEINFOW bi = { 0 };
- bi.hwndOwner = WASABI_API_WND->main_getRootWnd()->gethWnd();
- bi.lpszTitle = _( info.data.sdata ); // Info Text
- bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;
- bi.lpfn = BrowseCallbackProcX;
- bi.lParam = (LPARAM)title.data.sdata; // Window Title
- ITEMIDLIST *idlist = SHBrowseForFolderW( &bi );
- if ( idlist )
- {
- SHGetPathFromIDListW( idlist, staticStr );
- Shell_Free( idlist );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- return MAKE_SCRIPT_STRING( L"" );
- }
- #ifdef WASABI_COMPILE_MEDIACORE
- int SystemObject::corecb_onVolumeChange( int newvol )
- {
- vcpu_onVolumeChanged( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT( newvol ) );
- return 0;
- }
- int SystemObject::corecb_onEQStatusChange( int newval )
- {
- vcpu_onEqChanged( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT( newval ) );
- return 0;
- }
- int SystemObject::corecb_onEQPreampChange( int newval )
- {
- vcpu_onEqPreAmpChanged( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT( newval ) );
- return 0;
- }
- int SystemObject::corecb_onEQBandChange( int band, int newval )
- {
- vcpu_onEqBandChanged( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT( band ), MAKE_SCRIPT_INT( newval ) );
- return 0;
- }
- int SystemObject::corecb_onEQFreqChange( int newval )
- {
- vcpu_onEqFreqChanged( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT( newval ) );
- return 0;
- }
- int SystemObject::corecb_onStarted()
- {
- vcpu_onPlay( SCRIPT_CALL, getScriptObject() );
- return 0;
- }
- int SystemObject::corecb_onStopped()
- {
- vcpu_onStop( SCRIPT_CALL, getScriptObject() );
- return 0;
- }
- int SystemObject::corecb_onPaused()
- {
- vcpu_onPause( SCRIPT_CALL, getScriptObject() );
- return 0;
- }
- int SystemObject::corecb_onUnpaused()
- {
- vcpu_onResume( SCRIPT_CALL, getScriptObject() );
- return 0;
- }
- int SystemObject::corecb_onSeeked( int newpos )
- {
- vcpu_onSeeked( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT( newpos ) );
- return 0;
- }
- int SystemObject::corecb_onTitleChange( const wchar_t *title )
- {
- vcpu_onTitleChange( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( title ) );
- return 0;
- }
- int SystemObject::corecb_onTitle2Change( const wchar_t *title )
- {
- vcpu_onTitle2Change( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( title ) );
- return 0;
- }
- int SystemObject::corecb_onUrlChange( const wchar_t *url )
- {
- vcpu_onUrlChange( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( url ) );
- return 0;
- }
- int SystemObject::corecb_onInfoChange( const wchar_t *info )
- {
- vcpu_onInfoChange( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( info ) );
- return 0;
- }
- int SystemObject::corecb_onStatusMsg( const wchar_t *info )
- {
- vcpu_onStatusMsg( SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_STRING( info ) );
- return 0;
- }
- #endif
- scriptVar SystemObject::vcpu_getRating( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- return MAKE_SCRIPT_INT( WASABI_API_MEDIACORE->core_getRating() );
- #else
- RETURN_SCRIPT_ZERO;
- #endif
- }
- scriptVar SystemObject::vcpu_setRating( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar v )
- {
- SCRIPT_FUNCTION_INIT;
- #ifdef WASABI_COMPILE_MEDIACORE
- WASABI_API_MEDIACORE->core_setRating( GET_SCRIPT_INT( v ) );
- return MAKE_SCRIPT_VOID();
- #else
- RETURN_SCRIPT_VOID;
- #endif
- }
- scriptVar SystemObject::vcpu_getDownloadPath( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- wa2.getDownloadPath( staticStr );
- return MAKE_SCRIPT_STRING( staticStr );
- }
- scriptVar SystemObject::vcpu_setDownloadPath( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar new_path )
- {
- SCRIPT_FUNCTION_INIT;
- wa2.setDownloadPath( new_path.data.sdata );
- return MAKE_SCRIPT_VOID();
- }
- scriptVar SystemObject::vcpu_downloadURL( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar url, scriptVar filename, scriptVar title )
- {
- SCRIPT_FUNCTION_INIT;
- wa2.DownloadFile( AutoChar( GET_SCRIPT_STRING( url ) ) );
- return MAKE_SCRIPT_VOID();
- }
- scriptVar SystemObject::vcpu_downloadMedia( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar url, scriptVar filepath, scriptVar storeInMl, scriptVar notifyDownloadsList )
- {
- SCRIPT_FUNCTION_INIT;
- wa2.DownloadFile( AutoChar( GET_SCRIPT_STRING( url ) ), GET_SCRIPT_STRING( filepath ), GET_SCRIPT_BOOLEAN( storeInMl ), GET_SCRIPT_BOOLEAN( notifyDownloadsList ) );
- return MAKE_SCRIPT_VOID();
- }
- scriptVar SystemObject::vcpu_onDownloadFinished( SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar url, scriptVar success, scriptVar filename )
- {
- SCRIPT_FUNCTION_INIT;
- PROCESS_HOOKS3( o, systemController, url, success, filename );
- SCRIPT_FUNCTION_CHECKABORTEVENT_SYS( o );
- SCRIPT_EXEC_EVENT3( o, url, success, filename );
- }
- scriptVar SystemObject::vcpu_getAlbumArt( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar filename )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT( !!wa2.GetAlbumArt( GET_SCRIPT_STRING( filename ) ) );
- }
- scriptVar SystemObject::vcpu_isWinampPro( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT( !!wa2.IsWinampPro() );
- }
- static PtrList<StringW> embed_guids;
- static int embed_guid_enumProc( embedWindowState *ws, struct embedEnumStruct *param )
- {
- if ( ws->flags & EMBED_FLAGS_GUID )
- {
- wchar_t guid[ 39 ] = { 0 };
- nsGUID::toCharW( GET_EMBED_GUID( ws ), guid );
- embed_guids.addItem( new StringW( guid ) );
- }
- return 0;
- }
- scriptVar SystemObject::vcpu_enumEmbedGUID( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _index )
- {
- SCRIPT_FUNCTION_INIT;
- int index = GET_SCRIPT_INT( _index );
- if ( index == 0 ) // make the table
- {
- embed_guids.deleteAll();
- embedEnumStruct param;
- param.user_data = 0;
- param.enumProc = embed_guid_enumProc;
- SendMessageW( wa2.getMainWindow(), WM_WA_IPC, (WPARAM)¶m, IPC_EMBED_ENUM );
- }
- if ( index >= 0 && index < embed_guids.getNumItems() )
- return MAKE_SCRIPT_STRING( embed_guids[ index ]->getValue() );
- return MAKE_SCRIPT_STRING( L"" );
- }
- scriptVar SystemObject::vcpu_getWinampVersion( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- /** This would have been the code to return a double.
- double r = atof(wa2.getVersion());
- return MAKE_SCRIPT_DOUBLE(r);
- */
- return MAKE_SCRIPT_STRING( applicationApi->main_getVersionNumString() );
- }
- scriptVar SystemObject::vcpu_getBuildNumber( SCRIPT_FUNCTION_PARAMS, ScriptObject *object )
- {
- SCRIPT_FUNCTION_INIT;
- return MAKE_SCRIPT_INT( applicationApi->main_getBuildNumber() );
- }
- scriptVar SystemObject::vcpu_getFileSize( SCRIPT_FUNCTION_PARAMS, ScriptObject *object, scriptVar _file )
- {
- SCRIPT_FUNCTION_INIT;
- const wchar_t *file = GET_SCRIPT_STRING( _file );
- if ( file == NULL ) // make the table
- {
- return MAKE_SCRIPT_INT( 0 );
- }
- /*fileApi->fileOpen(file, 0);
- int size = fileApi->fileGetFileSize();
- fileApi->fileClose(;*/
- OSFILETYPE in = WFOPEN( file, WF_READONLY_BINARY );
- if ( in == OPEN_FAILED ) return MAKE_SCRIPT_INT( 0 );
- int size = (int)FGETSIZE( in );
- FCLOSE( in );
- return MAKE_SCRIPT_INT( size );
- }
- wchar_t SystemObject::staticStr[ 4096 ] = { 0 };
- wchar_t SystemObject::translateStr[ 4096 ] = { 0 };
- PtrList < ScriptObject > SystemObject::scriptobjects;
- // END VCPU
- // ---------------------------------------------------------------
- // -- END SCRIPT -------------------------------------------------
- // ---------------------------------------------------------------
|