void aspect_toggled() { Gtk::CheckButton *check; _xml->get_widget("aspect_check", check); _be.set_keep_aspect_ratio(check->get_active()); }
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 RSFilechooser::do_action() { const Gtk::FileChooserAction action = ((Gtk::FileChooser*)chooser)->get_action(); if (action == Gtk::FILE_CHOOSER_ACTION_OPEN) view->do_load(); else if (action == Gtk::FILE_CHOOSER_ACTION_SAVE) { switch(filetype) { case MODEL: view->do_save_stl(); break; case GCODE: view->do_save_gcode(); break; case SETTINGS: view->do_save_settings_as(); break; case SVG: { bool singlelayer = false; Gtk::CheckButton *mult; builder->get_widget("save_multiple", mult); if (mult) singlelayer = mult->get_state(); view->do_slice_svg(singlelayer); } break; default: break; } } // get updated paths Model * model = view->get_model(); if (model) { ModelPath = model->settings.STLPath; GCodePath = model->settings.GCodePath; SettingsPath = model->settings.SettingsPath; } else cerr << "no settings default paths" << endl; if (filetype == GCODE) view->show_notebooktab("gcode_tab", "controlnotebook"); else view->show_notebooktab("model_tab", "controlnotebook"); }
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 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); } }
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); } }
Gtk::Widget* PrefPage::appendCheckBox(const std::string& name, const std::string& flag, const std::string& registryKey) { // Create a new checkbox with the given caption and display it Gtk::CheckButton* check = Gtk::manage(new Gtk::CheckButton(flag)); // Connect the registry key to this toggle button registry::bindPropertyToBufferedKey(check->property_active(), registryKey, _registryBuffer, _resetValuesSignal); appendNamedWidget(name, *check); return check; }
void Example_Flasher::on_flash_arc_toggled() { if ( m_flash_arc.get_active() ) m_Flasher->add( m_Arc ); else m_Flasher->remove( m_Arc ); }
void Example_Flasher::on_flash_bezierline_toggled() { if ( m_flash_bezierline.get_active() ) m_Flasher->add( m_BezierLine ); else m_Flasher->remove( m_BezierLine ); }
void Example_Flasher::on_flash_group_toggled() { if ( m_flash_group.get_active() ) m_Flasher->add( m_Group ); else m_Flasher->remove( m_Group ); }
void Example_AffineAnimator::on_animate_arc_toggled() { if ( m_animate_arc.get_active() ) m_AffineAnimator->add( m_Arc ); else m_AffineAnimator->remove( m_Arc ); }
void Example_AffineAnimator::on_animate_bezierline_toggled() { if ( m_animate_bezierline.get_active() ) m_AffineAnimator->add( m_BezierLine ); else m_AffineAnimator->remove( m_BezierLine ); }
void Example_AffineAnimator::on_animate_group_toggled() { if ( m_animate_group.get_active() ) m_AffineAnimator->add( m_Group ); else m_AffineAnimator->remove( m_Group ); }
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; }
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()); }
ImageEditorFE(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args) : PluginEditorBase(m, grtm, args) , _be(grtm, workbench_model_ImageFigureRef::cast_from(args[0])) , _xml(0) , _image(0) { set_border_width(8); _xml= Gtk::Builder::create_from_file(grtm->get_data_file_path("modules/data/editor_image.glade")); Gtk::Widget *widget; _xml->get_widget("editor_image_hbox", widget); Gtk::Button *button(0); _xml->get_widget("browse_button", button); button->signal_clicked().connect(sigc::mem_fun(this, &ImageEditorFE::browse_file)); _xml->get_widget("reset_size_button", button); button->signal_clicked().connect(sigc::mem_fun(this, &ImageEditorFE::reset_aspect)); Gtk::CheckButton *check; _xml->get_widget("aspect_check", check); check->signal_toggled().connect(sigc::mem_fun(this, &ImageEditorFE::aspect_toggled)); Gtk::Entry *entry; _xml->get_widget("width_entry", entry); entry->signal_activate().connect(sigc::mem_fun(this, &ImageEditorFE::width_changed)); _xml->get_widget("height_entry", entry); entry->signal_activate().connect(sigc::mem_fun(this, &ImageEditorFE::height_changed)); _xml->get_widget("image", _image); widget->reparent(*this); show_all(); refresh_form_data(); }
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(); }
void apply_pitchshift1(FFTFilter<jack_default_audio_sample_t>** filt2) { double asdf = 1.; Gtk::CheckButton* cb; Gtk::Entry* e; b->get_widget("c_pitchshift", cb); if(cb->get_active()) { b->get_widget("t_pitch", e); asdf = strtod(e->get_text().c_str(), NULL); asdf=pow(2,asdf/12.d); //b->get_widget("t_pitch2", e); //asdf /= strtod(e->get_text().c_str(), NULL); } #ifdef JACKFFT_USE_SOUNDTOUCH if(asdf==1.) { apply_soundTouch=false; } else { for(int i=0;i<CHANNELS;i++) { soundTouch[i].setPitch(asdf); } wmb(); apply_soundTouch=true; } #else if(filt2 != NULL) { for(size_t i = 0; i < inputs.size(); i++) { if(filt2[i] == NULL)continue; filt2[i]->freq_scale = asdf; } return; } for(size_t i = 0; i < inputs.size(); i++) ((FFTFilter<jack_default_audio_sample_t>*)filt[i])->freq_scale = asdf; #endif }
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))); }
void GscPreferencesWindow::export_config() { // we don't clear config here, it might contain non-dialog options too. Gtk::CheckButton* check = 0; Gtk::Entry* entry = 0; // ------- General tab if ((check = this->lookup_widget<Gtk::CheckButton*>("scan_on_startup_check"))) prefs_config_set("gui/scan_on_startup", bool(check->get_active())); if ((check = this->lookup_widget<Gtk::CheckButton*>("show_smart_capable_only_check"))) prefs_config_set("gui/show_smart_capable_only", bool(check->get_active())); if ((check = this->lookup_widget<Gtk::CheckButton*>("search_in_smartmontools_first_check"))) prefs_config_set("system/win32_search_smartctl_in_smartmontools", bool(check->get_active())); if ((entry = this->lookup_widget<Gtk::Entry*>("smartctl_binary_entry"))) prefs_config_set("system/smartctl_binary", std::string(entry->get_text())); if ((entry = this->lookup_widget<Gtk::Entry*>("smartctl_options_entry"))) prefs_config_set("system/smartctl_options", std::string(entry->get_text())); // ------- Drives tab if ((entry = this->lookup_widget<Gtk::Entry*>("device_blacklist_patterns_entry"))) prefs_config_set("system/device_blacklist_patterns", std::string(entry->get_text())); device_option_map_t devmap = device_options_treeview->get_device_map(); std::string devmap_str = app_serialize_device_option_map(devmap); prefs_config_set("system/smartctl_device_options", devmap_str); }
// Construct main widgets Gtk::Widget& OverlayDialog::createWidgets() { Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12)); // "Use image" checkbox _useImageBtn = Gtk::manage(new Gtk::CheckButton(_("Use background image"))); _useImageBtn->set_active(registry::getValue<bool>(RKEY_OVERLAY_VISIBLE)); _useImageBtn->signal_toggled().connect( sigc::mem_fun(*this, &OverlayDialog::toggleUseImage) ); vbox->pack_start(*_useImageBtn, false, false, 0); // Other widgets are in a table, which is indented with respect to the // Use Image checkbox, and becomes enabled/disabled with it. _subTable = Gtk::manage(new Gtk::Table(8, 2, false)); _subTable->set_row_spacings(12); _subTable->set_col_spacings(12); // Image file Gtk::Label* imageLabel = Gtk::manage(new gtkutil::LeftAlignedLabel( std::string("<b>") + _("Image file") + "</b>")); _subTable->attach(*imageLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); // File chooser _fileChooserBtn = Gtk::manage( new Gtk::FileChooserButton(_("Choose image"), Gtk::FILE_CHOOSER_ACTION_OPEN) ); _fileChooserBtn->signal_selection_changed().connect( sigc::mem_fun(*this, &OverlayDialog::_onFileSelection) ); _subTable->attach(*_fileChooserBtn, 1, 2, 0, 1); // Transparency slider Gtk::Label* transpLabel = Gtk::manage(new gtkutil::LeftAlignedLabel( std::string("<b>") + _("Transparency") + "</b>")); _subTable->attach(*transpLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::FILL); Gtk::HScale* transSlider = Gtk::manage(new Gtk::HScale(0, 1, 0.01)); registry::bindPropertyToKey(transSlider->get_adjustment()->property_value(), RKEY_OVERLAY_TRANSPARENCY); transSlider->signal_value_changed().connect(sigc::mem_fun(*this, &OverlayDialog::_onScrollChange)); _subTable->attach(*transSlider, 1, 2, 1, 2); // Image size slider Gtk::Label* sizeLabel = Gtk::manage(new gtkutil::LeftAlignedLabel( std::string("<b>") + _("Image scale") + "</b>")); _subTable->attach(*sizeLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::FILL); Gtk::HScale* scale = Gtk::manage(new Gtk::HScale(0, 20, 0.01)); registry::bindPropertyToKey(scale->get_adjustment()->property_value(), RKEY_OVERLAY_SCALE); scale->signal_value_changed().connect(sigc::mem_fun(*this, &OverlayDialog::_onScrollChange)); _subTable->attach(*scale, 1, 2, 2, 3); // Translation X slider _subTable->attach(*Gtk::manage(new gtkutil::LeftAlignedLabel( std::string("<b>") + _("Horizontal offset") + "</b>")), 0, 1, 3, 4, Gtk::FILL, Gtk::FILL); Gtk::HScale* transx = Gtk::manage(new Gtk::HScale(-20, 20, 0.01)); registry::bindPropertyToKey(transx->get_adjustment()->property_value(), RKEY_OVERLAY_TRANSLATIONX); transx->signal_value_changed().connect(sigc::mem_fun(*this, &OverlayDialog::_onScrollChange)); _subTable->attach(*transx, 1, 2, 3, 4); // Translation Y slider _subTable->attach(*Gtk::manage(new gtkutil::LeftAlignedLabel( std::string("<b>") + _("Vertical offset") + "</b>")), 0, 1, 4, 5, Gtk::FILL, Gtk::FILL); Gtk::HScale* transy = Gtk::manage(new Gtk::HScale(-20, 20, 0.01)); registry::bindPropertyToKey(transy->get_adjustment()->property_value(), RKEY_OVERLAY_TRANSLATIONY); transy->signal_value_changed().connect(sigc::mem_fun(*this, &OverlayDialog::_onScrollChange)); _subTable->attach(*transy, 1, 2, 4, 5); // Options list _subTable->attach(*Gtk::manage(new gtkutil::LeftAlignedLabel( std::string("<b>") + _("Options") + "</b>")), 0, 1, 5, 6, Gtk::FILL, Gtk::FILL); Gtk::CheckButton* keepAspect = Gtk::manage(new Gtk::CheckButton(_("Keep aspect ratio"))); registry::bindPropertyToKey(keepAspect->property_active(), RKEY_OVERLAY_PROPORTIONAL); keepAspect->signal_toggled().connect( sigc::mem_fun(GlobalSceneGraph(), &scene::Graph::sceneChanged) ); _subTable->attach(*keepAspect, 1, 2, 5, 6); Gtk::CheckButton* scaleWithViewport = Gtk::manage(new Gtk::CheckButton(_("Zoom image with viewport"))); registry::bindPropertyToKey(scaleWithViewport->property_active(), RKEY_OVERLAY_SCALE_WITH_XY); scaleWithViewport->signal_toggled().connect( sigc::mem_fun(GlobalSceneGraph(), &scene::Graph::sceneChanged) ); _subTable->attach(*scaleWithViewport, 1, 2, 6, 7); Gtk::CheckButton* panWithViewport = Gtk::manage(new Gtk::CheckButton(_("Pan image with viewport"))); registry::bindPropertyToKey(panWithViewport->property_active(), RKEY_OVERLAY_PAN_WITH_XY); panWithViewport->signal_toggled().connect( sigc::mem_fun(GlobalSceneGraph(), &scene::Graph::sceneChanged) ); _subTable->attach(*panWithViewport, 1, 2, 7, 8); // Pack table into vbox and return vbox->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_subTable, 18, 1.0)), true, true, 0); return *vbox; }
void set_paragraph_flag(bool x) { return paragraph_checkbutton.set_active(x); }
bool get_paragraph_flag()const { return paragraph_checkbutton.get_active(); }
void set_scale_flag(bool x) { return checkbutton_scale.set_active(x); refresh_scale_flag(); }
bool get_scale_flag()const { return checkbutton_scale.get_active(); }
void set_layer_link_origins_flag(bool x) { return layer_link_origins_checkbutton.set_active(x); }
bool get_layer_link_origins_flag()const { return layer_link_origins_checkbutton.get_active(); }
void set_invert(bool i) { invert_checkbutton.set_active(i); }
bool get_invert()const { return invert_checkbutton.get_active(); }
void do_toggle() { if (resize->get_active()) inner->show(); else inner->hide(); }