From 4338af90cfd125216e34ee00e6dc47ac7910afb9 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 18 Nov 2007 09:19:58 +0000 Subject: [PATCH] Coninued with ObjectProperties. git-svn-id: svn+ssh://saetta.homelinux.org/svn/greptool/trunk@14 76169498-11ee-428b-941f-28d7a79d5cb2 --- data/greptool/glade/greptool.glade | 6 +- src/canvas.c | 46 ++++++- src/canvas.h | 6 +- src/canvastext.c | 2 + src/main.c | 4 +- src/object_properties.c | 200 ++++++++++++++++++++++++++++- src/objects_tree.c | 10 ++ src/objects_tree.h | 1 + src/page_properties.c | 45 ++++--- 9 files changed, 289 insertions(+), 31 deletions(-) diff --git a/data/greptool/glade/greptool.glade b/data/greptool/glade/greptool.glade index 288c490..b9f630e 100644 --- a/data/greptool/glade/greptool.glade +++ b/data/greptool/glade/greptool.glade @@ -512,7 +512,7 @@ You should have received a copy of the GNU General Public License along with Nau - GRepTool - Report Properties + Report Properties - GRepTool True 450 True @@ -872,7 +872,7 @@ You should have received a copy of the GNU General Public License along with Nau True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 3 - GRepTool - Page Properties + Page Properties - GRepTool True 300 True @@ -3312,7 +3312,7 @@ Custom - + True True True diff --git a/src/canvas.c b/src/canvas.c index 7b9067b..de2260b 100644 --- a/src/canvas.c +++ b/src/canvas.c @@ -537,7 +537,8 @@ GRptCanvas /* setting size */ size = rpt_report_get_page_size (priv->rpt_report); size->height = rpt_report_get_section_height (priv->rpt_report, RPTREPORT_SECTION_BODY); - grpt_canvas_set_size (grpt_canvas, *size); + grpt_canvas_set_canvas_width (grpt_canvas, size->width); + grpt_canvas_set_section_height (grpt_canvas, RPTREPORT_SECTION_BODY, size->height); /* GooGRptCanvasItem that represents the "selection" */ priv->selection = goo_canvas_rect_new (priv->root, 0, 0, 0, 0, @@ -584,13 +585,50 @@ GtkWidget return priv->scrolledw; } +RptReport +*grpt_canvas_get_rptreport (GRptCanvas *grpt_canvas) +{ + GRptCanvasPrivate *priv = GRPT_CANVAS_GET_PRIVATE (grpt_canvas); + + return priv->rpt_report; +} + +void +grpt_canvas_set_canvas_width (GRptCanvas *grpt_canvas, gdouble width) +{ + gdouble left; + gdouble top; + gdouble right; + gdouble bottom; + + GRptCanvasPrivate *priv = GRPT_CANVAS_GET_PRIVATE (grpt_canvas); + + goo_canvas_get_bounds (GOO_CANVAS (priv->goo_canvas), &left, &top, &right, &bottom); + + gtk_widget_set_size_request (priv->goo_canvas, width, bottom); + + goo_canvas_set_bounds (GOO_CANVAS (priv->goo_canvas), 0, 0, width, bottom); +} + void -grpt_canvas_set_size (GRptCanvas *grpt_canvas, RptSize size) +grpt_canvas_set_section_height (GRptCanvas *grpt_canvas, + RptReportSection section, + gdouble height) { + gdouble left; + gdouble top; + gdouble right; + gdouble bottom; + GRptCanvasPrivate *priv = GRPT_CANVAS_GET_PRIVATE (grpt_canvas); - gtk_widget_set_size_request (priv->goo_canvas, size.width, size.height); - goo_canvas_set_bounds (GOO_CANVAS (priv->goo_canvas), 0, 0, size.width, size.height); + /* TO DO */ + + goo_canvas_get_bounds (GOO_CANVAS (priv->goo_canvas), &left, &top, &right, &bottom); + + gtk_widget_set_size_request (priv->goo_canvas, right, height); + + goo_canvas_set_bounds (GOO_CANVAS (priv->goo_canvas), 0, 0, right, height); } GList diff --git a/src/canvas.h b/src/canvas.h index 8c46ba0..139f545 100644 --- a/src/canvas.h +++ b/src/canvas.h @@ -58,8 +58,12 @@ GType grpt_canvas_get_type (void) G_GNUC_CONST; GRptCanvas *grpt_canvas_new (RptReport *rpt_report); GtkWidget *grpt_canvas_get_widget (GRptCanvas *grpt_canvas); +RptReport *grpt_canvas_get_rptreport (GRptCanvas *grpt_canvas); -void grpt_canvas_set_size (GRptCanvas *grpt_canvas, RptSize size); +void grpt_canvas_set_canvas_width (GRptCanvas *grpt_canvas, gdouble width); +void grpt_canvas_set_section_height (GRptCanvas *grpt_canvas, + RptReportSection section, + gdouble height); GList *grpt_canvas_section_get_items (GRptCanvas *grpt_canvas, RptReportSection section); diff --git a/src/canvastext.c b/src/canvastext.c index 74bac8e..ccc4dd7 100644 --- a/src/canvastext.c +++ b/src/canvastext.c @@ -285,6 +285,7 @@ grpt_canvas_text_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanva switch (align->h_align) { case RPT_HALIGN_LEFT: + pango_layout_set_alignment (playout, PANGO_ALIGN_LEFT); break; case RPT_HALIGN_CENTER: @@ -296,6 +297,7 @@ grpt_canvas_text_paint (GooCanvasItemSimple *simple, cairo_t *cr, const GooCanva break; case RPT_HALIGN_JUSTIFIED: + pango_layout_set_alignment (playout, PANGO_ALIGN_LEFT); pango_layout_set_justify (playout, TRUE); break; } diff --git a/src/main.c b/src/main.c index f7a6d1c..e9b2a55 100644 --- a/src/main.c +++ b/src/main.c @@ -133,6 +133,8 @@ report_set_defaults () static void report_close () { + grpt_objects_tree_remove_all (objects_tree); + if (grpt_canvas != NULL) { grpt_canvas_free (grpt_canvas); @@ -367,7 +369,7 @@ void on_mnu_edit_page_properties_activate (GtkMenuItem *menuitem, gpointer user_data) { - page_properties (rpt_report); + page_properties (grpt_canvas); } void diff --git a/src/object_properties.c b/src/object_properties.c index f3fafec..235c517 100644 --- a/src/object_properties.c +++ b/src/object_properties.c @@ -59,6 +59,10 @@ static void on_chk_text_font_strike (GtkToggleButton *widget, gpointer user_data); static void on_cbtn_text_font_color_color_set (GtkColorButton *widget, gpointer user_data); +static void on_cb_text_alignment_h_changed (GtkComboBox *widget, + gpointer user_data); +static void on_cb_text_alignment_v_changed (GtkComboBox *widget, + gpointer user_data); static void on_cbtn_text_back_color_color_set (GtkColorButton *widget, gpointer user_data); static void on_spn_text_padd_top_value_changed (GtkSpinButton *spin_button, @@ -122,6 +126,20 @@ static void grpt_object_properties_set_signal_active (GRptObjectProperties *grpt #define GRPT_OBJECT_PROPERTIES_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GRPT_TYPE_OBJECT_PROPERTIES, GRptObjectPropertiesPrivate)) +enum +{ + ALIGN_ALIGN, + ALIGN_DESCR, + ALIGN_COLS +}; + +enum +{ + ADAPT_ADAPT, + ADAPT_DESCR, + ADAPT_COLS +}; + typedef struct _GRptObjectPropertiesPrivate GRptObjectPropertiesPrivate; struct _GRptObjectPropertiesPrivate { @@ -161,6 +179,9 @@ struct _GRptObjectPropertiesPrivate GtkWidget *spn_text_padd_right; GtkWidget *spn_text_padd_bottom; GtkWidget *spn_text_padd_left; + + GtkListStore *lstore_text_alignment_h; + GtkListStore *lstore_text_alignment_v; /* line */ GtkWidget *vbox_line; @@ -195,6 +216,8 @@ struct _GRptObjectPropertiesPrivate /* to do style */ GtkWidget *cb_image_adapt; + GtkListStore *lstore_image_adapt; + GRptCanvasItem *grpt_canvas_item; RptObject *rpt_obj; @@ -255,6 +278,9 @@ grpt_object_properties_init (GRptObjectProperties *grpt_object_properties) GRptObjectProperties *grpt_object_properties_new (void) { + GtkTreeIter iter; + GtkCellRenderer *renderer; + GRptObjectProperties *obj_prop = GRPT_OBJECT_PROPERTIES (g_object_new (grpt_object_properties_get_type (), NULL)); GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (obj_prop); @@ -322,6 +348,67 @@ GRptObjectProperties priv->spn_text_padd_bottom = glade_xml_get_widget (gla_text, "spn_text_padd_bottom"); priv->spn_text_padd_left = glade_xml_get_widget (gla_text, "spn_text_padd_left"); + priv->lstore_text_alignment_h = gtk_list_store_new (ALIGN_COLS, + G_TYPE_INT, + G_TYPE_STRING); + + gtk_combo_box_set_model (GTK_COMBO_BOX (priv->cb_text_alignment_h), + GTK_TREE_MODEL (priv->lstore_text_alignment_h)); + + renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->cb_text_alignment_h), renderer, FALSE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->cb_text_alignment_h), renderer, + "text", ALIGN_DESCR); + + gtk_list_store_append (priv->lstore_text_alignment_h, &iter); + gtk_list_store_set (priv->lstore_text_alignment_h, &iter, + ALIGN_ALIGN, RPT_HALIGN_LEFT, + ALIGN_DESCR, "Left", + -1); + gtk_list_store_append (priv->lstore_text_alignment_h, &iter); + gtk_list_store_set (priv->lstore_text_alignment_h, &iter, + ALIGN_ALIGN, RPT_HALIGN_CENTER, + ALIGN_DESCR, "Center", + -1); + gtk_list_store_append (priv->lstore_text_alignment_h, &iter); + gtk_list_store_set (priv->lstore_text_alignment_h, &iter, + ALIGN_ALIGN, RPT_HALIGN_RIGHT, + ALIGN_DESCR, "Right", + -1); + gtk_list_store_append (priv->lstore_text_alignment_h, &iter); + gtk_list_store_set (priv->lstore_text_alignment_h, &iter, + ALIGN_ALIGN, RPT_HALIGN_JUSTIFIED, + ALIGN_DESCR, "Justified", + -1); + + priv->lstore_text_alignment_v = gtk_list_store_new (ALIGN_COLS, + G_TYPE_INT, + G_TYPE_STRING); + + gtk_combo_box_set_model (GTK_COMBO_BOX (priv->cb_text_alignment_v), + GTK_TREE_MODEL (priv->lstore_text_alignment_v)); + + renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->cb_text_alignment_v), renderer, FALSE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->cb_text_alignment_v), renderer, + "text", ALIGN_DESCR); + + gtk_list_store_append (priv->lstore_text_alignment_v, &iter); + gtk_list_store_set (priv->lstore_text_alignment_v, &iter, + ALIGN_ALIGN, RPT_VALIGN_TOP, + ALIGN_DESCR, "Top", + -1); + gtk_list_store_append (priv->lstore_text_alignment_v, &iter); + gtk_list_store_set (priv->lstore_text_alignment_v, &iter, + ALIGN_ALIGN, RPT_VALIGN_CENTER, + ALIGN_DESCR, "Center", + -1); + gtk_list_store_append (priv->lstore_text_alignment_v, &iter); + gtk_list_store_set (priv->lstore_text_alignment_v, &iter, + ALIGN_ALIGN, RPT_VALIGN_BOTTOM, + ALIGN_DESCR, "Bottom", + -1); + g_signal_connect (G_OBJECT (priv->spn_text_border_width_top), "value-changed", G_CALLBACK (on_spn_text_border_width_top_value_changed), (gpointer)obj_prop); g_signal_connect (G_OBJECT (priv->spn_text_border_width_right), "value-changed", @@ -346,6 +433,10 @@ GRptObjectProperties G_CALLBACK (on_chk_text_font_strike), (gpointer)obj_prop); g_signal_connect (G_OBJECT (priv->cbtn_text_font_color), "color-set", G_CALLBACK (on_cbtn_text_font_color_color_set), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cb_text_alignment_h), "changed", + G_CALLBACK (on_cb_text_alignment_h_changed), (gpointer)obj_prop); + g_signal_connect (G_OBJECT (priv->cb_text_alignment_v), "changed", + G_CALLBACK (on_cb_text_alignment_v_changed), (gpointer)obj_prop); g_signal_connect (G_OBJECT (priv->cbtn_text_back_color), "color-set", G_CALLBACK (on_cbtn_text_back_color_color_set), (gpointer)obj_prop); @@ -401,7 +492,7 @@ GRptObjectProperties G_CALLBACK (on_cbtn_ellipse_fill_color_color_set), (gpointer)obj_prop); /* image */ - priv->vbox_image = glade_xml_get_widget (gla_text, "vbox"); + priv->vbox_image = glade_xml_get_widget (gla_image, "vbox"); g_object_ref (priv->vbox_image); gtk_widget_unparent (priv->vbox_image); priv->spn_image_border_width_top = glade_xml_get_widget (gla_image, "spn_image_border_width_top"); @@ -412,6 +503,35 @@ GRptObjectProperties priv->cbtn_image_border_color_right = glade_xml_get_widget (gla_image, "cbtn_image_border_color_right"); priv->cbtn_image_border_color_bottom = glade_xml_get_widget (gla_image, "cbtn_image_border_color_bottom"); priv->cbtn_image_border_color_left = glade_xml_get_widget (gla_image, "cbtn_image_border_color_left"); + 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_STRING); + + gtk_combo_box_set_model (GTK_COMBO_BOX (priv->cb_image_adapt), + GTK_TREE_MODEL (priv->lstore_image_adapt)); + + renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->cb_image_adapt), renderer, FALSE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->cb_image_adapt), renderer, + "text", ADAPT_DESCR); + + gtk_list_store_append (priv->lstore_image_adapt, &iter); + gtk_list_store_set (priv->lstore_image_adapt, &iter, + ADAPT_ADAPT, RPT_OBJ_IMAGE_ADAPT_NONE, + ADAPT_DESCR, "None", + -1); + gtk_list_store_append (priv->lstore_image_adapt, &iter); + gtk_list_store_set (priv->lstore_image_adapt, &iter, + ADAPT_ADAPT, RPT_OBJ_IMAGE_ADAPT_TO_BOX, + ADAPT_DESCR, "To Box", + -1); + gtk_list_store_append (priv->lstore_image_adapt, &iter); + gtk_list_store_set (priv->lstore_image_adapt, &iter, + ADAPT_ADAPT, RPT_OBJ_IMAGE_ADAPT_TO_IMAGE, + ADAPT_DESCR, "To Image", + -1); g_signal_connect (G_OBJECT (priv->spn_image_border_width_top), "value-changed", G_CALLBACK (on_spn_image_border_width_top_value_changed), (gpointer)obj_prop); @@ -755,15 +875,83 @@ on_cbtn_text_font_color_color_set (GtkColorButton *widget, } static void -on_cbtn_text_back_color_color_set (GtkColorButton *widget, - gpointer user_data) +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; GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + 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) + { + 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; + g_object_set (G_OBJECT (priv->rpt_obj), + "align", align, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); + } +} + +static void +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; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + + 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) + { + 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; + g_object_set (G_OBJECT (priv->rpt_obj), + "align", align, + NULL); + + goo_canvas_item_simple_changed ((GooCanvasItemSimple *)priv->grpt_canvas_item, TRUE); + } +} + +static void +on_cbtn_text_back_color_color_set (GtkColorButton *widget, + gpointer user_data) +{ GdkColor gdk_color; guint16 alpha; + GRptObjectProperties *grpt_object_properties = (GRptObjectProperties *)user_data; + GRptObjectPropertiesPrivate *priv = GRPT_OBJECT_PROPERTIES_GET_PRIVATE (grpt_object_properties); + gtk_color_button_get_color (GTK_COLOR_BUTTON (priv->cbtn_text_back_color), &gdk_color); alpha = gtk_color_button_get_alpha (GTK_COLOR_BUTTON (priv->cbtn_text_back_color)); @@ -1318,7 +1506,7 @@ grpt_object_properties_load_text (GRptObjectProperties *grpt_object_properties) } } - if (align!= NULL) + if (align != NULL) { } @@ -1544,6 +1732,8 @@ grpt_object_properties_set_signal_active (GRptObjectProperties *grpt_object_prop g_signal_handlers_unblock_by_func (priv->fbtn_text_font, G_CALLBACK (on_fbtn_text_font_font_set), grpt_object_properties); g_signal_handlers_unblock_by_func (priv->chk_text_font_strike, G_CALLBACK (on_chk_text_font_strike), grpt_object_properties); g_signal_handlers_unblock_by_func (priv->cbtn_text_font_color, G_CALLBACK (on_cbtn_text_font_color_color_set), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cb_text_alignment_h, G_CALLBACK (on_cb_text_alignment_h_changed), grpt_object_properties); + g_signal_handlers_unblock_by_func (priv->cb_text_alignment_v, G_CALLBACK (on_cb_text_alignment_v_changed), grpt_object_properties); g_signal_handlers_unblock_by_func (priv->cbtn_text_back_color, G_CALLBACK (on_cbtn_text_back_color_color_set), grpt_object_properties); g_signal_handlers_unblock_by_func (priv->spn_text_padd_top, G_CALLBACK (on_spn_text_padd_top_value_changed), grpt_object_properties); g_signal_handlers_unblock_by_func (priv->spn_text_padd_right, G_CALLBACK (on_spn_text_padd_right_value_changed), grpt_object_properties); @@ -1585,6 +1775,8 @@ grpt_object_properties_set_signal_active (GRptObjectProperties *grpt_object_prop g_signal_handlers_block_by_func (priv->fbtn_text_font, G_CALLBACK (on_fbtn_text_font_font_set), grpt_object_properties); g_signal_handlers_block_by_func (priv->chk_text_font_strike, G_CALLBACK (on_chk_text_font_strike), grpt_object_properties); g_signal_handlers_block_by_func (priv->cbtn_text_font_color, G_CALLBACK (on_cbtn_text_font_color_color_set), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cb_text_alignment_h, G_CALLBACK (on_cb_text_alignment_h_changed), grpt_object_properties); + g_signal_handlers_block_by_func (priv->cb_text_alignment_v, G_CALLBACK (on_cb_text_alignment_v_changed), grpt_object_properties); g_signal_handlers_block_by_func (priv->cbtn_text_back_color, G_CALLBACK (on_cbtn_text_back_color_color_set), grpt_object_properties); g_signal_handlers_block_by_func (priv->spn_text_padd_top, G_CALLBACK (on_spn_text_padd_top_value_changed), grpt_object_properties); g_signal_handlers_block_by_func (priv->spn_text_padd_right, G_CALLBACK (on_spn_text_padd_right_value_changed), grpt_object_properties); diff --git a/src/objects_tree.c b/src/objects_tree.c index b2cd275..6e775eb 100644 --- a/src/objects_tree.c +++ b/src/objects_tree.c @@ -547,6 +547,16 @@ grpt_objects_tree_remove_item (GRptObjectsTree *grpt_objects_tree, } } +void +grpt_objects_tree_remove_all (GRptObjectsTree *grpt_objects_tree) +{ + if (!GRPT_IS_OBJECTS_TREE (grpt_objects_tree)) return; + + GRptObjectsTreePrivate *priv = GRPT_OBJECTS_TREE_GET_PRIVATE (grpt_objects_tree); + + gtk_tree_store_clear (priv->tr_store); +} + void grpt_objects_tree_select (GRptObjectsTree *grpt_objects_tree, GList *objects) diff --git a/src/objects_tree.h b/src/objects_tree.h index 9760544..08f3d40 100644 --- a/src/objects_tree.h +++ b/src/objects_tree.h @@ -62,6 +62,7 @@ void grpt_objects_tree_add_item_to_section (GRptObjectsTree *grpt_objects_tree, RptReportSection section); void grpt_objects_tree_remove_item (GRptObjectsTree *grpt_objects_tree, GRptCanvasItem *canvas_item); +void grpt_objects_tree_remove_all (GRptObjectsTree *grpt_objects_tree); void grpt_objects_tree_select (GRptObjectsTree *grpt_objects_tree, GList *objects); diff --git a/src/page_properties.c b/src/page_properties.c index a1f5e94..43ddef6 100644 --- a/src/page_properties.c +++ b/src/page_properties.c @@ -18,9 +18,10 @@ #include #include -#include -static RptReport *rpt_report_; +#include "canvas.h" + +static GRptCanvas *grpt_canvas_; static GtkWidget *w_prop; static GtkWidget *cb_size_type; @@ -99,14 +100,18 @@ page_properties_load () gdouble left; gdouble height; - RptSize *size = rpt_report_get_page_size (rpt_report_); + RptSize *size; + RptReport *rpt_report; + + rpt_report = grpt_canvas_get_rptreport (grpt_canvas_); + size = rpt_report_get_page_size (rpt_report); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_width), size->width); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_height), size->height); page_properties_find_cb_page_size (); - rpt_report_get_page_margins (rpt_report_, + rpt_report_get_page_margins (rpt_report, &top, &right, &bottom, @@ -117,26 +122,26 @@ page_properties_load () gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_margin_top), bottom); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_margin_top), left); - height = rpt_report_get_section_height (rpt_report_, RPTREPORT_SECTION_PAGE_HEADER); + height = rpt_report_get_section_height (rpt_report, RPTREPORT_SECTION_PAGE_HEADER); if (height >= 0) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_header), TRUE); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_header_height), height); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_header_first_page), - rpt_report_get_page_header_first_page (rpt_report_)); + rpt_report_get_page_header_first_page (rpt_report)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_header_last_page), - rpt_report_get_page_header_last_page (rpt_report_)); + rpt_report_get_page_header_last_page (rpt_report)); } - height = rpt_report_get_section_height (rpt_report_, RPTREPORT_SECTION_PAGE_HEADER); + height = rpt_report_get_section_height (rpt_report, RPTREPORT_SECTION_PAGE_HEADER); if (height >= 0) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_footer), TRUE); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spn_footer_height), height); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_footer_first_page), - rpt_report_get_page_footer_first_page (rpt_report_)); + rpt_report_get_page_footer_first_page (rpt_report)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_footer_last_page), - rpt_report_get_page_footer_last_page (rpt_report_)); + rpt_report_get_page_footer_last_page (rpt_report)); } } @@ -181,13 +186,17 @@ page_properties_on_btn_ok_clicked (GtkButton *button, gpointer user_data) { RptSize size; + RptReport *rpt_report; size.height = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_height)); size.width = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_width)); - rpt_report_set_page_size (rpt_report_, size); + rpt_report = grpt_canvas_get_rptreport (grpt_canvas_); + rpt_report_set_page_size (rpt_report, size); + + grpt_canvas_set_canvas_width (grpt_canvas_, size.width); - rpt_report_set_page_margins (rpt_report_, + rpt_report_set_page_margins (rpt_report, gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_margin_top)), gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_margin_right)), gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_margin_bottom)), @@ -195,17 +204,17 @@ page_properties_on_btn_ok_clicked (GtkButton *button, if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_header))) { - rpt_report_set_section_height (rpt_report_, RPTREPORT_SECTION_PAGE_HEADER, + rpt_report_set_section_height (rpt_report, RPTREPORT_SECTION_PAGE_HEADER, gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_header_height))); - rpt_report_set_page_header_first_last_page (rpt_report_, + rpt_report_set_page_header_first_last_page (rpt_report, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_header_first_page)), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_header_last_page))); } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_footer))) { - rpt_report_set_section_height (rpt_report_, RPTREPORT_SECTION_PAGE_HEADER, + rpt_report_set_section_height (rpt_report, RPTREPORT_SECTION_PAGE_HEADER, gtk_spin_button_get_value (GTK_SPIN_BUTTON (spn_footer_height))); - rpt_report_set_page_header_first_last_page (rpt_report_, + rpt_report_set_page_header_first_last_page (rpt_report, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_footer_first_page)), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (chk_footer_last_page))); } @@ -214,12 +223,12 @@ page_properties_on_btn_ok_clicked (GtkButton *button, } void -page_properties (RptReport *rpt_report) +page_properties (GRptCanvas *grpt_canvas) { GladeXML *gla = glade_xml_new (GLADEDIR "/greptool.glade", "w_page_properties", NULL); w_prop = glade_xml_get_widget (gla, "w_page_properties"); - rpt_report_ = rpt_report; + grpt_canvas_ = grpt_canvas; glade_xml_signal_autoconnect (gla); -- 2.49.0