void setLightOn(bool lightOn) { this->lightOn = lightOn; if (lightOn) light.override_background_color(Gdk::RGBA("#FFCC00"), Gtk::STATE_FLAG_NORMAL); else light.override_background_color(Gdk::RGBA("#393f3f"), Gtk::STATE_FLAG_NORMAL); }
void StyleSwatch::setStyle(SPStyle *query) { _place[SS_FILL].remove(); _place[SS_STROKE].remove(); bool has_stroke = true; for (int i = SS_FILL; i <= SS_STROKE; i++) { Gtk::EventBox *place = &(_place[i]); SPIPaint *paint; if (i == SS_FILL) { paint = &(query->fill); } else { paint = &(query->stroke); } if (paint->set && paint->isPaintserver()) { SPPaintServer *server = (i == SS_FILL)? SP_STYLE_FILL_SERVER (query) : SP_STYLE_STROKE_SERVER (query); if (SP_IS_LINEARGRADIENT (server)) { _value[i].set_markup(_("L Gradient")); place->add(_value[i]); _tooltips.set_tip(*place, (i == SS_FILL)? (_("Linear gradient fill")) : (_("Linear gradient stroke"))); } else if (SP_IS_RADIALGRADIENT (server)) { _value[i].set_markup(_("R Gradient")); place->add(_value[i]); _tooltips.set_tip(*place, (i == SS_FILL)? (_("Radial gradient fill")) : (_("Radial gradient stroke"))); } else if (SP_IS_PATTERN (server)) { _value[i].set_markup(_("Pattern")); place->add(_value[i]); _tooltips.set_tip(*place, (i == SS_FILL)? (_("Pattern fill")) : (_("Pattern stroke"))); } } else if (paint->set && paint->isColor()) { guint32 color = paint->value.color.toRGBA32( SP_SCALE24_TO_FLOAT ((i == SS_FILL)? query->fill_opacity.value : query->stroke_opacity.value) ); ((Inkscape::UI::Widget::ColorPreview*)_color_preview[i])->setRgba32 (color); _color_preview[i]->show_all(); place->add(*_color_preview[i]); gchar *tip; if (i == SS_FILL) { tip = g_strdup_printf (_("Fill: %06x/%.3g"), color >> 8, SP_RGBA32_A_F(color)); } else {
Balance::Balance(){ Gtk::EventBox *event; fbri = new Gtk::Frame(" Brillo: "); fbri->set_border_width(4); pbri = new Gtk::HScale( Gtk::Adjustment::create(0.0, 0.0, 101.0, 0.1, 1.0, 1.0)); pbri->signal_value_changed().connect(sigc::bind<Glib::ustring> ( sigc::mem_fun(*this, &Balance::on_adjustment_value_changed), "Brillo")); pbri->set_value(50.0); pbri->set_draw_value(false); event = new Gtk::EventBox(); event->set_border_width(4); fbri->add(*event); event->add(*pbri); pack_start(*fbri, false, false, 0); fcon = new Gtk::Frame(" Contraste: "); fcon->set_border_width(4); pcon = new Gtk::HScale( Gtk::Adjustment::create(0.0, 0.0, 101.0, 0.1, 1.0, 1.0)); pcon->signal_value_changed().connect(sigc::bind<Glib::ustring> ( sigc::mem_fun(*this, &Balance::on_adjustment_value_changed), "Contraste")); pcon->set_value(50.0); pcon->set_draw_value(false); event = new Gtk::EventBox(); event->set_border_width(4); fcon->add(*event); event->add(*pcon); pack_start(*fcon, false, false, 0); fsat = new Gtk::Frame(" Saturación: "); fsat->set_border_width(4); psat = new Gtk::HScale( Gtk::Adjustment::create(0.0, 0.0, 101.0, 0.1, 1.0, 1.0)); psat->signal_value_changed().connect(sigc::bind<Glib::ustring> ( sigc::mem_fun(*this, &Balance::on_adjustment_value_changed), "Saturacion")); psat->set_value(50.0); psat->set_draw_value(false); event = new Gtk::EventBox(); event->set_border_width(4); fsat->add(*event); event->add(*psat); pack_start(*fsat, false, false, 0); fmat = new Gtk::Frame(" Matiz: "); fmat->set_border_width(4); pmat = new Gtk::HScale( Gtk::Adjustment::create(0.0, 0.0, 101.0, 0.1, 1.0, 1.0)); pmat->signal_value_changed().connect(sigc::bind<Glib::ustring> ( sigc::mem_fun(*this, &Balance::on_adjustment_value_changed), "Matiz")); pmat->set_value(50.0); pmat->set_draw_value(false); event = new Gtk::EventBox(); event->set_border_width(4); fmat->add(*event); event->add(*pmat); pack_start(*fmat, false, false, 0); fgam = new Gtk::Frame(" Gamma: "); fgam->set_border_width(4); pgam = new Gtk::HScale( Gtk::Adjustment::create(0.0, 0.0, 101.0, 0.1, 1.0, 1.0)); pgam->signal_value_changed().connect(sigc::bind<Glib::ustring> ( sigc::mem_fun(*this, &Balance::on_adjustment_value_changed), "Gamma")); pgam->set_value(10.0); pgam->set_draw_value(false); event = new Gtk::EventBox(); event->set_border_width(4); fgam->add(*event); event->add(*pgam); pack_start(*fgam, false, false, 0); //textview = new Gtk::TextView(); //pack_start(*textview, true, true, 0); //textview->set_editable(false); show_all();}
Gobby::StatusBar::MessageHandle Gobby::StatusBar::add_message(Gobby::StatusBar::MessageType type, const Glib::ustring& message, const Glib::ustring& dialog_message, unsigned int timeout) { if(m_visible_messages >= 12) { for(MessageHandle iter = m_list.begin(); iter != m_list.end(); ++iter) { if(*iter) { if((*iter)->is_error()) remove_message(iter); else // only hide message because whoever // installed it is expecting to be // able to call remove_message on it hide_message(iter); break; } } } Gtk::HBox* bar = Gtk::manage(new Gtk::HBox); Gtk::Image* image = Gtk::manage(new Gtk::Image( message_type_to_stock_id(type), Gtk::ICON_SIZE_MENU)); bar->pack_start(*image, Gtk::PACK_SHRINK); image->show(); Gtk::Label* label = Gtk::manage( new Gtk::Label(message, GtkCompat::ALIGN_LEFT)); label->set_ellipsize(Pango::ELLIPSIZE_END); bar->pack_start(*label, Gtk::PACK_EXPAND_WIDGET); label->show(); GtkShadowType shadow_type; gtk_widget_style_get(GTK_WIDGET(m_bar_position.gobj()), "shadow-type", &shadow_type, NULL); Gtk::Frame* frame = Gtk::manage(new Gtk::Frame); m_list.push_back(0); Gobby::StatusBar::MessageHandle iter(--m_list.end()); sigc::connection timeout_conn; if(timeout) { timeout_conn = Glib::signal_timeout().connect_seconds( sigc::bind( sigc::bind_return( sigc::mem_fun( *this, &StatusBar::remove_message), false), iter), timeout); } *iter = new Message(frame, message, dialog_message, timeout_conn); ++m_visible_messages; if(dialog_message.empty()) { frame->add(*bar); } else { Gtk::EventBox *eventbox = Gtk::manage(new Gtk::EventBox); frame->add(*eventbox); eventbox->add(*bar); eventbox->signal_button_press_event().connect( sigc::bind_return(sigc::bind( sigc::mem_fun( *this, &StatusBar::on_message_clicked), iter), false)); eventbox->show(); } frame->set_shadow_type(static_cast<Gtk::ShadowType>(shadow_type)); bar->show(); pack_start(*frame, Gtk::PACK_EXPAND_WIDGET); reorder_child(*frame, 0); frame->show(); return iter; }
Gobby::StatusBar::MessageHandle Gobby::StatusBar::add_message(Gobby::StatusBar::MessageType type, const Glib::ustring& message, const Glib::ustring& dialog_message, unsigned int timeout) { if(m_visible_messages >= 12) { for(MessageHandle iter = m_list.begin(); iter != m_list.end(); ++iter) { if(*iter) { if((*iter)->is_error()) remove_message(iter); else // only hide message because whoever // installed it is expecting to be // able to call remove_message on it hide_message(iter); break; } } } Gtk::Grid* grid = Gtk::manage(new Gtk::Grid()); grid->set_column_spacing(6); grid->set_margin_start(2); grid->set_margin_end(2); Gtk::Image* image = Gtk::manage(new Gtk::Image); image->set_from_icon_name(message_type_to_icon_name(type), Gtk::ICON_SIZE_MENU); grid->attach(*image, 0, 0, 1, 1); image->show(); Gtk::Label* label = Gtk::manage( new Gtk::Label(message, Gtk::ALIGN_START)); label->set_ellipsize(Pango::ELLIPSIZE_END); // If we set halign instead, the label will not behave correctly // when ellipsized, because then it has always all space around it // allocated, and the alignment "jumps" around whin resizing the // window due to new characters appearing or disappearing as a result // of the ellipsization. #if GTK_CHECK_VERSION(3, 16, 0) gtk_label_set_xalign(label->gobj(), 0.0); #else label->set_alignment(0.0, 0.0); #endif label->show(); grid->attach(*label, 1, 0, 1, 1); Gtk::Frame* frame = Gtk::manage(new Gtk::Frame); m_list.push_back(0); Gobby::StatusBar::MessageHandle iter(--m_list.end()); sigc::connection timeout_conn; if(timeout) { timeout_conn = Glib::signal_timeout().connect_seconds( sigc::bind( sigc::bind_return( sigc::mem_fun( *this, &StatusBar::remove_message), false), iter), timeout); } *iter = new Message(frame, message, dialog_message, timeout_conn); ++m_visible_messages; if(dialog_message.empty()) { frame->add(*grid); } else { Gtk::EventBox *eventbox = Gtk::manage(new Gtk::EventBox); frame->add(*eventbox); eventbox->add(*grid); eventbox->signal_button_press_event().connect( sigc::bind_return(sigc::bind( sigc::mem_fun( *this, &StatusBar::on_message_clicked), iter), false)); eventbox->show(); } grid->show(); // Insert at front gtk_grid_attach_next_to( gobj(), GTK_WIDGET(frame->gobj()), NULL, GTK_POS_LEFT, 1, 1); frame->set_halign(Gtk::ALIGN_START); frame->set_hexpand(false); frame->set_shadow_type(Gtk::SHADOW_NONE); frame->show(); return iter; }