From: Andrea Zagli Date: Sat, 7 Jun 2008 16:37:23 +0000 (+0000) Subject: Continued ObjectProperties. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=3f314b801db6dbf332c7ff59eab44620eeafc478;p=reptool%2Fgreptool Continued ObjectProperties. Migration to other server. git-svn-id: svn+ssh://saetta.homelinux.org/svn/greptool/trunk@15 76169498-11ee-428b-941f-28d7a79d5cb2 --- diff --git a/data/greptool/glade/greptool.glade b/data/greptool/glade/greptool.glade index b9f630e..e17dd90 100644 --- a/data/greptool/glade/greptool.glade +++ b/data/greptool/glade/greptool.glade @@ -465,7 +465,34 @@ - + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + + + + True + True + + + + + 3 + @@ -482,10 +509,12 @@ True + About GRepTool + True True GDK_WINDOW_TYPE_HINT_DIALOG w_main - GRepTool + GRepTool 0.0.1 Copyright (C) 2007 Andrea Zagli Creates and manages RepTool report's definition files @@ -1554,9 +1583,6 @@ Custom - - False - @@ -1566,7 +1592,6 @@ Custom tab - False False @@ -1967,7 +1992,6 @@ Custom 1 - False @@ -1979,7 +2003,6 @@ Custom tab 1 - False False @@ -2632,9 +2655,6 @@ Custom - - False - @@ -2644,7 +2664,6 @@ Custom tab - False False @@ -2746,7 +2765,6 @@ Custom 1 - False @@ -2758,7 +2776,6 @@ Custom tab 1 - False False @@ -3146,7 +3163,6 @@ Custom 2 - False @@ -3158,7 +3174,6 @@ Custom tab 2 - False False @@ -3312,7 +3327,7 @@ Custom - + True True True diff --git a/src/canvasimage.c b/src/canvasimage.c index ac3942a..4396d46 100644 --- a/src/canvasimage.c +++ b/src/canvasimage.c @@ -130,6 +130,99 @@ GRptCanvasItem return item; } +static void +grpt_canvas_image_print_line (cairo_t *cr, const RptPoint *from_p, const RptPoint *to_p, const RptStroke *stroke) +{ + if (from_p == NULL || to_p == NULL) return; + + if (stroke != NULL) + { + /* TO DO */ + /*cairo_set_line_width (priv->cr, stroke.width);*/ + if (stroke->color != NULL) + { + cairo_set_source_rgba (cr, stroke->color->r, stroke->color->g, stroke->color->b, stroke->color->a); + } + else + { + cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); + } + if (stroke->style != NULL) + { + gdouble *dash = rpt_common_style_to_array (stroke->style); + cairo_set_dash (cr, dash, stroke->style->len, 0.0); + } + } + else + { + cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); + } + + cairo_move_to (cr, from_p->x, from_p->y); + cairo_line_to (cr, to_p->x, to_p->y); + cairo_stroke (cr); + + if (stroke != NULL && stroke->style != NULL) + { + cairo_set_dash (cr, NULL, 0, 0.0); + } +} + +static void +grpt_canvas_image_print_border (cairo_t *cr, const RptPoint *position, const RptSize *size, const RptBorder *border) +{ + if (position == NULL || size == NULL || border == NULL) return; + + RptPoint *from_p = (RptPoint *)g_malloc0 (sizeof (RptPoint)); + RptPoint *to_p = (RptPoint *)g_malloc0 (sizeof (RptPoint)); + RptStroke *stroke = (RptStroke *)g_malloc0 (sizeof (RptStroke)); + + if (border->top_width != 0.0) + { + from_p->x = position->x; + from_p->y = position->y; + to_p->x = position->x + size->width; + to_p->y = position->y; + stroke->width = border->top_width; + stroke->color = border->top_color; + stroke->style = border->top_style; + grpt_canvas_image_print_line (cr, from_p, to_p, stroke); + } + if (border->right_width != 0.0) + { + from_p->x = position->x + size->width; + from_p->y = position->y; + to_p->x = position->x + size->width; + to_p->y = position->y + size->height; + stroke->width = border->right_width; + stroke->color = border->right_color; + stroke->style = border->right_style; + grpt_canvas_image_print_line (cr, from_p, to_p, stroke); + } + if (border->bottom_width != 0.0) + { + from_p->x = position->x; + from_p->y = position->y + size->height; + to_p->x = position->x + size->width; + to_p->y = position->y + size->height; + stroke->width = border->bottom_width; + stroke->color = border->bottom_color; + stroke->style = border->bottom_style; + grpt_canvas_image_print_line (cr, from_p, to_p, stroke); + } + if (border->left_width != 0.0) + { + from_p->x = position->x; + from_p->y = position->y; + to_p->x = position->x; + to_p->y = position->y + size->height; + stroke->width = border->left_width; + stroke->color = border->left_color; + stroke->style = border->left_style; + grpt_canvas_image_print_line (cr, from_p, to_p, stroke); + } +} + static void grpt_canvas_image_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanvasBounds *bounds) { @@ -138,7 +231,7 @@ grpt_canvas_image_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanv RptRotation *rotation = NULL; RptBorder *border = NULL; gchar *filename = NULL; - gchar *adapt = NULL; + guint adapt; gint w; gint h; @@ -166,15 +259,6 @@ grpt_canvas_image_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanv filename = g_strdup (ICONSDIR "/image.png"); } - if (adapt == NULL) - { - adapt = "none"; - } - else - { - g_strstrip (adapt); - } - image = cairo_image_surface_create_from_png (filename); if (cairo_surface_status (image) != CAIRO_STATUS_SUCCESS) { @@ -194,19 +278,21 @@ grpt_canvas_image_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanv } cairo_matrix_init_identity (&matrix); - if (strcmp (adapt, "none") != 0) + if (adapt != RPT_OBJ_IMAGE_ADAPT_NONE) { w = cairo_image_surface_get_width (image); h = cairo_image_surface_get_height (image); - if (strcmp (adapt, "to-box") == 0) - { - cairo_matrix_scale (&matrix, w / size->width, h / size->height); - } - else if (strcmp (adapt, "to-image") == 0) + switch (adapt) { - size->width = (gdouble)w; - size->height = (gdouble)h; + case RPT_OBJ_IMAGE_ADAPT_TO_BOX: + cairo_matrix_scale (&matrix, w / size->width, h / size->height); + break; + + case RPT_OBJ_IMAGE_ADAPT_TO_IMAGE: + size->width = (gdouble)w; + size->height = (gdouble)h; + break; } } cairo_matrix_translate (&matrix, -position->x, -position->y); @@ -218,10 +304,10 @@ grpt_canvas_image_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanv cairo_fill (cr); /* TO DO */ - /* border */ + grpt_canvas_image_print_border (cr, position, size, border); - /*cairo_pattern_destroy (pattern); - cairo_surface_destroy (image);*/ + /*cairo_pattern_destroy (pattern);*/ + cairo_surface_destroy (image); } static RptObject diff --git a/src/canvastext.c b/src/canvastext.c index ccc4dd7..19d5ea4 100644 --- a/src/canvastext.c +++ b/src/canvastext.c @@ -132,6 +132,99 @@ GRptCanvasItem return item; } +static void +grpt_canvas_text_print_line (cairo_t *cr, const RptPoint *from_p, const RptPoint *to_p, const RptStroke *stroke) +{ + if (from_p == NULL || to_p == NULL) return; + + if (stroke != NULL) + { + /* TO DO */ + /*cairo_set_line_width (priv->cr, stroke.width);*/ + if (stroke->color != NULL) + { + cairo_set_source_rgba (cr, stroke->color->r, stroke->color->g, stroke->color->b, stroke->color->a); + } + else + { + cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); + } + if (stroke->style != NULL) + { + gdouble *dash = rpt_common_style_to_array (stroke->style); + cairo_set_dash (cr, dash, stroke->style->len, 0.0); + } + } + else + { + cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0); + } + + cairo_move_to (cr, from_p->x, from_p->y); + cairo_line_to (cr, to_p->x, to_p->y); + cairo_stroke (cr); + + if (stroke != NULL && stroke->style != NULL) + { + cairo_set_dash (cr, NULL, 0, 0.0); + } +} + +static void +grpt_canvas_text_print_border (cairo_t *cr, const RptPoint *position, const RptSize *size, const RptBorder *border) +{ + if (position == NULL || size == NULL || border == NULL) return; + + RptPoint *from_p = (RptPoint *)g_malloc0 (sizeof (RptPoint)); + RptPoint *to_p = (RptPoint *)g_malloc0 (sizeof (RptPoint)); + RptStroke *stroke = (RptStroke *)g_malloc0 (sizeof (RptStroke)); + + if (border->top_width != 0.0) + { + from_p->x = position->x; + from_p->y = position->y; + to_p->x = position->x + size->width; + to_p->y = position->y; + stroke->width = border->top_width; + stroke->color = border->top_color; + stroke->style = border->top_style; + grpt_canvas_text_print_line (cr, from_p, to_p, stroke); + } + if (border->right_width != 0.0) + { + from_p->x = position->x + size->width; + from_p->y = position->y; + to_p->x = position->x + size->width; + to_p->y = position->y + size->height; + stroke->width = border->right_width; + stroke->color = border->right_color; + stroke->style = border->right_style; + grpt_canvas_text_print_line (cr, from_p, to_p, stroke); + } + if (border->bottom_width != 0.0) + { + from_p->x = position->x; + from_p->y = position->y + size->height; + to_p->x = position->x + size->width; + to_p->y = position->y + size->height; + stroke->width = border->bottom_width; + stroke->color = border->bottom_color; + stroke->style = border->bottom_style; + grpt_canvas_text_print_line (cr, from_p, to_p, stroke); + } + if (border->left_width != 0.0) + { + from_p->x = position->x; + from_p->y = position->y; + to_p->x = position->x; + to_p->y = position->y + size->height; + stroke->width = border->left_width; + stroke->color = border->left_color; + stroke->style = border->left_style; + grpt_canvas_text_print_line (cr, from_p, to_p, stroke); + } +} + static void grpt_canvas_text_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanvasBounds *bounds) { @@ -251,7 +344,7 @@ grpt_canvas_text_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanva if (font != NULL && font->strike) { PangoAttribute *pattr; - + pattr = pango_attr_strikethrough_new (TRUE); pattr->start_index = 0; pattr->end_index = strlen (text) + 1; @@ -277,7 +370,7 @@ grpt_canvas_text_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanva } /* drawing border */ - /*rpt_print_border (rpt_print, position, size, border, rotation);*/ + grpt_canvas_text_print_border (cr, position, size, border); /* setting horizontal alignment */ if (align != NULL) diff --git a/src/object_properties.c b/src/object_properties.c index 235c517..5c9f37c 100644 --- a/src/object_properties.c +++ b/src/object_properties.c @@ -109,6 +109,8 @@ static void on_cbtn_image_border_color_bottom_color_set (GtkColorButton *widget, gpointer user_data); static void on_cbtn_image_border_color_left_color_set (GtkColorButton *widget, gpointer user_data); +static void on_cb_image_adapt_on_changed (GtkComboBox *widget, + gpointer user_data); static void grpt_object_properties_set_vbox (GRptObjectProperties *grpt_object_properties, GtkWidget *vbox); @@ -227,6 +229,8 @@ struct _GRptObjectPropertiesPrivate RptFont *font; RptStroke *stroke; RptColor *color; + RptAlign *align; + guint adapt; }; GType @@ -506,7 +510,7 @@ GRptObjectProperties priv->cb_image_adapt = glade_xml_get_widget (gla_image, "cb_image_adapt"); priv->lstore_image_adapt = gtk_list_store_new (ADAPT_COLS, - G_TYPE_INT, + G_TYPE_UINT, G_TYPE_STRING); gtk_combo_box_set_model (GTK_COMBO_BOX (priv->cb_image_adapt), @@ -551,6 +555,9 @@ GRptObjectProperties g_signal_connect (G_OBJECT (priv->cbtn_image_border_color_left), "color-set", G_CALLBACK (on_cbtn_image_border_color_left_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cb_image_adapt), "changed", + G_CALLBACK (on_cb_image_adapt_on_changed), (gpointer)obj_prop); + gtk_widget_show_all (priv->w); return obj_prop; @@ -689,7 +696,7 @@ on_spn_text_border_width_top_value_changed (GtkSpinButton *spin_button, if (priv->border == NULL) { - priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + priv->border = rpt_common_rptborder_new (); } priv->border->top_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_top)); @@ -709,7 +716,7 @@ on_spn_text_border_width_right_value_changed (GtkSpinButton *spin_button, if (priv->border == NULL) { - priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + priv->border = rpt_common_rptborder_new (); } priv->border->right_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_right)); @@ -729,7 +736,7 @@ on_spn_text_border_width_bottom_value_changed (GtkSpinButton *spin_button, if (priv->border == NULL) { - priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + priv->border = rpt_common_rptborder_new (); } priv->border->bottom_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_bottom)); @@ -749,7 +756,7 @@ on_spn_text_border_width_left_value_changed (GtkSpinButton *spin_button, if (priv->border == NULL) { - priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + priv->border = rpt_common_rptborder_new (); } priv->border->left_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_text_border_width_left)); @@ -775,7 +782,7 @@ on_cbtn_text_border_color_top_color_set (GtkColorButton *widget, if (priv->border == NULL) { - priv->border = (RptBorder *)g_malloc0 (sizeof (RptBorder)); + priv->border = rpt_common_rptborder_new (); } priv->border->top_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); @@ -790,18 +797,78 @@ static void on_cbtn_text_border_color_right_color_set (GtkColorButton *widget, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_right), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_right)); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->right_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_cbtn_text_border_color_bottom_color_set (GtkColorButton *widget, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_bottom), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_bottom)); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->bottom_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_cbtn_text_border_color_left_color_set (GtkColorButton *widget, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_left), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_border_color_left)); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->left_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void @@ -879,7 +946,6 @@ on_cb_text_alignment_h_changed (GtkComboBox *widget, gpointer user_data) { GtkTreeIter iter; - RptAlign *align = NULL; gint ialign; GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; @@ -888,20 +954,17 @@ on_cb_text_alignment_h_changed (GtkComboBox *widget, if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->cb_text_alignment_h), &iter)) { - g_object_get (G_OBJECT (priv->rpt_obj), - "align", &align, - NULL); - if (align == NULL) + if (priv->align == NULL) { - align = rpt_common_rptalign_new (); + priv->align = rpt_common_rptalign_new (); } gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_text_alignment_h), &iter, ALIGN_ALIGN, &ialign, -1); - align->h_align = ialign; + priv->align->h_align = ialign; g_object_set (G_OBJECT (priv->rpt_obj), - "align", align, + "align", priv->align, NULL); goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); @@ -913,7 +976,6 @@ on_cb_text_alignment_v_changed (GtkComboBox *widget, gpointer user_data) { GtkTreeIter iter; - RptAlign *align = NULL; gint ialign; GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; @@ -922,20 +984,17 @@ on_cb_text_alignment_v_changed (GtkComboBox *widget, if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->cb_text_alignment_v), &iter)) { - g_object_get (G_OBJECT (priv->rpt_obj), - "align", &align, - NULL); - if (align == NULL) + if (priv->align == NULL) { - align = rpt_common_rptalign_new (); + priv->align = rpt_common_rptalign_new (); } gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_text_alignment_v), &iter, ALIGN_ALIGN, &ialign, -1); - align->v_align = ialign; + priv->align->v_align = ialign; g_object_set (G_OBJECT (priv->rpt_obj), - "align", align, + "align", priv->align, NULL); goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); @@ -1208,48 +1267,208 @@ static void on_spn_image_border_width_top_value_changed (GtkSpinButton *spin_button, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->top_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_top)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_spn_image_border_width_right_value_changed (GtkSpinButton *spin_button, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->right_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_right)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_spn_image_border_width_bottom_value_changed (GtkSpinButton *spin_button, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->bottom_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_bottom)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_spn_image_border_width_left_value_changed (GtkSpinButton *spin_button, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->left_width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (priv->spn_image_border_width_left)); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_cbtn_image_border_color_top_color_set (GtkColorButton *widget, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_top), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_top)); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->top_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_cbtn_image_border_color_right_color_set (GtkColorButton *widget, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_right), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_right)); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->right_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_cbtn_image_border_color_bottom_color_set (GtkColorButton *widget, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_bottom), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_bottom)); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->bottom_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); } static void on_cbtn_image_border_color_left_color_set (GtkColorButton *widget, gpointer user_data) { + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + GdkColor gdk_color; + guint16 alpha; + + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_left), &gdk_color); + alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_image_border_color_left)); + + if (priv->border == NULL) + { + priv->border = rpt_common_rptborder_new (); + } + priv->border->left_color = rpt_common_gdkcolor_to_rptcolor (&gdk_color, alpha); + + g_object_set (G_OBJECT (priv->rpt_obj), + "border", priv->border, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); +} + +static void +on_cb_image_adapt_on_changed (GtkComboBox *widget, + gpointer user_data) +{ + GtkTreeIter iter; + guint iadapt; + + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->cb_image_adapt), + &iter)) + { + gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_image_adapt), &iter, + ADAPT_ADAPT, &iadapt, + -1); + g_object_set (G_OBJECT (priv->rpt_obj), + "adapt", iadapt, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); + } } static void @@ -1401,7 +1620,6 @@ grpt_object_properties_load_common (GRptObjectProperties *grpt_object_properties static void grpt_object_properties_load_text (GRptObjectProperties *grpt_object_properties) { - RptAlign *align = NULL; gchar *source = NULL; RptColor *background_color = NULL; gdouble padding_top; @@ -1415,14 +1633,16 @@ grpt_object_properties_load_text (GRptObjectProperties *grpt_object_properties) g_free (priv->border); g_free (priv->font); + g_free (priv->align); priv->border = NULL; priv->font = NULL; + priv->align = NULL; g_object_get (G_OBJECT (priv->rpt_obj), "border", &priv->border, "font", &priv->font, - "align", &align, + "align", &priv->align, "source", &source, "background-color", &background_color, "padding-top", &padding_top, @@ -1506,8 +1726,12 @@ grpt_object_properties_load_text (GRptObjectProperties *grpt_object_properties) } } - if (align != NULL) + if (priv->align != NULL) { + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cb_text_alignment_h), + priv->align->h_align); + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->cb_text_alignment_v), + priv->align->v_align); } if (source != NULL) @@ -1642,7 +1866,6 @@ static void grpt_object_properties_load_image (GRptObjectProperties *grpt_object_properties) { gchar *source; - guint adapt; GdkColor *gdk_color; @@ -1651,11 +1874,12 @@ grpt_object_properties_load_image (GRptObjectProperties *grpt_object_properties) g_free (priv->border); priv->border = NULL; + priv->adapt = 0; g_object_get (G_OBJECT (priv->rpt_obj), "border", &priv->border, "source", &source, - "adapt", &adapt, + "adapt", &priv->adapt, NULL); if (priv->border != NULL) @@ -1755,6 +1979,7 @@ grpt_object_properties_set_signal_active (GRptObjectProperties *grpt_object_prop g_signal_handlers_unblock_by_func (priv->cbtn_image_border_color_right, G_CALLBACK (on_cbtn_image_border_color_right_color_set), grpt_object_properties); g_signal_handlers_unblock_by_func (priv->cbtn_image_border_color_bottom, G_CALLBACK (on_cbtn_image_border_color_bottom_color_set), grpt_object_properties); g_signal_handlers_unblock_by_func (priv->cbtn_image_border_color_left, G_CALLBACK (on_cbtn_image_border_color_left_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cb_image_adapt, G_CALLBACK (on_cb_image_adapt_on_changed), grpt_object_properties); } else { @@ -1798,5 +2023,6 @@ grpt_object_properties_set_signal_active (GRptObjectProperties *grpt_object_prop g_signal_handlers_block_by_func (priv->cbtn_image_border_color_right, G_CALLBACK (on_cbtn_image_border_color_right_color_set), grpt_object_properties); g_signal_handlers_block_by_func (priv->cbtn_image_border_color_bottom, G_CALLBACK (on_cbtn_image_border_color_bottom_color_set), grpt_object_properties); g_signal_handlers_block_by_func (priv->cbtn_image_border_color_left, G_CALLBACK (on_cbtn_image_border_color_left_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cb_image_adapt, G_CALLBACK (on_cb_image_adapt_on_changed), grpt_object_properties); } }