/usr/share/nrn/lib/hoc/shapebox.hoc is in neuron 7.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*
?0 UserClasses MenuExplore
?2 Type x
Shape and browser for creating a section panel
usage: ob = MenuExplore()
Pressing the left mouse button on a section in the Shape scene (make
sure the "Section" popup menu item is selected) colors the section red and
highlights the corresponding section name in the browser.
Pressing the left mouse button once on a name in the browser colors
the corresponding section in the Shape Scene (you can drag the mouse as well).
Double clicking the left mouse button on a name in the browser pops up
a panel showing the parameters associated with that section.
This assumes homogeneous sections by default. So Parameters which are not
initialized as constants along the section get a label to that effect instead
of a field editor. If this is not desired specify a position, 0<x<1,
for the location.
?0 UserClasses PointProcessLocator
shape, browser, and menu for a point process
usage: ob = PointProcessLocator(pointprocess)
In the shape scene there is a blue dot showing the location of the
pointprocess. Press the left mouse button at any point on the neuron to
relocate the point process. Parameters of the point process are
displayed in the lower part of the window.
?0 ShapeBrowser
Pressing the left mouse button on a section in the Shape scene (make
sure the "Section" popup menu item is selected) colors the section red and
highlights the corresponding section name in the browser.
Pressing the left mouse button once on a name in the browser colors
the corresponding section in the Shape Scene (you can drag the mouse as well).
This class is useful as a part of a larger class and as a dialog for
selecting a section.
*/
help ?0
/*
?0 User HocCode ShapeBrowser
*/
begintemplate ShapeBrowser
public s, b, hbox, dialog, sec
objectvar s, b, hbox, this, sec
strdef callback
proc init() {
hbox = new HBox()
hbox.ref(this)
hbox.intercept(1)
s = new Shape()
b = new SectionBrowser()
hbox.intercept(0)
hbox.save("")
s.action("b.select() sec = new SectionRef()")
b.select_action("s.select() sec = new SectionRef()")
if (numarg() > 0) {
sprint(callback, "execute(\"%s\")", $s1)
b.accept_action(callback)
}
sec = new SectionRef()
s.select()
b.select()
}
func dialog() {
return hbox.dialog("Select a Section")
}
endtemplate ShapeBrowser
/*
?0 User HocCode MenuExplore
*/
begintemplate MenuExplore
public s, unmap, hbox
objectvar s, b, hbox, this, vbox
strdef str
x=0
proc init() {
hbox = new HBox()
hbox.ref(this)
hbox.intercept(1)
s = new Shape()
vbox = new VBox()
vbox.intercept(1)
xpanel("MenuExplore",1)
x = -1
xmenu("Type")
type = 1
xradiobutton("Parameters", "type=1")
xradiobutton("Assigned", "type=2")
xradiobutton("State", "type=3")
xradiobutton("all types", "type=0")
xmenu()
xlabel ("(-1 means 0-1)")
xpanel()
xpanel("MenuExplore")
xpvalue("x", &x, 0, "changex()")
xpanel()
b = new SectionBrowser()
vbox.intercept(0)
vbox.map()
hbox.intercept(0)
if (numarg() == 2) {
hbox.map("Section Parameters (double click)", $1, $2, 1,1)
}else{
hbox.map("Section Parameters (double click)")
}
hbox.save("")
s.action("b.select()")
b.select_action("s.select()")
b.accept_action("make_menu()")
}
proc changex() {
if (x < 0 || x > 1) {
x = -1
}
}
proc make_menu() {local i, arc
/* must be executed at the top level since it parses section names */
arc = x
if (type > 0) {
if (type > 1 && arc < 0) { arc = .5 }
sprint(str, "nrnsecmenu(%g,%d)", arc, type)
execute(str)
}else{
for i=1,3 {
arc = x
if (i > 1 && arc < 0) { arc = .5}
sprint(str, "nrnsecmenu(%g,%d)", arc, i)
execute(str)
}
}
}
proc unmap() {
hbox.unmap()
}
endtemplate MenuExplore
/*
?0 User HocCode PointProcessLocator
*/
begintemplate PointProcessLocator
public st, unmap
objectvar s, b, pp, hbox, this
strdef st, sec
proc init() {
pp = $o1
hbox = new VBox()
hbox.intercept(1)
s = new Shape()
s.point_mark($o1, 3)
b = new SectionBrowser()
xpanel("")
st = "mmmmmmmmmmmmmmmmmmm"
xvarlabel(st)
xpanel()
nrnpointmenu(pp, 0)
hbox.intercept(0)
if (numarg() == 3) {
hbox.map("Point Process Mover", $2, $3, 1, 1)
}else{
hbox.map("Point Process Mover")
}
hbox.save("")
s.action("move()")
b.select_action("move()")
b.accept_action("pan()")
doEvents()
hoc_ac_ = pp.get_loc()
move()
pop_section()
}
proc move() {local x
s.select()
b.select()
x =hoc_ac_
pp.loc(x)
sectionname(sec)
sprint(st, "%s at %s(%g)", pp, sec, x)
}
proc pan() {
/* nrnpointmenu(pp)*/
}
proc unmap() {
hbox.unmap()
}
endtemplate PointProcessLocator
objectvar tempobj
proc makeMenuExplore() {
if(!execute1("v", 0)) {
continue_dialog("No accessed section: Can't start a MenuExplore")
return
}
tempobj = new MenuExplore()
objectvar tempobj
}
begintemplate ShapeLocation
public dialog, move
objectvar s, pp, hbox, this
strdef st, sec
proc init() {
pp = $o1
hbox = new VBox()
hbox.intercept(1)
xpanel("")
st = "mmmmmmmmmmmmmmmmmmm"
xvarlabel(st)
xpanel()
s = new Shape()
s.point_mark($o1, 3)
hbox.intercept(0)
hbox.save("")
s.action("move(hoc_ac_)")
doEvents()
hoc_ac_ = pp.get_loc()
move(hoc_ac_)
pop_section()
}
proc move() {local x
s.select()
x = $1
pp.loc(x)
sectionname(sec)
sprint(st, "%s(%g)",sec, x)
}
func dialog() {
return hbox.dialog("Select a Section")
}
endtemplate ShapeLocation
|