Notifications
Clear all

[Closed] How to make your own Timeline (NOT ENCRYPTED)

callbacks added, spinners wired to animationrange…


 try(destroydialog trackbarNavigatorLight) catch()
 
 if isproperty rootnode #TrackbarNavigatorLightAttrib do custattributes.delete rootnode TrackbarNavigatorLightAttrib
 gc()
 
 fn addTrackbarNavigatorLightAttrib dialog: = if not isproperty rootnode #TrackbarNavigatorLightAttrib do
 (
 	TrackbarNavigatorLightAttrib = attributes "TrackbarNavigatorLightAttrib" attribID:#(0x1145de09, 0x1145de09)
 	(
 		local dialog
 		parameters main
 		(
 			trackbarRange type:#point4 default:[0,0,100,1000] animatable:off
 			on trackbarRange set val do if dialog != undefined do dialog.updateUI()
 		)
 	)
 	custattributes.add rootnode TrackbarNavigatorLightAttrib
 	if dialog != unsupplied do rootnode.TrackbarNavigatorLightAttrib.dialog = dialog 
 )
 
 rollout trackbarNavigatorLight "Trackbar Navigator" width:327 height:24
 (
 	local updating = off
 	
 	spinner sa_sp fieldwidth:50 range:[-1e9,1e9,0] type:#integer pos:[0,4]
 	spinner sr_sp fieldwidth:50 range:[-1e9,1e9,0] type:#integer pos:[61,4]
 	
 	spinner er_sp fieldwidth:50 range:[-1e9,1e9,100] type:#integer pos:[200,4]
 	spinner ea_sp fieldwidth:50 range:[-1e9,1e9,1000] type:#integer pos:[261,4]
 
 	fn getParams = (if isproperty rootnode #TrackbarNavigatorLightAttrib do rootnode)
 	
 	fn updateUI = 
 	(
 		if (param = getParams()) != undefined do
 		(
 			sr_sp.value = param.trackbarRange[2]
 			er_sp.value = param.trackbarRange[3]
 			sa_sp.value = param.trackbarRange[1]
 			ea_sp.value = param.trackbarRange[4]
 			
 			if sr_sp.value != animationrange.start or er_sp.value != animationrange.end do 
 			(
 				updating = on
 				animationrange = interval sr_sp.value er_sp.value
 				updating = off
 			)
 		)
 	)
 	fn setRange value: event:#custom undoable:off = if not updating do with undo undoable
 	(
 		if event != #custom and event != #range do addTrackbarNavigatorLightAttrib dialog:trackbarNavigatorLight
 		
 		param = getParams()
 		if value == unsupplied do 
 		(
 			case event of
 			(
 				#custom: 
 				(
 					value = [sa_sp.value, sr_sp.value, er_sp.value, ea_sp.value]
 				)
 				default:
 				(
 					sr = animationrange.start
 					er = amax animationrange.end (sr+1)
 					sa = amin (if param != undefined then param.trackbarRange[1] else 0) sr
 					ea = amax (if param != undefined then param.trackbarRange[4] else 1000) er
 		
 					value = [sa, sr, er, ea]
 				)
 			)
 		)
 		if value[2] != animationrange.start or value[3] != animationrange.end do 
 		(
 			updating = on
 			animationrange = interval value[2] value[3]
 			updating = off
 		)
 		if param != undefined do param.trackbarRange = value
 			
 		if event != #custom do updateUI()
 	)
 	
 	on sr_sp entered arg can do if not can do 
 	(
 		sr = sr_sp.value
 		sa = amin sa_sp.value sr
 		er = amax er_sp.value (sr+1)
 		ea = amax ea_sp.value sr
 		
 		setRange value:[sa, sr, er, ea] undoable:on
 	)
 	on er_sp entered arg can do if not can do 
 	(
 		er = er_sp.value
 		sr = amin sr_sp.value (er-1)
 		sa = amin sa_sp.value sr
 		ea = amax ea_sp.value er
 		
 		setRange value:[sa, sr, er, ea] undoable:on
 	)
 	on sa_sp entered arg can do if not can do 
 	(
 		sa = sa_sp.value
 		sr = amax sr_sp.value sa
 		er = amax er_sp.value (sr+1)
 		ea = amax ea_sp.value er
 		
 		setRange value:[sa, sr, er, ea] undoable:on
 	)
 	on ea_sp entered arg can do if not can do 
 	(
 		ea = ea_sp.value
 		er = amin er_sp.value ea
 		sr = amin sr_sp.value (er-1)
 		sa = amin sa_sp.value sr
 		
 		setRange value:[sa, sr, er, ea] undoable:on
 	)
 	
 	on trackbarNavigatorLight close do 
 	(
 		callbacks.removescripts id:#trackbarNavigatorLight
 	)
 	on trackbarNavigatorLight open do 
 	(
 		addTrackbarNavigatorLightAttrib dialog:trackbarNavigatorLight
 		
 		callbacks.removescripts id:#trackbarNavigatorLight
 		call = "if trackbarNavigatorLight != undefined and trackbarNavigatorLight.open do trackbarNavigatorLight.setRange event:"
 		callbacks.addscript #animationRangeChange (call + "#range") id:#trackbarNavigatorLight
 		callbacks.addscript #filePostOpen (call + "#open") id:#trackbarNavigatorLight
 		callbacks.addscript #systemPostNew (call + "#new") id:#trackbarNavigatorLight
 		callbacks.addscript #systemPostReset (call + "#reset") id:#trackbarNavigatorLight
 		callbacks.addscript #postSystemStartup (call + "#start") id:#trackbarNavigatorLight
 		
 		setRange event:#range
 	)
 )
 createdialog trackbarNavigatorLight style:#(#style_titlebar, #style_sysmenu)
 

any questions?

Page 8 / 8