예제 #1
0
void PreferencesFrame::set_check_state(Gtk::CheckButton& check, int configuration_mode)
{
	switch (configuration_mode)
	{
		case 1:  check.set_active(true) ; break ;
		case 0:  check.set_active(false) ; break ;
		default: check.set_sensitive(false) ; break ;
	}

}
void GscPreferencesWindow::import_config()
{
	// Clear and fill the entries.

	Gtk::CheckButton* check = 0;
	Gtk::Entry* entry = 0;


	// ------- General tab

	bool scan_on_startup;
	if ( prefs_config_get("gui/scan_on_startup", scan_on_startup)
			&& (check = this->lookup_widget<Gtk::CheckButton*>("scan_on_startup_check")) )
		check->set_active(scan_on_startup);

	bool show_smart_capable_only;
	if ( prefs_config_get("gui/show_smart_capable_only", show_smart_capable_only)
			&& (check = this->lookup_widget<Gtk::CheckButton*>("show_smart_capable_only_check")) )
		check->set_active(show_smart_capable_only);

	bool win32_search_smartctl_in_smartmontools;
	if ( prefs_config_get("system/win32_search_smartctl_in_smartmontools", win32_search_smartctl_in_smartmontools)
			&& (check = this->lookup_widget<Gtk::CheckButton*>("search_in_smartmontools_first_check")) )
		check->set_active(win32_search_smartctl_in_smartmontools);

	std::string smartctl_binary;
	if ( prefs_config_get("system/smartctl_binary", smartctl_binary)
			&& (entry = this->lookup_widget<Gtk::Entry*>("smartctl_binary_entry")) )
		entry->set_text(smartctl_binary);

	std::string smartctl_options;
	if ( prefs_config_get("system/smartctl_options", smartctl_options)
			&& (entry = this->lookup_widget<Gtk::Entry*>("smartctl_options_entry")) )
		entry->set_text(smartctl_options);


	// ------- Drives tab

	std::string device_blacklist_patterns;
	if ( prefs_config_get("system/device_blacklist_patterns", device_blacklist_patterns)
			&& (entry = this->lookup_widget<Gtk::Entry*>("device_blacklist_patterns_entry")) )
		entry->set_text(device_blacklist_patterns);


	std::string devmap_str;
	if ( prefs_config_get("system/smartctl_device_options", devmap_str) ) {
		device_option_map_t devmap = app_unserialize_device_option_map(devmap_str);
		device_options_treeview->set_device_map(devmap);
	}

}
예제 #3
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;
  }
}
void
FontSubstitution::show(Glib::ustring out, GSList *l)
{
   Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."),
                       false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true);
   warning.set_resizable(true);
   warning.set_title(_("Font substitution"));

   GtkWidget *dlg = GTK_WIDGET(warning.gobj());
   sp_transientize(dlg);

   Gtk::TextView * textview = new Gtk::TextView();
   textview->set_editable(false);
   textview->set_wrap_mode(Gtk::WRAP_WORD);
   textview->show();
   textview->get_buffer()->set_text(_(out.c_str()));

   Gtk::ScrolledWindow * scrollwindow = new Gtk::ScrolledWindow();
   scrollwindow->add(*textview);
   scrollwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrollwindow->set_shadow_type(Gtk::SHADOW_IN);
   scrollwindow->set_size_request(0, 100);
   scrollwindow->show();

   Gtk::CheckButton *cbSelect = new Gtk::CheckButton();
   cbSelect->set_label(_("Select all the affected items"));
   cbSelect->set_active(true);
   cbSelect->show();

   Gtk::CheckButton *cbWarning = new Gtk::CheckButton();
   cbWarning->set_label(_("Don't show this warning again"));
   cbWarning->show();

#if GTK_CHECK_VERSION(3,0,0)
   Gtk::Box * box = warning.get_content_area();
#else
   Gtk::Box * box = warning.get_vbox();
#endif
   box->set_spacing(2);
   box->pack_start(*scrollwindow, true, true, 4);
   box->pack_start(*cbSelect, false, false, 0);
   box->pack_start(*cbWarning, false, false, 0);

   warning.run();

   if (cbWarning->get_active()) {
       Inkscape::Preferences *prefs = Inkscape::Preferences::get();
       prefs->setInt("/options/font/substitutedlg", 0);
   }

   if (cbSelect->get_active()) {

       SPDesktop *desktop = SP_ACTIVE_DESKTOP;
       Inkscape::Selection *selection = sp_desktop_selection (desktop);
       selection->clear();
       selection->setList(l);
   }

}
예제 #5
0
		FileChooserExtra(int init_x, int init_y) {
			Gtk::Label *lbl;

			resize = Gtk::manage(new Gtk::CheckButton("Save options (requires re-render)"));
			resize->set_active(false);
			pack_start(*resize);
			resize->signal_toggled().connect(sigc::mem_fun(*this, &FileChooserExtra::do_toggle));

			inner = Gtk::manage(new Gtk::HBox());

			lbl = Gtk::manage(new Gtk::Label("X resolution", 0.9, 0.5));
			inner->pack_start(*lbl);
			f_x = Gtk::manage(new Util::HandyEntry<int>());
			f_x->set_activates_default(true);
			inner->pack_start(*f_x);

			lbl = Gtk::manage(new Gtk::Label("Y resolution", 0.9, 0.5));
			inner->pack_start(*lbl);
			f_y = Gtk::manage(new Util::HandyEntry<int>());
			f_y->set_activates_default(true);
			inner->pack_start(*f_y);

			antialias = Gtk::manage(new Gtk::CheckButton("Antialias"));
			antialias->set_active(false);
			inner->pack_start(*antialias);

			do_hud = Gtk::manage(new Gtk::CheckButton("Render HUD"));
			do_hud->set_active(false);
			inner->pack_start(*do_hud);

			f_x->update(init_x);
			f_y->update(init_y);

			pack_start(*inner);
			show_all();
			resize->show();
			inner->hide();
		}
예제 #6
0
DlgConvertir::DlgConvertir(Gtk::Window &parent, const std::string &nombreDoc, DocumentoCalifa *doc)
    : DlgConvertir_glade( parent )
{
	Gtk::CheckButton * chk;
	std::string nombre = FileMan::replaceExt( nombreDoc, EtqExtCsv );

	// Inic
	this->set_title( NombreApp );
	this->set_icon( parent.get_icon() );
	ponNombreArchivo( nombre );

	// La lista de conversiones
	listaConversion->append( CnvtCSV );
	listaConversion->append( CnvtHTML );
	listaConversion->append( CnvtTXT );
	listaConversion->set_active( 0 );

	// Los separadores de campos
	listaSepCampos->set_active_text( "," );
	listaSepCampos->append( "," );
	listaSepCampos->append( ";" );
	listaSepCampos->append( "\\b <SPACE>" );
	listaSepCampos->append( "\\t <TAB>" );

	// Los separadores decimales
	listaSepDecimal->set_active_text( "," );
	listaSepDecimal->append( "." );
	listaSepDecimal->append( "," );

	// Poner la lista de chks para los campos
	for(unsigned int i = 0; i < doc->getListaCampos().size(); ++i) {
		chk = Gtk::manage(
				new class Gtk::CheckButton( doc->getListaCampos()[ i ]->nombre )
		);
		cajaListaCampos->pack_start( *chk, Gtk::PACK_SHRINK, 0 );
		chk->set_active();
		chk->show();
	}

	// Recordar el documento
	this->doc = doc;
}
예제 #7
0
 virtual void do_refresh_form_data()
 {    
   Gtk::Entry *entry;
   int w, h;
   _be.get_size(w, h);
   _xml->get_widget("width_entry", entry);
   entry->set_text(strfmt("%i", w));
   _xml->get_widget("height_entry", entry);
   entry->set_text(strfmt("%i", h));
   
   Gtk::CheckButton *check;
   _xml->get_widget("aspect_check", check);
   check->set_active(_be.get_keep_aspect_ratio());
 
   Glib::RefPtr<Gdk::Pixbuf> pixbuf(Gdk::Pixbuf::create_from_file(_be.get_attached_image_path()));
   if (pixbuf)
     _image->set(pixbuf);  
   else
     g_message("ImageEditorFE: can not set image from %s[%s]", _be.get_filename().c_str(), _be.get_attached_image_path().c_str());    
 }
예제 #8
0
void
PropertiesWindow::add_property(const Raul::URI& uri, const Atom& value)
{
	World* world = _app->world();

	const unsigned n_rows = _table->property_n_rows() + 1;
	_table->property_n_rows() = n_rows;

	// Column 0: Property
	LilvNode* prop = lilv_new_uri(world->lilv_world(), uri.c_str());
	Glib::ustring lab_text = RDFS::label(world, prop);
	if (lab_text.empty()) {
		lab_text = world->rdf_world()->prefixes().qualify(uri);
	}
	lab_text = Glib::ustring("<a href=\"") + uri + "\">"
		+ lab_text + "</a>";
	Gtk::Label* lab = manage(new Gtk::Label(lab_text, 1.0, 0.5));
	lab->set_use_markup(true);
	_table->attach(*lab, 0, 1, n_rows, n_rows + 1,
	               Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK);
	lilv_node_free(prop);

	// Column 1: Value
	Gtk::Alignment*   align      = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0));
	Gtk::CheckButton* present    = manage(new Gtk::CheckButton());
	Gtk::Widget*      val_widget = create_value_widget(uri, value);
	present->set_active(true);
	if (val_widget) {
		align->add(*val_widget);
	}
	_table->attach(*align, 1, 2, n_rows, n_rows + 1,
	               Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK);
	_table->attach(*present, 2, 3, n_rows, n_rows + 1,
	               Gtk::FILL, Gtk::SHRINK);
	_records.insert(make_pair(uri, Record(value, align, n_rows, present)));
}
예제 #9
0
	void set_layer_plant_flag(bool x) { return checkbutton_layer_plant.set_active(x); }
예제 #10
0
void setCheckButton(string cb, bool b) {
    Gtk::CheckButton* cbut;
    VRGuiBuilder()->get_widget(cb, cbut);
    cbut->set_active(b);
}
예제 #11
0
	void set_scale_flag(bool x) { return checkbutton_scale.set_active(x); refresh_scale_flag(); }
예제 #12
0
	void set_invert(bool i) { invert_checkbutton.set_active(i); }
예제 #13
0
	void set_invert(bool i) { checkbutton_invert.set_active(i); }
예제 #14
0
	void set_aspect_lock_flag(bool x) { return checkbutton_aspect_lock.set_active(x); refresh_aspect_lock_flag(); }
예제 #15
0
SignalsDialog::SignalsDialog(Debugger& debugger)
    : DialogBox(btn_ok_cancel, "Signal Handling")
    , debugger_(debugger)
{
    Gtk::Table* table = manage(new Gtk::Table(2, 3));
    get_vbox()->add(*table);

    for (int i = 0; i != 3; ++i)
    {
        Gtk::Label* label = manage(new Gtk::Label(titles[i], .0));
        // label->set_justify(Gtk_FLAG(JUSTIFY_LEFT));
        // label->set_usize(100, -1);
        table->attach(*label, i, i + 1, 0, 1,
            Gtk_FLAG(ATTACH_NONE), Gtk_FLAG(ATTACH_NONE));
    }

    Gtk::ScrolledWindow* sw = manage(new Gtk::ScrolledWindow());
    table->attach(*sw, 0, 3, 1, 2);

    table = manage(new Gtk::Table(_NSIG - 1, 3, true));
    Gtk_set_size(table, 300, -1);

    Gtk_add_with_viewport(sw, *table);
    Gtk_set_size(sw, 360, 300);

    sw->set_policy(Gtk_FLAG(POLICY_AUTOMATIC), Gtk_FLAG(POLICY_AUTOMATIC));

    for (int i = 1; i != _NSIG; ++i)
    {
        ostringstream os;

        os << setw(2) << i << "  " << sig_name(i);

        // --- label with signal's name
        Gtk::Label* label = manage(new Gtk::Label(os.str(), .0, .5));
        label->set_justify(Gtk_FLAG(JUSTIFY_LEFT));

        table->attach(*label, 0, 1, i - 1, i,
            Gtk_FLAG(FILL), Gtk_FLAG(ATTACH_NONE));

        // --- "Pass" button
        Gtk::CheckButton* btn = manage(new Gtk::CheckButton("Pass", .0));
        pass_.push_back(btn);

        if (debugger_.signal_policy(i)->pass())
        {
            btn->set_active(true);
        }
        table->attach(*btn, 1, 2, i - 1, i,
            Gtk_FLAG(EXPAND), Gtk_FLAG(ATTACH_NONE));

        // --- "Stop" button
        btn = manage(new Gtk::CheckButton("Stop", .0));
        stop_.push_back(btn);

        if (debugger_.signal_policy(i)->stop())
        {
            btn->set_active(true);
        }
        table->attach(*btn, 2, 3, i - 1, i,
            Gtk_FLAG(EXPAND), Gtk_FLAG(ATTACH_NONE));
    }

    assert(pass_.size() == stop_.size());
    assert(pass_.size() == _NSIG - 1);

    get_button_box()->set_layout(Gtk_FLAG(BUTTONBOX_END));
}
예제 #16
0
	void set_layer_region_flag(bool x) { return checkbutton_layer_region.set_active(x); }
예제 #17
0
	void set_layer_advanced_outline_flag(bool x) { return checkbutton_layer_advanced_outline.set_active(x); }
예제 #18
0
	void set_layer_link_origins_flag(bool x) { return layer_link_origins_checkbutton.set_active(x); }
예제 #19
0
	void set_layer_curve_gradient_flag(bool x) { return checkbutton_layer_curve_gradient.set_active(x); }
예제 #20
0
	void set_paragraph_flag(bool x) { return paragraph_checkbutton.set_active(x); }
예제 #21
0
	void set_relative(bool r) { check_relative.set_active(r); }