Пример #1
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);
  }
Пример #2
0
  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);
  }
Пример #3
0
void Toggle::connectWidget(Gtk::Widget* widget)
{
	if (dynamic_cast<Gtk::ToggleToolButton*>(widget) != NULL)
	{
		Gtk::ToggleToolButton* toolButton = static_cast<Gtk::ToggleToolButton*>(widget);

		toolButton->set_active(_toggled);

		// Connect the toggleToolbutton to the callback of this class
		_toggleWidgets[widget] = toolButton->signal_toggled().connect(
			sigc::mem_fun(*this, &Toggle::onToggleToolButtonClicked));
	}
	else if (dynamic_cast<Gtk::ToggleButton*>(widget) != NULL)
	{
		Gtk::ToggleButton* toggleButton = static_cast<Gtk::ToggleButton*>(widget);

		toggleButton->set_active(_toggled);

		// Connect the togglebutton to the callback of this class
		_toggleWidgets[widget] = toggleButton->signal_toggled().connect(
			sigc::mem_fun(*this, &Toggle::onToggleButtonClicked));
	}
	else if (dynamic_cast<Gtk::CheckMenuItem*>(widget) != NULL)
	{
		Gtk::CheckMenuItem* menuItem = static_cast<Gtk::CheckMenuItem*>(widget);

		menuItem->set_active(_toggled);

		// Connect the togglebutton to the callback of this class
		_toggleWidgets[widget] = menuItem->signal_toggled().connect(
			sigc::mem_fun(*this, &Toggle::onCheckMenuItemClicked));
	}
}
Пример #4
0
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_checked(mforms::ToolBarItem *item, bool toggled) {
  Gtk::ToggleButton *btn = cast<Gtk::ToggleButton *>(item->get_data_ptr());
  if (btn) {
    btn->set_data("ignore_signal", (void *)1);
    btn->set_active(toggled);
    btn->set_data("ignore_signal", (void *)0);
  }
}
Пример #5
0
//------------------------------------------------------------------------------
bool mforms::gtk::ToolBarImpl::get_item_checked(mforms::ToolBarItem *item) {
  bool ret = false;

  Gtk::ToggleButton *btn = cast<Gtk::ToggleButton *>(item->get_data_ptr());
  if (btn)
    ret = btn->get_active();

  return ret;
}
Пример #6
0
void View::connect_toggled(const char *name, const sigc::slot<void, Gtk::ToggleButton *> &slot)
{
  Gtk::ToggleButton *button = NULL;
  m_builder->get_widget (name, button);
  if (button)
    button->signal_toggled().connect (sigc::bind(slot, button));
  else {
    std::cerr << "missing toggle button " << name << "\n";
  }
}
Пример #7
0
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_alt_icon(mforms::ToolBarItem *item, const std::string &image_path) {
  Gtk::ToggleButton *btn = cast<Gtk::ToggleButton *>(item->get_data_ptr());
  if (btn) {
    static ImageCache *images = ImageCache::get_instance();
    Gtk::Image *img = new Gtk::Image(images->image_from_path(image_path));
    if (img) {
      btn->set_data("alt_icon", img, free_icon);
      btn->signal_toggled().connect(sigc::bind(sigc::ptr_fun(swap_icons), btn));
    }
  }
}
Пример #8
0
Gtk::ToggleButton *
ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *stockid,
		const char * tooltip)
{
	Gtk::ToggleButton *tbutton = manage(new class Gtk::ToggleButton());
	Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
	tbutton->set_tooltip_text(tooltip);
	tbutton->add(*icon);
	icon->set_padding(0, 0);
	icon->show();
	tbutton->set_relief(Gtk::RELIEF_NONE);
	tbutton->show();

	return tbutton;
}
Пример #9
0
/*! \fn Toolbox::add_state(const Smach::state_base *state)
 *  \brief Add and connect a toogle button to the toolbox defined by a state
 *  \param state a const pointer to Smach::state_base
*/
void
Toolbox::add_state(const Smach::state_base *state)
{
	Gtk::Image *icon;

	assert(state);

	String name=state->get_name();

	Gtk::StockItem stock_item;
	Gtk::Stock::lookup(Gtk::StockID("synfig-"+name),stock_item);

	Gtk::ToggleButton* button;
	button=manage(new class Gtk::ToggleButton());

	Gtk::AccelKey key;
	//Have a look to global fonction init_ui_manager() from app.cpp for "accel_path" definition
	Gtk::AccelMap::lookup_entry ("<Actions>/action_group_state_manager/state-"+name, key);
	//Gets the accelerator representation for labels
	Glib::ustring accel_path = key.get_abbrev ();

	icon=manage(new Gtk::Image(stock_item.get_stock_id(),Gtk::IconSize(4)));
	button->add(*icon);
	button->set_tooltip_text(stock_item.get_label()+" "+accel_path);
	icon->show();
	button->show();

	int row=state_button_map.size()/5;
	int col=state_button_map.size()%5;

	tool_table->attach(*button,col,col+1,row,row+1, Gtk::EXPAND, Gtk::EXPAND, 0, 0);

	state_button_map[name]=button;

	button->signal_clicked().connect(
		sigc::bind(
			sigc::mem_fun(*this,&studio::Toolbox::change_state_),
			state
		)
	);

	refresh();
}
Пример #10
0
void Torrents_viewport::add_info_widget(const std::string& name, Gtk::Widget& widget_container, Info_widget& widget, Gtk::ToggleButton& button)
{
	this->info_widgets.push_back(Info_widget_handle(name, button, widget));
	this->torrent_infos_notebook.append_page(widget_container);
	this->info_toggle_buttons_hbox.pack_start(button, false, false);

	button.signal_toggled().connect(
		sigc::bind<Gtk::ToggleButton*>(
			sigc::mem_fun(*this, &Torrents_viewport::on_toggle_info_callback),
			&button
		)
	);
}
Пример #11
0
	bool get_layer_curve_gradient_flag()const { return layer_curve_gradient_togglebutton.get_active(); }
Пример #12
0
	void set_layer_advanced_outline_flag(bool x) { return layer_advanced_outline_togglebutton.set_active(x); }
Пример #13
0
	bool get_layer_advanced_outline_flag()const { return layer_advanced_outline_togglebutton.get_active(); }
Пример #14
0
	void set_layer_region_flag(bool x) { return layer_region_togglebutton.set_active(x); }
Пример #15
0
	bool get_layer_region_flag()const { return layer_region_togglebutton.get_active(); }
Пример #16
0
//------------------------------------------------------------------------------
bool mforms::gtk::ToolBarImpl::create_tool_item(mforms::ToolBarItem *item, ToolBarItemType type) {
  Gtk::Widget *w = 0;
  switch (type) {
    case mforms::TextActionItem:
    case mforms::ActionItem:
    case mforms::SwitcherItem: {
      Gtk::Button *btn = Gtk::manage(new Gtk::Button());
      btn->set_focus_on_click(false);
      btn->set_border_width(0);
      btn->set_relief(Gtk::RELIEF_NONE);
      btn->signal_clicked().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item));
      if (type == mforms::SwitcherItem)
        btn->set_always_show_image(true);
      w = btn;
      break;
    }
    case mforms::SegmentedToggleItem:
    case mforms::ToggleItem: {
      Gtk::ToggleButton *btn = Gtk::manage(new Gtk::ToggleButton());
      btn->set_focus_on_click(false);
      btn->set_relief(Gtk::RELIEF_NONE);
      btn->signal_toggled().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item));
      btn->set_inconsistent(false);

      w = btn;
      break;
    }
    case mforms::SeparatorItem: {
      Gtk::Separator *sep = new Gtk::Separator(Gtk::ORIENTATION_VERTICAL);
      w = sep;
      break;
    }
    case mforms::SearchFieldItem: {
#if GTK_VERSION_GE(2, 16)
      Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());
      w = entry;
      entry->set_icon_from_stock(Gtk::Stock::FIND);
#else
      Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
      w = hbox;
      Gtk::Image *image = Gtk::manage(new Gtk::Image(Gtk::Stock::FIND, Gtk::ICON_SIZE_MENU));
      Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());

      hbox->pack_start(*image, false, true);
      hbox->pack_start(*entry, true, true);
      hbox->set_data("entry", entry);
      hbox->show_all();
#endif
      entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item));
      break;
    }
    case mforms::TextEntryItem: {
      Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
      w = hbox;
      Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());
      hbox->pack_start(*entry, true, true);
      hbox->set_data("entry", entry);
      hbox->show_all();
      entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item));
      break;
    }
    case mforms::FlatSelectorItem:
    case mforms::SelectorItem: {
      Gtk::ComboBoxText *ct = Gtk::manage(new Gtk::ComboBoxText());
      ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item));

      w = ct;
      break;
    }
    case mforms::ColorSelectorItem: {
      if (!color_combo_columns) {
        color_combo_columns = new ColorComboColumns();
      }
      Gtk::ComboBox *ct = Gtk::manage(new Gtk::ComboBox());

      ct->pack_start(color_combo_columns->image);
      ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item));

      w = ct;

      break;
    }
    case mforms::ExpanderItem:
    case mforms::LabelItem: {
      Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5));
      w = label;
      break;
    }
    case mforms::ImageBoxItem: {
      Gtk::Image *image = Gtk::manage(new Gtk::Image());
      w = image;
      break;
    }
    case mforms::TitleItem: {
      Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5));
      w = label;
      auto provider = Gtk::CssProvider::create();
      provider->load_from_data("* { color: #333; font-weight: bold; }");
      w->get_style_context()->add_provider(provider, GTK_STYLE_PROVIDER_PRIORITY_USER);
      break;
    }
  }

  if (w) {
    w->show();
  } else
    logError("create_tool_item, widget is 0 for passed type %i\n", type);

  item->set_data(w);

  return w != 0;
}
Пример #17
0
	bool get_layer_text_flag()const { return layer_text_togglebutton.get_active(); }
Пример #18
0
 void onToggleButton() {
   mVisible = mToggleButton->get_active();
   mRenderer->requestDraw();
 }
Пример #19
0
  bool addWidgets(Gtk::Box* iBox) {
    if (mBox != NULL) return false;

    mBox = Gtk::manage(new Gtk::VBox());

    Gtk::Box* box = Gtk::manage(new Gtk::HBox());

    mToggleButton = Gtk::manage(new Gtk::ToggleButton("                    "));
    Gdk::Color color;
    color.set_rgb_p(mAttributes.mColor[0], mAttributes.mColor[1],
                    mAttributes.mColor[2]);
    mToggleButton->modify_bg(Gtk::STATE_ACTIVE, color);
    color.set_rgb_p((mAttributes.mColor[0]+1)/2, (mAttributes.mColor[1]+1)/2,
                    (mAttributes.mColor[2]+1)/2);
    mToggleButton->modify_bg(Gtk::STATE_PRELIGHT, color); 
    color.set_rgb_p(0.8, 0.8, 0.8);
    mToggleButton->modify_bg(Gtk::STATE_NORMAL, color);
    mToggleButton->signal_toggled().connect
      (sigc::mem_fun(*this, &Helper::onToggleButton));
    mToggleButton->set_active(true);
    box->pack_start(*(mToggleButton), false, false);
    Gtk::Label* label = Gtk::manage(new Gtk::Label(mAttributes.mLabel));
    box->pack_start(*label, false, false);
    if (mViewId != 1) {
      Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button("X"));
      box->pack_start(*cancelButton, false, false);
      cancelButton->signal_clicked().connect
        (sigc::mem_fun(*this, &Helper::onRemoveButton));
    }
    Gtk::Button* button = Gtk::manage(new Gtk::Button("save"));
    button->signal_clicked().connect
      (sigc::mem_fun(*this, &Helper::onSaveButton));
    box->pack_start(*button, false, false);

    mBox->pack_start(*box, false, false);

    box = Gtk::manage(new Gtk::HBox());
    std::vector<int> ids;
    std::vector<std::string> labels;
    ids = { MeshRenderer::ColorModeFlat, MeshRenderer::ColorModeHeight,
            MeshRenderer::ColorModeRange, MeshRenderer::ColorModeNormal,
            MeshRenderer::ColorModeCamera };
    labels = { "Flat", "Height", "Range", "Normal", "Camera" };
    Gtk::ComboBox* combo = 
      gtkmm::RendererBase::createCombo(mAttributes.mColorMode, labels, ids);
    combo->signal_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*combo, false, false);

    ids = { MeshRenderer::MeshModePoints, MeshRenderer::MeshModeWireframe,
            MeshRenderer::MeshModeFilled };
    labels = { "Points", "Wireframe", "Filled" };
    combo =
      gtkmm::RendererBase::createCombo(mAttributes.mMeshMode, labels, ids);
    combo->signal_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*combo, false, false);
    
    Gtk::HScale* slider =
      gtkmm::RendererBase::createSlider(mAttributes.mPointSize, 0.1, 10, 0.1);
    slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*slider, true, true);

    mBox->pack_start(*box, false, false);

    box = Gtk::manage(new Gtk::HBox());
    label = Gtk::manage(new Gtk::Label("Z Rng"));
    box->pack_start(*label,false,false);
    slider = gtkmm::RendererBase::createSlider(mAttributes.mMinZ, -1, 2, 0.01);
    slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*slider, true, true);
    slider = gtkmm::RendererBase::createSlider(mAttributes.mMaxZ, -1, 2, 0.01);
    slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
    box->pack_start(*slider, true, true);

    mBox->pack_start(*box, false, false);

    mBox->pack_start(*Gtk::manage(new Gtk::HSeparator()));

    mBox->show_all();
    iBox->pack_start(*mBox, false, false);
    return true;
  }
Пример #20
0
void setToggleButtonCallback(string b, sigc::slot<void> sig ) {
    Gtk::ToggleButton* bu;
    VRGuiBuilder()->get_widget(b, bu);
    bu->signal_clicked().connect(sig);
}
Пример #21
0
 PropertyEditorBool::PropertyEditorBool(const char * key, Gtk::ToggleButton &button)
   : PropertyEditorBase(key, button)
 {
   m_connection = button.property_active().signal_changed().connect(
     sigc::mem_fun(*this, &PropertyEditorBool::on_changed));
 }
Пример #22
0
void
StateBrush_Context::refresh_tool_options()
{
	brush_buttons.clear();
	App::dialog_tool_options->clear();
	App::dialog_tool_options->set_local_name(_("Brush Tool"));
	App::dialog_tool_options->set_name("brush");

	// create container
	Gtk::Table *table = Gtk::manage(new Gtk::Table(1, 2, false));

	// create options
	table->attach(eraser_checkbox, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);

	// create brushes container widget
	int cols = 4;
	Gtk::Table *brushes_table = Gtk::manage(new Gtk::Table(1, cols));

	// load brushes
	// scan directories
	std::set<String> files;
	for(std::set<String>::const_iterator i = paths.begin(); i != paths.end(); ++i)
		scan_directory(*i, 1, files);

	// load files
	int col = 0; int row = 0;
	Gtk::ToggleButton *first_button = NULL;
	Gtk::IconSize iconsize = Gtk::ICON_SIZE_LARGE_TOOLBAR;
	for(std::set<String>::const_iterator i = files.begin(); i != files.end(); ++i)
	{
		if (!brush_buttons.count(*i) && filename_extension(*i) == ".myb")
		{
			const String &brush_file = *i;
			const String icon_file = filename_sans_extension(brush_file) + "_prev.png";
			if (files.count(icon_file))
			{
				// create button
				Gtk::ToggleButton *button = brush_buttons[*i] = Gtk::manage(new Gtk::ToggleButton());
				Glib::RefPtr<Gdk::Pixbuf> pixbuf, pixbuf_scaled;
				pixbuf = Gdk::Pixbuf::create_from_file(icon_file);
				pixbuf_scaled = pixbuf->scale_simple(48, 48, Gdk::INTERP_BILINEAR);
				button->set_image(*Gtk::manage(new Gtk::Image(pixbuf_scaled)));
				button->set_relief(Gtk::RELIEF_NONE);
				button->signal_toggled().connect(
					sigc::bind(sigc::mem_fun(*this, &StateBrush_Context::select_brush), button, brush_file) );
				if (first_button == NULL) first_button = button;

				if (col >= cols)
				{
					// add row
					col = 0;
					++row;
					brushes_table->resize(row + 1, cols);
				}

				// add button
				brushes_table->attach(*button, col, col+1, row, row+1);
				++col;
			}
		}
	}
	Gtk::ScrolledWindow *brushes_scroll = Gtk::manage(new Gtk::ScrolledWindow());
	brushes_scroll->add(*brushes_table);
	table->attach(*brushes_scroll, 0, 1, 1, 2);

	table->show_all();
	App::dialog_tool_options->add(*table);

	// select first brush
	if (first_button != NULL) first_button->set_active(true);
}
Пример #23
0
	void set_layer_curve_gradient_flag(bool x) { return layer_curve_gradient_togglebutton.set_active(x); }
Пример #24
0
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;
}
Пример #25
0
	void set_layer_rectangle_flag(bool x) { return layer_rectangle_togglebutton.set_active(x); }
Пример #26
0
	void set_layer_text_flag(bool x) { return layer_text_togglebutton.set_active(x); }
Пример #27
0
	bool get_layer_rectangle_flag()const { return layer_rectangle_togglebutton.get_active(); }