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