#include "Gra.ch" #include "Xbp.ch" #include "Appevent.ch" #include "Font.ch" #pragma library( "xppui2.lib" ) PROCEDURE AppSys() RETURN PROCEDURE Main LOCAL nEvent, mp1, mp2, bBlock LOCAL oDlg, oXbp, drawingArea, oVideo, oStatic1, oStatic2, oStatic3, oStatic4 LOCAL cFileName := "", oRestore oDlg := XbpDialog():new(SetAppWindow():setParent(),,{30,60}, {740,520}) oDlg:taskList := .T. oDlg:title := "Demo for BDVideo Class - 2001 Brent Dubs" oDlg:visible := .T. oDlg:close := {|mp1,mp2,obj| obj:destroy(),_quit() } oDlg:create() SetAppWindow( oDlg ) drawingArea := oDlg:drawingArea drawingArea:setFontCompoundName( "8.Arial" ) oVideo := BDVideo():new(drawingArea,,{170,175},{400,300}):create() oStatic1 := XbpStatic():new(drawingArea,,{280,160},{350,15}) oStatic1:create() oStatic2 := XbpStatic():new(drawingArea,,{280,145},{350,15}) oStatic2:create() oStatic3 := XbpStatic():new(drawingArea,,{280,130},{350,15}) oStatic3:create() oStatic4 := XbpStatic():new(drawingArea,,{100,570},{350,20}) oStatic4:visible := .F. oStatic4:caption := "Demo for BDVideo Class - 2001 Brent Dubs" oStatic4:setColorFG(GRA_CLR_DARKBLUE) oStatic4:setFontCompoundName("12.Arial") oStatic4:create() oXbp := XbpPushButton():new( drawingArea, , {10,10}, {80,30} ) oXbp:caption := "Open" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| cFilename := SelectFile("*.mpg;*.avi;*.dat"),; IF(ValType(cFileName) == "C" .AND. ; !EMPTY(cFileName),oVideo:loadFile(cFileName),cFileName := ""),; oStatic1:setcaption("FileName: " + AllTrim(oVideo:filename)),; oStatic2:setCaption("Length in seconds: " + Alltrim(STR(oVideo:length/1000))),; oStatic3:setCaption("Length in frames: " + Alltrim(STR(oVideo:frames)))} oXbp := XbpPushButton():new( drawingArea, , {100,10}, {80,30} ) oXbp:caption := "Play" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {||IF(oVideo:paused,oVideo:play(),oVideo:play(.T.))} oXbp := XbpPushButton():new( drawingArea, , {190,10}, {80,30} ) oXbp:caption := "Stop" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {||oVideo:stop()} oXbp := XbpPushButton():new( drawingArea, , {280,10}, {80,30} ) oXbp:caption := "Pause" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {||oVideo:pause(.T.)} oXbp := XbpPushButton():new( drawingArea, , {370,10}, {80,30} ) oXbp:caption := "Play and Wait" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {||oVideo:play(.T.,.T.)} oXbp := XbpPushButton():new( drawingArea, , {460,10}, {80,30} ) oXbp:caption := "Loop Video" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {||oVideo:play(.T.,.F.,.T.)} oXbp := XbpPushButton():new( drawingArea, , {550,10}, {80,30} ) oXbp:caption := "Status" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {||MSGBOX(oVideo:status(),"Playing mode status")} oXbp := XbpPushButton():new( drawingArea, , {640,10}, {80,30} ) oXbp:caption := "Close" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {||oVideo:stop(),_quit()} oXbp := XbpPushButton():new( drawingArea, , {10,50}, {80,30} ) oXbp:caption := "Volume Up" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| oVideo:setVolume(oVideo:volume+10)} oXbp := XbpPushButton():new( drawingArea, , {100,50}, {80,30} ) oXbp:caption := "Volume Down" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| oVideo:setVolume(oVideo:volume-10) } oXbp := XbpPushButton():new( drawingArea, , {190,50}, {80,30} ) oXbp:caption := "Volume Status" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| MSGBOX(ALLTRIM(STR(oVideo:volume))+"%","Volume level") } oXbp := XbpPushButton():new( drawingArea, , {280,50}, {80,30} ) oXbp:caption := "Mute" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|o| oVideo:mute(!oVideo:muted) } oXbp := XbpPushButton():new( drawingArea, , {370,50}, {80,30} ) oXbp:caption := "Frwd 5 Secs" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| oVideo:seek((oVideo:getPosition()+5)) } oXbp := XbpPushButton():new( drawingArea, , {460,50}, {80,30} ) oXbp:caption := "Bkwd 5 Secs" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| oVideo:seek((oVideo:getPosition()-5)) } oXbp := XbpPushButton():new( drawingArea, , {550,50}, {80,30} ) oXbp:caption := "Frwd 25 Frms" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| oVideo:frameStep(25) } oXbp := XbpPushButton():new( drawingArea, , {640,50}, {80,30} ) oXbp:caption := "Bkwd 25 Frms" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| oVideo:frameStep(-25) } oXbp := XbpPushButton():new( drawingArea, , {10,90}, {80,30} ) oXbp:caption := "Fast Forward" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| IF(!(oVideo:status() == "playing"),oVideo:play(),NIL),; oVideo:setSpeed(200) } oXbp := XbpPushButton():new( drawingArea, , {100,90}, {80,30} ) oXbp:caption := "Slow" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| IF(!(oVideo:status() == "playing"),oVideo:play(),NIL),; oVideo:setSpeed(50) } oXbp := XbpPushButton():new( drawingArea, , {190,90}, {80,30} ) oXbp:caption := "Normal Speed" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| IF(!(oVideo:status() == "playing"),oVideo:play(),NIL),; oVideo:setSpeed(100) } oXbp := XbpPushButton():new( drawingArea, , {280,90}, {80,30} ) oXbp:caption := "MCI Ready?" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| MSGBOX(IF(oVideo:ready(),"It's ready","Not Ready"),"MCI device ready status") } oXbp := XbpPushButton():new( drawingArea, , {640,90}, {80,30} ) oXbp:caption := "Full Screen" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:create() oXbp:activate := {|| oDlg:titleBar := .F., oDlg:configure(),; oDlg:setPosandSize({0,0},{800,600}),; oVideo:setPosandSize({0,0},{800,565}),; oRestore:show(), oStatic4:show(), SetAppFocus(oDlg) } oXbp := XbpPushButton():new( drawingArea, , {10,570}, {80,20} ) oXbp:caption := "Restore" oXbp:clipSiblings := .T. oXbp:tabStop := .T. oXbp:visible := .F. oXbp:create() oXbp:activate := {||oRestore:hide(),oStatic4:hide(),; oVideo:setPosandSize({170,175},{400,300}),; oDlg:titleBar := .T., oDlg:configure(),; oDlg:setPosandSize({30,60},{740,520}),; SetAppFocus(oDlg)} oRestore := oXbp SetAppFocus(oDlg) DO WHILE .T. nEvent := AppEvent( @mp1, @mp2, @oXbp, 0) IF (bBlock := SetAppEvent(nEvent)) <> NIL EVAL(bBlock,mp1,mp2,oXbp) ELSE oXbp:handleEvent( nEvent, mp1, mp2 ) ENDIF ENDDO RETURN FUNCTION SelectFile(cFiles) RETURN XbpFileDialog():new():create( SetAppWindow() ):open(cFiles)