/usr/share/xcrysden/Tcl/movieMaker.tcl is in xcrysden-data 1.5.60-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | #############################################################################
# Author: #
# ------ #
# Anton Kokalj Email: Tone.Kokalj@ijs.si #
# Department of Physical and Organic Chemistry Phone: x 386 1 477 3523 #
# Jozef Stefan Institute Fax: x 386 1 477 3811 #
# Jamova 39, SI-1000 Ljubljana #
# SLOVENIA #
# #
# Source: $XCRYSDEN_TOPDIR/Tcl/movieMaker.tcl
# ------ #
# Copyright (c) 2008 by Anton Kokalj #
#############################################################################
proc MovieMaker {togl} {
global movieMaker xcMisc
if { ![info exists xcMisc(gif_encoder)] && ![info exists xcMisc(movie_encoder)] } {
# at least one of encoder must exist to create movies
return
}
if { ! [info exists movieMaker(mode)] } {
set movieMaker(mode) realtime
}
if { ! [info exists movieMaker(fps)] } {
set movieMaker(fps) 20
}
if { ! [info exists movieMaker(count)] } {
set movieMaker(count) 0
}
if { ! [info exists movieMaker(recording_text)] } {
set movieMaker(recording_text) "Start recording"
}
set c [lindex [split $togl .] end]
if { [info exists .movie$c] } {
return
}
# toplevel
set t [xcToplevel .movie$c "Movie Maker" "Movie" . -0 0 1]
bind $t <Destroy> {movieMaker_close %W}
set movieMaker(tplw) $t
set movieMaker(togl) $togl
set movieMaker(recording) 0
# this is for "Hide" button
global unmapWin
xcRegisterUnmapWindow $t $unmapWin(frame,main) movie \
-textimage {MovieMaker unmap}
bind $t <Unmap> [list xcUnmapWindow unmap %W $t $unmapWin(frame,main) movie]
bind $t <Map> [list xcUnmapWindow map %W $t $unmapWin(frame,main) movie]
# container frames
set f1 [labelframe $t.f1 -text "Movie creation mode:"]
set f2 [labelframe $t.f2 -text "Movie encoding options:"]
set f3 [frame $t.f3]
set movieMaker(f1) $f1
set movieMaker(f2) $f2
set movieMaker(f3) $f3
pack $f1 -side top -expand 1 -fill x -padx 2m -pady 2m -ipadx 2m -ipady 2m
pack $f2 -side top -expand 1 -fill x -padx 2m -ipadx 5m -ipady 2m
pack $f3 -side top
pack [set movieMaker(mode_frame) [frame $f1.f]] -side top -expand 1 -fill x -padx 0 -pady 0 -ipadx 0 -ipady 0
# mode radiobuttons
foreach text {
"real-time capture" "capture every redisplay" "manual"
} value {
realtime everysnapshot manual
} {
radiobutton $f1.f.$value -text $text -variable movieMaker(mode) -value $value -anchor w
pack $f1.f.$value -side top -padx 5 -pady 0 -fill x -expand 1
}
set movieMaker(fps_entryframe) [frame $f1.fe]
set movieMaker(buttonframe) [frame $f1.bf]
pack $f1.fe -side top -expand 1 -fill x -padx 5
pack $f1.bf -side top -expand 1 -fill x -padx 5
# frequency entry for real-time-capture
label $f1.fe.fpsl -text "Real-time capture frequency (frames per second):" -anchor w
entry $f1.fe.fpse -relief sunken -textvariable movieMaker(fps) -width 5
pack $f1.fe.fpsl -side left -padx 5
pack $f1.fe.fpse -side left -fill x -expand 1
# buttons
set movieMaker(startstop_button) [button $f1.bf.startstop -textvariable movieMaker(recording_text) -command movieMaker_recording_]
set movieMaker(startstop_button_bg) [$f1.bf.startstop cget -background]
set movieMaker(snapshot_button) [button $f1.bf.snap -image snapshot -command movieMaker_frame]
pack $movieMaker(startstop_button) $movieMaker(snapshot_button) -side left -pady 3 -padx 3
# Animated GIF/MPEG/AVI control widgets (from gifAnim.tcl)
gifAnim_controlWidgets $f2 $togl
#
movieMaker_mode_
trace add variable movieMaker(mode) write movieMaker_mode_
# Close/Hide widgets
set hide [button $f3.hide -text "Hide" -default active -command [list HideWin $t movie]]
set close [button $f3.close -text "Close" -command [list movieMaker_close $t]]
pack $hide $close -side left -ipadx 1m -ipady 1m -padx 2m -pady 2m
xcUpdateState
}
proc movieMaker_frame {} {
global movieMaker
if { ! [info exists movieMaker(count)] } {
set movieMaker(count) 0
}
incr movieMaker(count)
scripting::makeMovie::makeFrame
}
proc movieMaker_end {} {
global movieMaker
if { $movieMaker(mode) != "manual" } {
global gifAnim
set gifAnim(filelist) [$movieMaker(togl) xc_realtimemovie filelist]
$movieMaker(togl) xc_realtimemovie end
if { $movieMaker(mode) == "realtime" } {
$movieMaker(togl) configure -time $movieMaker(togl_timedelay)
}
}
scripting::makeMovie::end
set movieMaker(count) 0
}
proc movieMaker_manual {} {
global movieMaker
set movieMaker(mode) "manual"
scripting::makeMovie::begin
}
proc movieMaker_realTimeCapture {{ms 50}} {
global movieMaker gifAnim system
scripting::makeMovie::begin
set gifAnim(frame_files_format) PPM
set movieMaker(mode) "realtime"
set movieMaker(togl_timedelay) [lindex [$movieMaker(togl) configure -time] end]
if { $gifAnim(temp_files_dir) == "pwd" } {
set dir $system(PWD)
} else {
set dir $system(SCRDIR)
}
$movieMaker(togl) configure -time $ms
$movieMaker(togl) xc_realtimemovie begin realtime $dir
}
proc movieMaker_everySnapshot {} {
global movieMaker gifAnim system
scripting::makeMovie::begin
set gifAnim(frame_files_format) PPM
set movieMaker(mode) "everysnapshot"
if { $gifAnim(temp_files_dir) == "pwd" } {
set dir $system(PWD)
} else {
set dir $system(SCRDIR)
}
$movieMaker(togl) xc_realtimemovie begin everysnapshot $dir
}
proc movieMaker_mode_ {args} {
global movieMaker gifAnim
switch -glob -- $movieMaker(mode) {
everysnap* {
xcDisableAll $movieMaker(fps_entryframe) $movieMaker(snapshot_button) $gifAnim(radio_frame,3)
movieMaker_destroy_manualWidgets_
set gifAnim(frame_files_format) PPM
}
realtime* {
xcDisableAll $movieMaker(snapshot_button) $gifAnim(radio_frame,3)
xcEnableAll $movieMaker(fps_entryframe)
movieMaker_destroy_manualWidgets_
set gifAnim(frame_files_format) PPM
}
manual {
xcDisableAll $movieMaker(fps_entryframe)
xcEnableAll $gifAnim(radio_frame,3)
_mencoder_temporary_files
if { $movieMaker(recording) } {
xcEnableAll $movieMaker(snapshot_button)
if { ! [winfo exists $movieMaker(togl).snap] } {
button $movieMaker(togl).snap -image snapshot -command movieMaker_frame
pack $movieMaker(togl).snap -side left -expand 0 -fill none -padx 0 -pady 0 -ipadx 0 -ipady 0 -anchor nw
}
if { ! [winfo exists $movieMaker(buttonframe).frame] } {
pack [label $movieMaker(buttonframe).frame -textvariable movieMaker(count)] -side right -padx 2
pack [label $movieMaker(buttonframe).label -text "No. of recorded frames: "] -side right -padx 2
}
} else {
xcDisableAll $movieMaker(snapshot_button)
movieMaker_destroy_manualWidgets_
}
}
}
}
proc movieMaker_destroy_manualWidgets_ {} {
global movieMaker
if { [winfo exists $movieMaker(togl).snap] } {
destroy $movieMaker(togl).snap
}
if { [winfo exists $movieMaker(buttonframe).frame] } {
destroy $movieMaker(buttonframe).label $movieMaker(buttonframe).frame
}
}
proc movieMaker_recording_ {} {
global movieMaker
if { ! $movieMaker(recording) } {
# start recording
set movieMaker(recording) 1
set movieMaker(recording_text) "Stop recording"
$movieMaker(startstop_button) config -background \#ff4444
xcDisableAll $movieMaker(mode_frame)
movieMaker_mode_
switch -glob -- $movieMaker(mode) {
everysnap* {
movieMaker_everySnapshot
}
realtime* {
set ms [expr round(1.0 / $movieMaker(fps) * 1000)]
puts stderr "fps = $movieMaker(fps) ; ms = $ms"
movieMaker_realTimeCapture $ms
}
manual {
movieMaker_manual
}
}
} else {
# stop recording
movieMaker_end
set movieMaker(recording) 0
set movieMaker(recording_text) "Start recording"
$movieMaker(startstop_button) config -background $movieMaker(startstop_button_bg)
xcEnableAll $movieMaker(mode_frame)
movieMaker_mode_
}
}
proc movieMaker_clear {} {
global movieMaker movie
set movieMaker(count) 0
set movieMaker(recording) 0
if { [info exists ::scripting::makeMovie::movie(notificationMovie)] } {
if { [winfo exists $::scripting::makeMovie::movie(notificationMovie)] } {
destroy $::scripting::makeMovie::movie(notificationMovie)
}
}
$movieMaker(togl) xc_realtimemovie clear
movieMaker_destroy_manualWidgets_
}
proc movieMaker_close {t} {
movieMaker_clear
set movieMaker(tplw) {}
destroy $t
xcUpdateState
}
|