CheckButton::CheckButton(Glib::ustring const &label, Glib::ustring const &tooltip, bool active) { set_use_underline (true); set_label (label); set_tooltip_text(tooltip); set_active(active); }
Widget_Link::Widget_Link(const std::string &tlt_inactive, const std::string &tlt_active) { const Glib::RefPtr<Gtk::StyleContext> context = get_style_context(); // hardfixed icon size. chain icon is not a square but a rectangle. Glib::RefPtr<Gtk::IconSet> chain_icon = Gtk::IconSet::lookup_default(Gtk::StockID("synfig-utils_chain_link_off")); Glib::RefPtr<Gdk::Pixbuf> chain_icon_pixbuff = chain_icon->render_icon_pixbuf(context, (Gtk::IconSize)-1); Glib::RefPtr<Gdk::Pixbuf> chain_icon_pixbuff_scaled = chain_icon_pixbuff->scale_simple(16, 32, Gdk::INTERP_BILINEAR); icon_off_ = manage(new Gtk::Image(chain_icon_pixbuff_scaled)); chain_icon = Gtk::IconSet::lookup_default(Gtk::StockID("synfig-utils_chain_link_on")); chain_icon_pixbuff_scaled = chain_icon->render_icon_pixbuf(context, (Gtk::IconSize)-1)->scale_simple(16, 32, Gdk::INTERP_BILINEAR); icon_on_ = manage(new Gtk::Image(chain_icon_pixbuff_scaled)); icon_off_->set_padding(0,0); icon_on_->set_padding(0,0); icon_off_->show(); add(*icon_off_); set_relief(Gtk::RELIEF_NONE); tooltip_inactive_ = tlt_inactive; tooltip_active_ = tlt_active; set_tooltip_text(tooltip_inactive_); }
Gui_ThresholdSetter::Gui_ThresholdSetter(Gui_ProcessorHandler& processor_hand,const std::string str): Gui_OptionSetterBaseClass(processor_hand,str), m_adjust(m_opts.getThr(), 0.0, 255.0, 1.0, 10.0, 0.0), m_spin_butt(m_adjust), m_check_butt(LABEL_CHECKBUTTON_AUTO_THR) { set_tooltip_text(TOOLTIP_THR_SETTER); m_combo.set_title("Mode"); m_combo_map["Regular"] = OCFU_THR_NORM; m_combo_map["Inverted"] = OCFU_THR_INV; m_combo_map["Bilateral"] = OCFU_THR_BILAT; m_combo.append_text("Regular"); m_combo.append_text("Inverted"); m_combo.append_text("Bilateral"); m_combo.set_active(m_opts.getThrMode()); m_check_butt.set_active(m_opts.getHasAutoThr()); this->m_vbox.add(m_hbox2); m_hbox2.add(m_combo); m_hbox2.add(m_spin_butt); m_hbox2.add(m_check_butt); m_spin_butt.signal_value_changed().connect( sigc::hide_return( sigc::mem_fun(*this,&Gui_ThresholdSetter::setOption))); m_check_butt.signal_clicked().connect( sigc::hide_return( sigc::mem_fun(*this,&Gui_ThresholdSetter::setOption))); m_combo.signal_changed().connect( sigc::hide_return( sigc::mem_fun(*this,&Gui_ThresholdSetter::setOption))); }
ColorPicker::ColorPicker (const Glib::ustring& title, const Glib::ustring& tip, guint32 rgba, bool undo) : _preview(rgba), _title(title), _rgba(rgba), _undo(undo), _colorSelectorDialog("dialogs.colorpickerwindow") { setupDialog(title); set_relief (Gtk::RELIEF_NONE); _preview.show(); add (_preview); set_tooltip_text (tip); }
Gui_ColourSelector::Gui_ColourSelector(Gui_ProcessorHandler& processor_hand,const std::string str): Gui_OptionSetterBaseClass(processor_hand,str), m_adjust_hue_center(m_processor_hand.getOptions().getCenTolHue().first, 0.0, 358, 2.0, 10.0, 0.0), m_adjust_hue_tol(m_processor_hand.getOptions().getCenTolHue().second, 0.0, 180, 1.0, 10.0, 0.0), m_adjust_sat_min(m_processor_hand.getOptions().getMinMaxSat().first, 0.0, 255, 1.0, 10.0, 0.0), m_adjust_sat_max(m_processor_hand.getOptions().getMinMaxSat().second, 0.0, 255, 1.0, 10.0, 0.0), m_spin_butt_hue_center(m_adjust_hue_center), m_spin_butt_hue_tol(m_adjust_hue_tol), m_spin_butt_sat_min(m_adjust_sat_min), m_spin_butt_sat_max(m_adjust_sat_max), m_check_butt(LABEL_CHECKBUTTON_HAS_HUE_FILT), m_lab_hue(LABEL_HUE), m_lab_center(LABEL_HUE_CENT), m_lab_tol(LABEL_HUE_TOL), m_lab_sat(LABEL_SATUR), m_lab_sat_min(LABEL_SATUR_MIN), m_lab_sat_max(LABEL_SATUR_MAX) { set_tooltip_text(TOOLTIP_COLOUR_SELECTOR); m_hbox21.set_tooltip_text(TOOLTIP_COLOUR_SELECTOR_HUE); m_hbox22.set_tooltip_text(TOOLTIP_COLOUR_SELECTOR_SAT); m_vbox.pack_start(m_check_butt); m_vbox.pack_start(m_hbox2); m_hbox2.pack_start(m_col_wheel,true,true); m_hbox2.pack_start(m_vbox2,false,false); m_vbox2.pack_start(m_hbox21,false,false); m_hbox21.pack_start(m_lab_hue,false,false); m_hbox21.pack_start(m_spin_butt_hue_center,false,false); m_hbox21.pack_start(m_lab_center,false,false); m_hbox21.pack_start(m_spin_butt_hue_tol,false,false); m_hbox21.pack_start(m_lab_tol,false,false); m_vbox2.pack_start(m_hbox22); m_hbox22.pack_start(m_lab_sat); m_hbox22.pack_start(m_spin_butt_sat_min); m_hbox22.pack_start(m_lab_sat_min); m_hbox22.pack_start(m_spin_butt_sat_max); m_hbox22.pack_start(m_lab_sat_max); m_spin_butt_hue_center.set_wrap(true); m_spin_butt_hue_center.signal_value_changed().connect( sigc::hide_return( sigc::mem_fun(*this,&Gui_ColourSelector::setOption))); m_spin_butt_hue_tol.signal_value_changed().connect( sigc::hide_return( sigc::mem_fun(*this,&Gui_ColourSelector::setOption))); m_spin_butt_sat_min.signal_value_changed().connect( sigc::hide_return( sigc::mem_fun(*this,&Gui_ColourSelector::on_MinSatChanged))); m_spin_butt_sat_max.signal_value_changed().connect( sigc::hide_return( sigc::mem_fun(*this,&Gui_ColourSelector::setOption))); m_check_butt.signal_toggled().connect(sigc::mem_fun(*this,&Gui_ColourSelector::on_activate_filter)); }
RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in) : RegisteredWidget<Gtk::CheckButton>() { init_parent(key, wr, repr_in, doc_in); setProgrammatically = false; set_tooltip_text (tip); Gtk::Label *l = new Gtk::Label (label); l->set_use_underline (true); add (*manage (l)); set_alignment (right? 1.0 : 0.0, 0.5); _toggled_connection = signal_toggled().connect (sigc::mem_fun (*this, &RegisteredCheckButton::on_toggled)); }
control::control(std::unique_ptr<property_widget::idata_proxy> Data) : base(std::move(Data)), m_image(new Gtk::Image()) { set_name("k3d-property-button"); set_tooltip_text(_("LMB-Click to make connections with other properties. RMB-Click for context menu.")); add(*manage(m_image)); data_changed(); m_data->document().document().pipeline().dependency_signal().connect(sigc::mem_fun(*this, &control::on_dependencies_changed)); signal_button_press_event().connect(sigc::mem_fun(*this, &base::button_press_event)); signal_button_release_event().connect(sigc::mem_fun(*this, &base::button_release_event)); }
ImageFileSettings::ImageFileSettings(const Glib::RefPtr<ImageFile>& imagefile, const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip) { set_label_widget(_label); image_file = imagefile; set_expanded(true); _n_entries = 0; _label.show(); _hbox.show(); table.show(); _label.set_label(label); set_tooltip_text(tooltip); add(table); Gtk::FileFilter img_filter; img_filter.set_name(_("Image Files")); img_filter.add_pixbuf_formats(); SettingsWidget::append_filename_widget(table, _n_entries, name, label, tooltip, img_filter, sigc::mem_fun(*image_file.operator->(), &ImageFile::get_filename), sigc::mem_fun(*image_file.operator->(), &ImageFile::set_filename), image_file->signal_imagefile_changed()); SettingsWidget::append_boolean_widget(table, _n_entries, name+"-needs-to-be-warped", "Warp?", "Decides, whether the Image needs to be warped before beeing used", sigc::mem_fun(*image_file.operator->(), &ImageFile::get_needs_to_be_warped), sigc::mem_fun(*image_file.operator->(), &ImageFile::set_needs_to_be_warped), image_file->signal_needs_to_be_warped_changed()); if(imagefile->correction_curve_type==ImageFile::COLOR_CURVE) SettingsWidget::append_colorcurve_widget(table, _n_entries, name+"-color-curve", _("ColorCurve"), _("Allows you to modify the Rexture's Contrast, Brightness, Color ..."), imagefile->get_color_curve()); else if(imagefile->correction_curve_type==ImageFile::CONTRAST_CURVE) SettingsWidget::append_curve_widget(table, _n_entries, name+"-contrast-curve", _("ConstrastCurve"), _("Allows you to modify the Rexture's Contrast, Brightness, ..."), imagefile->get_contrast_curve()); }
RadioButton::RadioButton(Glib::ustring const &label, Glib::ustring const &tooltip) { set_use_underline (true); set_label (label); set_tooltip_text(tooltip); }
void chooser::create_device (const std::set<scanner::info>& devices, const std::string& udi) { std::set<scanner::info>::const_iterator it = devices.begin (); while (devices.end () != it && udi != it->udi ()) { ++it; } if (devices.end () != it) { Glib::RefPtr< Gdk::Window > window = get_window (); if (window) { window->set_cursor (Gdk::Cursor (Gdk::WATCH)); Gdk::flush (); } scanner::ptr ptr; std::string why; try { // FIXME This is a bit clunky but scanner creation may be time // consuming and cannot be put in a separate thread if // the scanner object is run via process separation. // The child process would exit at thread end. while (Gtk::Main::events_pending ()) Gtk::Main::iteration (); ptr = scanner::create (*it); } catch (const std::exception& e) { why = e.what (); } catch (...) { // FIXME set a why we failed to create a device } if (window) { window->set_cursor (); } if (ptr) { cache_ = get_active (); set_tooltip_text (it->udi ()); signal_device_changed_.emit (ptr); } else { const std::string& name = get_active ()->get_value (cols_->name); const std::string& udi = get_active ()->get_value (cols_->udi); inhibit_callback_ = true; if (cache_) set_active (cache_); inhibit_callback_ = false; BOOST_THROW_EXCEPTION (std::runtime_error ((format (SEC_("Cannot access %1%\n(%2%)\n%3%")) % name % udi % _(why) ).str ())); } } }
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); }
RegionChooser::RegionChooser() : activeKeyColor("red"), red("#8070ff"), grey1("grey69"), white("white"), black("black"), m_VirtKeybModeChoice(_("Virtual Keyboard Mode")), currentActiveKey(-1) { set_size_request(500, KEYBOARD_HEIGHT + REGION_BLOCK_HEIGHT); instrument = 0; region = 0; resize.active = false; move.active = false; cursor_is_resize = false; h1 = REGION_BLOCK_HEIGHT; // properties of the virtual keyboard { const char* choices[] = { _("normal"), _("chord"), 0 }; static const virt_keyboard_mode_t values[] = { VIRT_KEYBOARD_MODE_NORMAL, VIRT_KEYBOARD_MODE_CHORD }; m_VirtKeybModeChoice.set_choices(choices, values); m_VirtKeybModeChoice.set_value(VIRT_KEYBOARD_MODE_NORMAL); } m_VirtKeybVelocityLabelDescr.set_text(_("Note-On Velocity:")); m_VirtKeybVelocityLabel.set_text("-"); m_VirtKeybOffVelocityLabelDescr.set_text(_("Note-Off Velocity:")); m_VirtKeybOffVelocityLabel.set_text("-"); m_VirtKeybPropsBox.pack_start(m_VirtKeybModeChoice.label, Gtk::PACK_SHRINK); m_VirtKeybPropsBox.pack_start(m_VirtKeybModeChoice.widget, Gtk::PACK_SHRINK); m_VirtKeybPropsBox.pack_start(m_VirtKeybVelocityLabelDescr, Gtk::PACK_SHRINK); m_VirtKeybPropsBox.pack_start(m_VirtKeybVelocityLabel, Gtk::PACK_SHRINK); m_VirtKeybPropsBox.pack_start(m_VirtKeybOffVelocityLabelDescr, Gtk::PACK_SHRINK); m_VirtKeybPropsBox.pack_start(m_VirtKeybOffVelocityLabel, Gtk::PACK_SHRINK); m_VirtKeybPropsBox.set_spacing(10); m_VirtKeybPropsBox.show(); for (int i = 0 ; i < 128 ; i++) key_pressed[i] = false; actionGroup = Gtk::ActionGroup::create(); actionGroup->add(Gtk::Action::create("Properties", _("_Properties")), sigc::mem_fun(*this, &RegionChooser::show_region_properties)); actionGroup->add(Gtk::Action::create("Remove", _("_Remove")), sigc::mem_fun(*this, &RegionChooser::delete_region)); actionGroup->add(Gtk::Action::create("Add", _("_Add")), sigc::mem_fun(*this, &RegionChooser::add_region)); actionGroup->add(Gtk::Action::create("Dimensions", _("Dimensions...")), sigc::mem_fun(*this, &RegionChooser::manage_dimensions)); uiManager = Gtk::UIManager::create(); uiManager->insert_action_group(actionGroup); Glib::ustring ui_info = "<ui>" " <popup name='PopupMenuInsideRegion'>" " <menuitem action='Properties'/>" " <menuitem action='Dimensions'/>" " <menuitem action='Remove'/>" " </popup>" " <popup name='PopupMenuOutsideRegion'>" " <menuitem action='Add'/>" " </popup>" "</ui>"; uiManager->add_ui_from_string(ui_info); popup_menu_inside_region = dynamic_cast<Gtk::Menu*>( uiManager->get_widget("/PopupMenuInsideRegion")); popup_menu_outside_region = dynamic_cast<Gtk::Menu*>( uiManager->get_widget("/PopupMenuOutsideRegion")); add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK); dimensionManager.region_to_be_changed_signal.connect( region_to_be_changed_signal.make_slot() ); dimensionManager.region_changed_signal.connect( region_changed_signal.make_slot() ); dimensionManager.region_changed_signal.connect( sigc::hide( sigc::mem_fun(*this, &RegionChooser::on_dimension_manager_changed) ) ); keyboard_key_hit_signal.connect( sigc::mem_fun(*this, &RegionChooser::on_note_on_event) ); keyboard_key_released_signal.connect( sigc::mem_fun(*this, &RegionChooser::on_note_off_event) ); set_tooltip_text(_("Right click here for adding new region. Use mouse pointer for moving (dragging) or resizing existing regions (by pointing at region's boundary). Right click on an existing region for more actions.")); }