File: coverage_size.tcl

package info (click to toggle)
savi 1.5.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,824 kB
  • sloc: ansic: 6,932; tcl: 5,011; makefile: 266; sh: 237
file content (142 lines) | stat: -rw-r--r-- 2,969 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
#
######################################################
#
#  SaVi by Lloyd Wood (lloydwood@users.sourceforge.net),
#          Patrick Worfolk (worfolk@alum.mit.edu) and
#          Robert Thurman.
#
#  Copyright (c) 1997 by The Geometry Center.
#  Also Copyright (c) 2017 by Lloyd Wood.
#
#  This file is part of SaVi.  SaVi is free software;
#  you can redistribute it and/or modify it only under
#  the terms given in the file COPYRIGHT which you should
#  have received along with this file.  SaVi may be
#  obtained from:
#  http://savi.sourceforge.net/
#  http://www.geom.uiuc.edu/locate/SaVi
#
######################################################
#
# coverage_size.tcl
#
# $Id: coverage_size.tcl,v 1.18 2017/01/02 06:11:33 lloydwood Exp $

proc coverage_size(build) {} {
    global NUM_COLORS NUM_COLORS_PREV IM_H

    if {[eval window(raise) coverage_size]} return

    set name [build_Toplevel coverage_size]

    wm protocol $name WM_DELETE_WINDOW coverage_size(dismiss)

    build_Title $name "Choose map settings..."

    if {$NUM_COLORS == 0} {

      if {$NUM_COLORS_PREV == 0} {
        coverage_size(default)
      } else {
	set NUM_COLORS $NUM_COLORS_PREV
      }

      set cmd [build_CmdFrame $name cmd]

      set cmda [build_StdFrame $name cmd]

      build_LabelEntryColumns $cmda colors \
	{ientry "Number of coverage shading levels (1-19)" {NUM_COLORS}}

      bind $cmda.colors.c0.0 <Return> coverage_size(number)
      bind $cmda.colors.c0.0 <Tab> coverage_size(number)

      pack $cmda -expand 1 -fill x

    }

    if {$IM_H == 0} {
      build_Buttonbar $name dbbar \
	{"Large (1024x512)" coverage_size(large)} \
        {"Small (600x300)" coverage_size(small)} \
	{"Cancel" "coverage_size(cancel)"}
    } else {
      build_Buttonbar $name dbbar \
	 {"Set color levels" coverage_size(set)} \
	 {"Cancel" "coverage_size(dismiss)"}
    }

    update
}

proc coverage_size(default) {} {
    global IM_H NUM_COLORS

    if {$IM_H > 400} {
	# We are large map, with room for a large key
	set NUM_COLORS 14
    } else {
        # traditional default value for SaVi
        set NUM_COLORS 4
    }
}

proc coverage_size(number) {} {
    global NUM_COLORS IM_H

    if {($NUM_COLORS < 1) || ($NUM_COLORS > 19)} {
        coverage_size(default)
	return
    }

    if {$IM_H == 0} return

    coverage_size(dismiss)
    coverage(build)
}

proc coverage_size(set) {} {

    coverage_size(number)

    coverage_size(dismiss)
    coverage(build)

}

proc coverage_size(large) {} {
    global IM_W IM_H

    coverage_size(number)

    set IM_W 1024
    set IM_H 512

    coverage_size(dismiss)
    coverage(build)
}

proc coverage_size(small) {} {
    global IM_W IM_H

    coverage_size(number)

    set IM_W 600
    set IM_H 300

    coverage_size(dismiss)
    coverage(build)
}


proc coverage_size(dismiss) {} {

    destroy .coverage_size
}

proc coverage_size(cancel) {} {
    global NUM_COLORS

    set NUM_COLORS 0
    coverage_size(dismiss)
}