1 #include <../../nrnconf.h>
5 #include <InterViews/polyglyph.h>
6 #include <InterViews/layout.h>
7 #include <InterViews/place.h>
8 #include <InterViews/patch.h>
9 #include <InterViews/background.h>
10 #include <InterViews/box.h>
11 #include <IV-look/kit.h>
12 #include <InterViews/input.h>
34 class NrnFixedLayout:
public Layout {
37 virtual ~NrnFixedLayout();
44 virtual void span(
Coord);
45 virtual Coord span() {
48 virtual bool vertical() {
70 Coord next_map_adjust_;
82 NrnFixedLayout* fixlay_;
86 Coord pstart_, fstart_;
92 virtual ~BoxDismiss();
109 BoxDismiss::~BoxDismiss() {
113 if (
b_->dismissing() ==
true) {
171 bool b = int(
chkarg(1, 0., 1.));
183 int p = int(
chkarg(1, -1000, 10000));
200 w = b->make_window(
float(*
getarg(2)),
205 w = b->make_window();
211 b->dismissing(
false);
213 if (b->full_request() && b->has_window()) {
214 b->window()->request_on_resize(
true);
216 b->dismiss_action(
NULL);
230 const char* a =
"Accept";
231 const char*
c =
"Cancel";
255 accept = (bool)
chkarg(1, 0, 1);
257 if (b->dialog_dismiss(accept)) {
260 if (b->has_window()) {
263 b->window()->dismiss();
281 b = ((
OcBox*)
v)->has_window();
318 bool x = ((int)
chkarg(1, 0, 1) != 0) ?
true :
false;
321 return (b->full_request() ? 1. : 0.);
355 }
else if (
ifarg(2)) {
367 b->save_action(
buf, 0);
474 hoc_execerror(
"Box or Deck is recursive. The GUI may no longer work correctly.\n",
475 "Exit program and eliminate the recursion");
483 bi_->full_request_ =
false;
484 bi_->dismissing_ =
false;
485 bi_->next_map_adjust_ = -1.;
487 bi_->ba_list_ =
NULL;
494 box = bi_->box_ = lk.hbox(3);
497 bi_->box_ = sb = lk.vscrollbox(10);
498 box = lk.hbox(sb, lk.hspace(4), wk.vscroll_bar(sb));
500 box = bi_->box_ = lk.vbox(3);
510 body(
new Background(wk.inset_frame(lk.variable_span(box)), wk.background()));
513 body(
new Background(wk.outset_frame(lk.variable_span(box)), wk.background()));
516 body(
new Background(wk.bright_inset_frame(lk.variable_span(box)), wk.background()));
519 body(
new Background(lk.variable_span(box), wk.background()));
525 bi_->save_action_ =
NULL;
526 bi_->save_pyact_ =
NULL;
528 bi_->keep_ref_ =
NULL;
529 bi_->dis_act_ =
NULL;
530 bi_->dis_pyact_ =
NULL;
536 for (
i = 0;
i <
cnt; ++
i) {
537 ((
OcGlyph*) (
bi_->ocglyph_list_->component(
i)))->parents(
false);
543 if (
bi_->save_action_) {
544 delete bi_->save_action_;
546 if (
bi_->save_pyact_) {
550 delete bi_->dis_act_;
552 if (
bi_->dis_pyact_) {
560 return bi_->full_request_;
563 bi_->full_request_ = b;
566 return bi_->dismissing_;
569 bi_->dismissing_ = d;
584 bi_->ocglyph_list_->append(
g);
586 if (
bi_->next_map_adjust_ > 0.) {
587 BoxAdjust* ba =
new BoxAdjust(
this,
bi_,
g,
bi_->next_map_adjust_);
588 if (!
bi_->ba_list_) {
590 bi_->ba_list_->ref();
592 bi_->ba_list_->append(ba);
593 bi_->box_->append(ba->ga_);
594 bi_->box_->append(ba);
595 bi_->next_map_adjust_ = -1.;
597 if (
bi_->type_ ==
V) {
598 bi_->box_->append(lk.hflexible(lk.vcenter(
g, 1.)));
600 bi_->box_->append(lk.vflexible(lk.vcenter(
g, 1.)));
607 body(
new Patch(body()));
612 bi_->next_map_adjust_ = natural;
617 if (
bi_->ba_list_ && index < bi_->
ba_list_->count()) {
618 BoxAdjust* ba = (BoxAdjust*)
bi_->ba_list_->component(
index);
623 ba->fixlay_->span(natural);
625 bi_->box_->modified(0);
627 ((
Patch*) body())->redraw();
636 NrnFixedLayout::~NrnFixedLayout() {}
645 void NrnFixedLayout::allocate(
const Allocation&,
653 void NrnFixedLayout::span(
Coord s) {
663 ga_ = lk.vcenter(
g, 1.);
665 ga_ = lk.hflexible(ga_);
668 ga_ = lk.vflexible(ga_);
674 BoxAdjust::~BoxAdjust() {}
677 if (fixlay_->vertical()) {
678 pstart_ =
e.pointer_y();
680 pstart_ =
e.pointer_x();
682 fstart_ = fixlay_->span();
687 if (fixlay_->vertical()) {
688 d =
e.pointer_y() - pstart_;
691 d =
e.pointer_x() - pstart_;
709 *
bi_->o_ << creat <<
"\n";
712 bi_->save_pyact_ = pyact;
723 bi_->dis_pyact_ = pyact;
725 delete bi_->dis_act_;
729 if (
bi_->dis_pyact_) {
734 *
bi_->dis_act_ = act;
741 new BoxDismiss(
window(),
bi_->dis_act_,
this,
bi_->dis_pyact_));
747 if (
bi_->save_action_ ||
bi_->save_pyact_) {
748 if (
bi_->save_action_ && strcmp(
bi_->save_action_->string(),
"") == 0) {
757 if (
bi_->save_pyact_) {
766 if (
bi_->type_ ==
H) {
767 o <<
"{\nocbox_ = new HBox()" << endl;
769 o <<
"{\nocbox_ = new VBox()" << endl;
771 o <<
"ocbox_list_.prepend(ocbox_)" << endl;
772 o <<
"ocbox_.intercept(1)\n}" << endl;
773 long i,
cnt =
bi_->ocglyph_list_->count();
774 for (
i = 0;
i <
cnt; ++
i) {
777 o <<
"{\nocbox_ = ocbox_list_.object(0)" << endl;
778 o <<
"ocbox_.intercept(0)" << endl;
789 "ocbox_.map(\"%s\", %g, %g, %g, %g)\n}",
793 "ocbox_.map(\"%s\", %g, %g, %g, %g)\n}",
799 window()->canvas()->width(),
800 window()->canvas()->height());
807 o <<
"ocbox_.map()\n}" << endl;
812 o <<
"ocbox_list_.remove(0)" << endl;
814 o <<
"objref ocbox_" << endl;
824 if (
bi_->keep_ref_) {
833 if (
bi_->keep_ref_) {
840 return bi_->keep_ref_;
virtual const char * name() const
virtual void replace_dismiss_action(WinDismiss *)
OcBox(int type, int frame=INSET, bool scroll=false)
virtual void box_append(OcGlyph *)
virtual void no_parents()
virtual void dismiss_action(const char *, Object *pyact=NULL)
virtual void adjuster(Coord natural)
virtual void adjust(Coord natural, int)
virtual void save(ostream &)
virtual void save_action(const char *, Object *)
virtual void intercept(bool)
OcGlyphContainer * parent_
virtual void request(Requisition &) const
virtual PrintableWindow * window()
virtual bool has_window()
virtual void def_size(Coord &w, Coord &h) const
static OcGlyphContainer * intercept(OcGlyphContainer *)
virtual Coord save_left() const
virtual Coord save_bottom() const
const Requirement & x_requirement() const
const Requirement & y_requirement() const
virtual void unref() const
const char * string() const
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)
void hoc_execerror(const char *, const char *)
unsigned int DimensionName
char * hoc_object_pathname(Object *ob)
int hoc_is_object_arg(int narg)
void hoc_assign_str(char **cpp, const char *buf)
int hoc_is_double_arg(int narg)
void hoc_obj_ref(Object *obj)
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_NO_RETURN(name, obj)
#define TRY_GUI_REDIRECT_OBJ(name, obj)
Object ** hoc_objgetarg(int)
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
static double adjuster(void *v)
const char * pwm_session_filename()
static Member_func members[]
static double adjust(void *v)
double(* nrnpy_object_to_double_)(Object *)
static double dialog(void *v)
static void destruct(void *v)
static double unmap(void *v)
static double b_size(void *v)
static double full_request(void *v)
static double map(void *v)
static double ses_pri(void *v)
static double dismiss_action(void *v)
static void * vcons(Object *)
static double save(void *v)
static double ismapped(void *v)
static double ref(void *v)
static double intercept(void *v)
static void * hcons(Object *)