コード例 #1
0
ファイル: view.cpp プロジェクト: earizaa/repsnapper
  TempRow(Model *model, TempType type) :
    m_model(model), m_type(type)
  {
    static const char *names[] = { "Nozzle", "Bed" };

    add(*(new Gtk::Label(names[type])));
    Gtk::ToggleButton *pOn = new Gtk::ToggleButton("Heat On");
    pOn->signal_toggled().connect
      (sigc::bind (sigc::mem_fun (*this, &TempRow::heat_toggled), pOn));
    add(*pOn);
    m_temp = new Gtk::Label();
    add (*m_temp);
    add(*(new Gtk::Label("Target Temperature (°C)")));
    m_target = new Gtk::SpinButton();
    m_target->set_increments (1, 5);
    m_target->set_range(25.0, 256.0);
    switch (type) {
    case TEMP_NOZZLE:
    default:
      m_target->set_value(200.0);
      break;
    case TEMP_BED:
      m_target->set_value(100.0);
      break;
    }
    add (*m_target);
  }
コード例 #2
0
ファイル: settings.cpp プロジェクト: Tyndi/3dprint
void Settings::set_to_gui (Builder &builder, int i)
{
  const char *glade_name = settings[i].glade_name;

  if (!glade_name)
        return;

  switch (settings[i].type) {
  case T_BOOL: {
    Gtk::CheckButton *check = NULL;
    builder->get_widget (glade_name, check);
    if (!check)
      std::cerr << "Missing boolean config item " << glade_name << "\n";
    else
      check->set_active (*PTR_BOOL(this, i));
    break;
  }
  case T_INT:
  case T_FLOAT: {
    Gtk::Widget *w = NULL;
    builder->get_widget (glade_name, w);
    if (!w) {
      std::cerr << "Missing user interface item " << glade_name << "\n";
      break;
    }

    Gtk::SpinButton *spin = dynamic_cast<Gtk::SpinButton *>(w);
    if (spin) {
      if (settings[i].type == T_INT)
          spin->set_value (*PTR_INT(this, i));
      else
          spin->set_value (*PTR_FLOAT(this, i));
      break;
    }
    Gtk::Range *range = dynamic_cast<Gtk::Range *>(w);
    if (range) {
      if (settings[i].type == T_INT)
        range->set_value (*PTR_INT(this, i));
      else
        range->set_value (*PTR_FLOAT(this, i));
    }
    break;
  }
  case T_STRING: {
    Gtk::Entry *e = NULL;
    builder->get_widget (glade_name, e);
    if (!e) {
      std::cerr << "Missing user interface item " << glade_name << "\n";
      break;
    }
    e->set_text(*PTR_STRING(this, i));
    break;
  }
  case T_COLOUR_MEMBER:
    break; // Ignore, Colour members are special 
  default:
    std::cerr << "corrupt setting type\n";
    break;
  }
}
コード例 #3
0
  TempRow(Model *model, Printer *printer, TempType type) :
    m_model(model), printer(printer), m_type(type)
  {
    static const char *names[] = { N_("Nozzle"), N_("Bed") };

    add(*(new Gtk::Label(_(names[type]))));
    Gtk::ToggleButton *pOn = new Gtk::ToggleButton(_("Heat On"));
    pOn->signal_toggled().connect
      (sigc::bind (sigc::mem_fun (*this, &TempRow::heat_toggled), pOn));
    add(*pOn);
    add(*(new Gtk::Label(_("Temp. (°C)"))));
    m_temp = new Gtk::Label(_("<unknown>"));
    add (*m_temp);

    add(*(new Gtk::Label(_("Target:"))));
    m_target = new Gtk::SpinButton();
    m_target->set_increments (1, 5);
    m_target->set_range(25.0, 256.0);
    switch (type) {
    case TEMP_NOZZLE:
    default:
      m_target->set_value(225.0);
      break;
    case TEMP_BED:
      m_target->set_value(60.0);
      break;
    }
    add (*m_target);
  }
コード例 #4
0
ファイル: view.cpp プロジェクト: earizaa/repsnapper
  AxisRow(Model *model, int axis) :
    m_inhibit_update(false), m_model(model), m_axis(axis)
  {
    add(*(new Gtk::Label(axis_names[axis])));
    Gtk::Button *home = new Gtk::Button("Home");
    home->signal_clicked().connect
      (sigc::mem_fun (*this, &AxisRow::home_clicked));
    add (*home);

    add_nudge_button (-10.0);
    add_nudge_button (-1.0);
    add_nudge_button (-0.1);
    m_target = new Gtk::SpinButton();
    m_target->set_digits (1);
    m_target->set_increments (0.1, 1);
    m_target->set_range(-200.0, +200.0);
    m_target->set_value(0.0);
    add (*m_target);
    m_target->signal_value_changed().connect
      (sigc::mem_fun(*this, &AxisRow::spin_value_changed));

    add_nudge_button (+0.1);
    add_nudge_button (+1.0);
    add_nudge_button (+10.0);
  }
コード例 #5
0
ファイル: DamageWindow.cpp プロジェクト: m2osw/turnwatcher
void DamageWindow::Value( int val )
{
	f_value = val;
	Gtk::SpinButton* sp;
	f_table.GetItem( DamageHealth, sp );
	sp->set_value( f_value );
}
コード例 #6
0
/*! Constructor
 * \param[in]	el	the configuration element to display
 * \param[in]	differ	shall the changes be applied later using apply_changes()?
 */
ConfigElement::ConfigElement(crn::ConfigElement &el, bool differ):
	value(el.GetValue()),
	tmpvalue(el.GetValue())
{
	if (!value)
		throw crn::ExceptionUninitialized(_("The element was not initialized."));
	if (differ)
		tmpvalue = crn::Clone(*value);

	if (std::dynamic_pointer_cast<crn::Int>(tmpvalue))
		typ = U"Int";
	else if (std::dynamic_pointer_cast<crn::Real>(tmpvalue))
		typ = U"Real";
	else if (std::dynamic_pointer_cast<crn::Prop3>(tmpvalue))
		typ = U"Prop3";
	else if (std::dynamic_pointer_cast<crn::String>(tmpvalue))
		typ = U"String";
	else if (std::dynamic_pointer_cast<crn::StringUTF8>(tmpvalue))
		typ = U"StringUTF8";
	else if (std::dynamic_pointer_cast<crn::Path>(tmpvalue))
		typ = U"Path";

	Gtk::Label *lab = Gtk::manage(new Gtk::Label(el.GetName().CStr()));
	lab->show();
	pack_start(*lab, false, true, 2);

	if (typ == U"Prop3")
	{
		Prop3 *p = Gtk::manage(new Prop3(Gtk::ICON_SIZE_BUTTON, el.GetValue<crn::Prop3>()));
		p->signal_value_changed().connect(sigc::mem_fun(this, &ConfigElement::on_p3_changed));
		p->show();
		pack_start(*p, true, true, 2);
	}
	else if (!el.GetAllowedValues().IsEmpty())
	{ // any Int, Real, String, StringUTF8 or Path
		Gtk::ComboBoxText *cb = Gtk::manage(new Gtk::ComboBoxText);
		const std::vector<crn::StringUTF8> values(el.GetAllowedValues<crn::StringUTF8>());
		for (const crn::StringUTF8 &val : values)
#ifdef CRN_USING_GTKMM3
			cb->append(val.CStr());
#else /* CRN_USING_GTKMM3 */
			cb->append_text(val.CStr());
#endif /* CRN_USING_GTKMM3 */
		cb->set_active_text(el.GetValue<crn::StringUTF8>().CStr());
		cb->signal_changed().connect(sigc::bind(sigc::mem_fun(this, &ConfigElement::on_combo_changed), cb));
		cb->show();
		pack_start(*cb, true, true, 2);
	}
	else if (typ == U"Int")
	{
		if (el.HasMinValue() && el.HasMaxValue())
		{ // has finite range, use a slider
#ifdef CRN_USING_GTKMM3
			auto *s = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
			s->set_range(el.GetMinValue<int>(), el.GetMaxValue<int>() + 1);
			s->set_increments(1, 1);
#else
			Gtk::HScale *s = Gtk::manage(new Gtk::HScale(el.GetMinValue<int>(), el.GetMaxValue<int>() + 1, 1));
#endif
			s->set_value(el.GetValue<int>());
			s->signal_value_changed().connect(sigc::bind(sigc::mem_fun(this, &ConfigElement::on_range_changed), s));
			s->show();
			pack_start(*s, true, true, 2);
		}
		else
		{ // has at least one infinite (maxed) bound, use a spin button
			Gtk::SpinButton *s = Gtk::manage(new Gtk::SpinButton);
			int m = std::numeric_limits<int>::min(), M = std::numeric_limits<int>::max();
			if (el.HasMinValue())
				m = el.GetMinValue<int>();
			if (el.HasMaxValue())
				M = el.GetMaxValue<int>();
			s->set_range(m, M);
			s->set_increments(1, 10);
			s->set_value(el.GetValue<int>());
			s->signal_value_changed().connect(sigc::bind(sigc::mem_fun(this, &ConfigElement::on_spin_changed), s));
			s->show();
			pack_start(*s, true, true, 2);
		}
	}
	else if (typ == U"Real")
	{
		if (el.HasMinValue() && el.HasMaxValue())
		{ // has finite range, use a slider
#ifdef CRN_USING_GTKMM3
			auto *s = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
			s->set_range(el.GetMinValue<double>(), el.GetMaxValue<double>() + 0.01);
			s->set_increments(0.01, 0.01);
#else
			Gtk::HScale *s = Gtk::manage(new Gtk::HScale(el.GetMinValue<double>(), el.GetMaxValue<double>() + 0.01, 0.01));
#endif
			s->set_digits(2);
			s->set_value(el.GetValue<double>());
			s->signal_value_changed().connect(sigc::bind(sigc::mem_fun(this, &ConfigElement::on_range_changed), s));
			s->show();
			pack_start(*s, true, true, 2);
		}
		else
		{ // has at least one infinite (maxed) bound, use a spin button
			Gtk::SpinButton *s = Gtk::manage(new Gtk::SpinButton(0, 2));
			double m = -std::numeric_limits<double>::max(), M = std::numeric_limits<double>::max();
			if (el.HasMinValue())
				m = el.GetMinValue<double>();
			if (el.HasMaxValue())
				M = el.GetMaxValue<double>();
			s->set_range(m, M);
			s->set_increments(0.01, 1);
			s->set_value(el.GetValue<double>());
			s->signal_value_changed().connect(sigc::bind(sigc::mem_fun(this, &ConfigElement::on_spin_changed), s));
			s->show();
			pack_start(*s, true, true, 2);
		}
	}
	else // string types
	{
		Gtk::Entry *e = Gtk::manage(new Gtk::Entry);
		e->set_text(el.GetValue<crn::StringUTF8>().CStr());
		e->signal_changed().connect(sigc::bind(sigc::mem_fun(this, &ConfigElement::on_entry_changed), e));
		e->show();
		pack_start(*e, true, true, 2);
	}
	lab = Gtk::manage(new Gtk::Label("?"));
	lab->show();
	lab->set_tooltip_text(el.GetDescription().CStr());
	pack_start(*lab, false, true, 2);
}
コード例 #7
0
ファイル: common___.cpp プロジェクト: zzzzzzzzzzz0/zhscript
int common___::proc__(std::deque<Glib::ustring>* p,char*buf,long siz,char**addr_ret,void*shangji,void*ce) {
	const Glib::ustring& p0=(*p)[0];

	if(p0=="剪贴板"){
		if(siz==-1)return 1;
		Glib::RefPtr<Gtk::Clipboard> cb = Gtk::Clipboard::get();
		if(p->size()>1)
			cb->set_text((*p)[1].c_str());
		else
			*addr_ret=dup__(cb->wait_for_text().c_str());
		return 1;
	}
	if(p0=="全屏"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->fullscreen();
		return 1;
	}
	if(p0=="取消全屏"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->unfullscreen();
		return 1;
	}
	if(p0=="置顶"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_keep_above(true);
		return 1;
	}
	if(p0=="取消置顶"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_keep_above(false);
		return 1;
	}
	if(p0=="无边框"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_decorated(false);
		return 1;
	}
	if(p0=="跳过任务栏"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		w->set_skip_taskbar_hint(true);
		return 1;
	}
	if(p0=="窗口活动"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,1);
		if(!w)
			return 1;
		cpy__(buf,w->property_is_active(),siz);
		return 1;
	}
	if(p0=="图标"){
		if(siz==-1)return 1;
		Gtk::Window* w=w__(p,2);
		if(!w)
			return 1;
		if(p->size()>1){
			const Glib::ustring& p1=(*p)[1];
			w->set_icon_name(p1);
			Glib::RefPtr<Gdk::Pixbuf> pb=Gdk::Pixbuf::create_from_file(p1);
			if(pb)
				w->set_icon(pb);
		}else
			cpy__(buf,w->get_icon_name().c_str(),siz);
		return 1;
	}

	if(p->size()<2){
		return 0;
	}
	const Glib::ustring& p1=(*p)[1];

	Gtk::Entry* e;
	Gtk::Label* l;
	Gtk::Button* b;
	Gtk::ToolButton* tb;
	Gtk::TextView* tv;
	Gtk::Notebook* n;
	Gtk::Bin* bI;
	Gtk::Widget* w;
	Gtk::Statusbar* sB;
	Gtk::FileChooserButton* fcb;
	Gtk::ToggleButton* tOb;//CheckButton RadioButton
	Gtk::ToggleToolButton*ttb;
	//Gtk::RadioButtonGroup* rbg;
	Gtk::MenuItem* mi;
	Gtk::CheckMenuItem* cmi;
	Gtk::SpinButton* sb;

	if(p0=="窗口标题"){
		if(siz==-1)return 1;
		Gtk::Window* w1;
		if(p1=="")
			w1=sh_->main_win_;
		else{
			sh_->builder_->get_widget(p1, w);
			if(!w){
				d_(sh_,err_show_wufa_,2,p,1);
				return 1;
			}
			w1=(Gtk::Window*)w;
		}
		if(p->size()<3){
			cpy__(buf,w1->get_title().c_str(),siz);
		}else{
			w1->set_title((*p)[2]);
		}
		return 1;
	}

	if(p0=="内容"){
		if(siz==-1)return 1;
		Glib::ustring text;
		bool read=false;
		int start=2;
		if(p->size()>2&&(*p)[2]=="读取"){
			read=true;
			start=3;
		}
		for(size_t i=start;i<p->size();i++){
			if((*p)[i]=="源码")
				text+=sh_->src_;
			else{
				if(read){
					string name=sh_->ui_file_;
					size_t i1=name.rfind('/');
					if(i1==string::npos)
						i1=name.rfind('\\');
					if(i1!=string::npos)
						name=name.substr(0,i1+1);
					name+=(*p)[i];
					file_get__(name.c_str(),text);
				}else
					text+=(*p)[i];
			}
		}
		if(p1=="源码"){
			if(p->size()>2)
				sh_->src_=text;
			else
				*addr_ret=dup__(sh_->src_.c_str());
			return 1;
		}else{
			sh_->builder_->get_widget(p1, sb);
			if(sb){
				if(p->size()>2){
					float f=0;
					sscanf(text.c_str(),"%f",&f);
					sb->set_value(f);
					return 1;
				}
			}
			sh_->builder_->get_widget(p1, e);
			if(e){
				if(p->size()<3){
					*addr_ret=dup__(e->get_text().c_str());
				}else{
					e->set_text(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, l);
			if(l){
				if(p->size()<3){
					*addr_ret=dup__(l->get_text().c_str());
				}else{
					l->set_markup(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, tv);
			if(tv){
				if(p->size()<3){
					*addr_ret=dup__(tv->get_buffer()->get_text().c_str());
				}else{
					tv->get_buffer()->set_text(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, fcb);
			if(fcb){
				if(p->size()<3){
					*addr_ret=dup__(fcb->get_filename().c_str());
				}else{
					fcb->set_filename(text);

					  /*GtkFileChooser *chooser=(GtkFileChooser *)fcb->gobj();
					  const gchar    *filename=text.c_str();
					  gtk_file_chooser_unselect_all (chooser);
					  //gtk_file_chooser_select_filename (chooser, filename);
					  GFile *file;
					  gboolean result;
					  file = g_file_new_for_path (filename);
					  result = gtk_file_chooser_select_file (chooser, file, NULL);
//#define GTK_FILE_CHOOSER_GET_IFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FILE_CHOOSER, GtkFileChooserIface))
					  //result = GTK_FILE_CHOOSER_GET_IFACE (chooser)->select_file (chooser, file, NULL);
					  g_object_unref (file);*/
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, tOb);
			if(tOb){
				if(p->size()<3){
					cpy__(buf,tOb->get_label().c_str(),siz);
				}else{
					tOb->set_label(text);
				}
				return 1;
			}
			sh_->builder_->get_widget(p1, sB);
			if(sB){
				if(p->size()<3){
				}else{
					sB->push(text,sB->get_context_id(text));
					return 1;
				}
			}
			sh_->builder_->get_widget(p1, n);
			if(n){
				if(p->size()<3){
					cpy__(buf,n->get_current_page()+1,siz);
				}else{
					n->set_current_page(s2i__(text,1)-1);
				}
				return 1;
			}
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="勾选"){
		if(siz==-1)return 1;
		if(p->size()>2){
			bool b=d_(sh_,bool_,(*p)[p->size()-1].c_str());
			for(size_t i=1;i<p->size()-1;i++){
				sh_->builder_->get_widget((*p)[i], tOb);
				if(tOb){
					tOb->set_active(b);
					continue;
				}
				sh_->builder_->get_widget((*p)[i], ttb);
				if(ttb){
					ttb->set_active(b);
					continue;
				}
				sh_->builder_->get_widget((*p)[i], cmi);
				if(cmi){
					cmi->set_active(b);
					continue;
				}
				d_(sh_,err_show_wufa_,2,p,i);
				return 1;
			}
		}else{
			sh_->builder_->get_widget(p1, tOb);
			if(tOb){
				cpy__(buf,tOb->get_active(),siz);
				return 1;
			}
			sh_->builder_->get_widget(p1, ttb);
			if(ttb){
				cpy__(buf,ttb->get_active(),siz);
				return 1;
			}
			sh_->builder_->get_widget(p1, cmi);
			if(cmi){
				cpy__(buf,cmi->get_active(),siz);
				return 1;
			}
			d_(sh_,err_show_wufa_,2,p,1);
		}
		return 1;
	}
	if(p0=="提示文字"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			if(p->size()<3){
				cpy__(buf,w->get_tooltip_markup().c_str(),siz);
			}else{
				w->set_tooltip_markup((*p)[2]);
			}
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="焦点"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			w->grab_focus();
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="侦听"){
		if(siz==-1)return 1;
		if(p->size()>2){
			if(p1=="点击"){
				Glib::ustring code;
				size_t size=p->size();
				if(size>=4)
					code=(*p)[--size];
				for(size_t i=2;i<size;i++){
					if((*p)[i].length()==0)
						continue;
					Glib::SignalProxy0< void >* sp0=NULL;
					Glib::SignalProxy1< bool, GdkEventButton* >* sp1=NULL;
					Glib::ustring dong;
					bI=NULL;
					w=NULL;
					for(;;){
						sh_->builder_->get_widget((*p)[i], b);
						if(b){
							bI=b;
							w=b;
							dong=b->get_label();
							sp0=&b->signal_clicked();
							break;
						}

						sh_->builder_->get_widget((*p)[i], tb);
						if(tb){
							bI=tb;
							w=tb;
							dong=tb->get_label();
							sp0=&tb->signal_clicked();
							break;
						}

						sh_->builder_->get_widget((*p)[i], mi);
						if(mi){
							bI=mi;
							w=mi;
							sp1=&mi->signal_button_press_event();
							break;
						}

						sh_->builder_->get_widget((*p)[i], w);
						if(w){
							sp1=&w->signal_button_press_event();
							break;
						}

						d_(sh_,err_show_wufa_,3,p,i,0);
						return 1;
					}

					if(w){
						const char*arg4;
						if(dong.empty()){
							dong=(*p)[i];
							arg4=NULL;
						}else
							arg4=(*p)[i].c_str();
						control___* c;
						const char*zhao;
						const char*arg3;
						//不buf会乱指
						Glib::ustring buf3;
						if(w==mi){
							zhao="菜单";
							buf3=mi->get_label();
						}else{
							zhao=bI!=NULL?"按钮":p1.c_str();
							buf3=w->get_tooltip_text();
						}
						arg3=buf3.c_str();
						if(!arg4)
							c=new control___(zhao,dong.c_str(),sh_,d_,code.c_str(),arg3);
						else
							c=new control___(zhao,dong.c_str(),sh_,d_,code.c_str(),arg3,arg4);
						if(sp0)
							sp0->connect(sigc::mem_fun(*c, &control___::on__));
						else if(sp1)
							sp1->connect(sigc::mem_fun(*c, &control___::on1__));
						w->set_data("ctl",c);
						if(p->size()==4)
							break;
					}
				}
				return 1;
			}
			d_(sh_,err_show_wufa_,2,p,1);
			return 1;
		}
		d_(sh_,err_show_buzu_,p);
		return 1;
	}
	if(p0=="点击"){
		if(siz==-1)return 1;
		for(size_t i=1;i<p->size();i++){
			w=NULL;
			for(;;){
				sh_->builder_->get_widget((*p)[i], b);
				if(b){
					w=b;
					break;
				}
				sh_->builder_->get_widget((*p)[i], tb);
				if(tb){
					w=tb;
					break;
				}
				sh_->builder_->get_widget((*p)[i], mi);
				if(mi){
					w=mi;
					break;
				}
				sh_->builder_->get_widget((*p)[i], w);
				if(w){
					break;
				}
				d_(sh_,err_show_wufa_,3,p,i,0);
				return 1;
			}
			control___* c=(control___*)w->get_data("ctl");
			if(!c){
				d_(sh_,err_show_wufa_,3,p,i,0);
				return 1;
			}
			c->on__();
		}
		return 1;
	}
	if(p0=="可见"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			if(p->size()>2){
				bool b=d_(sh_,bool_,(*p)[p->size()-1].c_str());
				for(size_t i=1;i<p->size()-1;i++){
					sh_->builder_->get_widget((*p)[i], w);
					if(w)
						w->set_visible(b);
					else
						d_(sh_,err_show_wufa_,2,p,i);
				}
			}else
				cpy__(buf,w->get_visible(),siz);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="可见状态"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, e);
		if(e){
			bool b;
			if(p->size()>2)
				b=d_(sh_,bool_,(*p)[2].c_str());
			else
				b=!e->get_visibility();
			e->set_visibility(b);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="敏感"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			if(p->size()>2){
				bool b=d_(sh_,bool_,(*p)[p->size()-1].c_str());
				for(size_t i=1;i<p->size()-1;i++){
					sh_->builder_->get_widget((*p)[i], w);
					if(w)
						w->set_sensitive(b);
					else
						d_(sh_,err_show_wufa_,2,p,i);
				}
			}else
				cpy__(buf,w->get_sensitive(),siz);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="区域信息"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			Gtk::Allocation a=w->get_allocation();
			sprintf(buf,"%d,%d,%d,%d,",a.get_x(),a.get_y(),a.get_width(),a.get_height());
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="鼠标"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, w);
		if(w){
			gint  x,y;
			/*Glib::RefPtr<Gdk::Window> w2=w->get_window();
			w2->get_pointer(x,y,);*/
			w->get_pointer(x,y);
			sprintf(buf,"%d,%d,",x,y);
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="数目"){
		if(siz==-1)return 1;
		sh_->builder_->get_widget(p1, n);
		if(n){
			sprintf(buf,"%d",n->get_n_pages());
			return 1;
		}
		d_(sh_,err_show_wufa_,2,p,1);
		return 1;
	}
	if(p0=="遍历"){
		if(siz==-1)return 1;
		const Glib::ustring& code=(*p)[p->size()-1];
		bool exe=true;
		char s1[16];
		const char*argv[]={s1};
		int err;
		for(size_t i=1;i<p->size()-1&&exe;i++){
			sh_->builder_->get_widget((*p)[i], n);
			if(n){
				for(int pn=0;pn<n->get_n_pages();pn++){
					w=n->get_nth_page(pn);
					sprintf(s1,"%d",pn+1);
					d_(sh_,call4_1_,code.c_str(),shangji,NULL,NULL,NULL,1,argv,0,ce,&err);
					if(err){
						if(err==jieshiqi_go_+keyword_break_)
							break;
						if(err==jieshiqi_go_+keyword_continue_)
							continue;
						if(err==jieshiqi_go_+keyword_exit_){
							exe=false;
							break;
						}
						d_(sh_,call4_2_,err);
						return 1;
					}
				}
				continue;
			}
			d_(sh_,err_show_wufa_,2,p,i);
		}
		return 1;
	}
	return 0;
}
コード例 #8
0
ファイル: view.cpp プロジェクト: earizaa/repsnapper
 void notify_homed()
 {
   m_inhibit_update = true;
   m_target->set_value(0.0);
   m_inhibit_update = false;
 }
コード例 #9
0
ファイル: view.cpp プロジェクト: earizaa/repsnapper
 void update_temp (double value)
 {
   m_target->set_value (value);
 }
コード例 #10
0
void DimensionManager::addDimension() {
    Gtk::Dialog dialog(_("New Dimension"), true /*modal*/);
    // add dimension type combo box to the dialog
    Glib::RefPtr<Gtk::ListStore> refComboModel = Gtk::ListStore::create(comboModel);
    for (int i = 0x01; i < 0xff; i++) {
        Glib::ustring sType =
            dimTypeAsString(static_cast<gig::dimension_t>(i));
        if (sType.find("Unknown") != 0) {
            Gtk::TreeModel::Row row = *(refComboModel->append());
            row[comboModel.m_type_id]   = i;
            row[comboModel.m_type_name] = sType;
        }
    }
    Gtk::Table table(2, 2);
    Gtk::Label labelDimType(_("Dimension:"), Gtk::ALIGN_START);
    Gtk::ComboBox comboDimType;
    comboDimType.set_model(refComboModel);
    comboDimType.pack_start(comboModel.m_type_id);
    comboDimType.pack_start(comboModel.m_type_name);
    Gtk::Label labelZones(_("Zones:"), Gtk::ALIGN_START);
    table.attach(labelDimType, 0, 1, 0, 1);
    table.attach(comboDimType, 1, 2, 0, 1);
    table.attach(labelZones, 0, 1, 1, 2);
    dialog.get_vbox()->pack_start(table);

    // number of zones: use a combo box with fix values for gig
    // v2 and a spin button for v3
    Gtk::ComboBoxText comboZones;
    Gtk::SpinButton spinZones;
    bool version2 = false;
    if (region) {
        gig::File* file = (gig::File*)region->GetParent()->GetParent();
        version2 = file->pVersion && file->pVersion->major == 2;
    }
    if (version2) {
        for (int i = 1; i <= 5; i++) {
            char buf[3];
            sprintf(buf, "%d", 1 << i);
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 24) || GTKMM_MAJOR_VERSION < 2
            comboZones.append_text(buf);
#else
            comboZones.append(buf);
#endif
        }
        table.attach(comboZones, 1, 2, 1, 2);
    } else {
        spinZones.set_increments(1, 8);
        spinZones.set_numeric(true);
        spinZones.set_range(2, 128);
        spinZones.set_value(2);
        table.attach(spinZones, 1, 2, 1, 2);
    }

    dialog.add_button(_("_OK"), 0);
    dialog.add_button(_("_Cancel"), 1);
    dialog.show_all_children();

    if (!dialog.run()) { // OK selected ...
        Gtk::TreeModel::iterator iterType = comboDimType.get_active();
        if (!iterType) return;
        Gtk::TreeModel::Row rowType = *iterType;
        if (!rowType) return;
        int iTypeID = rowType[comboModel.m_type_id];
        gig::dimension_t type = static_cast<gig::dimension_t>(iTypeID);
        gig::dimension_def_t dim;
        dim.dimension = type;

        if (version2) {
            if (comboZones.get_active_row_number() < 0) return;
            dim.bits = comboZones.get_active_row_number() + 1;
            dim.zones = 1 << dim.bits;
        } else {
            dim.zones = spinZones.get_value_as_int();
            dim.bits = zoneCountToBits(dim.zones);
        }

        // assemble the list of regions where the selected dimension shall be
        // added to
        std::vector<gig::Region*> vRegions;
        if (allRegions()) {
            gig::Instrument* instr = (gig::Instrument*)region->GetParent();
            for (gig::Region* rgn = instr->GetFirstRegion(); rgn; rgn = instr->GetNextRegion()) {
                if (!rgn->GetDimensionDefinition(type)) vRegions.push_back(rgn);
            }
        } else vRegions.push_back(region);
            
        std::set<Glib::ustring> errors;

        for (uint iRgn = 0; iRgn < vRegions.size(); ++iRgn) {
            gig::Region* region = vRegions[iRgn];
            try {
                printf(
                    "Adding dimension (type=0x%x, bits=%d, zones=%d)\n",
                    dim.dimension, dim.bits, dim.zones
                );
                // notify everybody that we're going to update the region
                region_to_be_changed_signal.emit(region);
                // add the new dimension to the region
                // (implicitly creates new dimension regions)
                region->AddDimension(&dim);
                // let everybody know there was a change
                region_changed_signal.emit(region);
            } catch (RIFF::Exception e) {
                // notify that the changes are over (i.e. to avoid dead locks)
                region_changed_signal.emit(region);
                Glib::ustring txt = _("Could not add dimension: ") + e.Message;
                if (vRegions.size() == 1) {
                    // show error message directly
                    Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
                    msg.run();
                } else {
                    // remember error, they are shown after all regions have been processed
                    errors.insert(txt);
                }
            }
        }
        // update all GUI elements
        refreshManager();

        if (!errors.empty()) {
            Glib::ustring txt = _(
                "The following errors occurred while trying to create the dimension on all regions:"
            );
            txt += "\n\n";
            for (std::set<Glib::ustring>::const_iterator it = errors.begin();
                 it != errors.end(); ++it)
            {
                txt += "-> " + *it + "\n";
            }
            txt += "\n";
            txt += _(
                "You might also want to check the console for further warnings and "
                "error messages."
            );
            Gtk::MessageDialog msg(*this, txt, false, Gtk::MESSAGE_ERROR);
            msg.run();
        }
    }
}
コード例 #11
0
ファイル: test8.cpp プロジェクト: tschoonj/gtkmm-plplot
    Window() :
      show_edges_label("Show edges"),
      show_labels_label("Show contour labels"),
      edge_color_label("Contour edge color"),
      edge_color(Gdk::RGBA("Red")),
      edge_width_label("Contour edge width"),
      edge_width_adj(Gtk::Adjustment::create(1.0, 0.1, 10.0, 0.1, 1.0, 0.0)),
      edge_width_spin(edge_width_adj, 0.1, 1),
      nlevels_label("Number of contour edges"),
      nlevels_adj(Gtk::Adjustment::create(7, 3, 20, 1, 5)),
      nlevels_spin(nlevels_adj, 1, 0),
      colormap_palette_label("Colormap palette"),
      area_fill_pattern_label("Fill pattern"),
      area_lines_width_label("Fill pattern width"),
      area_lines_width_adj(Gtk::Adjustment::create(1.0, 0.1, 10.0, 0.1, 1.0, 0.0)),
      area_lines_width_spin(area_lines_width_adj, 0.1, 1),
      colorbar_label("Show colorbar"),
      paned(Gtk::ORIENTATION_VERTICAL),
      aspect_frame(Glib::ustring(), Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER, 1.5, false)
      {

      Glib::ustring x_title = "X-axis";
      Glib::ustring y_title = "Y-axis";
      Glib::ustring plot_title = "Intensity vs detector position";

      // general window and canvas settings
      set_default_size(720, 720);
      Gdk::Geometry geometry;
      geometry.min_aspect = geometry.max_aspect = double(720)/double(720);
      set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT);
      set_title("Gtkmm-PLplot test8");
      canvas.set_hexpand(true);
      canvas.set_vexpand(true);

      //read in our dataset
      std::ifstream fs;
      fs.exceptions(std::ifstream::failbit | std::ifstream::badbit | std::ifstream::eofbit);

      // 11 x 11 dataset (I know the file layout and the data dimensions already)
      const int nx = 11;
      const int ny = 11;
      std::vector<double> x(nx);
      std::vector<double> y(ny);
#ifdef GTKMM_PLPLOT_BOOST_ENABLED
      boost::multi_array<double, 2> z(boost::extents[nx][ny]);
      std::cout << "Using Boost multi_array!" << std::endl;
#else
      double **z = Gtk::PLplot::calloc_array2d(nx, ny);
#endif

      fs.open(TEST_CSV);
      std::string line;
      std::getline(fs, line);
      gchar **splitted = g_strsplit(line.c_str(), ",", 0);

      //first line contains the x values
      for (int i = 1 ; i < nx + 1 ; i++) {
        x[i-1] = g_ascii_strtod(splitted[i], NULL);
      }

      g_strfreev(splitted);

      for (int i = 0 ; i < ny ; i++) {
        line.clear();
        std::getline(fs, line);
        splitted = g_strsplit(line.c_str(), ",", 0);
        y[i] = g_ascii_strtod(splitted[0], NULL);
        for (int j = 1 ; j < nx + 1 ; j++) {
          z[j-1][i] = g_ascii_strtod(splitted[j], NULL);
        }
        g_strfreev(splitted);
      }

      //construct the plot
      auto plot = Gtk::manage(new Gtk::PLplot::PlotContourShades(
        *Gtk::manage(new Gtk::PLplot::PlotDataSurface(
          x,
          y,
          z
        )),
        x_title,
        y_title,
        plot_title,
        7,
        Gtk::PLplot::ColormapPalette::BLUE_RED,
        edge_color.get_rgba(),
        1.0
      ));

      canvas.add_plot(*plot);

      plot->set_background_color(Gdk::RGBA("Yellow Green"));

      //now let's set up the grid
      grid.set_column_homogeneous(true);
      grid.set_column_spacing(5);
      grid.set_row_homogeneous(false);
      grid.set_row_spacing(5);

      int row_counter = 0;

      show_edges_label.set_hexpand(true);
      show_edges_label.set_vexpand(false);
      show_edges_label.set_valign(Gtk::ALIGN_CENTER);
      show_edges_label.set_halign(Gtk::ALIGN_END);
      show_edges_switch.set_hexpand(true);
      show_edges_switch.set_vexpand(false);
      show_edges_switch.set_halign(Gtk::ALIGN_START);
      show_edges_switch.set_valign(Gtk::ALIGN_CENTER);
      show_edges_switch.set_active(plot->is_showing_edges());
      show_edges_switch.property_active().signal_changed().connect([this, plot](){
        if (show_edges_switch.get_active()) {
          edge_color.set_sensitive();
          edge_width_spin.set_sensitive();
          show_labels_switch.set_sensitive();
          plot->show_edges();
        }
        else {
          edge_color.set_sensitive(false);
          edge_width_spin.set_sensitive(false);
          show_labels_switch.set_sensitive(false);
          plot->hide_edges();
        }
      });

      grid.attach(show_edges_label, 0, row_counter, 1, 1);
      grid.attach(show_edges_switch, 1, row_counter++, 1, 1);

      // show contour labels
      show_labels_label.set_hexpand(true);
      show_labels_label.set_vexpand(false);
      show_labels_label.set_valign(Gtk::ALIGN_CENTER);
      show_labels_label.set_halign(Gtk::ALIGN_END);
      show_labels_switch.set_hexpand(true);
      show_labels_switch.set_vexpand(false);
      show_labels_switch.set_halign(Gtk::ALIGN_START);
      show_labels_switch.set_valign(Gtk::ALIGN_CENTER);
      show_labels_switch.set_active(plot->is_showing_labels());
      show_labels_switch.property_active().signal_changed().connect([this, plot](){
        if (show_labels_switch.get_active()) {
          plot->show_labels();
        }
        else {
          plot->hide_labels();
        }
      });

      grid.attach(show_labels_label, 0, row_counter, 1, 1);
      grid.attach(show_labels_switch, 1, row_counter++, 1, 1);

      //color button
      edge_color_label.set_hexpand(true);
      edge_color_label.set_vexpand(false);
      edge_color_label.set_valign(Gtk::ALIGN_CENTER);
      edge_color_label.set_halign(Gtk::ALIGN_END);

      edge_color.set_rgba(plot->get_edge_color());
      edge_color.set_use_alpha(true);
      edge_color.set_hexpand(true);
      edge_color.set_vexpand(false);
      edge_color.set_halign(Gtk::ALIGN_START);
      edge_color.set_valign(Gtk::ALIGN_CENTER);
      edge_color.signal_color_set().connect([this, plot](){plot->set_edge_color(edge_color.get_rgba());});

      grid.attach(edge_color_label, 0, row_counter, 1, 1);
      grid.attach(edge_color, 1, row_counter++, 1, 1);

      //the edge width spinbutton
      edge_width_label.set_hexpand(true);
      edge_width_label.set_vexpand(false);
      edge_width_label.set_valign(Gtk::ALIGN_CENTER);
      edge_width_label.set_halign(Gtk::ALIGN_END);

      edge_width_spin.set_hexpand(true);
      edge_width_spin.set_vexpand(false);
      edge_width_spin.set_halign(Gtk::ALIGN_START);
      edge_width_spin.set_valign(Gtk::ALIGN_CENTER);
      edge_width_spin.set_wrap(true);
      edge_width_spin.set_snap_to_ticks(true);
      edge_width_spin.set_numeric(true);
      edge_width_spin.set_value(plot->get_edge_width());
      edge_width_spin.signal_value_changed().connect([this, plot](){
        plot->set_edge_width(edge_width_spin.get_value());
      });

      grid.attach(edge_width_label, 0, row_counter, 1, 1);
      grid.attach(edge_width_spin, 1, row_counter++, 1, 1);

      //nlevels
      nlevels_label.set_hexpand(true);
      nlevels_label.set_vexpand(false);
      nlevels_label.set_valign(Gtk::ALIGN_CENTER);
      nlevels_label.set_halign(Gtk::ALIGN_END);
      nlevels_spin.set_hexpand(true);
      nlevels_spin.set_vexpand(false);
      nlevels_spin.set_halign(Gtk::ALIGN_START);
      nlevels_spin.set_valign(Gtk::ALIGN_CENTER);
      nlevels_spin.set_wrap(true);
      nlevels_spin.set_snap_to_ticks(true);
      nlevels_spin.set_numeric(true);
      nlevels_spin.set_value(plot->get_nlevels());
      nlevels_spin.signal_value_changed().connect([this, plot](){
        plot->set_nlevels(nlevels_spin.get_value());
      });

      grid.attach(nlevels_label, 0, row_counter, 1, 1);
      grid.attach(nlevels_spin, 1, row_counter++, 1, 1);

      // colormap palette
      colormap_palette_label.set_hexpand(true);
      colormap_palette_label.set_vexpand(false);
      colormap_palette_label.set_valign(Gtk::ALIGN_CENTER);
      colormap_palette_label.set_halign(Gtk::ALIGN_END);
      colormap_palette_combo.set_hexpand(true);
      colormap_palette_combo.set_vexpand(false);
      colormap_palette_combo.set_halign(Gtk::ALIGN_START);
      colormap_palette_combo.set_valign(Gtk::ALIGN_CENTER);

      colormap_palette_combo.append("Default");
      colormap_palette_combo.append("Blue → Red");
      colormap_palette_combo.append("Blue → Yellow");
      colormap_palette_combo.append("Gray");
      colormap_palette_combo.append("High frequencies");
      colormap_palette_combo.append("Low frequencies");
      colormap_palette_combo.append("Radar");

      colormap_palette_combo.set_active(plot->get_colormap_palette());
      colormap_palette_combo.signal_changed().connect([this, plot](){
        plot->set_colormap_palette(static_cast<Gtk::PLplot::ColormapPalette>(colormap_palette_combo.get_active_row_number()));
      });

      grid.attach(colormap_palette_label, 0, row_counter, 1, 1);
      grid.attach(colormap_palette_combo, 1, row_counter++, 1, 1);

      //area fill pattern
      area_fill_pattern_label.set_hexpand(true);
      area_fill_pattern_label.set_vexpand(false);
      area_fill_pattern_label.set_valign(Gtk::ALIGN_CENTER);
      area_fill_pattern_label.set_halign(Gtk::ALIGN_END);
      area_fill_pattern_combo.set_hexpand(true);
      area_fill_pattern_combo.set_vexpand(false);
      area_fill_pattern_combo.set_halign(Gtk::ALIGN_START);
      area_fill_pattern_combo.set_valign(Gtk::ALIGN_CENTER);

      area_fill_pattern_combo.append("Solid");
      area_fill_pattern_combo.append("Horizontal lines");
      area_fill_pattern_combo.append("Vertical lines");
      area_fill_pattern_combo.append("Upward lines at 45 degrees");
      area_fill_pattern_combo.append("Downward lines at 45 degrees");
      area_fill_pattern_combo.append("Upward lines at 30 degrees");
      area_fill_pattern_combo.append("Downward lines at 30 degrees");
      area_fill_pattern_combo.append("Horizontal and vertical lines");
      area_fill_pattern_combo.append("Upward and downward lines at 45 degrees");
      area_fill_pattern_combo.set_active(plot->get_area_fill_pattern());
      area_fill_pattern_combo.signal_changed().connect([this, plot](){
        plot->set_area_fill_pattern(static_cast<Gtk::PLplot::AreaFillPattern>(area_fill_pattern_combo.get_active_row_number()));
        if (area_fill_pattern_combo.get_active_row_number() == 0 /* SOLID */) {
          area_lines_width_spin.set_sensitive(false);
        }
        else {
          area_lines_width_spin.set_sensitive();
        }
      });

      grid.attach(area_fill_pattern_label, 0, row_counter, 1, 1);
      grid.attach(area_fill_pattern_combo, 1, row_counter++, 1, 1);

      //the area lines width spinbutton
      area_lines_width_label.set_hexpand(true);
      area_lines_width_label.set_vexpand(false);
      area_lines_width_label.set_valign(Gtk::ALIGN_CENTER);
      area_lines_width_label.set_halign(Gtk::ALIGN_END);

      area_lines_width_spin.set_hexpand(true);
      area_lines_width_spin.set_vexpand(false);
      area_lines_width_spin.set_halign(Gtk::ALIGN_START);
      area_lines_width_spin.set_valign(Gtk::ALIGN_CENTER);
      area_lines_width_spin.set_wrap(true);
      area_lines_width_spin.set_snap_to_ticks(true);
      area_lines_width_spin.set_numeric(true);
      area_lines_width_spin.set_value(plot->get_area_lines_width());
      area_lines_width_spin.signal_value_changed().connect([this, plot](){
        plot->set_area_lines_width(area_lines_width_spin.get_value());
      });

      area_lines_width_spin.set_sensitive(false);

      grid.attach(area_lines_width_label, 0, row_counter, 1, 1);
      grid.attach(area_lines_width_spin, 1, row_counter++, 1, 1);

      //colorbar
      colorbar_label.set_hexpand(true);
      colorbar_label.set_vexpand(false);
      colorbar_label.set_valign(Gtk::ALIGN_CENTER);
      colorbar_label.set_halign(Gtk::ALIGN_END);
      colorbar_switch.set_hexpand(true);
      colorbar_switch.set_vexpand(false);
      colorbar_switch.set_halign(Gtk::ALIGN_START);
      colorbar_switch.set_valign(Gtk::ALIGN_CENTER);
      colorbar_switch.set_active(plot->is_showing_colorbar());
      colorbar_switch.property_active().signal_changed().connect([this, plot](){
        if (colorbar_switch.get_active()) {
          plot->show_colorbar();
        }
        else {
          plot->hide_colorbar();
        }
      });

      grid.attach(colorbar_label, 0, row_counter, 1, 1);
      grid.attach(colorbar_switch, 1, row_counter++, 1, 1);
      paned.add1(grid);

      //add canvas to grid
      aspect_frame.add(canvas);
      paned.add2(aspect_frame);

      //finishing up
      add(paned);
      set_border_width(10);
#if GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION >= 18
      paned.set_wide_handle(true);
#endif
      paned.show_all();

    }
コード例 #12
0
ファイル: argument.cpp プロジェクト: richardbeare/mrtrix
    Argument::Argument (const MR::Argument& argument) :
      arg (argument),
      description_label (arg.lname)
    {
      set_border_width (GUI_SPACING);
      set_spacing (GUI_SPACING);
      pack_start (description_label, Gtk::PACK_SHRINK);

      switch (arg.type) {
        case Integer: 
          {
            Gtk::SpinButton* sb = manage (new Gtk::SpinButton);
            sb->set_value (arg.extra_info.i.def);
            sb->set_range (arg.extra_info.i.min, arg.extra_info.i.max);
            sb->set_increments (1, 10);
            pack_start (*sb);
            widget = (void*) sb;
          }
          break;
        case Float:
          {
            Gtk::SpinButton* sb = manage (new Gtk::SpinButton);
            sb->set_range (arg.extra_info.f.min, arg.extra_info.f.max);
            sb->set_increments (
                1e-4 *(arg.extra_info.f.max-arg.extra_info.f.min), 
                1e-2 *(arg.extra_info.f.max-arg.extra_info.f.min));
            sb->set_digits (4);
            sb->set_value (arg.extra_info.f.def);
            pack_start (*sb);
            widget = (void*) sb;
          }
          break;
        case Text:
        case IntSeq:
        case FloatSeq: 
          { 
            Gtk::Entry* entry = manage (new Gtk::Entry);
            pack_start (*entry);
            widget = (void*) entry;
          }
          break;
        case ArgFile:
        case ImageIn:
        case ImageOut:
          { 
            Gtk::Entry* entry = manage (new Gtk::Entry);
            Gtk::Button* browse = manage (new Gtk::Button (Gtk::Stock::OPEN));
            browse->signal_clicked().connect (sigc::mem_fun (*this, &Argument::on_browse));
            pack_start (*entry);
            pack_start (*browse, Gtk::PACK_SHRINK);
            widget = (void*) entry;
          }
          break;
        case Choice:
          {
            Gtk::ComboBoxText* choice = manage (new Gtk::ComboBoxText);
            for (const gchar** p = arg.extra_info.choice; *p; p++) choice->append_text (*p);
            choice->set_active (0);
            pack_start (*choice);
            widget = (void*) choice;
          }
          break;
        default: break;
      }

      set_tooltip_text (arg.desc);
    }