Overview
Comment:Changed method of switching between states and outputs; listbox list is reconfigured instead of overlapping canvases - reduces cut&paste code.
Other cosmetic changes including menu hotkeys.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 1ed51bc98251230c383135d74ad3a4ca033a75a7226ae80d21e483f77f47758c
User & Date: geraint@users.sourceforge.net on 2002-07-16 18:07:07
Other Links: branch diff | manifest | tags
Context
2002-07-17
19:37:54
Added selection of any variable for X, Y and Z axes.
Added 3D plots.
check-in: b01110f152 user: geraint@users.sourceforge.net tags: origin/master, trunk
2002-07-16
18:07:07
Changed method of switching between states and outputs; listbox list is reconfigured instead of overlapping canvases - reduces cut&paste code.
Other cosmetic changes including menu hotkeys.
check-in: 1ed51bc982 user: geraint@users.sourceforge.net tags: origin/master, trunk
11:36:36
Fixed multiplot when selected before first parameter.
Added "Show Key" option.
Moved gnuplot options to menubar.
check-in: c570809fb2 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/struc2gnuplot_txt2wish from [13b6fd0e28] to [79ab7375ab].

1

2
3
4
5
6
7
8
#! /bin/sh


sys=$1

out=${sys}_gnuplot.wish

struc=${sys}_struc.txt
dat2=${sys}_odes.dat2

>







1
2
3
4
5
6
7
8
9
#! /bin/sh
# -*-tcl-*-

sys=$1

out=${sys}_gnuplot.wish

struc=${sys}_struc.txt
dat2=${sys}_odes.dat2
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
# Next line replaces shell with wish\\
exec wish "\$0" "\$@"

## main window
wm title . "MTT Viewer: ${sys}"
set parameter ""
set windownum 0


# menu bar
canvas .menubar

menubutton .menubar.file -text "File" -menu .menubar.file.menu
menu .menubar.file.menu
.menubar.file.menu add command -label "Open  (Gnuplot plot file)"    -command open_plotfile
.menubar.file.menu add command -label "Save  (Gnuplot plot file)"    -command save_plotfile
.menubar.file.menu add separator
.menubar.file.menu add command -label "Print (PostScript file)"	     -command print_postscript
.menubar.file.menu add separator
.menubar.file.menu add command -label "Quit"			     -command exit

menubutton .menubar.edit -text "Edit" -menu .menubar.edit.menu
menu .menubar.edit.menu
.menubar.edit.menu add cascade -label "Axes" -menu .menubar.edit.menu.axes
.menubar.edit.menu add cascade -label "Grid" -menu .menubar.edit.menu.grid
.menubar.edit.menu add cascade -label "Key"  -menu .menubar.edit.menu.key

menu .menubar.edit.menu.axes
.menubar.edit.menu.axes add command -label "Cartesian" -command { puts "set nopolar ; replot" }
.menubar.edit.menu.axes add command -label "Polar"     -command { puts "set   polar ; replot" }

menu .menubar.edit.menu.grid
.menubar.edit.menu.grid add command -label "Show Grid" -command { puts "set   grid ; replot" }
.menubar.edit.menu.grid add command -label "Hide Grid" -command { puts "set nogrid ; replot" }

menu .menubar.edit.menu.key
.menubar.edit.menu.key add command -label "Show Key"   -command { puts "set   key ; replot" }
.menubar.edit.menu.key add command -label "Hide Key"   -command { puts "set nokey ; replot" }


















button .menubar.xmtt  -text "xMTT" -relief flat		 -command { exec xmtt }
button .menubar.quit  -text "Quit" -relief flat		 -command exit 

pack .menubar.file    -expand false -fill x -side left
pack .menubar.edit    -expand false -fill x -side left
pack .menubar.xmtt    -expand false -fill x -side left
pack .menubar.quit    -expand false -fill x -side right

# status bar
canvas .statusbar

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

tk_optionMenu .statusbar.plot  plottype "Single Plot" "Multi Plot" "New Window"





pack .statusbar.states  -expand false -fill x -side left
pack .statusbar.outputs -expand false -fill x -side left
pack .statusbar.plot    -expand false -fill x -side right

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

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

## 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>> { set parameter [ .cx.l get anchor ] ; plot \$parameter }
bind .cy.l <<ListboxSelect>> { set parameter [ .cy.l get anchor ] ; plot \$parameter }

proc "reverse_name" "name" {
    set delim "_"
    set split_name [split \$name \$delim]
    set reversed_name [lindex \$split_name 0]
    for {set i 1} {\$i<[llength \$split_name]} {incr i} {
        set reversed_name [lindex \$split_name \$i]\$delim\$reversed_name







>




|

|
|

|

|

|

|
|
|


|
|


|
|


|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

<
|



|





|
|


>
>
>
>




|
<
<
<
<
<

|
|
|
|
<


|
<
|
<


|
<







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
# Next line replaces shell with wish\\
exec wish "\$0" "\$@"

## main window
wm title . "MTT Viewer: ${sys}"
set parameter ""
set windownum 0
set view outputs

# menu bar
canvas .menubar

menubutton .menubar.file -text "File" -underline 0 -menu .menubar.file.menu
menu .menubar.file.menu
.menubar.file.menu add command -label "Open  (Gnuplot plot file)" -underline 0   -command open_plotfile
.menubar.file.menu add command -label "Save  (Gnuplot plot file)" -underline 0   -command save_plotfile
.menubar.file.menu add separator
.menubar.file.menu add command -label "Print (PostScript file)"   -underline 0   -command print_postscript
.menubar.file.menu add separator
.menubar.file.menu add command -label "Quit"			  -underline 0   -command exit

menubutton .menubar.edit -text "Edit" -underline 0 -menu .menubar.edit.menu
menu .menubar.edit.menu
.menubar.edit.menu add cascade -label "Axes" -underline 0 -menu .menubar.edit.menu.axes
.menubar.edit.menu add cascade -label "Grid" -underline 0 -menu .menubar.edit.menu.grid
.menubar.edit.menu add cascade -label "Key"  -underline 0 -menu .menubar.edit.menu.key

menu .menubar.edit.menu.axes
.menubar.edit.menu.axes add command -label "Cartesian" -underline 0 -command { puts "set nopolar ; replot" }
.menubar.edit.menu.axes add command -label "Polar"     -underline 0 -command { puts "set   polar ; replot" }

menu .menubar.edit.menu.grid
.menubar.edit.menu.grid add command -label "Show Grid" -underline 0 -command { puts "set   grid  ; replot" }
.menubar.edit.menu.grid add command -label "Hide Grid" -underline 0 -command { puts "set nogrid  ; replot" }

menu .menubar.edit.menu.key
.menubar.edit.menu.key add command -label "Show Key"   -underline 0 -command { puts "set   key   ; replot" }
.menubar.edit.menu.key add command -label "Hide Key"   -underline 0 -command { puts "set nokey   ; replot" }

menubutton .menubar.tool -text "Tools" -underline 0 -menu .menubar.tool.menu
menu .menubar.tool.menu
.menubar.tool.menu add cascade -label "Sort List" -underline 0 -menu .menubar.tool.menu.sort
.menubar.tool.menu add command -label "X-MTT"     -underline 0 -command { exec xmtt & }

menu .menubar.tool.menu.sort
.menubar.tool.menu.sort add command -label "Left to Right" -underline 0 -command {
    set sortorder "normal"
    set xl [sort_list \$xl \$sortorder ]
    set yl [sort_list \$yl \$sortorder ]
}
.menubar.tool.menu.sort add command -label "Right to Left" -underline 0 -command {
    set sortorder "reverse"
    set xl [sort_list \$xl \$sortorder]
    set yl [sort_list \$yl \$sortorder]
}


button .menubar.quit  -text "Quit" -relief flat -command exit 

pack .menubar.file    -expand false -fill x -side left
pack .menubar.edit    -expand false -fill x -side left
pack .menubar.tool    -expand false -fill x -side left
pack .menubar.quit    -expand false -fill x -side right

# status bar
canvas .statusbar

radiobutton .statusbar.states  -text "States"      -value states  -variable view -command { .parameters.list configure -listvar xl }
radiobutton .statusbar.outputs -text "Outputs"     -value outputs -variable view -command { .parameters.list configure -listvar yl }

tk_optionMenu .statusbar.plot  plottype "Single Plot" "Multi Plot" "New Window"
checkbutton .statusbar.sort -text "Toggle Sort" -relief flat -indicatoron false -onvalue "reverse" -offvalue "normal" -variable sortorder -command {    
    set xl [sort_list \$xl \$sortorder ]
    set yl [sort_list \$yl \$sortorder ]
}

pack .statusbar.states  -expand false -fill x -side left
pack .statusbar.outputs -expand false -fill x -side left
pack .statusbar.plot    -expand false -fill x -side right
pack .statusbar.sort	-expand false -fill x -side right






## parameter list canvas
canvas		.parameters
listbox		.parameters.list -background oldlace -foreground black
scrollbar	.parameters.yscrollbar	-orient v


## configure scrollbars
.parameters.yscrollbar configure -command ".parameters.list yview"

.parameters.list configure -yscrollcommand ".parameters.yscrollbar set"


## bind lists
bind .parameters.list <<ListboxSelect>> { set parameter [ .parameters.list get anchor ] ; plot \$parameter }


proc "reverse_name" "name" {
    set delim "_"
    set split_name [split \$name \$delim]
    set reversed_name [lindex \$split_name 0]
    for {set i 1} {\$i<[llength \$split_name]} {incr i} {
        set reversed_name [lindex \$split_name \$i]\$delim\$reversed_name
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
    printf "lappend xl state:%s\n", $4
}
($1 == "output") {
    printf "lappend yl output:%s\n", $4
}' ${struc} >> ${out}

cat <<EOF >> ${out}
.cx.l configure -listvar xl
.cy.l configure -listvar yl

.cx.t configure -command { set xl [sort_list \$xl \$xsortorder] } -indicatoron false -onvalue "reverse" -offvalue "normal" -variable xsortorder
.cy.t configure -command { set yl [sort_list \$yl \$ysortorder] } -indicatoron false -onvalue "reverse" -offvalue "normal" -variable ysortorder

pack .menubar	      -expand false -fill x -side top
pack .statusbar	      -expand false -fill x -side bottom

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

## map names to column numbers
EOF

gawk '
BEGIN {
    print "proc \"plot\" \"title\" {";







<
|

<
<
<
<
<
<
|
|
<
|
<
<
|
<
<
|
<







148
149
150
151
152
153
154

155
156






157
158

159


160


161

162
163
164
165
166
167
168
    printf "lappend xl state:%s\n", $4
}
($1 == "output") {
    printf "lappend yl output:%s\n", $4
}' ${struc} >> ${out}

cat <<EOF >> ${out}

.parameters.list configure -listvar yl







pack .menubar			-expand false -fill x    -side top
pack .statusbar			-expand false -fill x    -side bottom

pack .parameters.yscrollbar	-expand false -fill y    -side right


pack .parameters.list		-expand true  -fill both -side left


pack .parameters		-expand true  -fill both


## map names to column numbers
EOF

gawk '
BEGIN {
    print "proc \"plot\" \"title\" {";


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