2 #include <../../nrnconf.h>
16 char** (*nrnpy_gui_helper3_str_)(
const char*
name,
Object* obj,
int handle_strptr) =
NULL;
27 #include <InterViews/box.h>
28 #include <IV-look/kit.h>
29 #include <InterViews/event.h>
30 #include <InterViews/layout.h>
31 #include <InterViews/style.h>
32 #include <InterViews/background.h>
33 #include <InterViews/border.h>
34 #include <InterViews/dialog.h>
35 #include <InterViews/printer.h>
37 #include <InterViews/transformer.h>
38 #include <InterViews/patch.h>
39 #include <InterViews/color.h>
40 #include <InterViews/telltale.h>
41 #include <InterViews/hit.h>
43 #include <InterViews/display.h>
61 virtual ~PanelInputHandler();
64 static bool has_old_focus() {
81 bool PanelInputHandler::sema_ =
false;
83 PanelInputHandler::PanelInputHandler(
Glyph*
g,
Style* s)
85 PanelInputHandler::~PanelInputHandler() {}
87 const Event*
e = h.event();
88 if (focus_ &&
e &&
e->type() ==
Event::key && focus_->handler()) {
89 h.target(depth,
this, 0, focus_->handler());
91 InputHandler::pick(
c, a, depth, h);
95 if (focus_ && focus_ != h) {
104 InputHandler::focus(h);
120 virtual ~ValEdLabel();
126 static const Color* color_;
131 const Color* ValEdLabel::color_;
133 ValEdLabel::ValEdLabel(
Glyph*
g)
137 color_ =
Color::lookup(Session::instance()->default_display(),
"yellow");
143 ValEdLabel::~ValEdLabel() {}
148 MonoGlyph::draw(
c, a);
150 void ValEdLabel::state(
bool s) {
161 static void hoc_ivpanelPlace(
Coord,
Coord,
int scroll = -1);
163 static String* xvalue_format;
165 #define Editor_Default "DefaultValueEditor"
166 #define Editor_Stepper "DefaultValueEditor"
183 h = (int)
chkarg(2, 0, 1) ? true :
false;
190 scroll = (int)
chkarg(3, -1, 1);
195 scroll = (int)
chkarg(1, -1, 1);
209 bool add2menubar =
false;
222 add2menubar = int(
chkarg(
i, 0, 1));
268 char *s1, *s2 = (
char*) 0;
301 char *s1, *s2 = (
char*) 0;
327 char *s1, *s2 = (
char*) 0;
353 static void hoc_xvalue_helper() {
385 bool canRun =
false, usepointer =
false;
420 bool usepointer =
false;
431 static void hoc_xpvalue_helper() {
476 hoc_xpvalue_helper();
509 float low = 0, high = 100;
510 float resolution = 1;
520 resolution = (high - low) / 100.;
533 vert = int(
chkarg(iarg, 0, 1));
537 slow = int(
chkarg(iarg, 0, 1));
551 class HocButton:
public Button {
554 virtual ~HocButton();
555 static HocButton* instance(
const char*,
Action*);
563 l_ = WidgetKit::instance()->label(
text);
566 HocButton::~HocButton() {
569 HocButton* HocButton::instance(
const char* s,
Action* a) {
570 Button* b = WidgetKit::instance()->push_button(s, a);
572 HocButton* hb =
new HocButton(s, b->body(), b->style(), b->state(), b->action());
581 static HocPanelList* hoc_panel_list;
582 static HocPanel* curHocPanel;
584 static void checkOpenPanel() {
595 return l_.count() == 0;
605 return (l_.count()) ? l_.item(0)->menu() :
NULL;
608 return (l_.count()) ? l_.item(0) :
NULL;
615 void MenuStack::push(
HocMenu* m) {
619 void MenuStack::clean() {
620 for (
long i = 0;
i < l_.count();
i++) {
625 static MenuStack* menuStack;
626 static Menu* hocmenubar;
631 virtual ~OcTelltaleGroup();
641 OcTelltaleGroup::OcTelltaleGroup() {
645 OcTelltaleGroup::~OcTelltaleGroup() {}
647 if (
t != current_ &&
t->test(TelltaleState::is_chosen)) {
648 previous_ = current_;
654 if (previous_ ==
t) {
664 previous_->set(TelltaleState::is_chosen,
true);
665 }
else if (current_) {
667 current_->set(TelltaleState::is_chosen,
false);
674 HocRadioAction(
const char* action, OcTelltaleGroup*,
Object* pyact =
NULL);
675 virtual ~HocRadioAction();
679 OcTelltaleGroup* tg_;
682 HocRadioAction::HocRadioAction(
const char* action, OcTelltaleGroup* tg,
Object* pyact)
688 HocRadioAction::~HocRadioAction() {
701 OcTelltaleGroup* group() {
711 HocRadio::HocRadio() {
714 HocRadio::~HocRadio() {
719 g_ =
new OcTelltaleGroup();
728 static HocRadio* hoc_radio;
732 hoc_radio =
new HocRadio();
735 fprintf(stderr,
"%s not closed\n", curHocPanel->getName());
739 curHocPanel->unref();
743 curHocPanel =
new HocPanel(
name, h);
751 curHocPanel->map_window(scroll);
752 curHocPanel->unref();
754 if (menuStack && !menuStack->isEmpty()) {
755 fprintf(stderr,
"%s menu not closed\n", menuStack->hoc_item()->getStr());
764 curHocPanel->left_ =
left;
765 curHocPanel->bottom_ = bottom;
772 if (menuStack && !menuStack->isEmpty()) {
773 menuStack->top()->append_item(curHocPanel->menuItem(
name, action,
false, pyact));
775 curHocPanel->pushButton(
name, action,
false, pyact);
787 if (menuStack && !menuStack->isEmpty()) {
788 menuStack->top()->append_item(curHocPanel->menuStateItem(pd,
name, action, pyvar, pyact));
790 curHocPanel->stateButton(pd,
name, action, style, pyvar, pyact);
796 if (!hoc_radio->group()) {
799 if (menuStack && !menuStack->isEmpty()) {
800 menuStack->top()->append_item(curHocPanel->menuItem(
name, action,
activate, pyact));
808 menuStack =
new MenuStack();
816 curHocPanel->itemAppend(
"xmenu()");
823 menuStack =
new MenuStack();
829 m->
item()->action(hma);
836 curHocPanel->valueEd(
name,
860 const char* variable,
883 if (!pvar && !pyvar) {
893 curHocPanel->valueEd(
name, variable, action, canrun, pvar, deflt,
false, xtra, pyvar, pyact);
904 curHocPanel->valueEd(
name, 0, action, canRun, pd, deflt,
false, extra);
910 curHocPanel->label(s);
916 curHocPanel->var_label(s, pyvar);
931 curHocPanel->slider(pd, low, high, resolution, nsteps, s, vert, slow, pyvar, pyact);
934 static char* hideQuote(
const char* s) {
935 static char buf[200];
941 for (cp1 = s; *cp1; cp1++, cp2++) {
951 static void saveMenuFile() {}
953 void HocPanel::save_all(ostream&) {
960 cnt = hoc_panel_list->count();
962 for (
i = 0;
i <
cnt; ++
i) {
963 hoc_panel_list->item(
i)->data_path(data_paths,
true);
967 for (
i = 0;
i <
cnt; ++
i) {
968 hoc_panel_list->item(
i)->data_path(data_paths,
false);
973 void HocPanel::update_ptrs() {
977 for (
i = 0;
i < hoc_panel_list->count(); ++
i) {
978 HocUpdateItemList& ul = hoc_panel_list->item(
i)->elist_;
979 for (
j = 0;
j < ul.count(); ++
j) {
980 ul.item(
j)->update_ptrs();
986 void HocPanel::mac_menubar() {
989 printf(
"menubar 0 %s\n", getName());
990 mac_menubar(mindex,
i, 0);
993 void HocPanel::mac_menubar(
int& mindex,
int&
i,
int m) {
996 while (
i < ilist_.count()) {
997 mr = ilist_.item(
i)->mac_menubar(mindex, m, mi);
1001 mac_menubar(mindex,
i, mr);
1002 }
else if (mr < m) {
1010 void HocPanel::map_window(
int scroll) {
1013 if (1 || maxcnt == -1) {
1015 Style* s = WidgetKit::instance()->style();
1016 s->find_attribute(
"panel_scroll", maxcnt);
1018 if ((scroll == -1 && box_->count() > maxcnt) || scroll == 1) {
1021 ScrollBox* vsb = lk.vscrollbox(box_->count());
1022 while (box_->count()) {
1023 vsb->append(box_->component(0));
1026 box_->append(lk.hbox(vsb, lk.hspace(4), wk.vscroll_bar(vsb)));
1030 w->style(
new Style(WidgetKit::instance()->style()));
1031 w->style()->attribute(
"name", getName());
1040 static void var_freed(
void* pd,
int size) {
1042 for (
long i = hoc_panel_list->count() - 1;
i >= 0; --
i) {
1043 hoc_panel_list->item(
i)->check_valid_pointers(pd, size);
1047 HocPanel::HocPanel(
const char*
name,
bool h)
1059 body(ih_ =
new PanelInputHandler(
1063 if (!hoc_panel_list) {
1064 hoc_panel_list =
new HocPanelList;
1068 hoc_panel_list->append(
this);
1075 HocPanel::~HocPanel() {
1078 for (
i = 0;
i < ilist_.count();
i++) {
1079 ilist_.item(
i)->HocItem::unref();
1081 for (
i = 0;
i < elist_.count();
i++) {
1082 elist_.item(
i)->HocItem::unref();
1084 for (
i = 0;
i < hoc_panel_list->count(); ++
i) {
1085 if (hoc_panel_list->item(
i) ==
this) {
1086 hoc_panel_list->remove(
i);
1090 ilist_.remove_all();
1091 elist_.remove_all();
1099 HocPanel::keep_updated(
this,
false);
1106 HocUpdateItemList* HocPanel::update_list_;
1108 void HocPanel::keep_updated() {
1110 if (update_list_ && (++
cnt % 10 == 0)) {
1111 long i,
cnt = update_list_->count();
1113 for (
i = 0;
i <
cnt; ++
i) {
1114 update_list_->item(
i)->update_hoc_item();
1119 if (!update_list_) {
1120 update_list_ =
new HocUpdateItemList();
1123 update_list_->append(hui);
1125 for (
long i = 0;
i < update_list_->count(); ++
i) {
1126 if (update_list_->item(
i) == hui) {
1127 update_list_->remove(
i);
1134 void HocPanel::paneltool(
const char*
name,
1141 HocCommandTool* hct =
new HocCommandTool(hc);
1143 if (selact || pyselact) {
1146 if (curHocPanel && (!menuStack || menuStack->isEmpty())) {
1148 curHocPanel->box()->append(b);
1154 void HocPanel::itemAppend(
const char* str) {
1155 item_append(
new HocItem(str));
1163 const char* HocPanel::getName() {
1164 return ilist_.item(0)->getStr();
1167 HocItem* HocPanel::hoc_item() {
1168 return ilist_.item(0);
1171 void HocPanel::pushButton(
const char*
name,
const char* action,
bool activate,
Object* pyact) {
1172 if (hoc_radio->group()) {
1173 HocRadioAction* a =
new HocRadioAction(action, hoc_radio->group(), pyact);
1174 Button* b = WidgetKit::instance()->radio_button(hoc_radio->group(),
name, a);
1179 tts->set(TelltaleState::is_chosen,
true);
1180 hoc_radio->group()->update(tts);
1184 box()->append(WidgetKit::instance()->push_button(
name, a));
1205 int HocPushButton::mac_menubar(
int&,
int m,
int mi) {
1206 printf(
"button item %d in menu %d \"%s\", \"%s\"\n", mi, m,
getStr(), hideQuote(
a_->
name()));
1228 int HocRadioButton::mac_menubar(
int&,
int m,
int mi) {
1229 printf(
"radio item %d in menu %d \"%s\", \"%s\"\n", mi, m,
getStr(), hideQuote(
a_->name()));
1234 void HocPanel::label(
const char*
name) {
1235 box()->append(LayoutKit::instance()->margin(WidgetKit::instance()->label(
name), 3));
1239 void HocPanel::var_label(
char**
name,
Object* pyvar) {
1247 void HocPanel::slider(
double* pd,
1257 OcSlider* s =
new OcSlider(pd, low, high, resolution, nsteps,
send, vert, slow, pyvar, pysend);
1261 wk->begin_style(
"SlowSlider");
1264 box()->append(lk->hflexible(WidgetKit::instance()->vscroll_bar(s->
adjustable())));
1266 box()->append(lk->hflexible(WidgetKit::instance()->hscroll_bar(s->
adjustable())));
1276 HocMenu* HocPanel::menu(
const char*
name,
bool add2menubar) {
1278 Menu* m = wk->pulldown();
1281 if (menuStack->isEmpty()) {
1292 box()->append(lk->hbox(m0, lk->hglue()));
1294 mi = wk->menubar_item(
name);
1295 m0->append_item(mi);
1296 hm =
new HocMenu(
name, m, mi, hoc_item(), add2menubar);
1299 menuStack->top()->append_item(mi);
1300 hm =
new HocMenu(
name, m, mi, menuStack->hoc_item());
1309 if (hoc_radio->group()) {
1310 HocRadioAction* a =
new HocRadioAction(act, hoc_radio->group(), pyact);
1316 tts->set(TelltaleState::is_chosen,
true);
1317 hoc_radio->group()->update(tts);
1332 add2menubar_ = add2menubar;
1345 int HocMenu::mac_menubar(
int& mindex,
int m,
int mi) {
1347 printf(
"menu %d is item %d in %d %s\n", mindex, mi, m,
getStr());
1352 static Coord xvalue_field_size;
1354 void HocPanel::valueEd(
const char* prompt,
1359 bool keep_updated) {
1360 valueEd(prompt,
NULL,
NULL, canrun,
NULL, deflt, keep_updated,
NULL, pyvar, pyact);
1363 void HocPanel::valueEd(
const char*
name,
1364 const char* variable,
1374 if (pyact || action) {
1387 vel =
new ValEdLabel(WidgetKit::instance()->label(nu));
1389 vel =
new ValEdLabel(WidgetKit::instance()->label(
name));
1393 prompt = WidgetKit::instance()->default_button(vel, act);
1395 prompt = WidgetKit::instance()->push_button(vel, act);
1397 vel->tts(prompt->state());
1405 }
else if (keep_updated) {
1408 fe =
new HocValEditor(
name, variable, vel, act, pd, canrun, hoc_item(), pyvar);
1417 Style* s = WidgetKit::instance()->style();
1418 if (!s->find_attribute(
"stepper_size", fct)) {
1422 box()->append(lk->hbox(lk->vcenter(prompt),
1424 lk->vcenter(lk->h_fixed_span(fe->
field_editor(), xvalue_field_size)),
1425 lk->vcenter(lk->fixed(fe->
stepper(), (
int) fct, (
int) fct))));
1429 lk->h_fixed_span(fe->
field_editor(), xvalue_field_size),
1436 last_fe_constructed_ = fe;
1445 void HocPanel::write(ostream&
o) {
1450 sprintf(
buf,
"xpanel(\"%s\", %d)", getName(), horizontal_);
1452 for (
i = 1;
i < ilist_.count();
i++) {
1453 ilist_.item(
i)->write(
o);
1456 sprintf(
buf,
"xpanel(%g,%g)", window()->save_left(), window()->save_bottom());
1459 o <<
"xpanel()" << endl;
1463 void HocPanel::item_append(
HocItem* hi) {
1481 int HocItem::mac_menubar(
int&,
int m,
int mi) {
1482 if (strcmp(
getStr(),
"xmenu()") == 0) {
1483 printf(
"end menu %d\n", m);
1502 char buf[200], *c2 =
buf;
1504 for (c1 =
getStr(); *c1; ++c1) {
1533 extern void purify_watch_rw_4(
char**);
1545 (*nrnpy_guigetstr)(pyvar_, &cp_);
1550 p_ =
new Patch(LayoutKit::instance()->margin(WidgetKit::instance()->label(cp_), 3));
1574 o <<
"xlabel(\"<can't retrieve>\")" << endl;
1581 p_->body(LayoutKit::instance()->margin(WidgetKit::instance()->label(
cp_), 3));
1591 p_->body(LayoutKit::instance()->margin(WidgetKit::instance()->label(
cp_), 3));
1599 p_->body(LayoutKit::instance()->margin(WidgetKit::instance()->label(
"Free'd"), 3));
1615 while (
hm_->
menu()->item_count()) {
1621 menuStack->push(
hm_);
1635 }
else if (action && action[0] !=
'\0') {
1727 class HocDefaultCheckbox:
public Button {
1730 virtual ~HocDefaultCheckbox();
1747 HocDefaultCheckbox::~HocDefaultCheckbox() {}
1754 k.begin_style(
"ToggleButton",
"Button");
1755 t =
new TelltaleState(TelltaleState::is_enabled | TelltaleState::is_toggle);
1756 g =
k.check_box_look(
NULL,
t);
1758 HocDefaultCheckbox*
cb =
new HocDefaultCheckbox(dve,
g, s,
t,
NULL);
1768 dve_->def_change(
e.pointer_root_x(),
e.pointer_root_y());
1778 const char* variable,
1786 checkbox_ = HocDefaultCheckbox::instance(
this);
1791 deflt_ = most_recent_ = get_val();
1805 char form[200],
buf[200];
1807 "Permanently replace default value %s with %s",
1809 xvalue_format->
string());
1823 bool chosen =
t->test(TelltaleState::is_chosen);
1824 if (same && chosen) {
1825 t->set(TelltaleState::is_chosen,
false);
1829 t->set(TelltaleState::is_chosen,
true);
1840 checkbox_->state()->set(TelltaleState::is_chosen,
1841 !
checkbox_->state()->test(TelltaleState::is_chosen));
1845 bool chosen =
checkbox_->state()->test(TelltaleState::is_chosen);
1865 const char* variable,
1873 HocPanel::keep_updated(
this,
true);
1877 HocPanel::keep_updated(
this,
false);
1895 static void set_format() {
1897 if (!xvalue_format) {
1898 xvalue_format =
new String(
"%.5g");
1899 WidgetKit::instance()->style()->find_attribute(
"xvalue_format", *xvalue_format);
1902 Glyph*
g = WidgetKit::instance()->label(
buf);
1909 Style* s = WidgetKit::instance()->style();
1910 if (!s->find_attribute(
"xvalue_field_size_increase", fct)) {
1919 if (!xvalue_format) {
1926 for (cp =
buf; *cp; ++cp) {
1933 if (*cp >=
'1' && *cp <=
'9') {
1944 sscanf(
buf,
"%lf", &y);
1950 const char* variable,
1958 if (!xvalue_format) {
1969 domain_limits_ =
NULL;
1978 }
else if (variable) {
1981 if (sym && sym->
extra) {
2030 (*nrnpy_guisetval)(
pyvar_, x);
2100 strcpy(
buf,
"Doesn't exist");
2136 "xvalue(\"%s\",\"%s\", %d,\"%s\", %d, %d )",
2167 bool unfocus =
false;
2176 if (
e.mapkey(
buf, 1) > 0)
2201 class HocEditorTempData {
2204 int sn(
const Event&);
2214 static HocEditorTempData etd;
2223 b_ =
e.pointer_button();
2231 int HocEditorTempData::sn(
const Event&) {
2233 float xnew =
e.pointer_x();
2234 float ynew =
e.pointer_y();
2240 sn_ = ( ((xnew -
x_)*xd_ + (ynew -
y_)*yd_ >= 0.)) ? sn_ : -sn_;
2287 char*
buf = abuf + 1;
2289 if (
i == strlen(
buf)) {
2294 if (isdigit(
buf[
i])) {
2295 buf[
i] = (((
buf[
i] -
'0') + sn + 100) % 10) +
'0';
2296 if (sn == 1 &&
buf[
i] !=
'0') {
2298 }
else if (sn == -1 &&
buf[
i] !=
'9') {
2305 if (
buf[0] ==
'-') {
2343 return InputHandler::focus_in();
2355 if (PanelInputHandler::has_old_focus()) {
2367 for (
long i = hoc_panel_list->count() - 1;
i >= 0; --
i) {
2368 hoc_panel_list->item(
i)->notifyHocValue();
2373 void HocPanel::notifyHocValue() {
2374 for (
long i = elist_.count() - 1;
i >= 0; --
i) {
2375 elist_.item(
i)->update_hoc_item();
2379 void HocPanel::check_valid_pointers(
void*
v,
int size) {
2380 for (
long i = elist_.count() - 1;
i >= 0; --
i) {
2381 elist_.item(
i)->check_pointer(
v, size);
2387 double* pd = (
double*)
v;
2392 if (pval_ < pd || pval_ >= pd + size)
2399 char** cpp = (
char**)
v;
2406 for (
long i = elist_.count() - 1;
i >= 0; --
i) {
2407 elist_.item(
i)->data_path(hdp,
append);
2437 class StepperMenuAction:
public Action {
2439 StepperMenuAction(
bool,
double);
2440 virtual ~StepperMenuAction();
2451 virtual ~StepperMenu();
2473 StepperMenuAction::StepperMenuAction(
bool b,
double x) {
2477 StepperMenuAction::~StepperMenuAction() {}
2481 StepperMenu::StepperMenu() {
2488 m->action(
new StepperMenuAction(
false, 0));
2491 m->action(
new StepperMenuAction(
true, 10));
2494 m->action(
new StepperMenuAction(
true,
pow(10., .1)));
2497 m->action(
new StepperMenuAction(
true,
exp(1.)));
2500 m->action(
new StepperMenuAction(
true,
exp(.1)));
2503 m->action(
new StepperMenuAction(
true, 2));
2506 m->action(
new StepperMenuAction(
true,
pow(2., .1)));
2508 for (
double x = 1000; x > .0005; x /= 10.) {
2511 m->action(
new StepperMenuAction(
false, x));
2515 StepperMenu::~StepperMenu() {}
2516 bool StepperMenu::event(
Event&
e) {
2518 if (
e.type() == Event::up) {
2524 class NrnUpDown:
public Glyph {
2526 static NrnUpDown* instance();
2527 virtual ~NrnUpDown();
2532 NrnUpDown(
const Color*);
2533 static NrnUpDown* instance_;
2534 const Color* color_;
2537 NrnUpDown* NrnUpDown::instance_;
2539 NrnUpDown::NrnUpDown(
const Color*
c)
2545 NrnUpDown::~NrnUpDown() {
2549 NrnUpDown* NrnUpDown::instance() {
2551 instance_ =
new NrnUpDown(WidgetKit::instance()->foreground());
2572 Coord x = (x1 + x2) * .5;
2573 Coord y = (y1 + y2) * .5;
2576 c->move_to(x1, y + 1);
2578 c->line_to(x2, y + 1);
2584 c->move_to(x1, y - 1);
2586 c->line_to(x2, y - 1);
2593 return WidgetKit::instance()->push_button_look(NrnUpDown::instance(),
t);
2601 k.begin_style(
"UpMover",
"Button");
2603 g = up_down_mover_look(
t);
2614 menu_ =
new StepperMenu();
2625 menu_->active(
false);
2629 switch (
e.pointer_button()) {
2631 case Event::middle: {
2633 if (
e.pointer_y() < (a.
bottom() + a.
top()) * .5) {
2640 menu_->stepper(
this);
2645 menu_->active(
true);
2646 menu_->stepper(
this);
2667 if (
menu_->active()) {
2668 menu_->active(
false);
2678 menu_->active(
true);
2680 handler()->event(
e);
2695 if (
steps_ > 0 && x * y <= 0.) {
2727 resolution_ = resolution;
2737 bv_->scroll_incr((high - low) / nsteps);
2740 }
else if (pysend) {
2764 static double last_send;
2770 (*nrnpy_guisetval)(
pyvar_, x);
2776 while (
Coord(x) != last_send) {
2778 last_send =
Coord(x);
2833 double* pd = (
double*)
v;
2838 if (pval_ < pd || pval_ >= pd + size)
2861 "xslider(&%s, %g, %g, \"%s\", %d, %d)",
2870 "xslider(&%s, %g, %g, %d, %d)",
2884 void HocPanel::stateButton(
double* pd,
2893 button = WidgetKit::instance()->palette_button(
name, act);
2895 button = WidgetKit::instance()->check_box(
name, act);
2897 box()->append(button);
2954 return b_->state()->test(TelltaleState::is_chosen);
2960 b_->state()->set(TelltaleState::is_chosen, !
chosen());
2993 b_->state()->set(TelltaleState::is_chosen,
true);
2995 b_->state()->set(TelltaleState::is_chosen,
false);
3001 double* pd = (
double*)
v;
3006 if (pval_ < pd || pval_ >= pd + size)
3030 "xstatebutton(\"%s\",&%s,\"%s\")",
3036 "xcheckbox(\"%s\",&%s,\"%s\")",
3049 MenuItem* HocPanel::menuStateItem(
double* pd,
3054 MenuItem* mi = WidgetKit::instance()->check_menu_item(
name);
3111 return b_->state()->test(TelltaleState::is_chosen);
3118 b_->state()->set(TelltaleState::is_chosen, !
chosen());
3151 b_->state()->set(TelltaleState::is_chosen,
true);
3153 b_->state()->set(TelltaleState::is_chosen,
false);
3159 double* pd = (
double*)
v;
3164 if (pval_ < pd || pval_ >= pd + size)
3188 "xcheckbox(\"%s\",&%s,\"%s\")",
3204 hoc_xvalue_helper();
3206 hoc_xpvalue_helper();
static double restore(void *v)
virtual Coord lower(DimensionName) const
virtual void scroll_to(DimensionName, Coord position)
virtual Coord cur_lower(DimensionName) const
virtual Coord upper(DimensionName) const
virtual void release(const Event &)
virtual const String * text() const
virtual void selection(int &start, int &index) const
virtual void press(const Event &)
virtual void keystroke(const Event &)
virtual void drag(const Event &)
virtual InputHandler * focus_in()
virtual void field(const char *)
const char * name() const
HocAction(const char *action, Object *pyact=NULL)
int execute(bool notify=true)
String * retrieve(double *)
virtual ~HocDefaultValEditor()
virtual void updateField()
HocDefaultValEditor(const char *name, const char *variable, ValEdLabel *, HocValAction *, double *pd=0, bool canrun=false, HocItem *parent=NULL, Object *pyvar=NULL)
void def_change(float, float)
HocEditorForItem(HocValEditor *, HocValAction *)
virtual void release(const Event &)
virtual void val_inc(const Event &)
virtual void press(const Event &)
virtual void keystroke(const Event &)
virtual ~HocEditorForItem()
virtual void drag(const Event &)
virtual InputHandler * focus_in()
virtual void help_parent(HocItem *)
virtual void write(ostream &)
HocItem(const char *, HocItem *parent=NULL)
virtual void help(const char *childpath=NULL)
virtual void write(ostream &)
virtual void update_hoc_item()
HocUpdateItem(const char *, HocItem *parent=NULL)
void update_ptrs_helper(double **)
virtual void check_pointer(void *, int vector_size)
virtual void data_path(HocDataPaths *, bool)
FieldSEditorAction * fea_
void accept(FieldSEditor *)
HocValAction(const char *action, Object *pyact=0)
void setFieldSEditor(HocValEditor *)
virtual void write(ostream &)
virtual void updateField()
virtual int hoc_default_val_editor()
virtual void update_hoc_item()
virtual void print(Printer *, const Allocation &) const
HocValEditor(const char *name, const char *variable, ValEdLabel *, HocValAction *, double *pd=0, bool canrun=false, HocItem *parent=NULL, Object *pvar=NULL)
const char * variable() const
virtual void exec_action()
virtual Stepper * stepper()
virtual void setlimits(float *)
virtual void data_path(HocDataPaths *, bool)
FieldSEditor * field_editor()
virtual void check_pointer(void *, int)
virtual double domain_limits(double)
virtual void update_ptrs()
virtual ~HocValEditorKeepUpdated()
HocValEditorKeepUpdated(const char *name, const char *variable, ValEdLabel *, HocValAction *, double *, HocItem *parent=NULL, Object *pyvar=NULL)
virtual void write(ostream &)
HocValStepper(HocValEditor *, Glyph *, Style *, TelltaleState *)
virtual void menu_up(Event &)
static HocValStepper * instance(HocValEditor *)
virtual void release(const Event &)
virtual void press(const Event &)
static StepperMenu * menu_
static StepperMenu * menu()
virtual void data_path(HocDataPaths *, bool)
virtual void write(ostream &)
HocVarLabel(char **, PolyGlyph *, Object *pyvar=NULL)
virtual void check_pointer(void *, int)
virtual void update_hoc_item()
static MenuItem * radio_menu_item(TelltaleGroup *, const char *)
static MenuItem * menu_item(const char *)
static bool equal(float x, float y, float e)
static double anint(double)
static double resolution(double)
virtual PrintableWindow * make_window(Coord left=-1, Coord bottom=-1, Coord width=-1, Coord height=-1)
static void help(const char *)
int run(int argc, const char **argv)
void notify_freed(void(*pf)(void *, int))
virtual void data_path(HocDataPaths *, bool)
virtual void write(ostream &)
virtual double slider_val()
virtual void update(Observable *)
OcSlider(double *, float low, float high, float resolution, int nsteps, const char *send_cmd, bool vert, bool slow=false, Object *pyvar=NULL, Object *pysend=NULL)
virtual void update_ptrs()
virtual void update_hoc_item()
virtual void check_pointer(void *, int vector_size)
Adjustable * adjustable()
void require_x(const Requirement &)
const Requirement & x_requirement() const
void require_y(const Requirement &)
virtual void unref() const
MenuItem * add_radio_menu(const char *, Action *, Menu *=NULL)
Button * radio_button(const char *, Action *)
const char * string() const
Symbol * hoc_get_last_pointer_symbol()
static double active(void *v)
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)
static HocParmLimits limits[]
static void update(NrnThread *)
#define FieldSEditorCallback(T)
#define declareFieldSEditorCallback(T)
#define implementFieldSEditorCallback(T)
void hoc_execerror(const char *, const char *)
int hoc_is_object_arg(int narg)
void hoc_audit_command(const char *buf)
Symbol * hoc_get_symbol(const char *var)
double check_domain_limits(float *limits, double val)
int hoc_is_str_arg(int narg)
double * hoc_val_pointer(const char *s)
void hoc_obj_ref(Object *obj)
int hoc_is_pdouble_arg(int narg)
double * hoc_pgetarg(int narg)
void hoc_obj_unref(Object *obj)
char ** hoc_pgargstr(int narg)
#define TRY_GUI_REDIRECT_ACTUAL_DOUBLE(name, obj)
#define TRY_GUI_REDIRECT_DOUBLE(name, obj)
#define TRY_GUI_REDIRECT_NO_RETURN(name, obj)
#define TRY_GUI_REDIRECT_OBJ(name, obj)
#define TRY_GUI_REDIRECT_DOUBLE_SEND_STRREF(name, obj)
void send(const char *url)
static void help(const char *)
Object ** hoc_objgetarg(int)
#define implementPtrList(PtrList, T)
#define declarePtrList(PtrList, T)
void append(Item *ql, Item *q)
double * nrn_recalc_ptr(double *)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
static philox4x32_key_t k
static void pr(N_Vector x)
void hoc_ivvarlabel(char **, Object *pyvar=0)
void hoc_ivvaluerun_ex(CChar *name, CChar *var, double *pvar, Object *pyvar, CChar *action, Object *pyact, bool deflt=false, bool canrun=false, bool usepointer=false, HocSymExtension *extra=NULL)
void hoc_ivvalue(CChar *name, CChar *variable, bool deflt=false, Object *pyvar=0)
void hoc_ivbutton(CChar *name, CChar *action, Object *pyact=0)
void hoc_ivmenu(CChar *, bool add2menubar=false)
void hoc_ivvalue_keep_updated(CChar *name, CChar *variable, Object *pyvar=0)
void hoc_ivradiobutton(CChar *name, CChar *action, bool activate=false, Object *pyact=0)
void hoc_ivpanelmap(int scroll=-1)
void hoc_ivpvalue(CChar *name, double *, bool deflt=false, HocSymExtension *extra=NULL)
void hoc_ivfixedvalue(CChar *name, CChar *variable, bool deflt=false, bool usepointer=false)
void hoc_ivvaluerun(CChar *name, CChar *variable, CChar *action, bool deflt=false, bool canrun=false, bool usepointer=false, Object *pyvar=0, Object *pyact=0)
void hoc_ivslider(double *, float low=0, float high=100, float resolution=1, int steps=10, const char *send_cmd=NULL, bool vert=false, bool slow=false, Object *pyvar=0, Object *pyact=0)
void hoc_ivstatebutton(double *, CChar *name, CChar *action, int style, Object *pyvar=0, Object *pyact=0)
void hoc_ivpanel(CChar *, bool h=false)
void hoc_ivlabel(CChar *)
void hoc_ivvarmenu(CChar *, CChar *, bool add2menubar=false, Object *pyvar=NULL)
void hoc_ivpvaluerun(CChar *name, double *, CChar *action, bool deflt=false, bool canrun=false, HocSymExtension *extra=NULL)
static double save(void *v)
static double remove(void *v)
static double least(void *v)
bool boolean_dialog(const char *label, const char *accept, const char *cancel, Window *w=NULL, Coord x=400., Coord y=400.)