|
1 |
|
2 set zoneWindow .zoning_window |
|
3 set HorizMerge 70 |
|
4 set VertMerge 70 |
|
5 |
|
6 set region_list [list] |
|
7 set ordered_region_list [list] |
|
8 |
|
9 set prev_reg_id 0 |
|
10 set region_data(0,x_final) 0 |
|
11 set region_data(0,y_final) 0 |
|
12 set region_data(0,x_init) -40 |
|
13 set region_data(0,y_init) -20 |
|
14 |
|
15 set cur_xoffset 0 |
|
16 set cur_yoffset 0 |
|
17 |
|
18 |
|
19 proc multiZone_open { filename } { |
|
20 global HorizMerge VertMerge cur_xoffset curyoffset |
|
21 |
|
22 set cur_xoffset 0 |
|
23 set cur_yoffset 0 |
|
24 # 1 means success |
|
25 global IMAGE_DISPLAY_WIN ZONING_SCALE_FACTOR DISPLAY_IMAGE XV xvprocess \ |
|
26 multiZone_display_open zoneWindow |
|
27 |
|
28 set open 1 |
|
29 |
|
30 if { $multiZone_display_open == $open } { |
|
31 focus .zoning_window |
|
32 } else { |
|
33 |
|
34 toplevel .zoning_window |
|
35 init_zoning_display |
|
36 } |
|
37 |
|
38 |
|
39 # puts stdout "Opening $filename" |
|
40 zoned_page_open $filename |
|
41 # Scale image to display |
|
42 init_ZONING_SCALE_FACTOR |
|
43 |
|
44 |
|
45 # puts stdout "Done putting into page structure" |
|
46 if { 1 } { |
|
47 set display_height [expr $ZONING_SCALE_FACTOR * [get_page_height]] |
|
48 set display_width [expr $ZONING_SCALE_FACTOR * [get_page_width]] |
|
49 wm geometry .zoning_window [expr int($display_width) +20]x[expr int($display_height) + 150]+300+100 |
|
50 |
|
51 |
|
52 if { $DISPLAY_IMAGE == $XV } { |
|
53 set xvprocess [exec xv $filename &] |
|
54 puts stdout "xvprocess $xvprocess" |
|
55 } else { |
|
56 # use the canvas... |
|
57 DESKEW |
|
58 zone_message "Displaying Image" |
|
59 DISPLAY_INTERVALS .zoning_window.work_space $ZONING_SCALE_FACTOR |
|
60 zone_message "Determining Line boundaries" |
|
61 FIND_LINES |
|
62 zone_message " " |
|
63 } |
|
64 } else { |
|
65 popup_image_failure_win |
|
66 } |
|
67 |
|
68 |
|
69 } |
|
70 |
|
71 proc init_ZONING_SCALE_FACTOR { } { |
|
72 global ZONING_SCALE_FACTOR |
|
73 |
|
74 set ZONING_SCALE_FACTOR [expr 800.0/[get_page_height]] |
|
75 set temp [expr 800.0/[get_page_width]] |
|
76 puts $ZONING_SCALE_FACTOR |
|
77 puts $temp |
|
78 if {[expr $temp] < [expr $ZONING_SCALE_FACTOR] } { |
|
79 set ZONING_SCALE_FACTOR $temp |
|
80 } |
|
81 if { $ZONING_SCALE_FACTOR > 1} { |
|
82 set ZONING_SCALE_FACTOR 1 |
|
83 } |
|
84 |
|
85 } |
|
86 |
|
87 |
|
88 proc init_zoning_display { } { |
|
89 global ZONING_SCALE_FACTOR BACKGROUND FOREGROUND scroll_inc zoneWindow |
|
90 global menu_bar_height button_bar_height SMALLFONT FONT |
|
91 |
|
92 wm geometry $zoneWindow 600x900+300+100 |
|
93 wm title $zoneWindow "CalZoning" |
|
94 wm positionfrom $zoneWindow user |
|
95 wm minsize $zoneWindow 500 300 |
|
96 $zoneWindow configure -background $BACKGROUND |
|
97 |
|
98 |
|
99 set canvas_width 1000 |
|
100 set canvas_height 1000 |
|
101 |
|
102 canvas $zoneWindow.work_space -bg white -xscrollcommand \ |
|
103 "$zoneWindow.xscroller set" -yscrollcommand \ |
|
104 "$zoneWindow.yscroller set" -xscrollincrement \ |
|
105 $scroll_inc -cursor {crosshair black gray} \ |
|
106 -width $canvas_width -height $canvas_height |
|
107 # two scrollbars |
|
108 scrollbar $zoneWindow.xscroller -command "$zoneWindow.work_space xview" -orient horizontal -background $BACKGROUND |
|
109 scrollbar $zoneWindow.yscroller -command "$zoneWindow.work_space yview" -background $BACKGROUND |
|
110 |
|
111 frame $zoneWindow.menu_bar -height $menu_bar_height -relief raised -bd 2 -background $BACKGROUND |
|
112 init_zoning_menu_bar |
|
113 |
|
114 frame $zoneWindow.message_bar -height $button_bar_height \ |
|
115 -background $BACKGROUND -relief raised -bd 2 |
|
116 message $zoneWindow.message_bar.m -background \ |
|
117 $BACKGROUND -foreground $FOREGROUND -font $SMALLFONT \ |
|
118 -justify center |
|
119 |
|
120 pack $zoneWindow.menu_bar -side top -fill x |
|
121 pack $zoneWindow.message_bar -side top -fill x |
|
122 pack $zoneWindow.message_bar.m -fill x -fill y |
|
123 |
|
124 pack $zoneWindow.xscroller -side bottom -fill x |
|
125 |
|
126 pack $zoneWindow.yscroller -side right -fill y |
|
127 pack $zoneWindow.work_space -side top -fill x -fill y |
|
128 $zoneWindow.work_space configure -scrollregion { 0 0 5000 5000 } |
|
129 bind $zoneWindow.work_space <Double-3> { |
|
130 set curx [.main_window.display.work_space canvasx %x] |
|
131 set cury [.main_window.display.work_space canvasy %y] |
|
132 set_active_zone $curx $cury |
|
133 } |
|
134 |
|
135 initialize_region_grab |
|
136 |
|
137 } |
|
138 |
|
139 |
|
140 proc max { a b } { |
|
141 if { [expr $a] > [expr $b] } { |
|
142 return $a |
|
143 } else { |
|
144 return $b |
|
145 } |
|
146 } |
|
147 |
|
148 proc init_zoning_menu_bar { } { |
|
149 |
|
150 # this command initializes the zoning menu bar |
|
151 |
|
152 global BACKGROUND FOREGROUND FONT zoneWindow |
|
153 |
|
154 #Zoning |
|
155 menubutton $zoneWindow.menu_bar.zoning -text "Zoning"\ |
|
156 -menu $zoneWindow.menu_bar.zoning.menu -borderwidth\ |
|
157 2 -background $BACKGROUND -foreground $FOREGROUND -font $FONT |
|
158 menu $zoneWindow.menu_bar.zoning.menu -background $BACKGROUND \ |
|
159 -foreground $FOREGROUND -font $FONT |
|
160 $zoneWindow.menu_bar.zoning.menu add command -label "AutoZone..." \ |
|
161 -command popup_autozone_menu |
|
162 $zoneWindow.menu_bar.zoning.menu add command -label "Destroy Zones" \ |
|
163 -command destroy_all_regions |
|
164 |
|
165 |
|
166 button $zoneWindow.menu_bar.scale -text "Scale Factor" \ |
|
167 -borderwidth 2 -background $BACKGROUND -foreground $FOREGROUND \ |
|
168 -relief flat \ |
|
169 -font $FONT -command popup_scale_menu |
|
170 |
|
171 # button $zoneWindow.menu_bar.recognize -text "Recognize All" \ |
|
172 # -borderwidth 2 -background $BACKGROUND -foreground $FOREGROUND \ |
|
173 # -relief flat \ |
|
174 # -font $FONT -command {puts "Recognize All"} |
|
175 |
|
176 button $zoneWindow.menu_bar.help -text "Help" -borderwidth 2 -background $BACKGROUND -foreground $FOREGROUND -font $FONT -relief flat \ |
|
177 -command { init_zoning_help .main_window.menu_bar.help } |
|
178 |
|
179 button $zoneWindow.menu_bar.close -text "Close" \ |
|
180 -borderwidth 2 -background $BACKGROUND -foreground $FOREGROUND \ |
|
181 -relief flat \ |
|
182 -font $FONT -command close_zoned_document |
|
183 |
|
184 pack $zoneWindow.menu_bar.zoning $zoneWindow.menu_bar.scale \ |
|
185 $zoneWindow.menu_bar.close -side left -padx 1m -pady 1m |
|
186 pack $zoneWindow.menu_bar.help -side right -padx 1m -pady 1m |
|
187 |
|
188 } |
|
189 |
|
190 |
|
191 |
|
192 proc popup_scale_menu { } { |
|
193 # a little box for the user to change the horizontal and vertial merging |
|
194 # parameters and initiate automatic zoning |
|
195 |
|
196 global BACKGROUND FOREGROUND SMALLFONT FONT ZONING_SCALE_FACTOR SELECT |
|
197 if { [winfo exists .scale] } { |
|
198 focus .scale |
|
199 return |
|
200 } |
|
201 |
|
202 toplevel .scale -background $BACKGROUND |
|
203 wm geometry .scale 200x100+350+150 |
|
204 message .scale.m -text "Scale Factor\n" -background \ |
|
205 $BACKGROUND -foreground $FOREGROUND -font $SMALLFONT \ |
|
206 -justify center -width 200 |
|
207 |
|
208 set gm .scale |
|
209 set var ZONING_SCALE_FACTOR |
|
210 set varWindow [string tolower $var] |
|
211 frame $gm.$varWindow |
|
212 label $gm.$varWindow.l -text "Scale Factor" -width 13 -fg $FOREGROUND -background $BACKGROUND -font $FONT -justify left |
|
213 entry $gm.$varWindow.set -width 4 -relief sunken -textvariable $var -fg $FOREGROUND -background $BACKGROUND -font $FONT -selectbackground $SELECT |
|
214 $gm.$varWindow.set icursor 0 |
|
215 $gm.$varWindow.set select range 0 10 |
|
216 bind $gm.$varWindow.set <Return> scale_zoned_page |
|
217 pack $gm.$varWindow.l -side left |
|
218 pack $gm.$varWindow.set -side right |
|
219 pack $gm.$varWindow -side top |
|
220 |
|
221 frame .scale.buttons |
|
222 button .scale.buttons.ok -text OK -command scale_zoned_page -fg $FOREGROUND -background $BACKGROUND -font $SMALLFONT -width 5 |
|
223 button .scale.buttons.cancel -text Cancel -command {destroy .scale}\ |
|
224 -fg $FOREGROUND -background $BACKGROUND -font $SMALLFONT -width 5 |
|
225 pack .scale.buttons.ok .scale.buttons.cancel -side left -expand 1 \ |
|
226 -fill x |
|
227 |
|
228 pack .scale.buttons\ |
|
229 -side top -fill x |
|
230 |
|
231 |
|
232 focus $gm.$varWindow.set |
|
233 |
|
234 } |
|
235 |
|
236 |
|
237 |
|
238 proc popup_autozone_menu { } { |
|
239 # a little box for the user to change the horizontal and vertial merging |
|
240 # parameters and initiate automatic zoning |
|
241 |
|
242 global BACKGROUND FOREGROUND SMALLFONT FONT HorizMerge VertMerge |
|
243 if { [winfo exists .autozone] } { |
|
244 focus .autozone |
|
245 return |
|
246 } |
|
247 |
|
248 toplevel .autozone -background $BACKGROUND |
|
249 wm geometry .autozone 250x225+300+150 |
|
250 message .autozone.m -text "Merging Parameters\n" -background \ |
|
251 $BACKGROUND -foreground $FOREGROUND -font $SMALLFONT \ |
|
252 -justify center -width 250 |
|
253 scale .autozone.hmerge -from 0 -to 255 -variable HorizMerge \ |
|
254 -orient horizontal -label "Horizontal Merge" \ |
|
255 -background $BACKGROUND -foreground $FOREGROUND -font $SMALLFONT |
|
256 scale .autozone.vmerge -from 0 -to 255 -variable VertMerge \ |
|
257 -orient horizontal -label "Vertical Merge" -background \ |
|
258 $BACKGROUND -foreground $FOREGROUND -font $SMALLFONT |
|
259 |
|
260 |
|
261 frame .autozone.buttons |
|
262 button .autozone.buttons.ok -text OK -command autozone -fg $FOREGROUND -background $BACKGROUND -font $SMALLFONT -width 5 |
|
263 button .autozone.buttons.cancel -text Cancel -command {destroy .autozone}\ |
|
264 -fg $FOREGROUND -background $BACKGROUND -font $SMALLFONT -width 5 |
|
265 pack .autozone.buttons.ok .autozone.buttons.cancel -side left -expand 1 \ |
|
266 -fill x |
|
267 |
|
268 pack .autozone.m .autozone.hmerge .autozone.vmerge .autozone.buttons \ |
|
269 -side top -fill x |
|
270 } |
|
271 |
|
272 |
|
273 proc autozone { } { |
|
274 global HorizMerge VertMerge zoneWindow |
|
275 |
|
276 zone_message "Zoning Document" |
|
277 destroy_all_regions |
|
278 AUTO_ZONE $HorizMerge $VertMerge |
|
279 destroy .autozone |
|
280 } |
|
281 |
|
282 proc zone_message { msg } { |
|
283 global zoneWindow |
|
284 $zoneWindow.message_bar.m configure -text $msg \ |
|
285 -width 500 -justify center |
|
286 } |
|
287 |
|
288 set x_init 0 |
|
289 set y_init 0 |
|
290 set x_final 0 |
|
291 set y_final 0 |
|
292 |
|
293 set prev_region_id 0 |
|
294 |
|
295 |
|
296 set started_region 0 |
|
297 set region_count 0 |
|
298 |
|
299 proc initialize_region_grab { } { |
|
300 global window |
|
301 # |
|
302 # |
|
303 # facilitates the grabbing of a rectangle of the window |
|
304 # using mouse button 1 |
|
305 # canvas subwindow must be called $zoneWindow.work_space |
|
306 |
|
307 |
|
308 global x_init y_init x_final y_final started_region region_data region_list region_id arrow_in_progress current_arrow zoneWindow |
|
309 |
|
310 |
|
311 |
|
312 bind $zoneWindow.work_space <ButtonPress-1> { |
|
313 if [expr ! $started_region] { |
|
314 puts stdout "window: $zoneWindow \n" |
|
315 grab set $zoneWindow |
|
316 set x_init [$zoneWindow.work_space canvasx %x] |
|
317 set y_init [$zoneWindow.work_space canvasy %y] |
|
318 start_region $x_init $y_init |
|
319 |
|
320 } |
|
321 } |
|
322 |
|
323 bind $zoneWindow.work_space <ButtonRelease-1> { |
|
324 set x_final [$zoneWindow.work_space canvasx %x] |
|
325 set y_final [$zoneWindow.work_space canvasy %y] |
|
326 end_region $x_final $y_final |
|
327 ADD_ZONE $x_init $y_init $x_final $y_final |
|
328 |
|
329 } |
|
330 |
|
331 bind $zoneWindow.work_space <B2-Motion> { |
|
332 if $arrow_in_progress { |
|
333 set curx [$zoneWindow.work_space canvasx %x] |
|
334 set cury [$zoneWindow.work_space canvasy %y] |
|
335 $zoneWindow.work_space coords $current_arrow 0 0 $curx $cury |
|
336 } |
|
337 } |
|
338 bind $zoneWindow.work_space <B1-Motion> { |
|
339 if $started_region { |
|
340 |
|
341 set curx [$zoneWindow.work_space canvasx %x] |
|
342 set cury [$zoneWindow.work_space canvasy %y] |
|
343 |
|
344 $zoneWindow.work_space coords region$region_id $x_init $y_init $curx $cury |
|
345 |
|
346 |
|
347 } |
|
348 } |
|
349 bind $zoneWindow <Enter> { |
|
350 SWITCH_TO_ZONED_PAGE |
|
351 } |
|
352 |
|
353 bind $zoneWindow <Leave> { |
|
354 # on leaving the display, release control of the mouse etc. |
|
355 # maybe make it scroll instead? |
|
356 if $started_region { |
|
357 grab release $zoneWindow |
|
358 set started_region 0 |
|
359 $zoneWindow.work_space coords region$region_id 0 0 0 0 |
|
360 } |
|
361 } |
|
362 } |
|
363 |
|
364 |
|
365 set arrow_in_progress 0 |
|
366 |
|
367 proc make_region_buttons { reg_id } { |
|
368 global region_data kill_button_data next_button_data arrow_in_progress current_arrow zoneWindow |
|
369 |
|
370 set x_init $region_data($reg_id,x_init) |
|
371 set y_init $region_data($reg_id,y_init) |
|
372 |
|
373 set next_num [$zoneWindow.work_space create rectangle $x_init $y_init [expr $x_init + 40] [expr $y_init + 20] -fill blue -tags "region$reg_id next_button$reg_id"] |
|
374 |
|
375 set next_button_data($next_num,reg_id) $reg_id |
|
376 $zoneWindow.work_space bind next_button$reg_id <Double-2> { |
|
377 set reg_id $next_button_data([$zoneWindow.work_space find withtag current],reg_id) |
|
378 if { $arrow_in_progress } { |
|
379 set canvas_x [$zoneWindow.work_space canvasx %x] |
|
380 set canvas_y [$zoneWindow.work_space canvasy %y] |
|
381 finish_arrow $reg_id $canvas_x $canvas_y |
|
382 } else { |
|
383 set canvas_x [$zoneWindow.work_space canvasx %x] |
|
384 set canvas_y [$zoneWindow.work_space canvasy %y] |
|
385 |
|
386 start_arrow $reg_id $canvas_x $canvas_y |
|
387 puts stdout "Starting an arrow at $canvas_x $canvas_y" |
|
388 } |
|
389 } |
|
390 set kill_num [$zoneWindow.work_space create rectangle [expr $x_init] $y_init [expr $x_init + 20] [expr $y_init + 20] -fill red -tags "region$reg_id kill_button$reg_id"] |
|
391 set kill_button_data($kill_num,reg_id) $reg_id |
|
392 |
|
393 $zoneWindow.work_space bind kill_button$reg_id <Double-2> { |
|
394 set reg_id $kill_button_data([$zoneWindow.work_space find withtag current],reg_id) |
|
395 destroy_region $reg_id $zoneWindow.work_space |
|
396 |
|
397 } |
|
398 } |
|
399 |
|
400 proc start_region { x y} { |
|
401 global x_init y_init x_final y_final started_region region_data region_list region_id arrow_in_progress current_arrow zoneWindow region_list |
|
402 |
|
403 set x_init $x |
|
404 set y_init $y |
|
405 |
|
406 set region_id [$zoneWindow.work_space create rectangle $x_init $y_init $x_init $y_init -outline black -width 3 ] |
|
407 $zoneWindow.work_space itemconfigure $region_id -tags region$region_id |
|
408 |
|
409 lappend region_list $region_id |
|
410 set started_region 1 |
|
411 |
|
412 } |
|
413 |
|
414 |
|
415 proc end_region { x y } { |
|
416 global x_init y_init x_final y_final started_region region_data region_list region_id arrow_in_progress current_arrow zoneWindow |
|
417 |
|
418 set x_final $x |
|
419 set y_final $y |
|
420 |
|
421 $zoneWindow.work_space coords region$region_id $x_init $y_init $x $y |
|
422 |
|
423 |
|
424 # if finishing a rectangle, initialize its stuff in the array |
|
425 if {$x_init <= $x_final} { |
|
426 set region_data($region_id,x_init) $x_init |
|
427 set region_data($region_id,x_final) $x_final |
|
428 } else { |
|
429 set region_data($region_id,x_final) $x_init |
|
430 set region_data($region_id,x_init) $x_final |
|
431 } |
|
432 if {$y_init <= $y_final} { |
|
433 set region_data($region_id,y_init) $y_init |
|
434 set region_data($region_id,y_final) $y_final |
|
435 } else { |
|
436 set region_data($region_id,y_init) $y_final |
|
437 set region_data($region_id,y_final) $y_init |
|
438 } |
|
439 |
|
440 set region_data($region_id,next_region_id) 0 |
|
441 lappend region_list $region_id |
|
442 |
|
443 make_region_buttons $region_id |
|
444 |
|
445 set started_region 0 |
|
446 grab release $zoneWindow |
|
447 } |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 proc start_arrow { reg_id x_start y_start } { |
|
453 global arrow_in_progress next_button_data region_data current_arrow \ |
|
454 zoneWindow prev_reg_id ordered_region_list |
|
455 |
|
456 |
|
457 set path_name $zoneWindow.work_space |
|
458 # start an arrow in the middle of the little red button |
|
459 |
|
460 |
|
461 |
|
462 set arrow [$zoneWindow.work_space create line \ |
|
463 [expr $region_data($prev_reg_id,x_init) + 40] \ |
|
464 [expr $region_data($prev_reg_id,y_init) + 20]\ |
|
465 \ |
|
466 $x_start $y_start -width 3 -arrow last \ |
|
467 -arrowshape {6.0m 8.0m 1.5m} -fill blue -tags arrow$reg_id] |
|
468 # [expr $region_data($prev_reg_id,x_init) + 40] \ |
|
469 # [expr $region_data($prev_reg_id,y_final)]\ |
|
470 |
|
471 set region_data($reg_id,arrow) $arrow |
|
472 #set arrow_in_progress 1 |
|
473 set current_arrow $arrow |
|
474 |
|
475 set prev_reg_id $reg_id |
|
476 lappend ordered_region_list $reg_id |
|
477 } |
|
478 |
|
479 |
|
480 proc finish_arrow { reg_id x_end y_end} { |
|
481 global arrow_in_progress next_button_data region_data current_arrow \ |
|
482 zoneWindow |
|
483 |
|
484 |
|
485 set path_name $zoneWindow.work_space |
|
486 # end an arrow in the middle of the little blue button |
|
487 |
|
488 |
|
489 |
|
490 set arrow [$zoneWindow.work_space create line $last_arrow_x $last_arrow_y $x_end $y_end -width 3 -arrow last -arrowshape {6.0m 8.0m 1.5m} -fill blue -tags arrow$reg_id] |
|
491 |
|
492 set region_data($reg_id,arrow) $arrow |
|
493 set arrow_in_progress 0 |
|
494 set current_arrow $arrow |
|
495 } |
|
496 |
|
497 |
|
498 |
|
499 proc destroy_region { reg_id path_name } { |
|
500 global region_list ordered_region_list region_data prev_reg_id |
|
501 |
|
502 set curx [expr [expr $region_data($reg_id,x_init) \ |
|
503 + $region_data($reg_id,x_final)] /2] |
|
504 set cury [expr [expr $region_data($reg_id,y_init) \ |
|
505 + $region_data($reg_id,y_final)] /2] |
|
506 REMOVE_ZONE $curx $cury |
|
507 |
|
508 $path_name delete region$reg_id |
|
509 set region_list [ldelete $region_list $reg_id] |
|
510 |
|
511 # Now we have to delete all of the ordering |
|
512 foreach reg $ordered_region_list { |
|
513 $path_name delete arrow$reg |
|
514 set ordered_region_list [ldelete $ordered_region_list $reg] |
|
515 } |
|
516 set prev_reg_id 0 |
|
517 } |
|
518 |
|
519 proc destroy_all_regions { } { |
|
520 global region_data region_list zoneWindow prev_reg_id |
|
521 |
|
522 # puts [array get region_list] |
|
523 foreach reg $region_list { |
|
524 destroy_region $reg $zoneWindow.work_space |
|
525 } |
|
526 |
|
527 |
|
528 } |
|
529 |
|
530 proc scale_zoned_page { } { |
|
531 |
|
532 global ZONING_SCALE_FACTOR |
|
533 .zoning_window.work_space delete all |
|
534 set display_height [expr $ZONING_SCALE_FACTOR * [get_page_height]] |
|
535 set display_width [expr $ZONING_SCALE_FACTOR * [get_page_width]] |
|
536 wm geometry .zoning_window [expr int($display_width)]x[expr int($display_height)]+300+100 |
|
537 zone_message "Displaying Image" |
|
538 DISPLAY_INTERVALS .zoning_window.work_space $ZONING_SCALE_FACTOR |
|
539 zone_message "Determining Line boundaries" |
|
540 FIND_LINES |
|
541 zone_message " " |
|
542 destroy .scale |
|
543 } |
|
544 |
|
545 |
|
546 proc set_active_zone { x y } { |
|
547 global ZONING_SCALE_FACTOR SCALE_FACTOR cur_xoffset cur_yoffset |
|
548 |
|
549 |
|
550 SET_ACTIVE_PAGE [expr int( [expr $x / $ZONING_SCALE_FACTOR ] ) ]\ |
|
551 [expr int( [expr $y / $ZONING_SCALE_FACTOR ] ) ] |
|
552 |
|
553 |
|
554 } |
|
555 |
|
556 |
|
557 proc close_zoned_document { } { |
|
558 global zoneWindow cur_xoffset cur_yoffset |
|
559 |
|
560 set cur_xoffset 0 |
|
561 set cur_yoffset 0 |
|
562 .main_window.edit_window.text_part delete 1.0 end |
|
563 .main_window.display.work_space delete all |
|
564 |
|
565 destroy $zoneWindow |
|
566 set COLORED_WORDS {} |
|
567 DEALLOCATE_PAGE |
|
568 |
|
569 } |
|
570 |
|
571 proc init_zoning_help { path } { |
|
572 global FOREGROUND BACKGROUND FONT |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 if { [winfo exists $help] } { |
|
578 focus $help |
|
579 return |
|
580 } |
|
581 |
|
582 set help [toplevel .zoning_help ] |
|
583 wm title $help "CalZoning Help" |
|
584 # wm geometry $help 400x500+600+150 |
|
585 message $help.msg -background white -foreground $FOREGROUND -font $FONT\ |
|
586 -width 600 -text "\n\ |
|
587 Delete a Zone - <Double-2> on red button\n\ |
|
588 Draw arrow to Zone - <Double-2> on blue button\n\ |
|
589 Create a Zone - <Button-1> drag and release\n\ |
|
590 Activate a Zone - <Double-2> within region (not on buttons)\n" |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 pack $help.msg -fill x -fill y -expand true |
|
596 |
|
597 } |
|
598 |
|
599 |
|
600 proc ldelete {list value} { |
|
601 |
|
602 set ix [lsearch -exact $list $value] |
|
603 if { $ix >= 0 } { |
|
604 return [lreplace $list $ix $ix] |
|
605 } else { |
|
606 return $list |
|
607 } |
|
608 } |
|
609 |
|
610 |
|
611 |
|
612 |