/* mediaSequenceEdit.pkg */ /* Media Sequence Editor v1.0 - DMS - Jun. '98 - by Marc BARILLEY */ /* Rev. 1.1 - Aug. '98 - by Marc BARILLEY */ /* TemplateEdit1 upgrade by Julien Zorko '00 */ /* Rev. - 09'01 - by Emmanuel Tollé */ typedef TestMedia = MovieTestMedia [ObjWin Multi] |SoundTestMedia [ObjWin Multi] |TextTestMedia [ObjWin ObjText] |BitmapTestMedia [ObjWin ObjBitmap] |UnknownTestMedia;; struct TestWin = [ stopTestWin : ObjWin, playTestWin : ObjWin, flagTestWin : I, mediaTestWin : TestMedia ] mkTestWin;; typeof mainTestWin = ObjWin;; typedef CMedia = MovieCMedia Multi |SoundCMedia Multi |BitmapCMedia ObjBitmap |TextCMedia ObjText |UnknownCMedia;; typedef MediaType = MovieMedia P |SoundMedia P |BitmapMedia P |TextMedia P |UnknownMedia;; struct MediaWin = [ winMediaWin : ObjWin, cwinMediaWin : ObjWin, playMediaWin : ObjButton, stopMediaWin : ObjButton, cmediaMediaWin : CMedia ] mkMediaWin;; struct ObjMedia = [ aliasObjMedia : S, typeObjMedia : MediaType, fbeginObjMedia : F, /* begining of file */ fendObjMedia : F, /* end of file */ mbeginObjMedia : F, /* begining of media in file */ mendObjMedia : F, /* end of media in file */ sbeginObjMedia : F, /* begining of media in sequence */ sendObjMedia : F, /* end of media in sequence */ loopObjMedia : I, mediaWinObjMedia : MediaWin ] mkObjMedia;; struct EditWin = [ winEditWin : ObjWin, baliasEditWin : ObjText, aliasEditWin : ObjText, bfileEditWin : ObjText, fileEditWin : ObjText, browseEditWin : ObjButton, sliderEditWin : ObjSlider, testEditWin : ObjButton, okEditWin : ObjButton, cancelEditWin : ObjButton, mediaEditWin : ObjMedia ] mkEditWin;; struct Line = [ aliasLine : ObjButton, sliderLine : ObjSlider, loopLine : ObjCheck, testLine : ObjButton, delLine : ObjButton, mediaLine : ObjMedia, editWinLine : EditWin ] mkLine;; typeof lineList = [Line r1];; typeof testList = [[ObjMedia TestWin] r1];; typeof startList = [[ObjMedia TestWin] r1];; typeof stopList = [[ObjMedia TestWin] r1];; typeof currentMedia = [ObjMedia TestWin];; typeof testTimer = Timer;; typeof plusButton = ObjButton;; typeof minusButton = ObjButton;; typeof maxTime = F;; typeof vertFont = ObjFont;; typeof horizFont = ObjFont;; typeof bigFont = ObjFont;; typeof editor = Editor;; typeof editWin = ObjWin;; var sequenceInProgress = 0;; var sequenceDisplayed = 0;; var playMapFile = "Dms/Media/MediaSequence/play.bmp";; var stopMapFile = "Dms/Media/MediaSequence/stop.bmp";; var browseMapFile = "Dms/Media/MediaSequence/open.bmp";; typeof playMap = ObjBitmap;; typeof stopMap = ObjBitmap;; typeof browseMap = ObjBitmap;; proto rflAlias = fun [ObjButton Line] EditWin;; proto rflTestMedia = fun [ObjButton ObjMedia] I;; proto rflLoopMedia = fun [ObjCheck ObjMedia I] I;; proto rflMoveSequenceSlider = fun [ObjSlider F F Line] I;; proto rflDelLine = fun [ObjButton Line] I;; /* general interface and others */ fun copyMedia (o1, o2)= let if o1==nil then mkObjMedia ["" UnknownMedia itof 0 itof 100 nil nil nil nil 0 nil] else o1 -> o1 in { set o1.aliasObjMedia = o2.aliasObjMedia; set o1.typeObjMedia = o2.typeObjMedia; set o1.fbeginObjMedia = o2.fbeginObjMedia; set o1.fendObjMedia = o2.fendObjMedia; set o1.mbeginObjMedia = o2.mbeginObjMedia; set o1.mendObjMedia = o2.mendObjMedia; set o1.sbeginObjMedia = o2.sbeginObjMedia; set o1.sendObjMedia = o2.sendObjMedia; set o1.loopObjMedia = o2.loopObjMedia; o1 };; fun cmpStart (o1_t1, o2_t2)= let o1_t1 -> [o1 t1] in let o2_t2 -> [o2 t2] in if o1.sbeginObjMedia >. o2.sbeginObjMedia then -1 else if o1.sbeginObjMedia <. o2.sbeginObjMedia then 1 else 0 ;; fun cmpStop (o1_t1, o2_t2)= let o1_t1 -> [o1 t1] in let o2_t2 -> [o2 t2] in if o1.sendObjMedia >. o2.sendObjMedia then -1 else if o1.sendObjMedia <. o2.sendObjMedia then 1 else 0;; fun cleanTestList (l)= if l==nil then 0 else let hd l -> [omedia testwin] in { match testwin.mediaTestWin with (MovieTestMedia m -> let m -> [win multi] in { _DSmulti multi; _DSwindow win; }) |(SoundTestMedia m -> let m -> [win multi] in { _DSmulti multi; _DSwindow win; }) |(BitmapTestMedia m -> let m -> [win bitmap] in { _DSbitmap bitmap; _DSwindow win; }) |(TextTestMedia m -> let m -> [win text] in { _DStext text; _DSwindow win; }) |(_ -> nil); _DSwindow testwin.stopTestWin; _DSwindow testwin.playTestWin; cleanTestList tl l };; fun clean_up (l)= if l==nil then 0 else let hd l -> line in { /* begin JZ _SIZEwindow mainWin wmainwin hmainwin-30 xmainwin ymainwin; JZ*/ let _GETwindowSizePosition editWin -> [w h x y] in RESIZEeditWin editor w h-30; /* end JZ */ _DSbutton line.aliasLine; _DSslider line.sliderLine; _DScheck line.loopLine; _DSbutton line.testLine; _DSbutton line.delLine; match line.mediaLine.mediaWinObjMedia.cmediaMediaWin with (MovieCMedia m -> {_DSmulti m; 0}) |(SoundCMedia m -> {_DSmulti m; 0}) |(BitmapCMedia m -> {_DSbitmap m; 0}) |(TextCMedia m -> {_DStext m; 0}) |(_ -> 0); _DSwindow line.mediaLine.mediaWinObjMedia.winMediaWin; _DSwindow line.mediaLine.mediaWinObjMedia.cwinMediaWin; _DStext line.editWinLine.baliasEditWin; _DStext line.editWinLine.aliasEditWin; _DStext line.editWinLine.bfileEditWin; _DStext line.editWinLine.fileEditWin; _DSbutton line.editWinLine.browseEditWin; _DSslider line.editWinLine.sliderEditWin; _DSbutton line.editWinLine.testEditWin; _DSbutton line.editWinLine.okEditWin; _DSbutton line.editWinLine.cancelEditWin; match line.editWinLine.mediaEditWin.mediaWinObjMedia.cmediaMediaWin with (MovieCMedia m -> {_DSmulti m; 0}) |(SoundCMedia m -> {_DSmulti m; 0}) |(BitmapCMedia m -> {_DSbitmap m; 0}) |(TextCMedia m -> {_DStext m; 0}) |(_ -> 0); _DSwindow line.editWinLine.mediaEditWin.mediaWinObjMedia.winMediaWin; _DSwindow line.editWinLine.mediaEditWin.mediaWinObjMedia.cwinMediaWin; _DSwindow line.editWinLine.winEditWin; clean_up tl l };; fun augmentSliders (l, newMaxTime)= if l==nil then 0 else let hd l -> line in { _SETsliderMax line.sliderLine newMaxTime; augmentSliders tl l newMaxTime; };; fun rflPlusButton (b, blurp)= set maxTime=maxTime+.(itof 10); augmentSliders lineList maxTime;; fun getMaxSeqTime (l)= if l==nil then itof 0 else let hd l -> line in let getMaxSeqTime tl l -> mm in if mm >. line.mediaLine.sendObjMedia then mm else line.mediaLine.sendObjMedia;; fun rflMinusButton (b, blurp)= let getMaxSeqTime lineList -> minTime in if maxTime -. (itof 10) <. minTime then nil else { set maxTime=maxTime-.(itof 10); augmentSliders lineList maxTime; };; /* line management */ fun moreLine ()= /* begin JZ _SIZEwindow mainWin wmainwin hmainwin+25 xmainwin ymainwin; */ let _GETwindowSizePosition editWin -> [ew eh ex ey] in let [ew eh+30] -> [w h]in let RESIZEeditWin editor w h -> _ in /* end JZ */ let _CRbutton _channel editWin 5 h-30 90 20 0 (_locEditor "2840-MEDIAS-empty" nil) -> alias in let _CRslider _channel editWin nil 110 h-30 w-325 25 0xff0000 itof 0 maxTime itof 0 itof 0 nil SLIDER_DRAW_VALUE|SLIDER_BUTTON -> slider in let _CRcheck _channel editWin w-180 h-30 10 10 0 "" -> loop in let _CRbutton _channel editWin w-110 h-30 10 10 0 "" -> test in let _CRbutton _channel editWin w-40 h-30 10 10 0 "" -> del in let mkLine [alias slider loop test del nil nil] -> newline in { _CBbutton alias @rflAlias newline; _CBbutton del @rflDelLine newline; _SETsliderPrecisionStep slider (itof 1)/.(itof 100); _CBslider slider mkfun4 @rflMoveSequenceSlider newline; set lineList = listcat lineList newline::nil; newline };; fun swap (lines, l)= let hd lines -> line in if (tl lines)==nil then { set lineList = remove_from_list lineList line; /* begin JZ _SIZEwindow mainWin wmainwin hmainwin-30 xmainwin ymainwin; JZ*/ let _GETwindowSizePosition editWin -> [w h x y] in RESIZEeditWin editor w h-30; /* end JZ */ set l.mediaLine = line.mediaLine; if line.mediaLine.aliasObjMedia==nil then _SETbuttonName l.aliasLine (_locEditor "2840-MEDIAS-empty" nil) else _SETbuttonName l.aliasLine line.mediaLine.aliasObjMedia; _CPslider l.sliderLine line.sliderLine; _SETcheck l.loopLine (_GETcheck line.loopLine); _CBcheck l.loopLine @rflLoopMedia l.mediaLine; _CBbutton l.testLine @rflTestMedia l.mediaLine; _DSbutton line.aliasLine; _DSslider line.sliderLine; _DScheck line.loopLine; _DSbutton line.testLine; _DSbutton line.delLine; } else { set l.mediaLine = line.mediaLine; _SETbuttonName l.aliasLine line.mediaLine.aliasObjMedia; _CPslider l.sliderLine line.sliderLine; _SETcheck l.loopLine (_GETcheck line.loopLine); _CBbutton l.testLine @rflTestMedia l.mediaLine; swap (tl lines) line };; fun rflDelLine (b, line)= if (pos_in_list lineList line 1) == (sizelist lineList) then nil else swap (endlist lineList (pos_in_list lineList line 0)+1) line; 0;; /* media management */ fun rflDestroyMediaWin (w, mwin)= match mwin.cmediaMediaWin with (MovieCMedia m -> { _DSmulti m; _DSbutton mwin.playMediaWin; _DSbutton mwin.stopMediaWin; _DSwindow mwin.cwinMediaWin; _DSwindow mwin.winMediaWin; }) |(SoundCMedia m -> { _DSmulti m; _DSbutton mwin.playMediaWin; _DSbutton mwin.stopMediaWin; _DSwindow mwin.cwinMediaWin; _DSwindow mwin.winMediaWin; }) |(BitmapCMedia m -> { _DSbitmap m; _DSwindow mwin.winMediaWin; }) |(TextCMedia m -> { _DStext m; _DSwindow mwin.winMediaWin; }) |(_ -> { _DSbutton mwin.playMediaWin; _DSbutton mwin.stopMediaWin; _DSwindow mwin.cwinMediaWin; _DSwindow mwin.winMediaWin; }); set mwin = nil;; fun rflPaintMediaWin (w, mwin)= match mwin.cmediaMediaWin with (BitmapCMedia m -> _BLTbitmap w m 0 0) |(_ -> nil);; fun rflPlayMediaWin (b, objmedia)= match objmedia.mediaWinObjMedia.cmediaMediaWin with (MovieCMedia m -> _PLAYmultiFromTo m ftoi ((itof 1000) *. objmedia.mbeginObjMedia) ftoi ((itof 1000) *. objmedia.mendObjMedia) ) |(SoundCMedia m -> _PLAYmultiFromTo m ftoi ((itof 1000) *. objmedia.mbeginObjMedia) ftoi ((itof 1000) *. objmedia.mendObjMedia) ) |(_ -> nil);; fun rflStopMediaWin (b, objmedia)= match objmedia.mediaWinObjMedia.cmediaMediaWin with (MovieCMedia m -> { _PAUSEmulti m; _SETmultiHome m; }) |(SoundCMedia m -> { _PAUSEmulti m; _SETmultiHome m; }) |(_ -> nil);; fun rflTestMedia (b, objmedia)= if sequenceDisplayed then nil else { match objmedia.typeObjMedia with (MovieMedia pack -> let _CRwindow _channel nil 0 0 200 200 WN_NORMAL|WN_HIDDEN strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> mwin in let _CRwindow _channel mwin 0 0 60 20 WN_CHILD|WN_NOBORDER "" -> cwin in let _CRbuttonBitmap _channel cwin playMap 0 0 20 20 0 -> pbut in let _CRbuttonBitmap _channel cwin stopMap 20 0 20 20 0 -> sbut in let _CRmulti _channel mwin 0 0 200 200 pack nil -> cmedia in let mkMediaWin [mwin cwin pbut sbut MovieCMedia cmedia] -> newMediaWin in let _GETmultiXYsource cmedia -> [xmsource ymsource wmsource hmsource] in { _SETmultiUseTime cmedia; _SETmultiXYdest cmedia 0 0 2*wmsource 2*hmsource; _SETmultiXYwin cmedia 0 0 2*wmsource 2*hmsource; _SIZEwindow mwin 2*wmsource 2*hmsource+20 0 0; _SIZEwindow cwin 60 20 0 2*hmsource; _CBbutton pbut @rflPlayMediaWin objmedia; _CBbutton sbut @rflStopMediaWin objmedia; _CBwinDestroy mwin @rflDestroyMediaWin newMediaWin; set objmedia.mediaWinObjMedia = newMediaWin; _SHOWwindow mwin WINDOW_UNHIDDEN; }) |(SoundMedia pack -> let _CRwindow _channel nil 0 0 200 200 WN_HIDDEN "" -> mwin in let _CRwindow _channel nil 0 0 60 20 WN_NORMAL|WN_HIDDEN strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> cwin in let _CRbuttonBitmap _channel cwin playMap 0 0 20 20 0 -> pbut in let _CRbuttonBitmap _channel cwin stopMap 20 0 20 20 0 -> sbut in let _CRmulti _channel mwin 0 0 200 200 pack nil -> cmedia in let mkMediaWin [mwin cwin pbut sbut SoundCMedia cmedia] -> newMediaWin in { _SETmultiUseTime cmedia; _CBbutton pbut @rflPlayMediaWin objmedia; _CBbutton sbut @rflStopMediaWin objmedia; _CBwinDestroy cwin @rflDestroyMediaWin newMediaWin; set objmedia.mediaWinObjMedia = newMediaWin; _SHOWwindow cwin WINDOW_UNHIDDEN; }) |(BitmapMedia pack -> let _CRwindow _channel nil 0 0 200 200 WN_NORMAL|WN_HIDDEN strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> mwin in let ( if (_LDbitmap _channel pack) == nil then if (_LDjpeg _channel pack) == nil then let _GETalphaBitmaps _LDalphaBitmap _channel pack -> [p _] in if p == nil then nil else p else _LDjpeg _channel pack else _LDbitmap _channel pack ) -> cmedia in let mkMediaWin [mwin nil nil nil BitmapCMedia cmedia] -> newMediaWin in let _GETbitmapSize cmedia -> [wmsource hmsource] in { _SIZEwindow mwin wmsource hmsource 0 0; _CBwinPaint mwin @rflPaintMediaWin newMediaWin; _CBwinDestroy mwin @rflDestroyMediaWin newMediaWin; set objmedia.mediaWinObjMedia = newMediaWin; _SHOWwindow mwin WINDOW_UNHIDDEN; }) |(TextMedia pack -> let _CRwindow _channel nil 0 0 200 200 WN_NORMAL|WN_HIDDEN strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> mwin in let _CRtext _channel mwin 0 0 200 200 ET_DOWN _getpack pack -> cmedia in let mkMediaWin [mwin nil nil nil TextCMedia cmedia] -> newMediaWin in { _CBwinDestroy mwin @rflDestroyMediaWin newMediaWin; set objmedia.mediaWinObjMedia = newMediaWin; _SHOWwindow mwin WINDOW_UNHIDDEN; }) |(_ -> nil); rflPlayMediaWin nil objmedia; }; 0;; fun rflLoopMedia (cb, objmedia, status)= set objmedia.loopObjMedia = status;; fun rflMoveSequenceSlider (s, left, right, line)= set line.mediaLine.sbeginObjMedia = left; set line.mediaLine.sendObjMedia = right; 0;; /* sequence test */ var STOP = 0;; var RUN = 1;; var PAUSE = 2;; var begintime = 0;; var cents = 0;; var oldtime = 0;; fun rflDestroyMainTestWin (w, l)= _deltimer testTimer; cleanTestList l; set currentMedia = nil; set sequenceDisplayed = 0; set sequenceInProgress = 0;; fun rflPaintPlayWin (w, blurp)= let _GETwindowSizePosition w -> [wmsource hmsource x y] in _TXTout w bigFont wmsource/2 hmsource/2 TD_BASELINE|TD_CENTER 0 (_locEditor "5190-MEDIAS-playing" nil);; fun rflPaintStopWin (w, blurp)= let _GETwindowSizePosition w -> [wmsource hmsource x y] in _TXTout w bigFont wmsource/2 hmsource/2 TD_BASELINE|TD_CENTER 0 (_locEditor "5230-MEDIAS-notdisplay" nil);; fun rflPaintBitmapWin (w, bitmap)= _BLTbitmap w bitmap 0 0;; fun rflMultiTestMedia (m, testwin_testmedia_omedia, mode)= let testwin_testmedia_omedia -> [testwin testmedia omedia] in if mode == MEDIA_MODE_STOP then if omedia.loopObjMedia then { _PLAYmultiFromTo m ftoi ((itof 1000) *. omedia.mbeginObjMedia) ftoi ((itof 1000) *. omedia.mendObjMedia); 0 } else { _SETmultiHome m; let testmedia -> [mwin mmulti] in _SHOWwindow mwin WINDOW_HIDDEN; _SHOWwindow testwin.playTestWin WINDOW_HIDDEN; set testwin.flagTestWin = STOP } else if mode==MEDIA_MODE_PAUSE then { _SETmultiHome m; let testmedia -> [mwin mmulti] in _SHOWwindow mwin WINDOW_HIDDEN; _SHOWwindow testwin.playTestWin WINDOW_HIDDEN; set testwin.flagTestWin = PAUSE } else if mode==MEDIA_MODE_PLAY then set testwin.flagTestWin = RUN else 0;; fun rflTimerTest (t, blurp) = if stopList==nil then { set oldtime = 0; set cents = 0; set currentMedia = nil; _deltimer t; } else let time - begintime -> newtime in { if oldtime < newtime then { set oldtime = newtime; set cents = 0 } else set cents = cents+10; let hd startList -> [omedia testwin] in if omedia.sbeginObjMedia <. (itof oldtime)+.((itof cents) /. (itof 100)) then { match testwin.mediaTestWin with (MovieTestMedia m -> let m -> [mwin mmulti] in { _SHOWwindow mwin WINDOW_UNHIDDEN; _PLAYmultiFromTo mmulti ftoi ((itof 1000) *. omedia.mbeginObjMedia) ftoi ((itof 1000) *. omedia.mendObjMedia); _SETmultiReflexMode mmulti @rflMultiTestMedia [testwin m omedia]; set testwin.flagTestWin = RUN }) |(SoundTestMedia m -> let m -> [mwin mmulti] in { _SHOWwindow testwin.playTestWin WINDOW_UNHIDDEN; _PLAYmultiFromTo mmulti ftoi ((itof 1000) *. omedia.mbeginObjMedia) ftoi ((itof 1000) *. omedia.mendObjMedia); _SETmultiReflexMode mmulti @rflMultiTestMedia [testwin m omedia]; set testwin.flagTestWin = RUN }) |(BitmapTestMedia m -> let m -> [mwin _] in { _SHOWwindow mwin WINDOW_UNHIDDEN; set testwin.flagTestWin = RUN }) |(TextTestMedia m -> let m -> [mwin _] in { _SHOWwindow mwin WINDOW_UNHIDDEN; set testwin.flagTestWin = RUN }) |(_ -> 0); set currentMedia = hd startList; set startList=tl startList; 0 } else 0; let hd stopList -> [omedia testwin] in if omedia.sendObjMedia <. (itof oldtime)+.((itof cents) /. (itof 100)) then { match testwin.mediaTestWin with (BitmapTestMedia m -> let m -> [mwin _] in { _SHOWwindow mwin WINDOW_HIDDEN; set testwin.flagTestWin = PAUSE }) |(TextTestMedia m -> let m -> [mwin _] in { _SHOWwindow mwin WINDOW_HIDDEN; set testwin.flagTestWin = PAUSE }) |(_ -> 0); set stopList=tl stopList; 0 } else 0 };; fun PlayMediaInt (x) = if x == nil then 0 else { let hd x -> line in let copyMedia nil line.mediaLine -> newmedia in { match newmedia.typeObjMedia with (MovieMedia pack -> let _CRwindow _channel mainTestWin 0 0 200 200 WN_CHILDMENU|WN_CHILD strcatn newmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> swin in let _CRwindow _channel swin 0 0 200 200 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> pwin in let _CRwindow _channel swin 0 0 200 200 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> mwin in let _CRmulti _channel mwin 0 0 200 200 pack nil -> cmedia in let mkTestWin [swin pwin 0 MovieTestMedia [mwin cmedia]] -> newTestWin in let _GETmultiXYsource cmedia -> [xmsource ymsource wmsource hmsource] in { _SETmultiUseTime cmedia; _SETmultiXYdest cmedia 0 0 2*wmsource 2*hmsource; _SETmultiXYwin cmedia 0 0 2*wmsource 2*hmsource; _SIZEwindow swin 2*wmsource 2*hmsource 0 0; _SIZEwindow pwin 2*wmsource 2*hmsource 0 0; _SIZEwindow mwin 2*wmsource 2*hmsource 0 0; _CBwinPaint pwin @rflPaintPlayWin 0; _CBwinPaint swin @rflPaintStopWin 0; set testList = [newmedia newTestWin]::testList; }) |(SoundMedia pack -> let _CRwindow _channel mainTestWin 0 0 200 50 WN_CHILDMENU|WN_CHILD strcatn newmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> swin in let _CRwindow _channel swin 0 0 200 50 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> pwin in let _CRwindow _channel swin 0 0 200 50 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> mwin in let _CRmulti _channel mwin 0 0 200 50 pack nil -> cmedia in let mkTestWin [swin pwin 0 SoundTestMedia [mwin cmedia]] -> newTestWin in { _SETmultiUseTime cmedia; _CBwinPaint pwin @rflPaintPlayWin 0; _CBwinPaint swin @rflPaintStopWin 0; set testList = [newmedia newTestWin]::testList; }) |(BitmapMedia pack -> let _CRwindow _channel mainTestWin 0 0 200 200 WN_CHILDMENU|WN_CHILD strcatn newmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> swin in let _CRwindow _channel swin 0 0 200 200 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> pwin in let _CRwindow _channel swin 0 0 200 200 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> mwin in let ( if (_LDbitmap _channel pack) == nil then if (_LDjpeg _channel pack) == nil then let _GETalphaBitmaps _LDalphaBitmap _channel pack -> [p _] in if p == nil then nil else p else _LDjpeg _channel pack else _LDbitmap _channel pack ) -> cmedia in let mkTestWin [swin pwin 0 BitmapTestMedia [mwin cmedia]] -> newTestWin in let _GETbitmapSize cmedia -> [wmsource hmsource] in { _SIZEwindow swin wmsource hmsource 0 0; _SIZEwindow pwin wmsource hmsource 0 0; _SIZEwindow mwin wmsource hmsource 0 0; _CBwinPaint pwin @rflPaintPlayWin 0; _CBwinPaint swin @rflPaintStopWin 0; _CBwinPaint mwin @rflPaintBitmapWin cmedia; set testList = [newmedia newTestWin]::testList; }) |(TextMedia pack -> let _CRwindow _channel mainTestWin 0 0 200 200 WN_CHILDMENU|WN_CHILD strcatn newmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil -> swin in let _CRwindow _channel swin 0 0 200 200 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> pwin in let _CRwindow _channel swin 0 0 200 200 WN_HIDDEN|WN_CHILD|WN_NOBORDER "" -> mwin in let _CRtext _channel mwin 0 0 200 200 ET_DOWN _getpack pack -> cmedia in let mkTestWin [swin pwin 0 TextTestMedia [mwin cmedia]] -> newTestWin in { _CBwinPaint pwin @rflPaintPlayWin 0; _CBwinPaint swin @rflPaintStopWin 0; set testList = [newmedia newTestWin]::testList; }) |(_ -> nil); }; PlayMediaInt tl x; 0 } ;; fun rflStartSequence (b, blurp)= if sequenceInProgress then nil else { set sequenceDisplayed = 1; set mainTestWin = _CRwindow _channel nil 0 0 640 480 WN_NORMAL|WN_HIDDEN (_locEditor "6620-MEDIAS-sequencete" nil); cleanTestList testList; set testList = nil; PlayMediaInt lineList; _CBwinDestroy mainTestWin @rflDestroyMainTestWin testList; _SHOWwindow mainTestWin WINDOW_UNHIDDEN; set cents = -50; set oldtime = 0; set begintime = time; set startList = rquicksort @cmpStart testList; set stopList = rquicksort @cmpStop testList; set sequenceInProgress = 1; set testTimer = _rfltimer _starttimer _channel 100 @rflTimerTest 0; } ;; /* editing window */ fun rflOkEditWin (b, line_objmedia)= let line_objmedia -> [line objmedia] in if ((strlen _GETtext line.editWinLine.aliasEditWin)==0) || ((strlen _GETtext line.editWinLine.fileEditWin)==0) then nil else { if line.mediaLine == nil then match objmedia.typeObjMedia with (MovieMedia p -> { set objmedia.loopObjMedia = 0; set objmedia.sbeginObjMedia = itof 0; set objmedia.sendObjMedia = objmedia.mendObjMedia -. objmedia.mbeginObjMedia; }) |(SoundMedia p -> { set objmedia.loopObjMedia = 0; set objmedia.sbeginObjMedia = itof 0; set objmedia.sendObjMedia = objmedia.mendObjMedia -. objmedia.mbeginObjMedia; }) |(_-> nil) else match objmedia.typeObjMedia with (MovieMedia p -> set objmedia.sendObjMedia = objmedia.sbeginObjMedia +. objmedia.mendObjMedia -. objmedia.mbeginObjMedia ) |(SoundMedia p -> set objmedia.sendObjMedia = objmedia.sbeginObjMedia +. objmedia.mendObjMedia -. objmedia.mbeginObjMedia ) |(_-> nil); set line.mediaLine = copyMedia line.mediaLine objmedia; _CBcheck line.loopLine @rflLoopMedia line.mediaLine; _CBbutton line.testLine @rflTestMedia line.mediaLine; if line.mediaLine.sendObjMedia >. maxTime then { augmentSliders lineList line.mediaLine.sendObjMedia; set maxTime = line.mediaLine.sendObjMedia } else nil; _SETsliderLeft line.sliderLine line.mediaLine.sbeginObjMedia; _SETsliderRight line.sliderLine line.mediaLine.sendObjMedia; let _GETsliderFlags line.sliderLine -> oldFlags in match objmedia.typeObjMedia with (MovieMedia p -> _SETsliderFlags line.sliderLine oldFlags|SLIDER_INTER_FIXED) |(SoundMedia p -> _SETsliderFlags line.sliderLine oldFlags|SLIDER_INTER_FIXED) |(_ -> _SETsliderFlags line.sliderLine oldFlags&~SLIDER_INTER_FIXED); _SETcheck line.loopLine objmedia.loopObjMedia; _SETbuttonName line.aliasLine line.mediaLine.aliasObjMedia; _DSslider line.editWinLine.sliderEditWin; _DSwindow line.editWinLine.winEditWin; set line.editWinLine = nil; if (pos_in_list lineList line 1)==(sizelist lineList) then moreLine else nil };; fun rflCancelEditWin (b, line)= _DSslider line.editWinLine.sliderEditWin; _DSwindow line.editWinLine.winEditWin; set line.editWinLine = nil;; fun rflDestroyEditWin (w, line)= rflCancelEditWin nil line;; fun rflMoveSliderEditWin (s, l, r, ewin)= set ewin.mediaEditWin.mbeginObjMedia = l; set ewin.mediaEditWin.mendObjMedia = r; 0;; fun rflTextAliasEditWin (t, ewin)= set ewin.mediaEditWin.aliasObjMedia = _GETtext t;; /* loading files */ proto getMedias = fun [[[S r1] r1]] [ObjMedia r1];; fun getMedias (sr1r1)= if sr1r1==nil then { status editor (_locEditor "8330-MEDIAS-allfileslo" nil); nil } else let hd sr1r1 -> [keyword [alias [file [mbegin [mend [sbegin [send [loop _]]]]]]]] in if (!strcmp keyword "media") then let _checkpack file -> pack in if pack==nil then getMedias (tl sr1r1) else { status editor strcat (_locEditor "8460-MEDIAS-loadingfil" nil) file; let _CRwindow _channel editWin 0 0 100 100 WN_CHILD|WN_HIDDEN file -> mediaWin in let let _CRmulti _channel mediaWin 0 0 100 100 pack nil -> m in if m==nil then let _LDbitmap _channel pack -> p in if p==nil then let _LDjpeg _channel pack -> p in if p==nil then let _GETalphaBitmaps _LDalphaBitmap _channel pack -> [p _] in if p==nil then [TextMedia pack nil nil] else ( _DSbitmap p; [BitmapMedia pack nil nil] ) else { _DSbitmap p; [BitmapMedia pack nil nil] } else { _DSbitmap p; [BitmapMedia pack nil nil] } else { _SETmultiUseTime m; let (itof (_GETmultiStart m))/.(itof 1000) -> start in let (itof (_GETmultiEnd m))/.(itof 1000) -> end in let _GETmultiXYsource m -> [xmsource ymsource wmsource hmsource] in if (xmsource==0) && (ymsource==0) && (wmsource==0) && (hmsource==0) then { _DSmulti m; [SoundMedia pack start end] } else { _DSmulti m; [MovieMedia pack start end] } } -> [type fstart fend] in let mkObjMedia [alias type fstart fend atof mbegin atof mend atof sbegin atof send atoi loop nil] -> media in { _DSwindow mediaWin; media::(getMedias (tl sr1r1)) } } else getMedias (tl sr1r1);; fun fillFileZone (l)= if l==nil then 0 else { let moreLine -> line in let hd l -> objmedia in { set line.mediaLine = copyMedia line.mediaLine objmedia; _CBcheck line.loopLine @rflLoopMedia line.mediaLine; _CBbutton line.testLine @rflTestMedia line.mediaLine; if line.mediaLine.sendObjMedia >. maxTime then { augmentSliders lineList line.mediaLine.sendObjMedia; set maxTime = line.mediaLine.sendObjMedia } else nil; _SETsliderLeft line.sliderLine line.mediaLine.sbeginObjMedia; _SETsliderRight line.sliderLine line.mediaLine.sendObjMedia; let _GETsliderFlags line.sliderLine -> oldFlags in match objmedia.typeObjMedia with (MovieMedia p -> _SETsliderFlags line.sliderLine oldFlags|SLIDER_INTER_FIXED) |(SoundMedia p -> _SETsliderFlags line.sliderLine oldFlags|SLIDER_INTER_FIXED) |(_ -> _SETsliderFlags line.sliderLine oldFlags&~SLIDER_INTER_FIXED); _SETcheck line.loopLine objmedia.loopObjMedia; _SETbuttonName line.aliasLine line.mediaLine.aliasObjMedia; }; fillFileZone tl l };; fun rflOpenMedia (ob, line, pack)= if pack==nil then nil else { status editor strcat (_locEditor "9360-MEDIAS-openingfil" nil) _PtoScol pack; let _CRwindow _channel editWin 0 0 100 100 WN_HIDDEN "" -> mwin in let ( let _CRmulti _channel mwin 0 0 100 100 pack nil -> m in if m==nil then let _LDbitmap _channel pack -> p in if p==nil then let _LDjpeg _channel pack -> p in if p==nil then let _GETalphaBitmaps _LDalphaBitmap _channel pack -> [p _] in if p==nil then [TextMedia pack itof 0 itof 100] else ( _DSbitmap p; [BitmapMedia pack itof 0 itof 100] ) else { _DSbitmap p; [BitmapMedia pack itof 0 itof 100] } else { _DSbitmap p; [BitmapMedia pack itof 0 itof 100] } else { _SETmultiUseTime m; let (itof (_GETmultiStart m))/.(itof 1000) -> start in let (itof (_GETmultiEnd m))/.(itof 1000) -> end in let _GETmultiXYsource m -> [xmsource ymsource wmsource hmsource] in if (xmsource==0) && (ymsource==0) && (wmsource==0) && (hmsource==0) then { _DSmulti m; [SoundMedia pack start end] } else { _DSmulti m; [MovieMedia pack start end] } } ) -> [type start end] in { _SETtext line.editWinLine.fileEditWin _PtoScol pack; if (strlen line.editWinLine.mediaEditWin.aliasObjMedia)==0 then { _SETtext line.editWinLine.aliasEditWin _GetFileNameFromP pack; set line.editWinLine.mediaEditWin.aliasObjMedia = _GetFileNameFromP pack; } else nil; set line.editWinLine.mediaEditWin.typeObjMedia = type; match type with (MovieMedia pack -> { _SETsliderMin line.editWinLine.sliderEditWin start; _SETsliderMax line.editWinLine.sliderEditWin end; _SETsliderLeft line.editWinLine.sliderEditWin start; _SETsliderRight line.editWinLine.sliderEditWin end; set line.editWinLine.mediaEditWin.fbeginObjMedia = start; set line.editWinLine.mediaEditWin.fendObjMedia = end; set line.editWinLine.mediaEditWin.mbeginObjMedia = start; set line.editWinLine.mediaEditWin.mendObjMedia = end; _SHOWslider line.editWinLine.sliderEditWin SLIDER_UNHIDDEN; }) |(SoundMedia pack -> { _SETsliderMin line.editWinLine.sliderEditWin start; _SETsliderMax line.editWinLine.sliderEditWin end; _SETsliderLeft line.editWinLine.sliderEditWin start; _SETsliderRight line.editWinLine.sliderEditWin end; set line.editWinLine.mediaEditWin.fbeginObjMedia = start; set line.editWinLine.mediaEditWin.fendObjMedia = end; set line.editWinLine.mediaEditWin.mbeginObjMedia = start; set line.editWinLine.mediaEditWin.mendObjMedia = end; _SHOWslider line.editWinLine.sliderEditWin SLIDER_UNHIDDEN; }) |(_ -> _SHOWslider line.editWinLine.sliderEditWin SLIDER_HIDDEN); _DSwindow mwin; status editor strcat (_locEditor "10160-MEDIAS-fileloaded" nil) _PtoScol pack; } } ;; fun rflBrowseMedia (button, line)= _DLGrflopen _DLGOpenFile _channel line.editWinLine.winEditWin "" "" "all (*.*)\0*.*\0picture (*.bmp;*.jpg;*.png)\0*.bmp;*.jpg;*.png\0video (*.avi;*.mpg;*.mov)\0*.avi;*.mpg;*.mov\0sound (*.wav;*.mid;*.rmi;*.mp3)\0*.wav;*.mid;*.rmi;*.mp3\0\0" @rflOpenMedia line; 0;; /* lines management */ fun rflAlias (b, line)= if line.editWinLine == nil then { let _CRwindow _channel editWin 0 0 330 125 WN_NORMAL|WN_HIDDEN "" -> ewin in let _CRbuttonBitmap _channel ewin browseMap 305 30 20 20 0 -> browse in let _CRbutton _channel ewin 5 100 70 20 0 (_locEditor "10360-MEDIAS-ok" nil) -> ok in let _CRbutton _channel ewin 80 100 70 20 0 (_locEditor "10370-MEDIAS-cancel" nil) -> cancel in let _CRbutton _channel ewin 270 100 50 20 0 (_locEditor "10380-MEDIAS-test" nil) -> test in let _CRtext _channel ewin 5 5 40 20 ET_ALIGN_RIGHT (_locEditor "10390-MEDIAS-alias:" nil) -> balias in let _CReditLine _channel ewin 45 5 280 20 ET_AHSCROLL|ET_DOWN "" -> alias in let _CRtext _channel ewin 5 30 40 20 ET_ALIGN_RIGHT (_locEditor "10410-MEDIAS-file:" nil) -> bfile in let _CReditLine _channel ewin 45 30 255 20 ET_AHSCROLL|ET_DOWN "" -> file in let _CRslider _channel ewin nil 5 55 320 40 0xff0000 itof 0 itof 100 itof 0 itof 100 nil SLIDER_NORMAL -> slider in let if line.mediaLine == nil then mkObjMedia ["" UnknownMedia itof 0 itof 100 itof 0 itof 100 itof 0 itof 100 0 mkMediaWin [nil nil nil nil UnknownCMedia]] else copyMedia mkObjMedia ["" UnknownMedia itof 0 itof 100 itof 0 itof 100 itof 0 itof 100 0 mkMediaWin [nil nil nil nil UnknownCMedia]] line.mediaLine -> objmedia in let mkEditWin [ewin balias alias bfile file browse slider test ok cancel objmedia] -> new in { _SETtext alias objmedia.aliasObjMedia; _CBtext alias @rflTextAliasEditWin new; _SETsliderPrecisionStep slider (itof 1)/.(itof 100); _CBslider slider mkfun4 @rflMoveSliderEditWin new; match line.mediaLine.typeObjMedia with (MovieMedia pack -> { _SETsliderMin slider objmedia.fbeginObjMedia; _SETsliderMax slider objmedia.fendObjMedia; _SETsliderLeft slider objmedia.mbeginObjMedia; _SETsliderRight slider objmedia.mendObjMedia; _SETwindowName ewin strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil; _SETtext file _PtoScol pack }) |(SoundMedia pack -> { _SETsliderMin slider objmedia.fbeginObjMedia; _SETsliderMax slider objmedia.fendObjMedia; _SETsliderLeft slider objmedia.mbeginObjMedia; _SETsliderRight slider objmedia.mendObjMedia; _SETwindowName ewin strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil; _SETtext file _PtoScol pack }) |(BitmapMedia pack -> { _SHOWslider slider SLIDER_HIDDEN; _SETwindowName ewin strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil; _SETtext file _PtoScol pack }) |(TextMedia pack -> { _SHOWslider slider SLIDER_HIDDEN; _SETwindowName ewin strcatn objmedia.aliasObjMedia::" ("::(_PtoScol pack)::")"::nil; _SETtext file _PtoScol pack }) |(_ -> nil); _CBwinDestroy ewin @rflDestroyEditWin line; _CBbutton browse @rflBrowseMedia line; _CBbutton test @rflTestMedia objmedia; _CBbutton ok @rflOkEditWin [line objmedia]; _CBbutton cancel @rflCancelEditWin line; _SHOWwindow ewin WINDOW_UNHIDDEN; set line.editWinLine = new }; } else nil;; fun rflPaintEditWin (win, param)= let _GETwindowSizePosition win -> [w h _ _] in ( _PAINTline editWin 5 25 w-10 25 DRAW_SOLID 1 0; _PAINTline editWin 105 10 105 h DRAW_SOLID 1 0; _PAINTline editWin 640 10 640 h DRAW_SOLID 1 0; _PAINTline editWin 710 10 710 h DRAW_SOLID 1 0; _PAINTline editWin 780 10 780 h DRAW_SOLID 1 0; _TXTout editWin vertFont 675 10 TD_TOP|TD_CENTER 0 (_locEditor "MEDIAS-loop" nil); _TXTout editWin vertFont 745 10 TD_TOP|TD_CENTER 0 (_locEditor "MEDIAS-playmed" nil); _TXTout editWin vertFont 815 10 TD_TOP|TD_CENTER 0 (_locEditor "MEDIAS-del" nil); _TXTout editWin horizFont 135 7 TD_TOP|TD_LEFT 0 (_locEditor "MEDIAS-playseq" nil) );; /* SCS editor */ fun saveLines (l)= if l==nil then nil else let hd l -> line in { if line.mediaLine == nil then saveLines tl l else ("media":: line.mediaLine.aliasObjMedia:: (match line.mediaLine.typeObjMedia with (MovieMedia p -> _PtoScol p) |(SoundMedia p -> _PtoScol p) |(BitmapMedia p -> _PtoScol p) |(TextMedia p -> _PtoScol p) |(_ -> "*") ):: (ftoa line.mediaLine.mbeginObjMedia):: (ftoa line.mediaLine.mendObjMedia):: (ftoa line.mediaLine.sbeginObjMedia):: (ftoa line.mediaLine.sendObjMedia):: (itoa line.mediaLine.loopObjMedia):: nil):: ("zoneC"::line.mediaLine.aliasObjMedia::nil):: ("action"::(strcat "play " line.mediaLine.aliasObjMedia)::nil):: ("action"::(strcat "stop " line.mediaLine.aliasObjMedia)::nil):: ("eventC"::(strcat "playing " line.mediaLine.aliasObjMedia)::nil):: ("eventC"::(strcat "stopped " line.mediaLine.aliasObjMedia)::nil):: (saveLines tl l) };; fun save (filename, n)= ("action"::"start"::"start"::nil):: ("action"::"destroy"::"destroy"::nil):: ("action"::"play"::nil):: ("action"::"stop"::nil):: ("eventC"::"in"::nil):: ("eventC"::"playing"::nil):: ("eventC"::"stopped"::nil):: saveLines lineList;; fun load (l) = cleanTestList testList; clean_up lineList; set lineList=nil; status editor (_locEditor "11620-MEDIAS-pleasewait" nil); fillFileZone getMedias l; moreLine; 0;; fun IniEditor(s)= let [850 30] -> [w h] in let startEditor _channel nil nil nil w h WN_MENU|WN_SIZEBOX EDITOR_NORMAL s "dms/media/mediasequence/mediasequence.dmc" nil nil @load @save nil -> ed in ( set editor = ed; set editWin = getEditWin ed; _CBwinPaint editWin @rflPaintEditWin [w h]; set vertFont = _CRfont _channel 12 900 0 "Arial"; set horizFont = _CRfont _channel 13 0 0 "Arial"; set bigFont = _CRfont _channel 18 0 FF_WEIGHT "Arial"; set playMap = _LDbitmap _channel _checkpack playMapFile; set stopMap = _LDbitmap _channel _checkpack stopMapFile; set browseMap = _LDbitmap _channel _checkpack browseMapFile; _CBbutton _CRbuttonBitmap _channel editWin playMap 110 2 20 20 0 @rflStartSequence 0; set minusButton = _CRbutton _channel editWin w-255 5 15 15 0 "-"; _CBbutton minusButton @rflMinusButton 0; set plusButton = _CRbutton _channel editWin w-240 5 15 15 0 "+"; _CBbutton plusButton @rflPlusButton 0; set maxTime = itof 10; moreLine; openDMI ed ); 0 ;;