NEURON
shapeplt.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 #include "classreg.h"
3 #include "gui-redirect.h"
4 
5 #if HAVE_IV
6 
7 #include <InterViews/handler.h>
8 #include <InterViews/action.h>
9 #include <InterViews/style.h>
10 #include <InterViews/color.h>
11 #include <InterViews/polyglyph.h>
12 #include <IV-look/kit.h>
13 #include <InterViews/layout.h>
14 #include <InterViews/background.h>
15 #include <OS/math.h>
16 
17 #include <ivstream.h>
18 #include <stdio.h>
19 #include "scenepic.h"
20 #endif
21 #include "shapeplt.h"
22 #if HAVE_IV
23 #include "graph.h"
24 #include "ivoc.h"
25 #include "nrnoc2iv.h"
26 #include "rubband.h"
27 #include "symchoos.h"
28 #include "symdir.h"
29 #include "parse.hpp"
30 #include "utility.h"
31 #include "objcmd.h"
32 #include "idraw.h"
33 
34 #define SelectVariable_ "PlotWhat PlotShape"
35 #define VariableScale_ "VariableScale PlotShape"
36 #define TimePlot_ "TimePlot PlotShape"
37 #define SpacePlot_ "SpacePlot PlotShape"
38 #define ShapePlot_ "ShapePlot PlotShape"
39 #define MoveText_ "MoveText PlotShape"
40 
42 #endif // HAVE_IV
43 
44 extern Object** (*nrnpy_gui_helper_)(const char* name, Object* obj);
45 extern double (*nrnpy_object_to_double_)(Object*);
46 void* (*nrnpy_get_pyobj)(Object* obj) = 0;
47 void (*nrnpy_decref)(void* pyobj) = 0;
48 
49 // PlotShape class registration for oc
50 static double sh_flush(void* v) {
51  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.flush", v);
52 #if HAVE_IV
53 IFGUI
54  ((ShapePlot*)v)->flush();
55 ENDGUI
56 #endif
57  return 1.;
58 }
59 
60 static double fast_flush(void* v) {
61  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.fast_flush", v);
62 #if HAVE_IV
63 IFGUI
64  ((ShapePlot*)v)->fast_flush();
65 ENDGUI
66 #endif
67  return 1.;
68 }
69 
70 static double sh_begin(void* v) {// a noop. Exists only because graphs and
71  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.begin", v);
72  return 1.; // shapes are often in same list
73 }
74 
75 static double sh_scale(void* v) {
76  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.scale", v);
77 #if HAVE_IV
78 IFGUI
79  ((ShapePlot*)v)->scale(float(*getarg(1)), float(*getarg(2)));
80 } else {
81  ((ShapePlotData*)v)->scale(float(*getarg(1)), float(*getarg(2)));
82 ENDGUI
83 #else
84  ((ShapePlotData*)v)->scale(float(*getarg(1)), float(*getarg(2)));
85 #endif
86  return 1.;
87 }
88 
89 #if HAVE_IV
90 void ShapePlot::has_iv_view(bool value) {
91  has_iv_view_ = value;
92 }
93 #endif
94 
95 static double sh_view(void* v) {
96  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.view", v);
97 #if HAVE_IV
98 IFGUI
99  ShapePlot* sh = (ShapePlot*)v;
100  sh->has_iv_view(true);
101  if (sh->varobj()) {
102  hoc_execerror("InterViews only supports string variables.", NULL);
103  }
104  if (ifarg(8)) {
105  Coord x[8]; int i;
106  for (i=0; i < 8; ++i) {
107  x[i] = *getarg(i+1);
108  }
109  sh->view(x);
110  }
111 ENDGUI
112 #endif
113  return 1.;
114 }
115 
116 static double sh_variable(void* v) {
117  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.variable", v);
118  ShapePlotData* spd = (ShapePlotData*) v;
119 #if HAVE_IV
120  // NOTE: only sh OR spd is valid, but both may be safely set
121  ShapePlot* sh = (ShapePlot*) v;
122 #endif
124  // note that we only get inside here when Python is available
125  void* py_var_ = nrnpy_get_pyobj(*hoc_objgetarg(1));
126  if (!py_var_) {
127  hoc_execerror("variable must be either a string or Python object", NULL);
128  }
129 #if HAVE_IV
130 IFGUI
131  if (sh->has_iv_view()) {
132  nrnpy_decref(py_var_);
133  hoc_execerror("InterViews only supports string variables.", NULL);
134  }
135  nrnpy_decref(sh->varobj());
136  sh->varobj(py_var_);
137  return 1;
138 ENDGUI
139 #endif
140  nrnpy_decref(spd->varobj());
141  spd->varobj(py_var_);
142  return 1;
143  }
144  Symbol* s;
145  s = hoc_table_lookup(gargstr(1), hoc_built_in_symlist);
146  if (s) {
147 #if HAVE_IV
148 IFGUI
149  if (nrnpy_decref) {
150  nrnpy_decref(sh->varobj());
151  }
152 
153  sh->varobj(NULL);
154  sh -> variable(s);
155 } else {
156  if (nrnpy_decref) {
157  nrnpy_decref(spd->varobj());
158  }
159  spd->varobj(NULL);
160  spd -> variable(s);
161 ENDGUI
162 #else
163  if (nrnpy_decref) {
164  nrnpy_decref(spd->varobj());
165  }
166  spd->varobj(NULL);
167  spd -> variable(s);
168 #endif
169  }
170  return 1.;
171 }
172 
173 static double sh_view_count(void* v) {
174  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.view_count", v);
175  int n = 0;
176 #if HAVE_IV
177 IFGUI
178  n = ((ShapeScene*)v)->view_count();
179 ENDGUI
180 #endif
181  return double(n);
182 }
183 
184 static double sh_save_name(void* v) {
185  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.save_name", v);
186 #if HAVE_IV
187 IFGUI
188  ((ShapeScene*)v)->name(gargstr(1));
189 ENDGUI
190 #endif
191  return 1.;
192 }
193 
194 static double sh_unmap(void*v) {
195  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.unmap", v);
196 #if HAVE_IV
197 IFGUI
198  ShapeScene* s = (ShapeScene*)v;
199  s->dismiss();
200 ENDGUI
201 #endif
202  return 0.;
203 }
204 
205 static double sh_printfile(void* v) {
206  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.printfile", v);
207 #if HAVE_IV
208 IFGUI
209  ShapeScene* s = (ShapeScene*)v;
210  s->printfile(gargstr(1));
211 ENDGUI
212 #endif
213  return 1.;
214 }
215 
216 static double sh_show(void* v) {
217  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.show", v);
218 #if HAVE_IV
219 IFGUI
220  ShapeScene* s = (ShapeScene*)v;
221  s->shape_type(int(chkarg(1, 0., 2.)));
222 ENDGUI
223 #endif
224  return 1.;
225 }
226 
227 extern double ivoc_gr_menu_action(void* v);
228 
229 static double s_colormap(void* v) {
230  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.colormap", v);
231 #if HAVE_IV
232 IFGUI
233  ShapePlot* s = (ShapePlot*)v;
234  if (ifarg(4)) {
235  s->color_value()->colormap(int(chkarg(1, 0, 255)),
236  int(chkarg(2, 0, 255)),
237  int(chkarg(3, 0, 255)),
238  int(chkarg(4, 0, 255))
239  );
240  }else{
241  bool b = false;
242  if (ifarg(2)) {
243  b = (bool)chkarg(2, 0, 1);
244  }
245  s->color_value()->colormap(int(chkarg(1, 0, 1000)), b);
246  }
247 ENDGUI
248 #endif
249  return 1.;
250 }
251 
252 static double sh_hinton(void* v) {
253  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.hinton", v);
254 #if HAVE_IV
255 IFGUI
256  ShapeScene* ss = (ShapeScene*)v;
257  double* pd = hoc_pgetarg(1);
258  double xsize = chkarg(4, 1e-9, 1e9);
259  double ysize = xsize;
260  if (ifarg(5)) {
261  ysize = chkarg(5, 1e-9, 1e9);
262  }
263  Hinton* h = new Hinton(pd, xsize, ysize, ss);
264  ss->append(new FastGraphItem(h));
265  ss->move(ss->count() - 1, *getarg(2), *getarg(3));
266 ENDGUI
267 #endif
268  return 1.;
269 }
270 
271 static double exec_menu(void* v) {
272  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("PlotShape.exec_menu", v);
273 #if HAVE_IV
274 IFGUI
275  ((Scene*)v)->picker()->exec_item(gargstr(1));
276 ENDGUI
277 #endif
278  return 0.;
279 }
280 
281 extern double ivoc_gr_menu_tool(void*);
282 extern double ivoc_gr_mark(void*);
283 extern double ivoc_gr_size(void*);
284 extern double ivoc_gr_label(void*);
285 extern double ivoc_gr_line(void*);
286 extern double ivoc_gr_begin_line(void*);
287 extern double ivoc_gr_erase(void*);
288 extern double ivoc_gr_gif(void*);
289 extern double ivoc_erase_all(void*);
290 extern double nrniv_sh_observe(void*);
291 extern double nrniv_sh_rotate(void*);
292 extern double nrniv_sh_nearest(void*);
293 extern double nrniv_sh_push(void*);
294 extern double nrniv_sh_color(void*);
295 extern double nrniv_sh_color_all(void*);
296 extern double nrniv_sh_color_list(void*);
297 extern double nrniv_len_scale(void*);
298 extern Object** nrniv_sh_nearest_seg(void*);
299 extern Object** nrniv_sh_selected_seg(void*);
300 
302  "hinton", sh_hinton,
303  "nearest", nrniv_sh_nearest,
304  "push_selected", nrniv_sh_push,
305  "scale", sh_scale,
306  "view", sh_view,
307  "size", ivoc_gr_size,
308  "view_count", sh_view_count,
309  "flush", sh_flush,
310  "fastflush", fast_flush,
311  "begin", sh_begin,
312  "variable", sh_variable,
313  "save_name", sh_save_name,
314  "unmap", sh_unmap,
315  "color", nrniv_sh_color,
316  "color_all", nrniv_sh_color_all,
317  "color_list", nrniv_sh_color_list,
318  "printfile", sh_printfile,
319  "show", sh_show,
320  "menu_action", ivoc_gr_menu_action,
321  "menu_tool", ivoc_gr_menu_tool,
322  "colormap", s_colormap,
323  "exec_menu", exec_menu,
324  "observe", nrniv_sh_observe,
325  "rotate", nrniv_sh_rotate,
326  "beginline", ivoc_gr_begin_line,
327  "line", ivoc_gr_line,
328  "label", ivoc_gr_label,
329  "mark", ivoc_gr_mark,
330  "erase", ivoc_gr_erase,
331  "erase_all", ivoc_erase_all,
332  "len_scale", nrniv_len_scale,
333  "gif", ivoc_gr_gif,
334  0,0
335 };
336 
338  "nearest_seg", nrniv_sh_nearest_seg,
339  "selected_seg", nrniv_sh_selected_seg,
340  NULL, NULL
341 };
342 
343 static void* sh_cons(Object* ho) {
344  TRY_GUI_REDIRECT_OBJ("PlotShape", NULL);
345  int i=1;
346  int iarg=1;
347  SectionList* sl = NULL;
348  Object* ob = NULL;
349  // first arg may be an object.
350  if (ifarg(iarg)) {
351  if (hoc_is_object_arg(iarg)) {
352  ob = *hoc_objgetarg(iarg);
353  check_obj_type(ob, "SectionList");
354 #if HAVE_IV
355 IFGUI
356  sl = new SectionList(ob);
357  sl->ref();
358 ENDGUI
359 #endif
360  ++iarg;
361  }
362  }
363  if (ifarg(iarg)) {
364  i = int(chkarg(iarg,0,1));
365  }
366 #if HAVE_IV
367 IFGUI
368  ShapePlot* sh = NULL;
369  sh = new ShapePlot(NULL, sl);
370  sh->has_iv_view(i ? true : false);
371  sh->varobj(NULL);
372  Resource::unref(sl);
373  sh->ref();
374  sh->hoc_obj_ptr(ho);
375  if (i) {
376  sh->view(200);
377  }
378  return (void*)sh;
379 } else {
380  ShapePlotData* spd = new ShapePlotData(NULL, ob);
381  return (void*)spd;
382 ENDGUI
383 #else
384  ShapePlotData* sh = new ShapePlotData(NULL, ob);
385  return (void*)sh;
386 #endif
387 }
388 
389 static void sh_destruct(void* v) {
390  TRY_GUI_REDIRECT_NO_RETURN("~PlotShape", v);
391 #if HAVE_IV
392 IFGUI
393  if (nrnpy_decref) {
394  ShapePlot* sp = (ShapePlot*) v;
395  nrnpy_decref(sp->varobj());
396  }
397 
398  ((ShapeScene*)v)->dismiss();
399 } else {
400  if (nrnpy_decref) {
401  ShapePlotData* sp = (ShapePlotData*) v;
402  nrnpy_decref(sp->varobj());
403  }
404 ENDGUI
406 #else
407  if (nrnpy_decref) {
408  ShapePlotData* sp = (ShapePlotData*) v;
409  nrnpy_decref(sp->varobj());
410  }
411 
412 #endif
413 }
415 // printf("PlotShape_reg\n");
416  class2oc("PlotShape", sh_cons, sh_destruct, sh_members, NULL, retobj_members, NULL);
417 }
418 
419 void* ShapePlotData::varobj() const {
420  return py_var_;
421 }
422 
423 void ShapePlotData::varobj(void* obj) {
424  py_var_ = obj;
425 }
426 
427 #if HAVE_IV
428 
429 /* static */ class ShapePlotImpl : public Observer {
430 public:
431  ShapePlotImpl(ShapePlot*, Symbol*);
432  ~ShapePlotImpl();
433  virtual void time();
434  virtual void space();
435  virtual void shape();
436  virtual void show_shape_val(bool);
437  virtual void select_variable();
438  virtual void scale();
439  virtual void colorbar();
440  virtual void update(Observable*);
441 public:
442  ShapePlot* sp_;
443  Symbol* sym_;
444  GLabel* variable_;
445  double graphid_;
446  int colorid_;
447  SectionHandler* time_sh_;
448  bool showing_;
449  Glyph* colorbar_;
450  bool fast_;
451 };
452 
453 /* static */ class MakeTimePlot : public SectionHandler {
454 public:
455  MakeTimePlot(ShapePlotImpl*);
456  virtual ~MakeTimePlot();
457  virtual bool event(Event&);
458 private:
459  ShapePlotImpl* spi_;
460 };
461 
462 /* static */ class MakeSpacePlot : public RubberAction {
463 public:
464  MakeSpacePlot(ShapePlotImpl*);
465  virtual ~MakeSpacePlot();
466  virtual void execute(Rubberband*);
467 private:
468  ShapePlotImpl* spi_;
469 };
470 
471 declareActionCallback(ShapePlotImpl);
472 implementActionCallback(ShapePlotImpl);
473 
474 ShapePlot::ShapePlot(Symbol* sym, SectionList* sl) : ShapeScene(sl) {
475  py_var_ = NULL;
476  if (sl) {
477  sl_ = sl->nrn_object();
478  } else {
479  sl_ = NULL;
480  }
481  if (sl_) ++sl_->refcount;
482  spi_ = new ShapePlotImpl(this, sym);
483  variable(spi_->sym_);
484  picker()->add_menu("Plot What?", new ActionCallback(ShapePlotImpl)(
485  spi_, &ShapePlotImpl::select_variable));
486  picker()->add_menu("Variable scale", new ActionCallback(ShapePlotImpl)(
487  spi_, &ShapePlotImpl::scale));
488  picker()->add_radio_menu("Time Plot", new ActionCallback(ShapePlotImpl)(
489  spi_, &ShapePlotImpl::time));
490  picker()->add_radio_menu("Space Plot", new ActionCallback(ShapePlotImpl)(
491  spi_, &ShapePlotImpl::space));
492  picker()->add_radio_menu("Shape Plot", new ActionCallback(ShapePlotImpl)(
493  spi_, &ShapePlotImpl::shape));
494  color_value()->attach(spi_);
495  spi_->colorbar();
496 }
497 ShapePlot::~ShapePlot() {
498  if (sl_) hoc_dec_refcount(&sl_);
499  color_value()->detach(spi_);
500  delete spi_;
501 }
502 
503 
504 float ShapePlot::low() {
505  return color_value()->low();
506 }
507 float ShapePlot::high() {
508  return color_value()->high();
509 }
510 
511 Object* ShapePlot::neuron_section_list() {
512  return sl_;
513 }
514 
515 void ShapePlot::observe(SectionList* sl) {
516 // printf("ShapePlot::observe\n");
517  if (sl_) hoc_dec_refcount(&sl_);
518  sl_ = sl ? sl -> nrn_object() : NULL;
519  if (sl_) ++sl_->refcount;
521  if (spi_->showing_) {
522  PolyGlyph* pg = shape_section_list();
523  GlyphIndex i, cnt = pg->count();
524  for (i=0; i < cnt; ++i) {
525  ShapeSection* ss = (ShapeSection*)pg->component(i);
526  ss->set_range_variable(spi_->sym_);
527  }
528  damage_all();
529  }
530 }
531 
532 void ShapePlot::update_ptrs() {
533  PolyGlyph* pg = shape_section_list();
534  GlyphIndex i, cnt = pg->count();
535  for (i=0; i < cnt; ++i) {
536  ShapeSection* ss = (ShapeSection*)pg->component(i);
537  ss->update_ptrs();
538  }
539 }
540 
541 void ShapePlot::erase_all() {
542  Resource::unref(spi_->colorbar_);
543  spi_->colorbar_ = NULL;
545 }
547  colorbar();
548  sp_->damage_all();
549 }
550 
551 void ShapePlot::variable(Symbol* sym) {
552  GlyphIndex i;
553  spi_->sym_ = sym;
554  i = glyph_index(spi_->variable_);
555  GLabel* g = new GLabel(spi_->sym_->name, colors->color(1), 1, 1, .5, .5);
556  if (i >= 0) {
557  damage(i);
558  replace(i, new GraphItem(g, 0));
559  damage(i);
560  }else{
561  append_fixed(new GraphItem(g, 0));
562  }
563  Resource::unref(spi_->variable_);
564  Resource::ref(g);
565  spi_->variable_ = g;
566  if (spi_->showing_) {
567  spi_->showing_ = false;
568  spi_->show_shape_val(true);
569  }
570  scale(-80, 40);
571 }
572 const char* ShapePlot::varname()const {
573  return spi_->sym_->name;
574 }
575 
576 void* ShapePlot::varobj() const {
577  return py_var_;
578 }
579 
580 void ShapePlot::varobj(void* obj) {
581  py_var_ = obj;
582 }
583 
584 
585 void ShapePlot::scale(float min, float max) {
586  color_value()->set_scale(min, max);
587 }
588 
589 
590 void ShapePlot::save_phase1(ostream& o) {
591  o << "{" << endl;
592  save_class(o, "PlotShape");
593  char buf[256];
594  sprintf(buf, "save_window_.variable(\"%s\")", spi_->sym_->name);
595  o << buf << endl;
596 }
597 
598 void ShapePlot::shape_plot() {}
599 void ShapePlot::make_time_plot(Section*, float) {
600 }
601 void ShapePlot::make_space_plot(Section*, float, Section*, float) {
602 }
603 void ShapePlot::flush() {
604  spi_->fast_ = false;
605  if (tool() == SHAPE) {
606  damage_all();
607  }
608 }
609 void ShapePlot::fast_flush() {
610  if (tool() == SHAPE) {
611  int i, cnt = view_count();
612  spi_->fast_ = true;
613  // fast for only one view
614  for (i=0; i < cnt; ++i) {
615  XYView* v = sceneview(i);
616  Coord x = v->left(), y = v->bottom();
617 #if defined(WIN32)
618 // if x,y is not on the screen then use right, top. Otherwise InvalidateRect
619 // will not take effect.
620  Window* w = v->canvas() ? v->canvas()->window() : NULL;
621  if (w) {
622  if (w->left() < 0) {
623  x = v->right();
624  }
625  if (w->bottom() < 0) {
626  y = v->top();
627  }
628  }
629 #endif
630  v->damage(x, y, x, y);
631  }
632  }
633 }
634 #if defined(WIN32)
635 extern void* mswin_setclip(Canvas*, int, int, int, int);
636 extern void mswin_delete_object(void*);
637 #endif
638 
639 void ShapePlot::draw(Canvas* c, const Allocation& a) const {
640  if (spi_->fast_) {
641 #if defined(WIN32) || MAC
642 //win32 clipping is much more strict than X11 clipping even though the
643 //implementations seem to agree that clipping is the intersection of
644 //all clip requests on the clip stack in canvas. Clipping is originally
645 //set to the damage area and thus nothing actually gets drawn to
646 //the buffer. Furthermore, when copying from buffer to screen, only
647 //the original damage area is copied. For some reason in X11 neither
648 //seems to prevent the correct appearance although I wonder if it
649 //will work on all x11 implementations. However, for WIN32, both cause
650 //problems and thus the implementation of Canvas16::clip was changed to
651 // not do an intersection and the "damage_all" below along with a change
652 // to the window.cpp paint function in which the damage area is reread before
653 // the bit block transfer solves the problem.
654 // At any rate this is fast only for the first view since the fast_draw's
655 // only work once.
656 
658  c->push_clipping(true);
659 #if MAC
660  c->clip_rect(v->left(), v->bottom(), v->right(), v->top());
661 #endif
662 #if defined(WIN32)
663 //Consider the commit message:
664 // -------
665 // 28) Branch: MAIN Date: 2004-05-21 06:30 Commit by: hines
666 // canvas16.cpp
667 //MSWin PolyGlyphs inside a ScrollBox occasionally do not repair all the damage
668 // This is apparently a long standing problem dating from 1999 which just
669 //now became very noticable with the MultipleRunFitter Parameter panel
670 //when there are many parameters (so that it is a scrollbox). This has
671 //been traced to a #if 0 fragment in the clipping mechanism which turned
672 //off the intersection calculation when a new clipping region was requested
673 // We have turned this section back on. There was no reason mentioned in
674 //the 1999 log message when the #if 0 was introduced. The major reason for
675 //the larger change in that file was drawing dashed brush lines. If a
676 //problem with clipping exists then it will have to be fixed in another way.
677 // -------
678 // Well, here is the reason for the #if 0. Without it, the fast_flush movie
679 // is not drawn for shapeplots. (Strangely, the neurondemo movie works for
680 // the stylized neuron but not the pyramidal cell.
681 // So as not to ruin the MAIN 28 commit of canvas16.cpp
682 // we force the clipping to the entire canvas for the fast_flush.
683 // Feeble attempts to do everything here, foundered on my inability to
684 // include <windows.h> in this file. So the implementation is placed in
685 // ivocwin.cpp. Note that the clip region must be deleted after use.
686 //
687  void* new_clip = mswin_setclip(c, 0, 0, c->pwidth(), c->pheight());
688 #endif
689 #endif
690  GlyphIndex i, cnt = count();
691  for (i=0; i < cnt; ++i) {
692  GraphItem* gi = (GraphItem*)component(i);
693  if (gi->is_fast()) {
694  Coord x, y;
695  location(i, x, y);
696  ((FastShape*)(gi->body()))->fast_draw(c, x, y, false);
697  }
698  }
699 #if defined(WIN32) || MAC
700  c->pop_clipping();
701 #if defined(WIN32)
702  mswin_delete_object(new_clip);
703 #endif
704  v->damage_all();;
705 #endif
706  spi_->fast_ = false;
707  }else{
708  ShapeScene::draw(c, a);
709  }
710 }
711 
712 ShapePlotImpl::ShapePlotImpl(ShapePlot* sp, Symbol* sym) {
713  sp_ = sp;
714  colorid_ = 0;
715  graphid_ = 0;
716  showing_ = false;
717  fast_ = false;
718  colorbar_ = NULL;
719  if (sym) {
720  sym_ = sym;
721  }else{
722  sym_ = hoc_table_lookup("v", hoc_built_in_symlist);
723  }
724  variable_ = NULL;
725  time_sh_ = new MakeTimePlot(this);
726  time_sh_->ref();
727 }
728 
729 ShapePlotImpl::~ShapePlotImpl() {
730  Resource::unref(variable_);
731  time_sh_->unref();
732  Resource::unref(colorbar_);
733 }
734 
735 void ShapePlotImpl::colorbar() {
736  bool showing;
737  if (colorbar_) {
738  int i = sp_->glyph_index(colorbar_);
739  Resource::unref(colorbar_);
740  showing = sp_->showing(i);
741  sp_->remove(i);
742  }else{
743  showing = false;
744  }
745  colorbar_ = sp_->color_value()->make_glyph();
746  colorbar_->ref();
747  sp_->append_fixed(new GraphItem(colorbar_, 0));
748  sp_->show(sp_->count() - 1, showing);
749  if (showing) {
751  sp_->move(sp_->count() - 1, v->left(), v->top());
752  }
753 }
754 
755 void ShapePlotImpl::select_variable() {
756  if (Oc::helpmode()) {
757  Oc::help(SelectVariable_);
758  }
759  SymChooser* sc;
760  Oc oc;
761  Style* style = new Style(Session::instance()->style());
762  style->attribute("caption", "Variable in the shape domain");
763  sc = new SymChooser(new SymDirectory(RANGEVAR) , WidgetKit::instance(), style, NULL, 1);
764  sc->ref();
765  while (sc->post_for(XYView::current_pick_view()->canvas()->window())) {
766  Symbol* s;
768  if (s) {
769  sp_->variable(s);
770  break;
771  }
772  }
773  sc->unref();
774 }
775 
776 void ShapePlotImpl::scale() {
777  if (Oc::helpmode()) {
778  Oc::help(VariableScale_);
779  }
780  Coord x, y;
781  x = sp_->color_value()->low();
782  y = sp_->color_value()->high();
783  if (var_pair_chooser("Variable range scale", x, y,
784  XYView::current_pick_view()->canvas()->window())) {
785  sp_->scale(x, y);
786  }
787 }
788 
789 void ShapePlotImpl::time() {
790  if (Oc::helpmode()) {
791  Oc::help(TimePlot_);
792  return;
793  }
794  sp_->tool(ShapePlot::TIME);
795  graphid_ = 0;
796  colorid_ = 2;
797  sp_->color(colors->color(1));
798  sp_->section_handler(time_sh_);
799  show_shape_val(false);
800  sp_->picker()->bind_select((OcHandler*)NULL);
801 }
802 
803 void ShapePlotImpl::space() {
804  if (Oc::helpmode()) {
805  Oc::help(SpacePlot_);
806  return;
807  }
808  sp_->tool(ShapePlot::SPACE);
809  graphid_ = 0;
810  colorid_ = 1;
811  sp_->color(colors->color(1));
812  sp_->section_handler((SectionHandler*)NULL);
813  show_shape_val(false);
814  sp_->picker()->bind_select(new RubberLine(new MakeSpacePlot(this)));
815 }
816 
817 void ShapePlotImpl::shape() {
818  if (Oc::helpmode()) {
819  Oc::help(ShapePlot_);
820  return;
821  }
822  sp_->tool(ShapePlot::SHAPE);
823 //printf("shape\n");
824  sp_->section_handler((SectionHandler*)NULL);
825  sp_->picker()->bind_select((OcHandler*)NULL);
826  show_shape_val(true);
827 }
828 
829 void ShapePlotImpl::show_shape_val(bool show) {
830  if (show != showing_) {
831  PolyGlyph* pg = sp_->shape_section_list();
832  GlyphIndex i, cnt = pg->count();
833  if (show) {
834  for (i=0; i < cnt; ++i) {
835  ShapeSection* ss = (ShapeSection*)pg->component(i);
837  }
838  }else{
839  for (i=0; i < cnt; ++i) {
840  ShapeSection* ss = (ShapeSection*)pg->component(i);
841  ss->clear_variable();
842  }
843  }
844  if (colorbar_) {
845  int i = sp_->glyph_index(colorbar_);
846  sp_->show(i, show);
847  if (show) {
849  sp_->move(i, v->left(), v->top());
850  }
851  }
852  sp_->damage_all();
853  showing_ = show;
854  }
855 }
856 
857 MakeTimePlot::MakeTimePlot(ShapePlotImpl* spi){
858  spi_ = spi;
859 }
860 MakeTimePlot::~MakeTimePlot(){
861 }
862 
863 bool MakeTimePlot::event(Event&) {
864  Oc oc;
865  ShapeSection* ss = shape_section();
866  Section* sec = ss->section();
867  if (spi_->sp_->tool() != ShapePlot::TIME) {
868  return false;
869  }
870  if (spi_->graphid_ == 0) {
871  oc.run("newPlotV()\n");
872  oc.run("hoc_ac_ = object_id(graphItem)\n");
873  spi_->graphid_ = hoc_ac_;
874  }
875  oc.run("hoc_ac_ = object_id(graphItem)\n");
876 //printf("graphid_=%g hoc_ac_=%g\n", graphid_, hoc_ac_);
877  float x = spi_->sp_->arc_selected();
878  x = nrn_arc_position(sec, node_exact(sec, x));
879  x = (nrn_section_orientation(sec) == 0.) ? x : 1. - x;
880  if (spi_->graphid_ == hoc_ac_) {
881  char buf[200];
882  sprintf(buf, "{graphItem.color(%d)}\n", spi_->colorid_);
883  oc.run(buf);
884  sprintf(buf, "{graphItem.addvar(\"%s.%s(%g)\")}\n",
886  spi_->sp_->varname(),
887  x
888  );
889  oc.run(buf);
890  ss->setColor(colors->color(spi_->colorid_),
892  ++spi_->colorid_;
893  }else{
894  spi_->graphid_ = 0;
895  }
896  return true;
897 }
898 
899 MakeSpacePlot::MakeSpacePlot(ShapePlotImpl* spi){
900  spi_ = spi;
901 }
902 MakeSpacePlot::~MakeSpacePlot(){
903 }
904 
906  ShapePlot* sp = spi_->sp_;
907  RubberLine* rl = (RubberLine*)rb;
908  Coord x1, y1, x2, y2;
909  float a1, a2;
910  rl->get_line(x1, y1, x2, y2);
911 //printf("MakeSpacePlot %g %g %g %g\n", x1, y1, x2, y2);
912  char buf[256];
913  Oc oc;
914  oc.run("objectvar rvp_\n");
915  Section* sec1, *sec2;
916  sp->nearest(x1, y1);
917  sec1 = sp->selected()->section();
918  a1 = sp->arc_selected();
919  a1 = (a1 < .5) ? 0. : 1.;
920  sp->nearest(x2, y2);
921  sec2 = sp->selected()->section();
922  a2 = sp->arc_selected();
923  a2 = (a2 < .5) ? 0. : 1.;
924  if (sec1 == sec2 && a1 == a2) {
925  printf("Null path for space plot: ignored\n");
926  return;
927  }
928  oc.run("hoc_ac_ = object_id(graphItem)\n");
929 //printf("graphid_=%g hoc_ac_=%g\n", graphid_, hoc_ac_);
930  if (spi_->graphid_ == 0. || spi_->graphid_ != hoc_ac_) {
931  oc.run("graphItem = new Graph()\n");
932  oc.run("hoc_ac_ = object_id(graphItem)\n");
933  spi_->graphid_ = hoc_ac_;
934  oc.run("{graphItem.save_name(\"flush_list.\")}\n");
935  oc.run("{flush_list.append(graphItem)}\n");
936  spi_->colorid_ = 1;
937  }
938  ++spi_->colorid_;
939  ColorValue* cv = sp->color_value();
940  sprintf(buf, "rvp_ = new RangeVarPlot(\"%s\")\n", sp->varname());oc.run(buf);
941  sprintf(buf, "%s rvp_.begin(%g)\n", hoc_section_pathname(sec1), a1);oc.run(buf);
942  sprintf(buf, "%s rvp_.end(%g)\n", hoc_section_pathname(sec2), a2);oc.run(buf);
943  oc.run("{rvp_.origin(rvp_.d2root)}\n");
944  sprintf(buf, "{graphItem.size(rvp_.left(), rvp_.right(), %g, %g)}\n", cv->low(), cv->high()); oc.run(buf);
945  sprintf(buf, "{graphItem.addobject(rvp_, %d, 1) graphItem.yaxis()}\n", spi_->colorid_); oc.run(buf);
946  sp->color(sec1, sec2, colors->color(spi_->colorid_));
947 }
948 
949 
950 static const Color* gray;
951 static int csize;
952 static const Color** crange;
953 
954 static int spec[] = { 95, 0, 95,
955  111, 0, 111,
956  127, 0, 143,
957  143, 0, 127,
958  159, 0, 111,
959  175, 0, 95,
960  191, 0, 79,
961  207, 0, 63,
962  207, 31, 47,
963  223, 47, 47,
964  239, 63, 31,
965  255, 79, 15,
966  255, 95, 7,
967  255, 111, 0,
968  255, 127, 0,
969  255, 143, 0,
970  255, 159, 0,
971  255, 175, 0,
972  255, 191, 0,
973  255, 207, 0,
974  255, 223, 0,
975  255, 239, 0,
976  255, 247, 0,
977  255, 255, 0,
978  -1};
979 
980 
981 ColorValue::ColorValue(){
982  if (!gray) {
983  Style* s = Session::instance()->style();
985  csize = 0;
986  if (s->find_attribute("shape_scale_file", name)) {
987  name = expand_env_var(name.string());
988 //printf("ColorValue %s\n", name.string());
989  FILE* f;
990  if ((f = fopen(name.string(), "r")) == 0) {
991 #ifdef WIN32
992 #else
993  printf("Cannot open %s: Using built-in colormap for shapeplot\n", name.string());
994 #endif
995  }else{
996  int r, g, b;
997  while(fscanf(f, "%d %d %d", &r, &g, &b) == 3) {
998  ++csize;
999  }
1000  if (csize) {
1001  crange = new const Color*[csize];
1002  rewind(f);
1003  csize = 0;
1004  while(fscanf(f, "%d %d %d", &r, &g, &b) == 3) {
1005  crange[csize] = new Color(
1006  ColorIntensity(r/256.),
1007  ColorIntensity(g/256.),
1008  ColorIntensity(b/256.)
1009  );
1010  Resource::ref(crange[csize]);
1011  ++csize;
1012  }
1013  }
1014  fclose(f);
1015  }
1016  }
1017  if (csize == 0) {
1018  for ( csize=0; spec[csize*3] != -1; csize++) { }
1019  crange = new const Color*[csize];
1020  for ( csize=0; spec[csize*3] != -1; csize++) {
1021  crange[csize] = new Color(
1022  ColorIntensity(spec[csize*3]/256.),
1023  ColorIntensity(spec[csize*3+1]/256.),
1024  ColorIntensity(spec[csize*3+2]/256.)
1025  );
1026  Resource::ref(crange[csize]);
1027  }
1028  }
1029  gray = Color::lookup(Session::instance()->default_display(), "gray");
1030  Resource::ref(gray);
1031  }
1032  csize_ = 0;
1033  crange_ = NULL;
1034  set_scale(0, 1);
1035 }
1036 
1037 ColorValue::~ColorValue(){
1038  int i;
1039  if (csize_) { // delete the local
1040  for (i=0; i < csize_; ++i) {
1041  crange_[i]->unref();
1042  }
1043  delete [] crange_;
1044  }
1045 }
1046 
1047 void ColorValue::set_scale(float low, float high) {
1048  if (low < high) {
1049  low_ = low;
1050  high_ = high;
1051  }
1052  notify();
1053 }
1054 
1055 const Color* ColorValue::get_color(float val) const {
1056  float x = (val - low_)/(high_ - low_);
1057  if (csize_) {
1058  if (x > .99)return crange_[csize_-1];
1059  else if (x < 0) return crange_[0];
1060  else return crange_[int(csize_ * x)];
1061  }else{
1062  if (x > .99)return crange[csize-1];
1063  else if (x < 0) return crange[0];
1064  else return crange[int(csize * x)];
1065  }
1066 }
1067 
1068 const Color* ColorValue::no_value() const {
1069  return gray;
1070 }
1071 
1072 class ColorValueGlyphItem : public MonoGlyph {
1073 public:
1074  ColorValueGlyphItem(const char*, const Color*);
1075  virtual ~ColorValueGlyphItem();
1076  virtual void draw(Canvas*, const Allocation&)const;
1077 private:
1078  CopyString label_;
1079  const Color* color_;
1080 };
1081 
1082 ColorValueGlyphItem::ColorValueGlyphItem(const char* buf, const Color* c) {
1083  body(new Background(WidgetKit::instance()->label(buf), c));
1084  label_ = buf;
1085  color_ = c;
1086 }
1087 
1088 ColorValueGlyphItem::~ColorValueGlyphItem() {}
1089 
1090 void ColorValueGlyphItem::draw(Canvas* c, const Allocation& a)const {
1091  body()->draw(c, a);
1092  if (OcIdraw::idraw_stream) {
1093  OcIdraw::pict();
1094  OcIdraw::rect(c, a.left(), a.bottom(), a.right(), a.top(), color_, NULL, true);
1095  Transformer t;
1096  t.translate(a.left(), a.bottom());
1097  OcIdraw::text(c, label_.string(), t);
1098  OcIdraw::end();
1099  }
1100 }
1101 
1102 Glyph* ColorValue::make_glyph() {
1103  LayoutKit& lk = *LayoutKit::instance();
1104  WidgetKit& wk = *WidgetKit::instance();
1105  PolyGlyph* box = lk.vbox(csize+2);
1106  int c = csize_ ? csize_ : csize;
1107  for (int i = c-1;i >= 0; --i) {
1108  char buf[50];
1109  float x = low_ + i*(high_ - low_)/(c-1);
1110  sprintf(buf, "%5g", x);
1111  box->append(new ColorValueGlyphItem(buf, get_color(x)));
1112 // box->append(new Background(wk.label(buf), get_color(x)));
1113  }
1114  return box;
1115 }
1116 
1117 void ColorValue::colormap(int size, bool global) {
1118  int i;
1119  if (csize_) {
1120  for (i=0; i < csize_; ++i) {
1121  crange_[i]->unref();
1122  }
1123  delete [] crange_;
1124  crange_ = NULL;
1125  csize_ = 0;
1126  }
1127  if (global) {
1128  if (csize) {
1129  for (i=0; i < csize; ++i) {
1130  crange[i]->unref();
1131  }
1132  delete [] crange;
1133  }
1134  csize = (size > 1) ? size : 2;
1135  crange = new const Color*[csize];
1136  for (i=0; i < csize; ++i) {
1137  crange[i] = gray;
1138  crange[i]->ref();
1139  }
1140  }else{
1141  csize_ = (size > 1) ? size : 2;
1142  crange_ = new const Color*[csize_];
1143  for (i=0; i < csize_; ++i) {
1144  crange_[i] = gray;
1145  crange_[i]->ref();
1146  }
1147  }
1148 }
1149 void ColorValue::colormap(int i, int r, int g, int b) {
1150  if (crange_) {
1151  if (i >= 0 && i < csize_ && r < 256 && g < 256 && b < 256) {
1152  crange_[i]->unref();
1153  crange_[i] = new Color(
1154  ColorIntensity(r/256.),
1155  ColorIntensity(g/256.),
1156  ColorIntensity(b/256.)
1157  );
1158  Resource::ref(crange_[i]);
1159  }
1160  }else{
1161  if (i >= 0 && i < csize && r < 256 && g < 256 && b < 256) {
1162  crange[i]->unref();
1163  crange[i] = new Color(
1164  ColorIntensity(r/256.),
1165  ColorIntensity(g/256.),
1166  ColorIntensity(b/256.)
1167  );
1168  Resource::ref(crange[i]);
1169  }
1170  }
1171 }
1172 
1173 FastGraphItem::FastGraphItem(FastShape* g, bool s, bool p) : GraphItem(g, s, p) {}
1174 
1176 }
1178 }
1179 
1180 Hinton::Hinton(double* pd, Coord xsize, Coord ysize, ShapeScene* ss) {
1181  pd_ = pd;
1182  old_ = NULL; // not referenced
1183  xsize_ = xsize/2;
1184  ysize_ = ysize/2;
1185  ss_ = ss;
1186  Oc oc;
1187  oc.notify_when_freed(pd_, this);
1188 }
1189 Hinton::~Hinton() {
1190  Oc oc;
1191  oc.notify_pointer_disconnect(this);
1192 }
1193 void Hinton::update(Observable*) {
1194  pd_ = NULL;
1195  ss_->remove(ss_->glyph_index(this));
1196 }
1197 void Hinton::request(Requisition& req) const {
1198  assert(this);
1199  Requirement rx(2.*xsize_, 0, 0, .5);
1200  Requirement ry(2.*ysize_, 0, 0, .5);
1201  req.require_x(rx);
1202  req.require_y(ry);
1203 }
1204 
1205 void Hinton::allocate(Canvas* c, const Allocation& a, Extension& ext) {
1206  ext.set(c, a);
1207 }
1208 
1209 void Hinton::draw(Canvas* c, const Allocation& a) const {
1210  if (pd_) {
1211  Coord x = a.x();
1212  Coord y = a.y();
1213  const Color* color = ss_->color_value()->get_color(*pd_);
1214  c->fill_rect(x - xsize_, y - ysize_, x + xsize_, y + ysize_, color);
1215  ((Hinton*)this)->old_ = color;
1216  IfIdraw(rect(c, x - xsize_, y - ysize_, x + xsize_, y + ysize_, color, NULL, true));
1217  }
1218 }
1219 void Hinton::fast_draw(Canvas* c, Coord x, Coord y, bool) const {
1220  if (pd_) {
1221  const Color* color = ss_->color_value()->get_color(*pd_);
1222  if (color != old_) {
1223  c->fill_rect(x - xsize_, y - ysize_, x + xsize_, y + ysize_, color);
1224  ((Hinton*)this)->old_ = color;
1225  }
1226  }
1227 }
1228 
1229 bool ShapePlot::has_iv_view() {
1230  return has_iv_view_;
1231 }
1232 
1233 #endif //HAVE_IV
1234 
1236  sym_ = sym;
1237  sl_ = sl;
1238  if (sl_) {
1239  ++sl_->refcount;
1240  }
1241  varobj(NULL);
1242 }
1243 
1245  if (sl_) {
1247  }
1248 }
1249 
1251  return false;
1252 }
1253 
1255  return lo;
1256 }
1257 
1259  return hi;
1260 }
1261 
1262 void ShapePlotData::scale(float min, float max) {
1263  lo = min;
1264  hi = max;
1265 }
1266 
1268  sym_ = sym;
1269  scale(-80, 40);
1270 }
1271 
1272 const char* ShapePlotData::varname() const {
1273  if (sym_ == NULL) {
1274  return "v";
1275  }
1276  return sym_->name;
1277 }
1278 
1280  return sl_;
1281 }
o
Definition: seclist.cpp:180
virtual void * varobj() const
Definition: shapeplt.cpp:419
FastGraphItem(FastShape *g, bool save=true, bool pick=true)
Object * sl_
Definition: shapeplt.h:44
virtual void damage_all()
char * hoc_section_pathname(Section *sec)
Definition: cabcode.cpp:1846
static ostream * idraw_stream
Definition: idraw.h:47
void PlotShape_reg()
Definition: shapeplt.cpp:414
Definition: hocdec.h:84
Object ** nrniv_sh_nearest_seg(void *)
Definition: shape.cpp:277
static double fast_flush(void *v)
Definition: shapeplt.cpp:60
double ivoc_gr_begin_line(void *)
Definition: graph.cpp:671
double max(double a, double b)
Definition: geometry3d.cpp:22
#define assert(ex)
Definition: hocassrt.h:26
virtual Coord bottom() const
double ivoc_erase_all(void *)
Definition: graph.cpp:741
static bool helpmode()
Definition: ivoc.h:66
void set(Canvas *, const Allocation &)
Coord x() const
Definition: geometry.h:290
void execute(Inst *p)
Definition: code.cpp:2651
#define TRY_GUI_REDIRECT_NO_RETURN(name, obj)
Definition: gui-redirect.h:44
static double sh_view_count(void *v)
Definition: shapeplt.cpp:173
#define WidgetKit
Definition: _defines.h:331
virtual ~ShapePlotData()
Definition: shapeplt.cpp:1244
static double sh_variable(void *v)
Definition: shapeplt.cpp:116
#define min(a, b)
Definition: matrix.h:157
Definition: ivoc.h:36
#define g
Definition: passive0.cpp:23
double nrn_arc_position(Section *sec, Node *node)
Definition: cabcode.cpp:1880
#define Glyph
Definition: _defines.h:132
#define Coord
Definition: _defines.h:19
void
static Member_ret_obj_func retobj_members[]
Definition: shapeplt.cpp:337
size_t p
#define Color
Definition: _defines.h:74
static double sh_show(void *v)
Definition: shapeplt.cpp:216
const char * expand_env_var(const char *s)
Definition: fileio.cpp:146
virtual Coord top() const
static void help(const char *)
double ivoc_gr_menu_action(void *v)
Definition: graph.cpp:308
static void update(NrnThread *)
Definition: fadvance.cpp:570
static double sh_save_name(void *v)
Definition: shapeplt.cpp:184
check_obj_type(o, "SectionList")
char * name
Definition: model.h:72
#define IfIdraw(arg)
Definition: idraw.h:61
static double location(void *v)
Definition: impedanc.cpp:82
double ivoc_gr_line(void *)
Definition: graph.cpp:694
double nrniv_sh_color_all(void *)
Definition: shape.cpp:386
#define v
Definition: md1redef.h:4
Coord y() const
Definition: geometry.h:291
virtual void ref() const
Definition: resource.cpp:47
#define PolyGlyph
Definition: _defines.h:207
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
ColorPalette * colors
#define TRY_GUI_REDIRECT_ACTUAL_DOUBLE(name, obj)
Definition: gui-redirect.h:66
Section * section() const
#define e
Definition: passive0.cpp:24
virtual void draw(Canvas *, const Allocation &) const
#define gargstr
Definition: hocdec.h:14
double * hoc_pgetarg(int narg)
Definition: code.cpp:1604
const char * string() const
Definition: string.h:139
virtual bool is_fast()
Definition: graph.h:41
void update_ptrs()
bool var_pair_chooser(const char *, float &x, float &y, Window *w=NULL, Coord x1=400., Coord y1=400.)
float hi
Definition: shapeplt.h:43
virtual void get_line(Coord &x1, Coord &y1, Coord &x2, Coord &y2) const
static void * sh_cons(Object *ho)
Definition: shapeplt.cpp:343
int refcount
Definition: hocdec.h:227
sl
Definition: seclist.cpp:186
double ivoc_gr_label(void *)
Definition: graph.cpp:842
double nrniv_sh_nearest(void *)
Definition: shape.cpp:250
void(* nrnpy_decref)(void *pyobj)=0
Definition: shapeplt.cpp:47
int const size_t const size_t n
Definition: nrngsl.h:12
#define color
Definition: rbtqueue.cpp:50
static double sh_hinton(void *v)
Definition: shapeplt.cpp:252
void notify_pointer_disconnect(Observer *)
_CONST char * s
Definition: system.cpp:74
Coord top() const
Definition: geometry.h:295
virtual void damage(Glyph *, const Allocation &, bool fixed=false, bool viewfixed=false)
double ivoc_gr_gif(void *)
Definition: graph.cpp:753
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
Definition: hoc_oop.cpp:1581
double ivoc_gr_mark(void *)
Definition: graph.cpp:1003
virtual Coord left() const
int val
Definition: dll.cpp:167
static double sh_unmap(void *v)
Definition: shapeplt.cpp:194
#define printf
Definition: mwprefix.h:26
Object ** nrniv_sh_selected_seg(void *)
Definition: shape.cpp:296
double nrniv_len_scale(void *)
Definition: shape.cpp:490
static double sh_printfile(void *v)
Definition: shapeplt.cpp:205
Symbol * sym_
Definition: shapeplt.h:42
int
Definition: nrnmusic.cpp:71
Coord left() const
Definition: geometry.h:292
#define LayoutKit
Definition: _defines.h:161
static XYView * current_draw_view()
#define GlyphIndex
Definition: _defines.h:23
#define ENDGUI
Definition: hocdec.h:352
virtual bool has_iv_view()
Definition: shapeplt.cpp:1250
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:741
#define cnt
Definition: spt2queue.cpp:19
#define Canvas
Definition: _defines.h:65
void require_y(const Requirement &)
Definition: geometry.h:248
#define SPACE
Definition: fmenu.cpp:131
double nrniv_sh_color(void *)
Definition: shape.cpp:366
void hoc_dec_refcount(Object **pobj)
Definition: hoc_oop.cpp:1986
static double sh_scale(void *v)
Definition: shapeplt.cpp:75
double ivoc_gr_menu_tool(void *)
Definition: graph.cpp:326
double nrniv_sh_rotate(void *)
Definition: shape.cpp:335
double nrniv_sh_observe(void *)
Definition: shape.cpp:314
Definition: model.h:57
virtual void scale(float min, float max)
Definition: shapeplt.cpp:1262
double nrn_section_orientation(Section *sec)
Definition: cabcode.cpp:1651
virtual void unref() const
Definition: resource.cpp:52
char * name
Definition: init.cpp:16
ShapePlotData(Symbol *=NULL, Object *=NULL)
Definition: shapeplt.cpp:1235
virtual void variable(Symbol *)
Definition: shapeplt.cpp:1267
static void rect(Canvas *, Coord x1, Coord y1, Coord x2, Coord y2, const Color *c=NULL, const Brush *b=NULL, bool fill=false)
static double s_colormap(void *v)
Definition: shapeplt.cpp:229
Coord bottom() const
Definition: geometry.h:294
#define Event
Definition: _defines.h:107
virtual float low()
Definition: shapeplt.cpp:1254
Symlist * hoc_built_in_symlist
Definition: symbol.cpp:39
virtual void erase_all()
double(* nrnpy_object_to_double_)(Object *)
Definition: xmenu.cpp:14
static uint32_t value
Definition: scoprand.cpp:26
int ifarg(int)
Definition: code.cpp:1562
virtual const char * varname() const
Definition: shapeplt.cpp:1272
#define ColorIntensity
Definition: _defines.h:17
#define lookup
Definition: redef.h:90
float lo
Definition: shapeplt.h:43
static double sh_begin(void *v)
Definition: shapeplt.cpp:70
static void sh_destruct(void *v)
Definition: shapeplt.cpp:389
double ivoc_gr_erase(void *)
Definition: graph.cpp:729
void require_x(const Requirement &)
Definition: geometry.h:247
#define TRY_GUI_REDIRECT_OBJ(name, obj)
Definition: gui-redirect.h:12
virtual Object * neuron_section_list()
Definition: shapeplt.cpp:1279
Canvas * canvas()
static ShapeScene * current_pick_scene()
#define Transformer
Definition: _defines.h:316
static void pict()
void notify_when_freed(void *p, Observer *)
Object * nrn_object()
Definition: ndatclas.cpp:263
virtual void setColor(const Color *, ShapeScene *)
Coord right() const
Definition: geometry.h:293
static int component(PyHocObject *po)
Definition: nrnpy_hoc.cpp:448
#define RubberLine
Definition: _defines.h:237
Definition: hocdec.h:226
virtual void clear_variable()
#define getarg
Definition: hocdec.h:15
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:60
virtual float high()
Definition: shapeplt.cpp:1258
#define i
Definition: md1redef.h:12
static double sh_view(void *v)
Definition: shapeplt.cpp:95
#define c
virtual const String * selected() const
void * py_var_
Definition: shapeplt.h:45
sec
Definition: solve.cpp:885
Definition: graph.h:329
#define Window
Definition: _defines.h:333
char buf[512]
Definition: init.cpp:13
#define Style
Definition: _defines.h:281
static double exec_menu(void *v)
Definition: shapeplt.cpp:271
static void text(Canvas *, const char *, const Transformer &, const Font *f=NULL, const Color *c=NULL)
double ivoc_gr_size(void *)
Definition: graph.cpp:789
int hoc_is_object_arg(int narg)
Definition: code.cpp:745
virtual ~FastShape()
double hoc_ac_
Definition: hoc_init.cpp:261
#define MonoGlyph
Definition: _defines.h:181
double nrniv_sh_color_list(void *)
Definition: shape.cpp:399
#define Background
Definition: _defines.h:43
#define IFGUI
Definition: hocdec.h:351
double t
Definition: init.cpp:123
static XYView * current_pick_view()
int run(int argc, const char **argv)
double nrniv_sh_push(void *)
Definition: shape.cpp:261
static void end()
Object ** hoc_objgetarg(int)
Definition: code.cpp:1568
virtual Coord right() const
FILE * fopen()
static double sh_flush(void *v)
Definition: shapeplt.cpp:50
const Color * color(int) const
return NULL
Definition: cabcode.cpp:461
Node * node_exact(Section *sec, double x)
Definition: cabcode.cpp:1956
double chkarg(int, double low, double high)
Definition: code2.cpp:608
static Member_func sh_members[]
Definition: shapeplt.cpp:301
virtual void set_range_variable(Symbol *)
virtual void observe(SectionList *=NULL)
void *(* nrnpy_get_pyobj)(Object *obj)=0
Definition: shapeplt.cpp:46