NEURON
symchoos.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 /*
3  * Copyright (c) 1991 Stanford University
4  * Copyright (c) 1991 Silicon Graphics, Inc.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and
7  * its documentation for any purpose is hereby granted without fee, provided
8  * that (i) the above copyright notices and this permission notice appear in
9  * all copies of the software and related documentation, and (ii) the names of
10  * Stanford and Silicon Graphics may not be used in any advertising or
11  * publicity relating to the software without the specific, prior written
12  * permission of Stanford and Silicon Graphics.
13  *
14  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17  *
18  * IN NO EVENT SHALL STANFORD OR SILICON GRAPHICS BE LIABLE FOR
19  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23  * OF THIS SOFTWARE.
24  */
25 
26 /* hacked by Michael Hines from filechooser.cpp */
27 
28 /*
29  * SymChooser -- select a name
30  */
31 
32 #if HAVE_IV
33 
34 #include <IV-look/choice.h>
35 #include <IV-look/dialogs.h>
36 #include <IV-look/fbrowser.h>
37 #include <IV-look/kit.h>
38 #include <InterViews/action.h>
39 #include <InterViews/event.h>
40 #include <InterViews/font.h>
41 #include <InterViews/hit.h>
42 #include <InterViews/input.h>
43 #include <InterViews/layout.h>
44 #include <InterViews/scrbox.h>
45 #include <InterViews/style.h>
46 #include <InterViews/target.h>
47 #include <InterViews/session.h>
48 #include <InterViews/display.h>
49 #include <OS/string.h>
50 #include <stdio.h>
51 
52 #include "symchoos.h"
53 #include "utility.h"
54 #include "symdir.h"
55 
56 #include "oc2iv.h"
57 #include "parse.hpp"
58 #include "ivoc.h"
59 #endif /* HAVE_IV */
60 
61 #include "classreg.h"
62 #include "gui-redirect.h"
63 
64 #if HAVE_IV
65 
66 class SymChooserImpl {
67  private:
68  friend class SymChooser;
69  friend class SymBrowserAccept;
70  SymChooserImpl(int nbrowser);
71  ~SymChooserImpl();
72 
73  WidgetKit* kit_;
74  SymChooser* fchooser_;
75  int nbrowser_;
76  int browser_index_;
77  FileBrowser** fbrowser_;
78  FieldEditor* editor_;
79  FieldEditor* filter_;
80  FieldEditor* directory_filter_;
81  int* filter_map_;
82  SymDirectory** dir_;
83  SymChooserAction* action_;
84  std::string selected_;
85  CopyString last_selected_;
86  int last_index_;
87  Style* style_;
88  Action* update_;
89 
91  void scfree();
92  void build();
93  Menu* makeshowmenu();
94  void clear(int);
95  void load(int);
96  void show(int);
97  void show_all();
98  void show_var();
99  void show_objid();
100  void show_objref();
101  void show_sec();
102  void show_pysec();
103  double* selected_var();
104  int selected_vector_count();
105  FieldEditor* add_filter(Style*,
106  const char* pattern_attribute,
107  const char* default_pattern,
108  const char* caption_attribute,
109  const char* default_caption,
110  Glyph*,
112  bool filtered(const String&, FieldEditor*);
113  void accept_browser();
114  void accept_browser_index(int);
115  void cancel_browser();
116  void editor_accept(FieldEditor*);
117  void filter_accept(FieldEditor*);
118  bool chdir(int, int);
119 };
120 
121 /*static*/ class SymBrowserAccept: public Action {
122  public:
123  SymBrowserAccept(SymChooserImpl*, int);
124  virtual ~SymBrowserAccept();
125  virtual void execute();
126 
127  private:
128  SymChooserImpl* sci_;
129  int browser_index_;
130 };
131 
132 SymBrowserAccept::SymBrowserAccept(SymChooserImpl* sci, int browser_index) {
133  sci_ = sci;
134  browser_index_ = browser_index;
135 }
136 
137 SymBrowserAccept::~SymBrowserAccept() {}
138 
139 void SymBrowserAccept::execute() {
140  sci_->accept_browser_index(browser_index_);
141 }
142 #endif /* HAVE_IV */
143 
144 static void* scons(Object*) {
145  TRY_GUI_REDIRECT_OBJ("SymChooser", NULL);
146 #if HAVE_IV
147  SymChooser* sc = NULL;
148  if (hoc_usegui) {
149  const char* caption = "Choose a Variable Name or";
150  if (ifarg(1)) {
151  caption = gargstr(1);
152  }
153  Style* style = new Style(Session::instance()->style());
154  style->attribute("caption", caption);
155  if (ifarg(2)) {
156  Symbol* sym = hoc_lookup(gargstr(2));
157  int type = RANGEVAR;
158  if (sym) {
159  type = sym->type;
160  }
161  sc = new SymChooser(new SymDirectory(type), WidgetKit::instance(), style, NULL, 1);
162  } else {
163  sc = new SymChooser(NULL, WidgetKit::instance(), style);
164  }
165  Resource::ref(sc);
166  }
167  return (void*) sc;
168 #else
169  return nullptr;
170 #endif /* HAVE_IV */
171 }
172 static void sdestruct(void* v) {
173  TRY_GUI_REDIRECT_NO_RETURN("~SymChooser", v);
174 #if HAVE_IV
175  SymChooser* sc = (SymChooser*) v;
176  Resource::unref(sc);
177 #endif /* HAVE_IV */
178 }
179 static double srun(void* v) {
180  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("SymChooser.run", v);
181 #if HAVE_IV
182  bool b = false;
183  if (hoc_usegui) {
184  SymChooser* sc = (SymChooser*) v;
185  Display* d = Session::instance()->default_display();
186  Coord x, y;
187  if (nrn_spec_dialog_pos(x, y)) {
188  b = sc->post_at_aligned(x, y, 0.0, 0.0);
189  } else {
190  b = sc->post_at_aligned(d->width() / 2, d->height() / 2, .5, .5);
191  }
192  }
193  return double(b);
194 #else
195  return 0.;
196 #endif /* HAVE_IV */
197 }
198 static double text(void* v) {
199  TRY_GUI_REDIRECT_ACTUAL_DOUBLE("SymChooser.text", v);
200 #if HAVE_IV
201  if (hoc_usegui) {
202  SymChooser* sc = (SymChooser*) v;
203  hoc_assign_str(hoc_pgargstr(1), sc->selected().c_str());
204  }
205  return 0.;
206 #else
207  return 0.;
208 #endif /* HAVE_IV */
209 }
210 static Member_func members[] = {{"run", srun}, {"text", text}, {nullptr, nullptr}};
212  class2oc("SymChooser", scons, sdestruct, members, nullptr, nullptr);
213 }
214 #if HAVE_IV
215 
216 declareActionCallback(SymChooserImpl)
217 implementActionCallback(SymChooserImpl)
218 
219 declareFieldEditorCallback(SymChooserImpl)
220 implementFieldEditorCallback(SymChooserImpl)
221 #define SHOW_SECTION 1
222 
224  WidgetKit* kit,
225  Style* s,
226  SymChooserAction* a,
227  int nbrowser)
228  : Dialog(NULL, s) {
229  impl_ = new SymChooserImpl(nbrowser);
230  SymChooserImpl& fc = *impl_;
231  if (dir) {
232  fc.dir_[0] = dir;
233  } else {
234 #if SHOW_SECTION
235  fc.dir_[0] = new SymDirectory(SECTION);
236 #else
237  fc.dir_[0] = new SymDirectory(-1);
238 #endif
239  }
240  Resource::ref(dir);
241  fc.kit_ = kit;
242  fc.init(this, s, a);
243 }
244 
246  impl_->scfree();
247  delete impl_;
248 }
249 
250 const std::string& SymChooser::selected() const {
251  return impl_->selected_;
252 }
253 
254 double* SymChooser::selected_var() {
255  return impl_->selected_var();
256 }
257 
259  return impl_->selected_vector_count();
260 }
261 
262 void SymChooser::reread() {
263  SymChooserImpl& fc = *impl_;
264 #if 0
265  if (!fc.chdir(fc.dir_->path())) {
266  /* should generate an error message */
267  }
268 #endif
269 }
270 
271 void SymChooser::dismiss(bool accept) {
272  Dialog::dismiss(accept);
273  SymChooserImpl& fc = *impl_;
274  if (fc.action_ != NULL) {
275  fc.action_->execute(this, accept);
276  }
277 }
278 
279 /** class SymChooserImpl **/
280 SymChooserImpl::SymChooserImpl(int nbrowser) {
281  nbrowser_ = nbrowser;
282  dir_ = new SymDirectory*[nbrowser];
283  fbrowser_ = new FileBrowser*[nbrowser];
284  last_index_ = -1;
285  for (int i = 0; i < nbrowser_; ++i) {
286  dir_[i] = NULL;
287  fbrowser_[i] = NULL;
288  }
289 }
290 SymChooserImpl::~SymChooserImpl() {
291  delete[] dir_;
292  delete[] fbrowser_;
293 }
294 
296  fchooser_ = chooser;
297  filter_map_ = NULL;
298  Resource::ref(a);
299  action_ = a;
300  style_ = new Style(s);
301  Resource::ref(style_);
302  style_->alias("FileChooser");
303  style_->alias("Dialog");
304  update_ = new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::build);
305  style_->add_trigger_any(update_);
306  build();
307 }
308 
309 void SymChooserImpl::scfree() {
310  for (int i = nbrowser_ - 1; i >= 0; --i) {
311  Resource::unref(dir_[i]);
312  }
313  delete[] filter_map_;
314  Resource::unref(action_);
315  style_->remove_trigger_any(update_);
316  Resource::unref(style_);
317 }
318 
319 void SymChooserImpl::build() {
320  WidgetKit& kit = *kit_;
321  const LayoutKit& layout = *LayoutKit::instance();
322  Style* s = style_;
323  kit.push_style();
324  kit.style(s);
325  String caption("");
326  s->find_attribute("caption", caption);
327  String subcaption("Enter Symbol name:");
328  s->find_attribute("subcaption", subcaption);
329  String open("Accept");
330  s->find_attribute("open", open);
331  String close("Cancel");
332  s->find_attribute("cancel", close);
333  long rows = 10;
334  s->find_attribute("rows", rows);
335  const Font* f = kit.font();
336  FontBoundingBox bbox;
337  f->font_bbox(bbox);
338  Coord height = rows * (bbox.ascent() + bbox.descent()) + 1.0;
339  Coord width;
340  if (!s->find_attribute("width", width)) {
341  width = 16 * f->width('m') + 3.0;
342  }
343 
344  int i;
345  Action* accept = new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::accept_browser);
346  Action* cancel = new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::cancel_browser);
347  editor_ = DialogKit::instance()->field_editor(
348  "", s, new FieldEditorCallback(SymChooserImpl)(this, &SymChooserImpl::editor_accept, NULL));
349  browser_index_ = 0;
350  for (i = 0; i < nbrowser_; ++i) {
351  fbrowser_[i] = new FileBrowser(kit_, new SymBrowserAccept(this, i), NULL);
352  }
353  fchooser_->remove_all_input_handlers();
354  fchooser_->append_input_handler(editor_);
355  for (i = 0; i < nbrowser_; ++i) {
356  fchooser_->append_input_handler(fbrowser_[i]);
357  }
358  fchooser_->next_focus();
359 
360  Glyph* g = layout.vbox();
361  if (caption.length() > 0) {
362  g->append(layout.r_margin(kit.fancy_label(caption), 5.0, fil, 0.0));
363  }
364  if (subcaption.length() > 0) {
365  g->append(layout.r_margin(kit.fancy_label(subcaption), 5.0, fil, 0.0));
366  }
367  g->append(layout.vglue(5.0, 0.0, 2.0));
368  g->append(editor_);
369  g->append(layout.vglue(5.0, 0.0, 2.0));
370  g->append(makeshowmenu());
371  g->append(layout.vglue(15.0, 0.0, 12.0));
372  PolyGlyph* h = layout.hbox(nbrowser_);
373  Glyph* b;
374  for (i = 0; i < nbrowser_; ++i) {
375  b = layout.hbox(layout.vcenter(kit.inset_frame(layout.margin(
376  layout.natural_span(fbrowser_[i], width, height), 1.0)),
377  1.0),
378  layout.hspace(4.0),
379  kit.vscroll_bar(fbrowser_[i]->adjustable()));
380  h->append(b);
381  }
382  g->append(h);
383  g->append(layout.vspace(15.0));
384  if (s->value_is_on("filter")) {
385  FieldEditorAction* action = new FieldEditorCallback(
386  SymChooserImpl)(this, &SymChooserImpl::filter_accept, NULL);
387  filter_ = add_filter(s, "filterPattern", "", "filterCaption", "Filter:", g, action);
388  if (s->value_is_on("directoryFilter")) {
389  directory_filter_ = add_filter(s,
390  "directoryFilterPattern",
391  "",
392  "directoryFilterCaption",
393  "Name Filter:",
394  g,
395  action);
396  } else {
397  directory_filter_ = NULL;
398  }
399  } else {
400  filter_ = NULL;
401  directory_filter_ = NULL;
402  }
403  g->append(layout.hbox(layout.hglue(10.0),
404  layout.vcenter(kit.default_button(open, accept)),
405  layout.hglue(10.0, 0.0, 5.0),
406  layout.vcenter(kit.push_button(close, cancel)),
407  layout.hglue(10.0)));
408 
409  fchooser_->body(layout.vcenter(kit.outset_frame(layout.margin(g, 5.0)), 1.0));
410  kit.pop_style();
411  load(0);
412 }
413 
414 Menu* SymChooserImpl::makeshowmenu() {
415  WidgetKit& k = *WidgetKit::instance();
416  Menu* mb = k.menubar();
417  MenuItem* mi = k.menubar_item("Show");
418  mb->append_item(mi);
419  Menu* mp = k.pulldown();
420  mi->menu(mp);
421  TelltaleGroup* ttg = new TelltaleGroup();
422 
423  mi = K::radio_menu_item(ttg, "All");
424  mi->action(new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::show_all));
425  mp->append_item(mi);
426  mi->state()->set(TelltaleState::is_chosen, true);
427 
428  mi = K::radio_menu_item(ttg, "Variables");
429  mi->action(new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::show_var));
430  mp->append_item(mi);
431 
432  mi = K::radio_menu_item(ttg, "Object refs");
433  mi->action(new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::show_objref));
434  mp->append_item(mi);
435 
436  mi = K::radio_menu_item(ttg, "Objects");
437  mi->action(new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::show_objid));
438  mp->append_item(mi);
439 
440  mi = K::radio_menu_item(ttg, "Sections");
441  mi->action(new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::show_sec));
442  mp->append_item(mi);
443 #if SHOW_SECTION
444  mi->state()->set(TelltaleState::is_chosen, true);
445 #endif
446  mi = K::radio_menu_item(ttg, "Python Sections");
447  mi->action(new ActionCallback(SymChooserImpl)(this, &SymChooserImpl::show_pysec));
448  mp->append_item(mi);
449 
450  return mb;
451 }
452 
453 void SymChooserImpl::show(int i) {
454  Resource::unref(dir_[0]);
455  dir_[0] = new SymDirectory(i);
456  clear(0);
457  load(0);
458 }
459 
460 void SymChooserImpl::show_all() {
461  show(-1);
462 }
463 void SymChooserImpl::show_var() {
464  show(VAR);
465 }
466 void SymChooserImpl::show_objref() {
467  show(OBJECTVAR);
468 }
469 void SymChooserImpl::show_objid() {
470  show(TEMPLATE);
471 }
472 void SymChooserImpl::show_sec() {
473  show(SECTION);
474 }
475 void SymChooserImpl::show_pysec() {
476  show(PYSEC);
477 }
478 
479 void SymChooserImpl::clear(int bindex) {
480  for (int bi = bindex; bi < nbrowser_; ++bi) {
481  // printf("clearing %d\n", bi);
482  FileBrowser& b = *fbrowser_[bi];
483  b.select(-1);
484  GlyphIndex n = b.count();
485  for (GlyphIndex i = 0; i < n; i++) {
486  b.remove_selectable(0);
487  b.remove(0);
488  }
489  b.refresh();
490  // b.undraw(); // with this the slider gets changed. albeit the mouse has
491  // to run over it. But the new load doesn't appear til
492  // the mouse runs over it
493  }
494 }
495 
496 void SymChooserImpl::load(int bindex) {
497  SymDirectory& d = *dir_[bindex];
498  Browser& b = *fbrowser_[bindex];
499  WidgetKit& kit = *kit_;
500  kit.push_style();
501  kit.style(style_);
502  const LayoutKit& layout = *LayoutKit::instance();
503  int dircount = d.count();
504  delete[] filter_map_;
505  int* index = new int[dircount];
506  filter_map_ = index;
507  // printf("loading %d\n", bindex);
508  for (int i = 0; i < dircount; i++) {
509  const String& f = d.name(i).c_str();
510  bool is_dir = d.is_directory(i);
511  if ((is_dir && filtered(f, directory_filter_)) || (!is_dir && filtered(f, filter_))) {
512  Glyph* name = kit.label(f);
513  if (is_dir) {
514  if (d.symbol(i) && d.symbol(i)->type == TEMPLATE) {
515  name = layout.hbox(name, kit.label("_"));
516  } else {
517  name = layout.hbox(name, kit.label("."));
518  }
519  }
520  Glyph* label = new Target(layout.h_margin(name, 3.0, 0.0, 0.0, 15.0, fil, 0.0),
521  TargetPrimitiveHit);
522  TelltaleState* t = new TelltaleState(TelltaleState::is_enabled);
523  b.append_selectable(t);
524  b.append(new ChoiceItem(t, label, kit.bright_inset_frame(label)));
525  *index++ = i;
526  }
527  }
528  // the order of the following two statements is important for carbon
529  // to avoid a premature browser request which ends up showing an
530  // empty list.
531  fbrowser_[bindex]->refresh();
532  editor_->field(d.path().c_str());
533  kit.pop_style();
534 }
535 
536 FieldEditor* SymChooserImpl::add_filter(Style* s,
537  const char* pattern_attribute,
538  const char* default_pattern,
539  const char* caption_attribute,
540  const char* default_caption,
541  Glyph* body,
542  FieldEditorAction* action) {
543  String pattern(default_pattern);
544  s->find_attribute(pattern_attribute, pattern);
545  String caption(default_caption);
546  s->find_attribute(caption_attribute, caption);
547  FieldEditor* e = DialogKit::instance()->field_editor(pattern, s, action);
548  fchooser_->append_input_handler(e);
549  WidgetKit& kit = *kit_;
550  LayoutKit& layout = *LayoutKit::instance();
551  body->append(layout.hbox(layout.vcenter(kit.fancy_label(caption), 0.5),
552  layout.hspace(2.0),
553  layout.vcenter(e, 0.5)));
554  body->append(layout.vspace(10.0));
555  return e;
556 }
557 
558 bool SymChooserImpl::filtered(const String& name, FieldEditor* e) {
559  if (e == NULL) {
560  return true;
561  }
562  const String* s = e->text();
563  if (s == NULL || s->length() == 0) {
564  return true;
565  }
566  return s == NULL || s->length() == 0 || SymDirectory::match(name.string(), s->string());
567 }
568 
569 void SymChooserImpl::accept_browser_index(int bindex) {
570  int i = int(fbrowser_[bindex]->selected());
571  if (i == -1) {
572  return;
573  }
574  // i = filter_map_[i];
575  SymDirectory* dir = dir_[bindex];
576  const String& path = dir->path().c_str();
577  const String& name = dir->name(i).c_str();
578  Symbol* sym = dir->symbol(i);
579  int length = path.length() + name.length();
580  auto const tmp_len = length + 2;
581  char* tmp = new char[tmp_len];
582  std::snprintf(
583  tmp, tmp_len, "%.*s%.*s", path.length(), path.string(), name.length(), name.string());
584  editor_->field(tmp);
585  last_selected_ = tmp;
586  last_index_ = i;
587  selected_ = editor_->text()->string();
588  if (dir->is_directory(i)) {
589  if (chdir(bindex, i)) {
590  fchooser_->focus(editor_);
591  } else {
592  /* should generate an error message */
593  }
594  } else {
595  clear(bindex + 1);
596  browser_index_ = bindex;
597  // fchooser_->dismiss(true);
598  }
599  delete[] tmp;
600 }
601 
602 double* SymChooserImpl::selected_var() {
603  if (last_index_ != -1 && selected_ == last_selected_.string()) {
604  SymDirectory* dir = dir_[browser_index_];
605  return dir->variable(last_index_);
606  } else {
607  return NULL;
608  }
609 }
610 
611 int SymChooserImpl::selected_vector_count() {
612  if (last_index_ != -1 && selected_ == last_selected_.string()) {
613  SymDirectory* dir = dir_[browser_index_];
614  return dir->whole_vector(last_index_);
615  } else {
616  return 0;
617  }
618 }
619 
620 void SymChooserImpl::accept_browser() {
621  int bi = browser_index_;
622  int i = int(fbrowser_[bi]->selected());
623  if (i == -1) {
624  editor_accept(editor_);
625  return;
626  }
627  // i = filter_map_[i];
628  const String& path = dir_[bi]->path().c_str();
629  const String& name = dir_[bi]->name(i).c_str();
630  int length = path.length() + name.length();
631  char* tmp = new char[length + 1];
632  std::snprintf(
633  tmp, length + 1, "%.*s%.*s", path.length(), path.string(), name.length(), name.string());
634  // printf("accept_browser %s\n", tmp);
635  editor_->field(tmp);
636  selected_ = editor_->text()->string();
637  if (dir_[bi]->is_directory(i)) {
638  if (chdir(bi, i)) {
639  fchooser_->focus(editor_);
640  } else {
641  /* should generate an error message */
642  }
643  } else {
644  fchooser_->dismiss(true);
645  }
646  delete[] tmp;
647 }
648 
649 void SymChooserImpl::cancel_browser() {
650  selected_.clear();
651  fchooser_->dismiss(false);
652 }
653 
654 void SymChooserImpl::editor_accept(FieldEditor* e) {
655  if (int i = dir_[browser_index_]->index(e->text()->string()); i >= 0) {
656  if (!chdir(browser_index_, i)) {
657  selected_ = dir_[browser_index_]->name(i);
658  fchooser_->dismiss(true);
659  }
660  return;
661  } else {
662  selected_ = e->text()->string();
663  fchooser_->dismiss(true);
664  }
665 }
666 
667 void SymChooserImpl::filter_accept(FieldEditor*) {
668  clear(0);
669  load(0);
670 }
671 
672 bool SymChooserImpl::chdir(int bindex, int index) {
673  if (dir_[bindex]->is_directory(index)) {
674  int bi;
675  SymDirectory* d;
676  if (dir_[bindex]->obj(index)) {
677  d = new SymDirectory(dir_[bindex]->obj(index));
678  bi = bindex;
679  } else if (dir_[bindex]->is_pysec(index)) {
680  d = dir_[bindex]->newsymdir(index);
681  bi = bindex + 1;
682  } else {
683  d = new SymDirectory(dir_[bindex]->path(),
684  dir_[bindex]->object(),
685  dir_[bindex]->symbol(index),
686  dir_[bindex]->array_index(index));
687  bi = bindex + 1;
688  }
689  if (bi > nbrowser_ - 1) {
690  bi = nbrowser_ - 1;
691  // rotate
692  }
693  Resource::ref(d);
694  browser_index_ = bi;
695  Resource::unref(dir_[bi]);
696  dir_[bi] = d;
697  clear(bi);
698  load(bi);
699  return true;
700  }
701  return false;
702 }
703 
704 /** class SymChooserAction **/
705 
709 #endif /* HAVE_IV */
#define TelltaleState
Definition: _defines.h:293
#define Menu
Definition: _defines.h:174
#define Target
Definition: _defines.h:289
#define FileBrowser
Definition: _defines.h:112
#define FontBoundingBox
Definition: _defines.h:119
#define Browser
Definition: _defines.h:55
#define Style
Definition: _defines.h:278
#define FieldEditorAction
Definition: _defines.h:110
#define Coord
Definition: _defines.h:17
#define Display
Definition: _defines.h:95
#define Dialog
Definition: _defines.h:92
#define WidgetKit
Definition: _defines.h:328
#define GlyphIndex
Definition: _defines.h:21
#define MenuItem
Definition: _defines.h:177
#define PolyGlyph
Definition: _defines.h:205
#define Font
Definition: _defines.h:118
#define ChoiceItem
Definition: _defines.h:70
#define TelltaleGroup
Definition: _defines.h:292
#define FieldEditor
Definition: _defines.h:109
#define LayoutKit
Definition: _defines.h:159
#define Action
Definition: _defines.h:25
#define Glyph
Definition: _defines.h:130
static MenuItem * radio_menu_item(TelltaleGroup *, const char *)
virtual void ref() const
Definition: resource.cpp:42
virtual void unref() const
Definition: resource.cpp:47
virtual void execute(SymChooser *, bool accept)
virtual ~SymChooserAction()
virtual void reread()
virtual void dismiss(bool)
virtual ~SymChooser()
virtual double * selected_var()
SymChooserImpl * impl_
Definition: symchoos.h:64
virtual const std::string & selected() const
virtual int selected_vector_count()
SymChooser(SymDirectory *, WidgetKit *, Style *, SymChooserAction *=NULL, int nbrowser=3)
virtual int count() const
Definition: symdir.cpp:282
virtual double * variable(int index)
Definition: symdir.cpp:224
virtual int whole_vector(int index)
Definition: symdir.cpp:275
static bool match(const std::string &name, const std::string &pattern)
Definition: symdir.cpp:308
Symbol * symbol(int index) const
Definition: symdir.cpp:311
SymDirectory * newsymdir(int index)
Definition: symdir.cpp:148
virtual const std::string & name(int index) const
Definition: symdir.cpp:285
virtual const std::string & path() const
Definition: symdir.cpp:279
virtual bool is_directory(int index) const
Definition: symdir.cpp:305
void class2oc(const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
Definition: hoc_oop.cpp:1631
char * gargstr(int narg)
Definition: code2.cpp:227
#define fil
Definition: coord.h:41
#define v
Definition: md1redef.h:11
#define i
Definition: md1redef.h:19
bool show
static RNG::key_type k
Definition: nrnran123.cpp:9
void hoc_assign_str(char **cpp, const char *buf)
Definition: code.cpp:2263
Symbol * hoc_lookup(const char *)
Definition: symbol.cpp:59
char ** hoc_pgargstr(int narg)
Definition: code.cpp:1623
#define TRY_GUI_REDIRECT_ACTUAL_DOUBLE(name, obj)
Definition: gui-redirect.h:55
#define TRY_GUI_REDIRECT_NO_RETURN(name, obj)
Definition: gui-redirect.h:40
#define TRY_GUI_REDIRECT_OBJ(name, obj)
Definition: gui-redirect.h:10
int hoc_usegui
Definition: hoc.cpp:121
void init()
Definition: init.cpp:141
const char * name
Definition: init.cpp:16
int const size_t const size_t n
Definition: nrngsl.h:10
s
Definition: multisend.cpp:521
int ifarg(int)
Definition: code.cpp:1607
short index
Definition: cabvars.h:11
short type
Definition: cabvars.h:10
static PyObject * is_pysec(NPySecObj *self)
Definition: nrnpy_nrn.cpp:1032
#define NULL
Definition: spdefs.h:105
Definition: hocdec.h:173
Definition: model.h:47
short type
Definition: model.h:48
void SymChooser_reg()
Definition: symchoos.cpp:211
static double text(void *v)
Definition: symchoos.cpp:198
static Member_func members[]
Definition: symchoos.cpp:210
static double srun(void *v)
Definition: symchoos.cpp:179
static void * scons(Object *)
Definition: symchoos.cpp:144
static void sdestruct(void *v)
Definition: symchoos.cpp:172
bool nrn_spec_dialog_pos(Coord &x, Coord &y)
true if Style 'dialog_spec_position: on' and fills x,y with dialog_left_position and dialog_bottom_po...