Overview
Comment:Improved scrollbar, radio buttons; plot with lines.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: ebf3a17763574c4ee1289844d78293d46fa3556532024ca0a4428031bf82e778
User & Date: geraint@users.sourceforge.net on 2001-10-11 00:22:52.000
Other Links: branch diff | manifest | tags
Context
2001-10-11
03:15:55
Fixed make dependencies for c++ simulation code
- re-simulation no longer required for different output format.
check-in: b565a8e71c user: geraint@users.sourceforge.net tags: origin/master, trunk
00:22:52
Improved scrollbar, radio buttons; plot with lines. check-in: ebf3a17763 user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-10-10
05:57:22
TK viewer for simulation output (requires wish8.3).
- invoked with mtt sys gnuplot view.
check-in: e56822f1ba user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes
︙︙
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
Ny=`mtt_getsize ${sys} y`


## write header
cat <<EOF > ${out}
#!/bin/sh
# Next line replaces shell with wish\\
exec wish "${out}" "$@"

## main window
wm title . "MTT Viewer: ${sys}"

button .print -text "Print" -command print
button .quit  -text "Quit"  -command exit

## states canvas
canvas		.cx
listbox		.cx.l
scrollbar	.cx.s
label		.cx.t	-text		"States"

## outputs canvas
canvas		.cy
listbox		.cy.l
scrollbar	.cy.s
label		.cy.t	-text		"Outputs"

## configure scrollbars
.cx.s configure -command ".cx.l yview"
.cy.s configure -command ".cy.l yview"
.cx configure -yscrollcommand ".cx.s set" -scrollregion "0 0 20 ${Nx}"
.cy configure -yscrollcommand ".cy.s set" -scrollregion "0 0 20 ${Ny}"

## bind lists
bind .cx.l <<ListboxSelect>> { plot [ .cx.l get anchor ] }
bind .cy.l <<ListboxSelect>> { plot [ .cy.l get anchor ] }

EOF








|










|





|



|
|
|
|







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
Ny=`mtt_getsize ${sys} y`


## write header
cat <<EOF > ${out}
#!/bin/sh
# Next line replaces shell with wish\\
exec wish "\$0" "\$@"

## main window
wm title . "MTT Viewer: ${sys}"

button .print -text "Print" -command print
button .quit  -text "Quit"  -command exit

## states canvas
canvas		.cx
listbox		.cx.l
scrollbar	.cx.sy	-orient v
label		.cx.t	-text		"States"

## outputs canvas
canvas		.cy
listbox		.cy.l
scrollbar	.cy.sy	-orient v
label		.cy.t	-text		"Outputs"

## configure scrollbars
.cx.sy configure -command ".cx.l yview"
.cy.sy configure -command ".cy.l yview"
.cx.l configure -yscrollcommand ".cx.sy set"
.cy.l configure -yscrollcommand ".cy.sy set"

## bind lists
bind .cx.l <<ListboxSelect>> { plot [ .cx.l get anchor ] }
bind .cy.l <<ListboxSelect>> { plot [ .cy.l get anchor ] }

EOF

︙︙
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
}' ${struc} >> ${out}

cat <<EOF >> ${out}

pack .cx.t -expand false -fill x -side top
pack .cy.t -expand false -fill x -side top




pack .cx.l -expand true -fill both -side left
pack .cy.l -expand true -fill both -side left

pack .cx.s -expand false -fill y -side right
pack .cy.s -expand false -fill y -side right

pack .cx -expand true -fill both

#pack .cy -expand true -fill both
radiobutton .states  -text "States"  -textvariable showx -command { .outputs deselect ; raise .cx }
radiobutton .outputs -text "Outputs" -textvariable showy -command { .states  deselect ; raise .cy }
place .cy -in .cx -relx 0 -rely 0 -relwidth 1 -relheight 1 -anchor nw -bordermode outside


pack .quit  -expand false -fill x -side right
pack .print -expand false -fill x -side right
pack .states .outputs -side right


## map names to column numbers
EOF

awk '
BEGIN {







>
>
>



<
<
<

>
|
|
|
|
>



<







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
}' ${struc} >> ${out}

cat <<EOF >> ${out}

pack .cx.t -expand false -fill x -side top
pack .cy.t -expand false -fill x -side top

pack .cx.sy -expand false -fill y -side right
pack .cy.sy -expand false -fill y -side right

pack .cx.l -expand true -fill both -side left
pack .cy.l -expand true -fill both -side left




pack .cx -expand true -fill both
place .cy -in .cx -relx 0 -rely 0 -relwidth 1 -relheight 1 -anchor nw -bordermode outside

radiobutton .states  -text "States"  -value states  -variable view -command { raise .cx } -relief solid
radiobutton .outputs -text "Outputs" -value outputs -variable view -command { raise .cy } -relief solid

pack .states .outputs -side left

pack .quit  -expand false -fill x -side right
pack .print -expand false -fill x -side right



## map names to column numbers
EOF

awk '
BEGIN {
︙︙
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
' Title=\$title Ny=${Ny} ${struc} >> ${out}


cat <<EOF >> ${out}

## call gnuplot
proc "plot_var" "title column" {
    exec echo plot \"${dat2}\" using 1:\$column title \"\$title\" > ${tmp}
    exec echo pause -1 >> ${tmp}
    exec gnuplot -title "\$title" ${tmp} &
}

## print output
proc "print" "" {
    exec echo set term postscript > ${tmp}.print







|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
' Title=\$title Ny=${Ny} ${struc} >> ${out}


cat <<EOF >> ${out}

## call gnuplot
proc "plot_var" "title column" {
    exec echo plot \\\"${dat2}\\\" using 1:\$column title \\\"\$title\\\" with lines > ${tmp}
    exec echo pause -1 >> ${tmp}
    exec gnuplot -title "\$title" ${tmp} &
}

## print output
proc "print" "" {
    exec echo set term postscript > ${tmp}.print
︙︙

MTT: Model Transformation Tools
[ GitHub | SourceHut | Sourceforge | Fossil RSS ]