void StimResponseEditor::populateWindow() { // Create the overall vbox _dialogVBox = Gtk::manage(new Gtk::VBox(false, 12)); add(*_dialogVBox); // Create the notebook and add it to the vbox _notebook = Gtk::manage(new Gtk::Notebook); _dialogVBox->pack_start(*_notebook, true, true, 0); // The tab label items (icon + label) Gtk::HBox* stimLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); stimLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_STIM + SUFFIX_EXTENSION))), false, false, 3 ); stimLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Stims"))), false, false, 3); Gtk::HBox* responseLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); responseLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_RESPONSE + SUFFIX_EXTENSION))), false, false, 3 ); responseLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Responses"))), false, false, 3); Gtk::HBox* customLabelHBox = Gtk::manage(new Gtk::HBox(false, 0)); customLabelHBox->pack_start( *Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbufWithMask(ICON_CUSTOM_STIM))), false, false, 3 ); customLabelHBox->pack_start(*Gtk::manage(new Gtk::Label(_("Custom Stims"))), false, false, 3); // Show the widgets before using them as label, they won't appear otherwise stimLabelHBox->show_all(); responseLabelHBox->show_all(); customLabelHBox->show_all(); // Cast the helper class to a widget and add it to the notebook page _stimPageNum = _notebook->append_page(*_stimEditor, *stimLabelHBox); _responsePageNum = _notebook->append_page(*_responseEditor, *responseLabelHBox); _customStimPageNum = _notebook->append_page(*_customStimEditor, *customLabelHBox); if (_lastShownPage == -1) { _lastShownPage = _stimPageNum; } // Pack in dialog buttons _dialogVBox->pack_start(createButtons(), false, false, 0); }
void c_PreferencesDlg::InitControls() { for (const Utils::Const::Language_t &lang: Utils::Const::languages) { m_UILanguage.append(lang.name == Utils::Const::SYSTEM_DEFAULT_LANG ? _("System language") : lang.name); if (lang.langId == std::string(Configuration::UILanguage)) m_UILanguage.set_active(m_UILanguage.get_model()->children().size()-1); } get_content_area()->pack_start(*Utils::PackIntoBox<Gtk::HBox>( { Gtk::manage(new Gtk::Label(_("User interface language:"))), &m_UILanguage } ), Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); int iconSizePx; Gtk::IconSize::lookup(Configuration::GetToolIconSize(), iconSizePx, iconSizePx); m_ToolIconSize.set_adjustment(Gtk::Adjustment::create(iconSizePx, MIN_ICON_SIZE_PIX, MAX_ICON_SIZE_PIX)); m_ToolIconSize.set_digits(0); m_ToolIconSize.set_value_pos(Gtk::PositionType::POS_LEFT); for (unsigned sizeMark: { 8, 16, 24, 32, 40, 64, 80, 100, 128 }) m_ToolIconSize.add_mark(sizeMark, Gtk::PositionType::POS_TOP, Glib::ustring::format(sizeMark)); Gtk::HBox *boxToolIconSize = Gtk::manage(new Gtk::HBox()); boxToolIconSize->pack_start(*Gtk::manage(new Gtk::Label(_("Tool icon size:"))), Gtk::PackOptions::PACK_SHRINK); boxToolIconSize->pack_start(m_ToolIconSize); boxToolIconSize->set_spacing(10); boxToolIconSize->show_all(); get_content_area()->pack_start(*boxToolIconSize, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); m_ExportInactiveFramesQuality.set_label(_("Include inactive frames when exporting quality data")); m_ExportInactiveFramesQuality.set_active(Configuration::ExportInactiveFramesQuality); m_ExportInactiveFramesQuality.show(); get_content_area()->pack_start(m_ExportInactiveFramesQuality, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); m_NumQualHistBins.set_adjustment(Gtk::Adjustment::create(Configuration::NumQualityHistogramBins, 10, Utils::Const::MaxQualityHistogramBins, 1, 10, 10)); get_content_area()->pack_start(*Utils::PackIntoBox<Gtk::HBox>( { Gtk::manage(new Gtk::Label(_("Number of frame quality histogram bins:"))), &m_NumQualHistBins }), Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); auto separator = Gtk::manage(new Gtk::Separator()); separator->show(); get_content_area()->pack_end(*separator, Gtk::PackOptions::PACK_SHRINK, Utils::Const::widgetPaddingInPixels); add_button(_("OK"), Gtk::RESPONSE_OK); add_button(_("Cancel"), Gtk::RESPONSE_CANCEL); //FIXME: not working when a Gtk::Entry has focus! #### set_default(*get_widget_for_response(Gtk::ResponseType::RESPONSE_OK)); }
TreeViewTooltips::TreeViewTooltips(BuddyView* view): m_buddyview(view) , Window(Gtk::WINDOW_POPUP) { this->set_decorated(false); this->set_skip_pager_hint(true); this->set_skip_taskbar_hint(true); this->set_name("gtk-tooltips"); this->set_position(Gtk::WIN_POS_MOUSE); this->set_resizable(false); this->set_border_width(4); this->set_app_paintable(true); this->property_can_focus() = false; m_label = Gtk::manage(new Gtk::Label()); m_label->set_line_wrap(true); m_label->set_alignment(0.5, 0.5); m_label->set_use_markup(true); m_avatar = Gtk::manage(new Gtk::Image()); Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox()); Gtk::Image* logo = getImage("default.png"); hbox->pack_start(*logo); hbox->pack_start(*m_label); hbox->pack_start(*m_avatar); hbox->show_all(); add (*hbox); add_events(Gdk::POINTER_MOTION_MASK); this->signal_expose_event().connect(sigc::mem_fun(*this, &TreeViewTooltips::on_expose_event)); /* this->signal_motion_notify_event().connect(sigc::mem_fun( *this, &TreeViewTooltips::on_motion_event), false); this->signal_leave_notify_event().connect(sigc::mem_fun( *this, &TreeViewTooltips::on_leave_event), false); */ }
Widget_Preview::Widget_Preview(): Gtk::Table(1, 5), adj_time_scrub(0, 0, 1000, 0, 10, 0), scr_time_scrub(adj_time_scrub), b_loop(/*_("Loop")*/), current_surface(NULL), currentindex(-100000),//TODO get the value from canvas setting or preview option audiotime(0), adj_sound(0, 0, 4), l_lasttime("0s"), playing(false), jackdial(NULL), jack_enabled(false), jack_is_playing(false), jack_time(0), jack_offset(0) #ifdef WITH_JACK , jack_client(NULL), jack_synchronizing(false) #endif { //catch key press event for shortcut keys signal_key_press_event().connect(sigc::mem_fun(*this, &Widget_Preview::on_key_pressed)); //connect to expose events //signal_expose_event().connect(sigc::mem_fun(*this, &studio::Widget_Preview::redraw)); //manage all the change in values etc... //1st row: preview content preview_window.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //pack preview content into scrolled window preview_window.add(draw_area); //preview window background color Gdk::Color bg_color; bg_color.set_red(54*256); bg_color.set_blue(59*256); bg_color.set_green(59*256); draw_area.modify_bg(Gtk::STATE_NORMAL, bg_color); adj_time_scrub.signal_value_changed().connect(sigc::mem_fun(*this,&Widget_Preview::slider_move)); scr_time_scrub.signal_event().connect(sigc::mem_fun(*this,&Widget_Preview::scroll_move_event)); draw_area.signal_expose_event().connect(sigc::mem_fun(*this,&Widget_Preview::redraw)); scr_time_scrub.set_draw_value(0); disp_sound.set_time_adjustment(&adj_sound); timedisp = -1; //Set up signals to modify time value as it should be... disp_sound.signal_start_scrubbing().connect(sigc::mem_fun(*this,&Widget_Preview::scrub_updated)); disp_sound.signal_scrub().connect(sigc::mem_fun(*this,&Widget_Preview::scrub_updated)); Gtk::Button *button = 0; Gtk::Image *icon = 0; #if 1 //2nd row: prevframe play/pause nextframe loop | halt-render re-preview erase-all toolbar = Gtk::manage(new class Gtk::HBox(false, 0)); //prev rendered frame Gtk::Button *prev_framebutton; Gtk::Image *icon0 = manage(new Gtk::Image(Gtk::StockID("synfig-animate_seek_prev_frame"), Gtk::ICON_SIZE_BUTTON)); prev_framebutton = manage(new class Gtk::Button()); prev_framebutton->set_tooltip_text(_("Prev frame")); icon0->set_padding(0,0); icon0->show(); prev_framebutton->add(*icon0); prev_framebutton->set_relief(Gtk::RELIEF_NONE); prev_framebutton->show(); prev_framebutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,&Widget_Preview::seek_frame), -1)); toolbar->pack_start(*prev_framebutton, Gtk::PACK_SHRINK, 0); { //play Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID("synfig-animate_play"), Gtk::ICON_SIZE_BUTTON)); play_button = manage(new class Gtk::Button()); play_button->set_tooltip_text(_("Play")); icon->set_padding(0,0); icon->show(); play_button->add(*icon); play_button->set_relief(Gtk::RELIEF_NONE); play_button->show(); play_button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::on_play_pause_pressed)); toolbar->pack_start(*play_button, Gtk::PACK_SHRINK, 0); } { //pause Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID("synfig-animate_pause"), Gtk::ICON_SIZE_BUTTON)); pause_button = manage(new class Gtk::Button()); pause_button->set_tooltip_text(_("Pause")); icon->set_padding(0,0); icon->show(); pause_button->add(*icon); pause_button->set_relief(Gtk::RELIEF_NONE); pause_button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::on_play_pause_pressed)); toolbar->pack_start(*pause_button, Gtk::PACK_SHRINK, 0); } //next rendered frame Gtk::Button *next_framebutton; Gtk::Image *icon2 = manage(new Gtk::Image(Gtk::StockID("synfig-animate_seek_next_frame"), Gtk::ICON_SIZE_BUTTON)); next_framebutton = manage(new class Gtk::Button()); next_framebutton->set_tooltip_text(_("Next frame")); icon2->set_padding(0,0); icon2->show(); next_framebutton->add(*icon2); next_framebutton->set_relief(Gtk::RELIEF_NONE); next_framebutton->show(); next_framebutton->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this,&Widget_Preview::seek_frame), 1)); toolbar->pack_start(*next_framebutton, Gtk::PACK_SHRINK, 0); //spacing Gtk::Alignment *space = Gtk::manage(new Gtk::Alignment()); space->set_size_request(8); toolbar->pack_start(*space, false, true); //loop button = &b_loop; IMAGIFY_BUTTON(button,"synfig-animate_loop", _("Loop")); toolbar->pack_start(b_loop, Gtk::PACK_SHRINK,0); //spacing Gtk::Alignment *space1 = Gtk::manage(new Gtk::Alignment()); space1->set_size_request(24); toolbar->pack_start(*space1, false, true); //halt render button = manage(new Gtk::Button(/*_("Halt Render")*/)); button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::stoprender)); IMAGIFY_BUTTON(button,Gtk::Stock::STOP, _("Halt render")); toolbar->pack_start(*button, Gtk::PACK_SHRINK, 0); //re-preview button = manage(new Gtk::Button(/*_("Re-Preview")*/)); button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::repreview)); IMAGIFY_BUTTON(button, Gtk::Stock::EDIT, _("Re-preview")); toolbar->pack_start(*button, Gtk::PACK_SHRINK, 0); //erase all button = manage(new Gtk::Button(/*_("Erase All")*/)); button->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Preview::eraseall)); IMAGIFY_BUTTON(button, Gtk::Stock::CLEAR, _("Erase all rendered frame(s)")); toolbar->pack_start(*button, Gtk::PACK_SHRINK, 0); //spacing Gtk::Alignment *space2 = Gtk::manage(new Gtk::Alignment()); space1->set_size_request(24); toolbar->pack_start(*space2, false, true); //jack jackdial = Gtk::manage(new JackDial()); #ifdef WITH_JACK jack_dispatcher.connect(sigc::mem_fun(*this, &Widget_Preview::on_jack_sync)); jackdial->signal_enable_jack().connect(sigc::mem_fun(*this, &studio::Widget_Preview::on_toggle_jack_pressed)); jackdial->signal_offset_changed().connect(sigc::mem_fun(*this, &studio::Widget_Preview::on_jack_offset_changed)); jackdial->signal_disable_jack().connect(sigc::mem_fun(*this, &studio::Widget_Preview::on_toggle_jack_pressed)); #endif //FIXME: Hardcoded FPS! jackdial->set_fps(24.f); jackdial->set_offset(jack_offset); if ( !getenv("SYNFIG_DISABLE_JACK") ) jackdial->show(); toolbar->pack_start(*jackdial, false, true); //zoom preview factor_refTreeModel = Gtk::ListStore::create(factors); zoom_preview.set_model(factor_refTreeModel); zoom_preview.property_has_frame() = true; zoom_preview.signal_changed().connect(sigc::mem_fun(*this, &Widget_Preview::preview_draw)); Gtk::TreeModel::Row row = *(factor_refTreeModel->append()); row[factors.factor_id] = "1"; row[factors.factor_value] = "25%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "2"; row[factors.factor_value] = "50%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "3"; row[factors.factor_value] = "100%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "4"; row[factors.factor_value] = "200%"; row = *(factor_refTreeModel->append()); row[factors.factor_id] = "5"; row[factors.factor_value] = _("Fit"); zoom_preview.set_text_column(factors.factor_value); Gtk::Entry* entry = zoom_preview.get_entry(); entry->set_text("100%"); //default zoom level entry->set_icon_from_stock(Gtk::StockID("synfig-zoom")); entry->signal_activate().connect(sigc::mem_fun(*this, &Widget_Preview::on_zoom_entry_activated)); //set the zoom widget width zoom_preview.set_size_request(100, -1); zoom_preview.show(); toolbar->pack_end(zoom_preview, Gtk::PACK_SHRINK, 0); show_toolbar(); //3rd row: previewing frame numbering and rendered frame numbering Gtk::HBox *status = manage(new Gtk::HBox); status->pack_start(l_currenttime, Gtk::PACK_SHRINK, 5); Gtk::Label *separator = manage(new Gtk::Label(" / ")); status->pack_start(*separator, Gtk::PACK_SHRINK, 0); status->pack_start(l_lasttime, Gtk::PACK_SHRINK, 5); status->show_all(); //5th row: sound track disp_sound.set_size_request(-1,32); // attach all widgets attach(preview_window, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0); attach(scr_time_scrub, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); attach(*toolbar, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); attach(*status, 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); // attach(disp_sound,0,1,4,5,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK); preview_window.show_all(); scr_time_scrub.show_all(); //if(draw_area.get_window()) gc_area = Gdk::GC::create(draw_area.get_window()); #endif }
void BugzillaPreferences::add_clicked() { Gtk::FileChooserDialog dialog(_("Select an icon..."), Gtk::FILE_CHOOSER_ACTION_OPEN); dialog.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button (Gtk::Stock::OPEN, Gtk::RESPONSE_OK); dialog.set_default_response(Gtk::RESPONSE_OK); dialog.set_local_only(true); dialog.set_current_folder (last_opened_dir); Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create(); filter->add_pixbuf_formats (); dialog.add_filter(filter); // Extra Widget Gtk::Label *l = manage(new Gtk::Label (_("_Host name:"), true)); Gtk::Entry *host_entry = manage(new Gtk::Entry ()); l->set_mnemonic_widget(*host_entry); Gtk::HBox *hbox = manage(new Gtk::HBox (false, 6)); hbox->pack_start (*l, false, false, 0); hbox->pack_start (*host_entry, true, true, 0); hbox->show_all (); dialog.set_extra_widget(*hbox); int response; std::string icon_file; std::string host; while(1) { response = dialog.run (); icon_file = dialog.get_filename(); host = sharp::string_trim(host_entry->get_text()); if (response == (int) Gtk::RESPONSE_OK) { bool valid = sanitize_hostname(host); if(valid && !host.empty()) { break; } // Let the user know that they // have to specify a host name. gnote::utils::HIGMessageDialog warn( NULL, GTK_DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, _("Host name invalid"), _("You must specify a valid Bugzilla " "host name to use with this icon.")); warn.run (); host_entry->grab_focus (); } else if (response != (int) Gtk::RESPONSE_OK) { return; } } // Keep track of the last directory the user had open last_opened_dir = dialog.get_current_folder(); // Copy the file to the BugzillaIcons directory std::string err_msg; if (!copy_to_bugzilla_icons_dir (icon_file, host, err_msg)) { gnote::utils::HIGMessageDialog err(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, _("Error saving icon"), std::string(_("Could not save the icon file.")) + " " + err_msg); err.run(); } update_icon_store(); }