Lines Matching defs:psel
75 static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel, gchar const *px, SPPaintSelector::Mode mode, gchar const *tip);
76 static void sp_paint_selector_style_button_toggled(GtkToggleButton *tb, SPPaintSelector *psel);
77 static void sp_paint_selector_fillrule_toggled(GtkToggleButton *tb, SPPaintSelector *psel);
79 static void sp_paint_selector_set_mode_empty(SPPaintSelector *psel);
80 static void sp_paint_selector_set_mode_multiple(SPPaintSelector *psel);
81 static void sp_paint_selector_set_mode_none(SPPaintSelector *psel);
82 static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode mode);
83 static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelector::Mode mode);
84 static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSelector::Mode mode);
85 static void sp_paint_selector_set_mode_swatch(SPPaintSelector *psel, SPPaintSelector::Mode mode);
86 static void sp_paint_selector_set_mode_unset(SPPaintSelector *psel);
89 static void sp_paint_selector_set_style_buttons(SPPaintSelector *psel, GtkWidget *active);
123 static SPGradientSelector *getGradientFromData(SPPaintSelector const *psel)
126 if (psel->mode == SPPaintSelector::MODE_SWATCH) {
127 SwatchSelector *swatchsel = static_cast<SwatchSelector*>(g_object_get_data(G_OBJECT(psel->selector), "swatch-selector"));
132 grad = reinterpret_cast<SPGradientSelector*>(g_object_get_data(G_OBJECT(psel->selector), "gradient-selector"));
198 sp_paint_selector_init(SPPaintSelector *psel)
201 gtk_orientable_set_orientation(GTK_ORIENTABLE(psel), GTK_ORIENTATION_VERTICAL);
204 psel->mode = static_cast<SPPaintSelector::Mode>(-1); // huh? do you mean 0xff? -- I think this means "not in the enum"
208 psel->style = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
209 gtk_box_set_homogeneous(GTK_BOX(psel->style), FALSE);
211 psel->style = gtk_hbox_new(FALSE, 0);
213 gtk_widget_show(psel->style);
214 gtk_container_set_border_width(GTK_CONTAINER(psel->style), 4);
215 gtk_box_pack_start(GTK_BOX(psel), psel->style, FALSE, FALSE, 0);
218 psel->none = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-none"),
220 psel->solid = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-solid"),
222 psel->gradient = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-gradient-linear"),
224 psel->radial = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-gradient-radial"),
227 psel->mesh = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-gradient-mesh"),
230 psel->pattern = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-pattern"),
232 psel->swatch = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-swatch"),
234 psel->unset = sp_paint_selector_style_button_add(psel, INKSCAPE_ICON("paint-unknown"),
240 psel->fillrulebox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
241 gtk_box_set_homogeneous(GTK_BOX(psel->fillrulebox), FALSE);
243 psel->fillrulebox = gtk_hbox_new(FALSE, 0);
245 gtk_box_pack_end(GTK_BOX(psel->style), psel->fillrulebox, FALSE, FALSE, 0);
248 psel->evenodd = gtk_radio_button_new(NULL);
249 gtk_button_set_relief(GTK_BUTTON(psel->evenodd), GTK_RELIEF_NONE);
250 gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(psel->evenodd), FALSE);
252 gtk_widget_set_tooltip_text(psel->evenodd, _("Any path self-intersections or subpaths create holes in the fill (fill-rule: evenodd)"));
253 g_object_set_data(G_OBJECT(psel->evenodd), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_EVENODD));
255 gtk_container_add(GTK_CONTAINER(psel->evenodd), w);
256 gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->evenodd, FALSE, FALSE, 0);
257 g_signal_connect(G_OBJECT(psel->evenodd), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel);
259 psel->nonzero = gtk_radio_button_new(gtk_radio_button_get_group(GTK_RADIO_BUTTON(psel->evenodd)));
260 gtk_button_set_relief(GTK_BUTTON(psel->nonzero), GTK_RELIEF_NONE);
261 gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(psel->nonzero), FALSE);
263 gtk_widget_set_tooltip_text(psel->nonzero, _("Fill is solid unless a subpath is counterdirectional (fill-rule: nonzero)"));
264 g_object_set_data(G_OBJECT(psel->nonzero), "mode", GUINT_TO_POINTER(SPPaintSelector::FILLRULE_NONZERO));
266 gtk_container_add(GTK_CONTAINER(psel->nonzero), w);
267 gtk_box_pack_start(GTK_BOX(psel->fillrulebox), psel->nonzero, FALSE, FALSE, 0);
268 g_signal_connect(G_OBJECT(psel->nonzero), "toggled", G_CALLBACK(sp_paint_selector_fillrule_toggled), psel);
272 psel->label = gtk_label_new("");
279 gtk_widget_show(psel->label);
280 gtk_box_pack_start(GTK_BOX(lbbox), psel->label, false, false, 4);
281 gtk_box_pack_start(GTK_BOX(psel), lbbox, false, false, 4);
284 psel->frame = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
285 gtk_box_set_homogeneous(GTK_BOX(psel->frame), FALSE);
287 psel->frame = gtk_vbox_new(FALSE, 4);
289 gtk_widget_show(psel->frame);
290 //gtk_container_set_border_width(GTK_CONTAINER(psel->frame), 0);
291 gtk_box_pack_start(GTK_BOX(psel), psel->frame, TRUE, TRUE, 0);
295 psel->selected_color = new SelectedColor;
296 psel->updating_color = false;
298 psel->selected_color->signal_grabbed.connect(sigc::mem_fun(psel, &SPPaintSelector::onSelectedColorGrabbed));
299 psel->selected_color->signal_dragged.connect(sigc::mem_fun(psel, &SPPaintSelector::onSelectedColorDragged));
300 psel->selected_color->signal_released.connect(sigc::mem_fun(psel, &SPPaintSelector::onSelectedColorReleased));
301 psel->selected_color->signal_changed.connect(sigc::mem_fun(psel, &SPPaintSelector::onSelectedColorChanged));
306 SPPaintSelector *psel = SP_PAINT_SELECTOR(object);
309 g_object_set_data(G_OBJECT(psel),"patternmenu",NULL);
311 if (psel->selected_color) {
312 delete psel->selected_color;
313 psel->selected_color = NULL;
320 static GtkWidget *sp_paint_selector_style_button_add(SPPaintSelector *psel,
341 gtk_box_pack_start(GTK_BOX(psel->style), b, FALSE, FALSE, 0);
342 g_signal_connect(G_OBJECT(b), "toggled", G_CALLBACK(sp_paint_selector_style_button_toggled), psel);
348 sp_paint_selector_style_button_toggled(GtkToggleButton *tb, SPPaintSelector *psel)
350 if (!psel->update && gtk_toggle_button_get_active(tb)) {
351 psel->setMode(static_cast<SPPaintSelector::Mode>(GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(tb), "mode"))));
356 sp_paint_selector_fillrule_toggled(GtkToggleButton *tb, SPPaintSelector *psel)
358 if (!psel->update && gtk_toggle_button_get_active(tb)) {
360 g_signal_emit(G_OBJECT(psel), psel_signals[FILLRULE_CHANGED], 0, fr);
365 sp_paint_selector_show_fillrule(SPPaintSelector *psel, bool is_fill)
367 if (psel->fillrulebox) {
369 gtk_widget_show_all(psel->fillrulebox);
371 gtk_widget_destroy(psel->fillrulebox);
372 psel->fillrulebox = NULL;
380 SPPaintSelector *psel = static_cast<SPPaintSelector*>(g_object_new(SP_TYPE_PAINT_SELECTOR, NULL));
382 psel->setMode(SPPaintSelector::MODE_MULTIPLE);
387 sp_paint_selector_show_fillrule(psel, kind == FILL);
389 return psel;
458 sp_paint_selector_set_mode(psel, MODE_COLOR_CMYK);
583 sp_paint_selector_clear_frame(SPPaintSelector *psel)
585 g_return_if_fail( psel != NULL);
587 if (psel->selector) {
591 gtk_widget_set_visible(psel->selector, false);
592 gtk_widget_destroy(psel->selector);
593 psel->selector = NULL;
598 sp_paint_selector_set_mode_empty(SPPaintSelector *psel)
600 sp_paint_selector_set_style_buttons(psel, NULL);
601 gtk_widget_set_sensitive(psel->style, FALSE);
603 sp_paint_selector_clear_frame(psel);
605 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>No objects</b>"));
609 sp_paint_selector_set_mode_multiple(SPPaintSelector *psel)
611 sp_paint_selector_set_style_buttons(psel, NULL);
612 gtk_widget_set_sensitive(psel->style, TRUE);
614 sp_paint_selector_clear_frame(psel);
616 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Multiple styles</b>"));
620 sp_paint_selector_set_mode_unset(SPPaintSelector *psel)
622 sp_paint_selector_set_style_buttons(psel, psel->unset);
623 gtk_widget_set_sensitive(psel->style, TRUE);
625 sp_paint_selector_clear_frame(psel);
627 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Paint is undefined</b>"));
631 sp_paint_selector_set_mode_none(SPPaintSelector *psel)
633 sp_paint_selector_set_style_buttons(psel, psel->none);
634 gtk_widget_set_sensitive(psel->style, TRUE);
636 sp_paint_selector_clear_frame(psel);
638 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>No paint</b>"));
671 static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelector::Mode /*mode*/)
675 if ((psel->mode == SPPaintSelector::MODE_SWATCH)
676 || (psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR)
677 || (psel->mode == SPPaintSelector::MODE_GRADIENT_RADIAL) ) {
678 SPGradientSelector *gsel = getGradientFromData(psel);
687 psel->selected_color->setColorAlpha(color, alpha, false);
692 sp_paint_selector_set_style_buttons(psel, psel->solid);
693 gtk_widget_set_sensitive(psel->style, TRUE);
695 if ((psel->mode == SPPaintSelector::MODE_SOLID_COLOR)) {
700 sp_paint_selector_clear_frame(psel);
712 Gtk::Widget *color_selector = Gtk::manage(new ColorNotebook(*(psel->selected_color)));
717 gtk_container_add(GTK_CONTAINER(psel->frame), vb);
719 psel->selector = vb;
722 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Flat color</b>"));
731 static void sp_paint_selector_gradient_grabbed(SPGradientSelector * /*csel*/, SPPaintSelector *psel)
733 g_signal_emit(G_OBJECT(psel), psel_signals[GRABBED], 0);
736 static void sp_paint_selector_gradient_dragged(SPGradientSelector * /*csel*/, SPPaintSelector *psel)
738 g_signal_emit(G_OBJECT(psel), psel_signals[DRAGGED], 0);
741 static void sp_paint_selector_gradient_released(SPGradientSelector * /*csel*/, SPPaintSelector *psel)
743 g_signal_emit(G_OBJECT(psel), psel_signals[RELEASED], 0);
746 static void sp_paint_selector_gradient_changed(SPGradientSelector * /*csel*/, SPPaintSelector *psel)
748 g_signal_emit(G_OBJECT(psel), psel_signals[CHANGED], 0);
751 static void sp_paint_selector_set_mode_gradient(SPPaintSelector *psel, SPPaintSelector::Mode mode)
758 sp_paint_selector_set_style_buttons(psel, psel->gradient);
760 sp_paint_selector_set_style_buttons(psel, psel->radial);
764 sp_paint_selector_set_style_buttons(psel, psel->mesh);
767 gtk_widget_set_sensitive(psel->style, TRUE);
769 if ((psel->mode == SPPaintSelector::MODE_GRADIENT_LINEAR) || (psel->mode == SPPaintSelector::MODE_GRADIENT_RADIAL)) {
771 gsel = GTK_WIDGET(g_object_get_data(G_OBJECT(psel->selector), "gradient-selector"));
773 sp_paint_selector_clear_frame(psel);
777 g_signal_connect(G_OBJECT(gsel), "grabbed", G_CALLBACK(sp_paint_selector_gradient_grabbed), psel);
778 g_signal_connect(G_OBJECT(gsel), "dragged", G_CALLBACK(sp_paint_selector_gradient_dragged), psel);
779 g_signal_connect(G_OBJECT(gsel), "released", G_CALLBACK(sp_paint_selector_gradient_released), psel);
780 g_signal_connect(G_OBJECT(gsel), "changed", G_CALLBACK(sp_paint_selector_gradient_changed), psel);
782 gtk_container_add(GTK_CONTAINER(psel->frame), gsel);
783 psel->selector = gsel;
784 g_object_set_data(G_OBJECT(psel->selector), "gradient-selector", gsel);
791 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Linear gradient</b>"));
794 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Radial gradient</b>"));
799 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Mesh gradient</b>"));
809 sp_paint_selector_set_style_buttons(SPPaintSelector *psel, GtkWidget *active)
811 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->none), (active == psel->none));
812 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->solid), (active == psel->solid));
813 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->gradient), (active == psel->gradient));
814 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->radial), (active == psel->radial));
816 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->mesh), (active == psel->mesh));
818 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->pattern), (active == psel->pattern));
819 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->swatch), (active == psel->swatch));
820 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(psel->unset), (active == psel->unset));
823 static void sp_psel_pattern_destroy(GtkWidget *widget, SPPaintSelector * /*psel*/)
829 static void sp_psel_pattern_change(GtkWidget * /*widget*/, SPPaintSelector *psel)
831 g_signal_emit(G_OBJECT(psel), psel_signals[CHANGED], 0);
1032 static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSelector::Mode mode)
1035 sp_paint_selector_set_style_buttons(psel, psel->pattern);
1038 gtk_widget_set_sensitive(psel->style, TRUE);
1042 if (psel->mode == SPPaintSelector::MODE_PATTERN) {
1044 tbl = GTK_WIDGET(g_object_get_data(G_OBJECT(psel->selector), "pattern-selector"));
1046 sp_paint_selector_clear_frame(psel);
1079 g_signal_connect(G_OBJECT(combo), "changed", G_CALLBACK(sp_psel_pattern_change), psel);
1080 g_signal_connect(G_OBJECT(combo), "destroy", G_CALLBACK(sp_psel_pattern_destroy), psel);
1081 g_object_set_data(G_OBJECT(psel), "patternmenu", combo);
1107 gtk_container_add(GTK_CONTAINER(psel->frame), tbl);
1108 psel->selector = tbl;
1109 g_object_set_data(G_OBJECT(psel->selector), "pattern-selector", tbl);
1111 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Pattern fill</b>"));
1179 static void sp_paint_selector_set_mode_swatch(SPPaintSelector *psel, SPPaintSelector::Mode mode)
1182 sp_paint_selector_set_style_buttons(psel, psel->swatch);
1185 gtk_widget_set_sensitive(psel->style, TRUE);
1187 if (psel->mode == SPPaintSelector::MODE_SWATCH){
1188 // swatchsel = static_cast<SwatchSelector*>(g_object_get_data(G_OBJECT(psel->selector), "swatch-selector"));
1190 sp_paint_selector_clear_frame(psel);
1195 swatchsel->connectGrabbedHandler( G_CALLBACK(sp_paint_selector_gradient_grabbed), psel );
1196 swatchsel->connectDraggedHandler( G_CALLBACK(sp_paint_selector_gradient_dragged), psel );
1197 swatchsel->connectReleasedHandler( G_CALLBACK(sp_paint_selector_gradient_released), psel );
1198 swatchsel->connectchangedHandler( G_CALLBACK(sp_paint_selector_gradient_changed), psel );
1201 gtk_container_add(GTK_CONTAINER(psel->frame), GTK_WIDGET(swatchsel->gobj()));
1202 psel->selector = GTK_WIDGET(swatchsel->gobj());
1203 g_object_set_data(G_OBJECT(psel->selector), "swatch-selector", swatchsel);
1205 gtk_label_set_markup(GTK_LABEL(psel->label), _("<b>Swatch fill</b>"));