[go: up one dir, main page]

File: cecilia-tcl

package info (click to toggle)
cecilia 2.0.5-2.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,440 kB
  • ctags: 833
  • sloc: tcl: 9,786; sh: 1,085; makefile: 69; csh: 13
file content (254 lines) | stat: -rwxr-xr-x 6,370 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/wish
#
# $Id $
#
# Formerly, this file was called 'xcec'
# 	MULTI-PLATFORM STARTUP SEQUENCE
# 	(c) 1997 Alexandre Burton
# 	v1.80a (10/08/97)
#
########################################
#
# on Mac:
# 
#    Cecilia:        Main app (wish stub + TCL stuff)
#    Cecilia.shlb:   custom C code
#    TCL librairies: required to run the stub
#    perf:           Csound engine
#    soundapp:       Soundfile info & playing
#    Cecilia Files:  Resources (graphics, HTML) for Cecilia
#    ISSUES:         Bugs & such stuff
#    README:         General Docs
#
#
### Preparation of Wish



wm withdraw .

if {$tcl_platform(platform) == "macintosh"} { 
	set ceclib [pwd]
	catch {load Example.shlb} error
} {
    if [info exists env(CEC_LIBRARY)] {
	if [file exists [file join $env(CEC_LIBRARY) files]] {
	    puts "Cecilia installation located in $env(CEC_LIBRARY) (environment)"
	    set ceclib $env(CEC_LIBRARY)
	} { puts "

error: environmental variable CEC_LIBRARY is set but dangling!
set it so that it points to your Cecilia installation, or place the
distribution in /usr/local/lib/cecilia or /usr/lib/cecilia.

if you're not in charge of this, contact your sysadmin.

now exiting.

"
	    exit 0
	}
    } {
	foreach lib [list /usr/local/lib/cecilia /usr/lib/cecilia [exec pwd]] {
	    if [file exists  [file join $lib files]] {
		puts "Cecilia installation located in $lib (automatic)"
		set ceclib $lib
		break
	    }
	}
	if ![info exists ceclib] {
	    puts "

error: could not locate your installation of Cecilia. Either set your
CEC_LIBRARY environment variable to point to the directory where the
Cecilia support files were installed, or place them either in
/usr/local/lib/cecilia (recommended) or /usr/lib/cecilia for them 
to be found automatically.

if you're not in charge of this, contact your sysadmin.

now exiting.

"

            exit 0
        }
	} 				 
   
}

if {[winfo fpixels . 1i] > 80} {set dpi highres} {set dpi lowres}

# no zoom icon on main window (for Mac)
if {$tcl_platform(platform) == "macintosh"} { 
	unsupported1 style . documentProc  
}

#hide the console on non-unix
if {$tcl_platform(platform) != "unix"} { 
	console hide
}

###
########################################
### debug stuff

proc bug {args} {
    #puts ":: $args"
}

proc modebug {mode args} {
    .temp.statusL config -text $mode 
    .temp.statusR config -text [join $args]
    update ;#idletasks
}

###
########################################
### splash screen

proc showBulle {w} {
	global _db
	if $w {
		.temp.cecile raise bulle3
		set _db(cancel,bulle) [after 100 ".temp.cecile raise bulle2"]
 		lappend _db(cancel,bulle) [after 200 ".temp.cecile raise bulle"]
 		lappend _db(cancel,bulle) [after 200 ".temp.cecile raise texte"]
	} {
		foreach id $_db(cancel,bulle) [after cancel $id]
		after 300 ".temp.cecile lower bulle"
		after 200 ".temp.cecile lower bulle2"
		after 100 ".temp.cecile lower bulle3"
		after 300 ".temp.cecile lower texte"
	}
	
}



proc center {w} {
	update
	set x [expr ([winfo screenwidth $w] - ([winfo width $w] -1))/2]
	set y [expr ([winfo screenheight $w] - ([winfo height $w] -1))/2]
	wm geometry $w +$x+$y 
	update
}

proc buildSplash {} {
	global tcl_platform ceclib dpi
	
	destroy .temp
	toplevel .temp -bg black
	
	### no decoration on splash screen 
	#(Other ways)
	if {$tcl_platform(platform) != "macintosh"} { 
		wm transient .temp
		wm overrideredirect .temp 1
	}
	
	wm withdraw .temp
	
	#(Mac way)
	if {$tcl_platform(platform) == "macintosh"} { 
		unsupported1 style .temp plainDBox  
	}
	#
	###
	
	set cecile [image create photo -file [file join $ceclib files graphics $dpi splash.gif]]
	
	grid columnconfigure .temp  0 -weight 0
#	pack [label .temp.cecile -bg gray20 -image $cecile] -side top
	
	pack [canvas .temp.cecile -width [image width $cecile] \
	  -bg black -height [image height $cecile]] -fill both -expand t
	.temp.cecile create oval 10 110 110 150 -fill \#f6dc71 -tags bulle
	.temp.cecile create oval 80 149 100 160 -fill \#f6dc71 -tags bulle2
	.temp.cecile create oval 100 158 110 165 -fill \#f6dc71 -tags bulle3
	.temp.cecile create text 60 131 -text "getting the Job\ndone... right!" \
	  -tags texte -justify center -font "helvetica 10 bold"
	.temp.cecile create image 0 0 -anchor nw -image $cecile
	.temp.cecile create oval 108 152 142 180 -outline "" -tags hotspot
	.temp.cecile bind hotspot <Enter> "showBulle 1"
	.temp.cecile bind hotspot <Leave> "showBulle 0"

	pack [label .temp.statusL -bg black -fg orange -font "helvetica 9" -text "" -anchor e] -side left
	pack [label .temp.statusR -bg black -fg orange -font "helvetica 9" -text ""] -side left

	update
	center .temp
	center .temp
	
	wm deiconify .temp
	raise .temp
	update
}

proc showfirst {} {
	return
	global ceclib tcl_platform dpi
	destroy .first
	toplevel .first -bg gray20
	bind .first <Button-1> "destroy .first"

	# no decoration on splash screen (Other ways)
	if {$tcl_platform(platform) != "macintosh"} { 
		wm transient .first
		wm overrideredirect .first 1
	}
	wm withdraw .first

	if {$tcl_platform(platform) == "macintosh"} { 
		unsupported1 style .first plainDBox  
	}

	bug [file join $ceclib files graphics first.gif]
	set cecile [image create photo -file [file join $ceclib graphics $dpi first.gif]]
	
	pack [button .first.cecile -bg gray20 -image $cecile] -padx 0 -pady 0
	
	center .first
	center .first
	
	while {[winfo rooty .first] < [winfo rooty .temp]} {
		wm geometry .temp +[expr [winfo rootx .temp]-0]+[expr [winfo rooty .temp]-8]
		after 10
		update idletasks
	}
	wm deiconify .first
	raise .first
	update
}

###
########################################
### source proc

proc loadSourceFiles {} {
	global env ceclib tcl_platform
    foreach item [lsort [glob -nocomplain -- [file join $ceclib lib *.tcl]]] { 
    	modebug "loading code:" [file tail $item]; source $item
    } 
    foreach item [lsort [glob -nocomplain -- [file join $ceclib lib $tcl_platform(platform) *.tcl]]] { 
    	modebug "loading code:" [file tail $item]; source $item
    } 
}

###
########################################
### MAIN

buildSplash

if {$tcl_platform(platform) != "macintosh"} {
	if ![info exists tcload] {puts "Loading the sources on $tcl_platform(os)!";loadSourceFiles}
	if {[llength $argv] > 0} {
    	set arr $argv
	} else {
    	set arr ""
	}
	doCecilia $arr
} {doCecilia ""}
###
########################################