1 #include <../../nrnconf.h>
17 #include <InterViews/box.h>
18 #include <IV-look/kit.h>
19 #include <InterViews/event.h>
20 #include <InterViews/layout.h>
21 #include <InterViews/style.h>
22 #include <InterViews/background.h>
23 #include <InterViews/border.h>
24 #include <InterViews/dialog.h>
25 #include <InterViews/printer.h>
27 #include <InterViews/transformer.h>
28 #include <InterViews/patch.h>
29 #include <InterViews/color.h>
30 #include <InterViews/telltale.h>
31 #include <InterViews/hit.h>
34 #include <InterViews/display.h>
52 virtual ~PanelInputHandler();
55 static bool has_old_focus() {
72 bool PanelInputHandler::sema_ =
false;
74 PanelInputHandler::PanelInputHandler(
Glyph* g,
Style*
s)
76 PanelInputHandler::~PanelInputHandler() {}
78 const Event* e = h.event();
79 if (focus_ && e && e->type() ==
Event::key && focus_->handler()) {
80 h.target(depth,
this, 0, focus_->handler());
82 InputHandler::pick(
c, a, depth, h);
86 if (focus_ && focus_ != h) {
95 InputHandler::focus(h);
111 virtual ~ValEdLabel();
117 static const Color* color_;
122 const Color* ValEdLabel::color_;
124 ValEdLabel::ValEdLabel(
Glyph* g)
128 color_ =
Color::lookup(Session::instance()->default_display(),
"yellow");
134 ValEdLabel::~ValEdLabel() {}
139 MonoGlyph::draw(
c, a);
141 void ValEdLabel::state(
bool s) {
152 static void hoc_ivpanelPlace(
Coord,
Coord,
int scroll = -1);
154 static String* xvalue_format;
156 #define Editor_Default "DefaultValueEditor"
157 #define Editor_Stepper "DefaultValueEditor"
173 h = (int)
chkarg(2, 0, 1) ? true :
false;
180 scroll = (int)
chkarg(3, -1, 1);
185 scroll = (int)
chkarg(1, -1, 1);
199 bool add2menubar =
false;
212 add2menubar = int(
chkarg(
i, 0, 1));
249 static void hoc_state_or_checkbox(
int style) {
260 ptr2 = hoc_hgetarg<double>(2);
305 char *s1, *s2 = (
char*) 0;
331 static void hoc_xvalue_helper() {
344 ptr2 = hoc_hgetarg<double>(2);
363 bool canRun =
false, usepointer =
false;
396 bool usepointer =
false;
406 static void hoc_xpvalue_helper() {
414 pd = hoc_hgetarg<double>(2);
450 hoc_xpvalue_helper();
483 float low = 0, high = 100;
484 float resolution = 1;
494 resolution = (high - low) / 100.;
507 vert = int(
chkarg(iarg, 0, 1));
511 slow = int(
chkarg(iarg, 0, 1));
516 pval = hoc_hgetarg<double>(1);
518 hoc_ivslider(
pval, low, high, resolution, nsteps, send, vert, slow, pyvar, pysend);
525 class HocButton:
public Button {
528 virtual ~HocButton();
529 static HocButton* instance(
const char*,
Action*);
537 l_ = WidgetKit::instance()->label(
text);
540 HocButton::~HocButton() {
543 HocButton* HocButton::instance(
const char*
s,
Action* a) {
544 Button* b = WidgetKit::instance()->push_button(
s, a);
546 HocButton* hb =
new HocButton(
s, b->body(), b->style(), b->state(), b->action());
554 static std::vector<HocPanel*>* hoc_panel_list;
557 static void checkOpenPanel() {
572 l_.erase(l_.begin());
576 return (l_.empty()) ? nullptr : l_.front()->menu();
579 return (l_.empty()) ? nullptr : l_.front();
584 std::vector<HocMenu*> l_;
586 void MenuStack::push(
HocMenu* m) {
588 l_.insert(l_.begin(), m);
590 void MenuStack::clean() {
591 for (
auto& item: l_) {
596 static MenuStack* menuStack;
597 static Menu* hocmenubar;
602 virtual ~OcTelltaleGroup();
612 OcTelltaleGroup::OcTelltaleGroup() {
616 OcTelltaleGroup::~OcTelltaleGroup() {}
618 if (
t != current_ &&
t->test(TelltaleState::is_chosen)) {
619 previous_ = current_;
625 if (previous_ ==
t) {
635 previous_->set(TelltaleState::is_chosen,
true);
636 }
else if (current_) {
638 current_->set(TelltaleState::is_chosen,
false);
645 HocRadioAction(
const char* action, OcTelltaleGroup*,
Object* pyact =
NULL);
646 virtual ~HocRadioAction();
650 OcTelltaleGroup* tg_;
653 HocRadioAction::HocRadioAction(
const char* action, OcTelltaleGroup* tg,
Object* pyact)
659 HocRadioAction::~HocRadioAction() {
662 void HocRadioAction::help() {
672 OcTelltaleGroup* group() {
682 HocRadio::HocRadio() {
685 HocRadio::~HocRadio() {
688 void HocRadio::start() {
690 g_ =
new OcTelltaleGroup();
694 void HocRadio::stop() {
699 static HocRadio* hoc_radio;
703 hoc_radio =
new HocRadio();
706 fprintf(stderr,
"%s not closed\n", curHocPanel->
getName());
710 curHocPanel->unref();
723 curHocPanel->unref();
725 if (menuStack && !menuStack->isEmpty()) {
726 fprintf(stderr,
"%s menu not closed\n", menuStack->hoc_item()->getStr());
733 void hoc_ivpanelPlace(
Coord left,
Coord bottom,
int scroll) {
743 if (menuStack && !menuStack->isEmpty()) {
744 menuStack->top()->append_item(curHocPanel->
menuItem(
name, action,
false, pyact));
758 if (menuStack && !menuStack->isEmpty()) {
759 menuStack->top()->append_item(curHocPanel->
menuStateItem(pd,
name, action, pyvar, pyact));
767 if (!hoc_radio->group()) {
770 if (menuStack && !menuStack->isEmpty()) {
779 menuStack =
new MenuStack();
794 menuStack =
new MenuStack();
800 m->
item()->action(hma);
834 const char* variable,
857 if (!pvar && !pyvar) {
865 xtra =
s ?
s->extra :
NULL;
867 curHocPanel->
valueEd(
name, variable, action, canrun, pvar, deflt,
false, xtra, pyvar, pyact);
878 curHocPanel->
valueEd(
name, 0, action, canRun, pd, deflt,
false, extra);
905 curHocPanel->
slider(pd, low, high, resolution, nsteps,
s, vert, slow, pyvar, pyact);
908 static char* hideQuote(
const char*
s) {
909 static char buf[200];
915 for (cp1 =
s; *cp1; cp1++, cp2++) {
925 static void saveMenuFile() {}
934 if (hoc_panel_list) {
935 for (
auto& item: *hoc_panel_list) {
936 item->data_path(data_paths,
true);
940 if (hoc_panel_list) {
941 for (
auto& item: *hoc_panel_list) {
942 item->data_path(data_paths,
false);
951 if (1 || maxcnt == -1) {
953 Style*
s = WidgetKit::instance()->style();
954 s->find_attribute(
"panel_scroll", maxcnt);
956 if ((scroll == -1 &&
box_->count() > maxcnt) || scroll == 1) {
960 while (
box_->count()) {
961 vsb->append(
box_->component(0));
964 box_->append(lk.hbox(vsb, lk.hspace(4), wk.vscroll_bar(vsb)));
968 w->style(
new Style(WidgetKit::instance()->style()));
969 w->style()->attribute(
"name",
getName());
974 static void var_freed(
void* pd,
int size) {
975 if (hoc_panel_list) {
976 for (
auto&& elem:
reverse(*hoc_panel_list)) {
977 elem->check_valid_pointers(pd, size);
994 body(ih_ =
new PanelInputHandler(
998 if (!hoc_panel_list) {
999 hoc_panel_list =
new std::vector<HocPanel*>;
1003 hoc_panel_list->push_back(
this);
1012 for (
auto& item:
ilist_) {
1013 item->HocItem::unref();
1015 for (
auto& item:
elist_) {
1016 item->HocItem::unref();
1043 item->update_hoc_item();
1065 HocCommandTool* hct =
new HocCommandTool(hc);
1067 if (selact || pyselact) {
1070 if (curHocPanel && (!menuStack || menuStack->isEmpty())) {
1072 curHocPanel->
box()->append(b);
1088 return ilist_.front()->getStr();
1096 if (hoc_radio->group()) {
1097 HocRadioAction* a =
new HocRadioAction(action, hoc_radio->group(), pyact);
1098 Button* b = WidgetKit::instance()->radio_button(hoc_radio->group(),
name, a);
1103 tts->set(TelltaleState::is_chosen,
true);
1104 hoc_radio->group()->update(tts);
1108 box()->append(WidgetKit::instance()->push_button(
name, a));
1125 o <<
buf << std::endl;
1141 o <<
buf << std::endl;
1145 box()->append(LayoutKit::instance()->margin(WidgetKit::instance()->
label(
name), 3));
1167 OcSlider*
s =
new OcSlider(pd, low, high, resolution, nsteps, send, vert, slow, pyvar, pysend);
1171 wk->begin_style(
"SlowSlider");
1174 box()->append(lk->hflexible(WidgetKit::instance()->vscroll_bar(
s->adjustable())));
1176 box()->append(lk->hflexible(WidgetKit::instance()->hscroll_bar(
s->adjustable())));
1188 Menu* m = wk->pulldown();
1191 if (menuStack->isEmpty()) {
1202 box()->append(lk->hbox(m0, lk->hglue()));
1204 mi = wk->menubar_item(
name);
1205 m0->append_item(mi);
1209 menuStack->top()->append_item(mi);
1210 hm =
new HocMenu(
name, m, mi, menuStack->hoc_item());
1219 if (hoc_radio->group()) {
1220 HocRadioAction* a =
new HocRadioAction(act, hoc_radio->group(), pyact);
1226 tts->set(TelltaleState::is_chosen,
true);
1227 hoc_radio->group()->update(tts);
1242 add2menubar_ = add2menubar;
1252 static Coord xvalue_field_size;
1259 bool keep_updated) {
1264 const char* variable,
1274 if (pyact || action) {
1287 vel =
new ValEdLabel(WidgetKit::instance()->
label(nu));
1289 vel =
new ValEdLabel(WidgetKit::instance()->
label(
name));
1293 prompt = WidgetKit::instance()->default_button(vel, act);
1295 prompt = WidgetKit::instance()->push_button(vel, act);
1297 vel->tts(prompt->state());
1317 Style*
s = WidgetKit::instance()->style();
1318 if (!
s->find_attribute(
"stepper_size", fct)) {
1322 box()->append(lk->hbox(lk->vcenter(prompt),
1324 lk->vcenter(lk->h_fixed_span(fe->
field_editor(), xvalue_field_size)),
1325 lk->vcenter(lk->fixed(fe->
stepper(), (
int) fct, (
int) fct))));
1329 lk->h_fixed_span(fe->
field_editor(), xvalue_field_size),
1336 last_fe_constructed_ = fe;
1340 o <<
"{" << std::endl;
1342 o <<
"}" << std::endl;
1349 for (std::size_t
i = 1;
i <
ilist_.size(); ++
i) {
1354 o <<
"xpanel(" << double(
window()->save_left()) <<
"," << double(
window()->save_bottom())
1355 <<
")" << std::endl;
1357 o <<
"xpanel()" << std::endl;
1375 o <<
str_.string() << std::endl;
1379 return str_.string();
1388 char buf[200], *c2 =
buf;
1390 for (c1 =
getStr(); *c1; ++c1) {
1413 o <<
"xlabel(\"" << hideQuote(
getStr()) <<
"\")" << std::endl;
1417 extern void purify_watch_rw_4(
char**);
1433 p_ =
new Patch(LayoutKit::instance()->margin(WidgetKit::instance()->label(cp_), 3));
1450 o <<
"xvarlabel(" <<
variable_ <<
")" << std::endl;
1452 o <<
"xlabel(\"<can't retrieve>\")" << std::endl;
1459 p_->body(LayoutKit::instance()->margin(WidgetKit::instance()->label(
cp_), 3));
1469 p_->body(LayoutKit::instance()->margin(WidgetKit::instance()->label(
cp_), 3));
1477 p_->body(LayoutKit::instance()->margin(WidgetKit::instance()->label(
"Free'd"), 3));
1493 while (
hm_->
menu()->item_count()) {
1499 menuStack->push(
hm_);
1513 }
else if (action && action[0] !=
'\0') {
1606 class HocDefaultCheckbox:
public Button {
1609 virtual ~HocDefaultCheckbox();
1611 virtual void release(
const Event&);
1626 HocDefaultCheckbox::~HocDefaultCheckbox() {}
1633 k.begin_style(
"ToggleButton",
"Button");
1634 t =
new TelltaleState(TelltaleState::is_enabled | TelltaleState::is_toggle);
1635 g =
k.check_box_look(
NULL,
t);
1637 HocDefaultCheckbox* cb =
new HocDefaultCheckbox(dve, g,
s,
t,
NULL);
1642 void HocDefaultCheckbox::release(
const Event& e) {
1646 if (e.pointer_button() == Event::right) {
1647 dve_->def_change(e.pointer_root_x(), e.pointer_root_y());
1657 const char* variable,
1665 checkbox_ = HocDefaultCheckbox::instance(
this);
1670 deflt_ = most_recent_ = get_val();
1684 char form[200],
buf[200];
1686 "Permanently replace default value %s with %s",
1687 xvalue_format->string(),
1688 xvalue_format->string());
1702 bool chosen =
t->test(TelltaleState::is_chosen);
1703 if (same && chosen) {
1704 t->set(TelltaleState::is_chosen,
false);
1708 t->set(TelltaleState::is_chosen,
true);
1719 checkbox_->state()->set(TelltaleState::is_chosen,
1720 !
checkbox_->state()->test(TelltaleState::is_chosen));
1724 bool chosen =
checkbox_->state()->test(TelltaleState::is_chosen);
1744 const char* variable,
1774 static void set_format() {
1776 if (!xvalue_format) {
1777 xvalue_format =
new String(
"%.5g");
1778 WidgetKit::instance()->style()->find_attribute(
"xvalue_format", *xvalue_format);
1780 Sprintf(
buf, xvalue_format->string(), -8.888888888888888e-18);
1781 Glyph* g = WidgetKit::instance()->label(
buf);
1788 Style*
s = WidgetKit::instance()->style();
1789 if (!
s->find_attribute(
"xvalue_field_size_increase", fct)) {
1798 if (!xvalue_format) {
1802 Sprintf(
buf, xvalue_format->string(), std::abs(x));
1805 for (cp =
buf; *cp; ++cp) {
1812 if (*cp >=
'1' && *cp <=
'9') {
1823 sscanf(
buf,
"%lf", &y);
1829 const char* variable,
1838 if (!xvalue_format) {
1849 domain_limits_ =
NULL;
1853 }
else if (variable) {
1856 if (sym && sym->
extra) {
1933 oc.
run(std::string(
"hoc_ac_ = ") +
fe_->
text()->string() +
"\n");
1941 auto sout = std::stringstream{};
1947 sout <<
"// " <<
pval_ <<
" set to " <<
fe_->
text()->string();
1949 auto buf = sout.str();
1967 strcpy(
buf,
"Doesn't exist");
1974 if (strcmp(
buf,
fe_->
text()->string()) != 0) {
1993 o <<
buf << std::endl;
2003 "xvalue(\"%s\",\"%s\", %d,\"%s\", %d, %d )",
2010 o <<
buf << std::endl;
2028 o <<
buf << std::endl;
2030 o <<
buf << std::endl;
2034 bool unfocus =
false;
2043 if (e.mapkey(
buf, 1) > 0)
2053 parent()->focus(
NULL);
2065 parent()->focus(
NULL);
2068 class HocEditorTempData {
2071 int sn(
const Event&);
2081 static HocEditorTempData etd;
2090 b_ = e.pointer_button();
2091 if (
b_ == Event::right) {
2098 int HocEditorTempData::sn(
const Event&) {
2100 float xnew = e.pointer_x();
2101 float ynew = e.pointer_y();
2107 sn_ = ( ((xnew -
x_)*xd_ + (ynew -
y_)*yd_ >= 0.)) ? sn_ : -sn_;
2136 if (etd.b_ == Event::left) {
2152 const char*
s =
text()->string();
2154 char*
buf = abuf + 1;
2156 if (
i == strlen(
buf)) {
2161 if (isdigit(
buf[
i])) {
2162 buf[
i] = (((
buf[
i] -
'0') + sn + 100) % 10) +
'0';
2163 if (sn == 1 &&
buf[
i] !=
'0') {
2165 }
else if (sn == -1 &&
buf[
i] !=
'9') {
2172 if (
buf[0] ==
'-') {
2210 return InputHandler::focus_in();
2222 if (PanelInputHandler::has_old_focus()) {
2233 if (hoc_panel_list) {
2234 for (
auto&& e:
reverse(*hoc_panel_list)) {
2235 e->notifyHocValue();
2243 e->update_hoc_item();
2249 e->check_pointer(
v, size);
2254 auto*
const pval_raw =
static_cast<double const*
>(
pval_);
2256 auto*
const pd =
static_cast<double*
>(
v);
2258 if (pd != pval_raw) {
2262 if (pval_raw < pd || pval_raw >= pd + size)
2269 char** cpp = (
char**)
v;
2277 e->data_path(hdp,
append);
2283 auto*
const pval_raw =
static_cast<double*
>(
pval_);
2302 class StepperMenuAction:
public Action {
2304 StepperMenuAction(
bool,
double);
2305 virtual ~StepperMenuAction();
2306 virtual void execute();
2316 virtual ~StepperMenu();
2338 StepperMenuAction::StepperMenuAction(
bool b,
double x) {
2342 StepperMenuAction::~StepperMenuAction() {}
2343 void StepperMenuAction::execute() {
2346 StepperMenu::StepperMenu() {
2353 m->action(
new StepperMenuAction(
false, 0));
2356 m->action(
new StepperMenuAction(
true, 10));
2359 m->action(
new StepperMenuAction(
true,
pow(10., .1)));
2362 m->action(
new StepperMenuAction(
true,
exp(1.)));
2365 m->action(
new StepperMenuAction(
true,
exp(.1)));
2368 m->action(
new StepperMenuAction(
true, 2));
2371 m->action(
new StepperMenuAction(
true,
pow(2., .1)));
2373 for (
double x = 1000; x > .0005; x /= 10.) {
2376 m->action(
new StepperMenuAction(
false, x));
2380 StepperMenu::~StepperMenu() {}
2381 bool StepperMenu::event(
Event& e) {
2383 if (e.type() == Event::up) {
2389 class NrnUpDown:
public Glyph {
2391 static NrnUpDown* instance();
2392 virtual ~NrnUpDown();
2397 NrnUpDown(
const Color*);
2398 static NrnUpDown* instance_;
2399 const Color* color_;
2402 NrnUpDown* NrnUpDown::instance_;
2404 NrnUpDown::NrnUpDown(
const Color*
c)
2410 NrnUpDown::~NrnUpDown() {
2414 NrnUpDown* NrnUpDown::instance() {
2416 instance_ =
new NrnUpDown(WidgetKit::instance()->foreground());
2437 Coord x = (x1 + x2) * .5;
2438 Coord y = (y1 + y2) * .5;
2441 c->move_to(x1, y + 1);
2443 c->line_to(x2, y + 1);
2449 c->move_to(x1, y - 1);
2451 c->line_to(x2, y - 1);
2458 return WidgetKit::instance()->push_button_look(NrnUpDown::instance(),
t);
2466 k.begin_style(
"UpMover",
"Button");
2468 g = up_down_mover_look(
t);
2479 menu_ =
new StepperMenu();
2490 menu_->active(
false);
2494 switch (e.pointer_button()) {
2496 case Event::middle: {
2498 if (e.pointer_y() < (a.
bottom() + a.
top()) * .5) {
2505 menu_->stepper(
this);
2509 case Event::right: {
2510 menu_->active(
true);
2511 menu_->stepper(
this);
2532 if (
menu_->active()) {
2533 menu_->active(
false);
2537 Stepper::release(e);
2543 menu_->active(
true);
2545 handler()->event(e);
2560 if (
steps_ > 0 && x * y <= 0.) {
2592 resolution_ = resolution;
2601 bv_->scroll_incr((high - low) / nsteps);
2604 }
else if (pysend) {
2625 static double last_send;
2637 while (
Coord(x) != last_send) {
2639 last_send =
Coord(x);
2652 auto sout = std::stringstream{};
2658 sout <<
"// " <<
pval_ <<
" set to " <<
buf <<
"\n";
2660 auto str = sout.str();
2697 auto*
const pval_raw =
static_cast<double const*
>(
pval_);
2699 auto*
const pd =
static_cast<double*
>(
v);
2704 if (pval_raw < pd || pval_raw >= pd + size)
2712 auto*
const pval_raw =
static_cast<double*
>(
pval_);
2725 "xslider(&%s, %g, %g, \"%s\", %d, %d)",
2734 "xslider(&%s, %g, %g, %d, %d)",
2741 o <<
buf << std::endl;
2757 button = WidgetKit::instance()->palette_button(
name, act);
2759 button = WidgetKit::instance()->check_box(
name, act);
2761 box()->append(button);
2785 name_ =
new CopyString(
text);
2808 Glyph* l = WidgetKit::instance()->label(
name_->string());
2815 return b_->state()->test(TelltaleState::is_chosen);
2821 b_->state()->set(TelltaleState::is_chosen, !
chosen());
2853 b_->state()->set(TelltaleState::is_enabled_visible_active_chosen,
false);
2857 b_->state()->set(TelltaleState::is_chosen,
true);
2859 b_->state()->set(TelltaleState::is_chosen,
false);
2864 auto*
const pval_raw =
static_cast<double const*
>(
pval_);
2866 auto*
const pd =
static_cast<double*
>(
v);
2871 if (pval_raw < pd || pval_raw >= pd + size)
2880 auto*
const pval_raw =
static_cast<double*
>(
pval_);
2893 "xstatebutton(\"%s\",&%s,\"%s\")",
2899 "xcheckbox(\"%s\",&%s,\"%s\")",
2904 o <<
buf << std::endl;
2917 MenuItem* mi = WidgetKit::instance()->check_menu_item(
name);
2942 name_ =
new CopyString(
text);
2964 Glyph* l = WidgetKit::instance()->label(
name_->string());
2971 return b_->state()->test(TelltaleState::is_chosen);
2978 b_->state()->set(TelltaleState::is_chosen, !
chosen());
3011 b_->state()->set(TelltaleState::is_enabled_visible_active_chosen,
false);
3015 b_->state()->set(TelltaleState::is_chosen,
true);
3017 b_->state()->set(TelltaleState::is_chosen,
false);
3022 auto*
const pval_raw =
static_cast<double const*
>(
pval_);
3024 auto*
const pd =
static_cast<double*
>(
v);
3029 if (pval_raw < pd || pval_raw >= pd + size)
3038 auto*
const pval_raw =
static_cast<double*
>(
pval_);
3051 "xcheckbox(\"%s\",&%s,\"%s\")",
3056 o <<
buf << std::endl;
3067 hoc_xvalue_helper();
3069 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)
std::string retrieve(double *) const
HocDefaultValEditor(const char *name, const char *variable, ValEdLabel *, HocValAction *, neuron::container::data_handle< double > pd={}, bool canrun=false, HocItem *parent=NULL, Object *pyvar=NULL)
virtual ~HocDefaultValEditor()
virtual void updateField()
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 write(std::ostream &)
virtual void help_parent(HocItem *)
HocItem(const char *, HocItem *parent=NULL)
virtual void help(const char *childpath=NULL)
virtual void write(std::ostream &)
void item_append(HocItem *)
void data_path(HocDataPaths *, bool)
void valueEd(const char *prompt, const char *variable, const char *action=0, bool canrun=false, neuron::container::data_handle< double > pd={}, bool deflt=false, bool keep_updated=false, HocSymExtension *extra=NULL, Object *pyvar=NULL, Object *pyact=NULL)
virtual void map_window(int scroll=-1)
HocMenu * menu(const char *name, bool add2menubar=false)
static std::vector< HocUpdateItem * > * update_list_
void var_label(char **, Object *pyvar=NULL)
virtual HocItem * hoc_item()
static void save_all(std::ostream &)
std::vector< HocItem * > ilist_
static void paneltool(const char *name, const char *procname, const char *action, ScenePicker *, Object *pycallback=NULL, Object *pyselact=NULL)
MenuItem * menuItem(const char *name, const char *action, bool activate=false, Object *pyact=0)
void slider(neuron::container::data_handle< 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=NULL, Object *pysend=NULL)
static void keep_updated()
virtual void save(std::ostream &)
std::vector< HocUpdateItem * > elist_
void stateButton(neuron::container::data_handle< double > pd, const char *name, const char *action, int style, Object *pyvar=NULL, Object *pyact=NULL)
HocPanel(const char *name, bool horizontal=false)
virtual void write(std::ostream &)
void check_valid_pointers(void *, int)
void pushButton(const char *name, const char *action, bool activate=false, Object *pyact=0)
MenuItem * menuStateItem(neuron::container::data_handle< double > pd, const char *name, const char *action, Object *pyvar=NULL, Object *pyact=NULL)
void itemAppend(const char *)
virtual void update_hoc_item()
HocUpdateItem(const char *, HocItem *parent=NULL)
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 *)
HocValEditor(const char *name, const char *variable, ValEdLabel *, HocValAction *, neuron::container::data_handle< double > pd={}, bool canrun=false, HocItem *parent=NULL, Object *pvar=NULL)
neuron::container::data_handle< double > pval_
virtual void updateField()
virtual void write(std::ostream &)
virtual int hoc_default_val_editor()
virtual void update_hoc_item()
virtual void print(Printer *, const Allocation &) const
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 ~HocValEditorKeepUpdated()
HocValEditorKeepUpdated(const char *name, const char *variable, ValEdLabel *, HocValAction *, neuron::container::data_handle< double >, HocItem *parent=NULL, Object *pyvar=NULL)
virtual void write(std::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(std::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 double anint(double)
static double resolution(double)
virtual PrintableWindow * make_window(Coord left=-1, Coord bottom=-1, Coord width=-1, Coord height=-1)
virtual PrintableWindow * window()
virtual bool has_window()
static void help(const char *)
int run(int argc, const char **argv)
void notify_freed(void(*pf)(void *, int))
virtual void write(std::ostream &)
virtual void data_path(HocDataPaths *, bool)
neuron::container::data_handle< double > pval_
virtual double slider_val()
virtual void update(Observable *)
OcSlider(neuron::container::data_handle< 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_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 *)
void class2oc(const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
#define y_(arg)
Crout matrix decomposition : Forward/Backward substitution.
Symbol * hoc_get_last_pointer_symbol()
static double active(void *v)
void erase_first(T &&iterable, value_type &&value)
constexpr auto reverse(T &&iterable)
static HocParmLimits limits[]
double chkarg(int, double low, double high)
#define FieldSEditorCallback(T)
#define declareFieldSEditorCallback(T)
#define implementFieldSEditorCallback(T)
int hoc_is_object_arg(int narg)
void hoc_audit_command(const char *buf)
Symbol * hoc_get_symbol(const char *var)
neuron::container::data_handle< double > hoc_val_handle(std::string_view s)
double check_domain_limits(float *limits, double val)
int hoc_is_str_arg(int narg)
void hoc_obj_ref(Object *obj)
int hoc_is_pdouble_arg(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)
Object ** hoc_objgetarg(int)
Symbol * lookup(const char *)
void append(Item *ql, Item *q)
void update(NrnThread *_nt)
void hoc_execerror(const char *s1, const char *s2)
impl_ptrs methods
Collection of pointers to functions with python-version-specific implementations.
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
#define nrn_assert(x)
assert()-like macro, independent of NDEBUG status
static int guigetstr(Object *ho, char **cpp)
static double guigetval(Object *ho)
static void pr(N_Vector x)
void hoc_ivvarlabel(char **, Object *pyvar=0)
void hoc_ivvalue(CChar *name, CChar *variable, bool deflt=false, Object *pyvar=0)
void hoc_ivpvalue(CChar *name, neuron::container::data_handle< double >, bool deflt=false, HocSymExtension *extra=NULL)
void hoc_ivpvaluerun(CChar *name, neuron::container::data_handle< double >, CChar *action, bool deflt=false, bool canrun=false, HocSymExtension *extra=NULL)
void hoc_ivbutton(CChar *name, CChar *action, Object *pyact=0)
void hoc_ivstatebutton(neuron::container::data_handle< double >, CChar *name, CChar *action, int style, Object *pyvar=0, 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_ivslider(neuron::container::data_handle< 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_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_ivvaluerun_ex(CChar *name, CChar *var, neuron::container::data_handle< double > pvar, Object *pyvar, CChar *action, Object *pyact, bool deflt=false, bool canrun=false, bool usepointer=false, HocSymExtension *extra=NULL)
void hoc_ivpanel(CChar *, bool h=false)
void hoc_ivlabel(CChar *)
void hoc_ivvarmenu(CChar *, CChar *, bool add2menubar=false, Object *pyvar=NULL)
static double remove(void *v)
static int equal(const char *c1, const char *c2)
int(* guigetstr)(Object *, char **)
double(* guigetval)(Object *)
void(* guisetval)(Object *, double)
bool boolean_dialog(const char *label, const char *accept, const char *cancel, Window *w=NULL, Coord x=400., Coord y=400.)