]> saetta.ns0.it Git - reptool/greptool/commitdiff
Coninued with ObjectProperties.
authorAndrea Zagli <azagli@libero.it>
Sun, 18 Nov 2007 09:19:58 +0000 (09:19 +0000)
committerAndrea Zagli <azagli@libero.it>
Sun, 18 Nov 2007 09:19:58 +0000 (09:19 +0000)
git-svn-id: svn+ssh://saetta.homelinux.org/svn/greptool/trunk@14 76169498-11ee-428b-941f-28d7a79d5cb2

data/greptool/glade/greptool.glade
src/canvas.c
src/canvas.h
src/canvastext.c
src/main.c
src/object_properties.c
src/objects_tree.c
src/objects_tree.h
src/page_properties.c

index 288c4908989a54b8352ea1997ef68582e40a7f1b..b9f630ed86aae9131c2fa6e89db1a873705d77cd 100644 (file)
@@ -512,7 +512,7 @@ You should have received a copy of the GNU General Public License along with Nau
     </child>
   </widget>
   <widget class="GtkWindow" id="w_report_properties">
-    <property name="title" translatable="yes">GRepTool - Report Properties</property>
+    <property name="title" translatable="yes">Report Properties - GRepTool</property>
     <property name="modal">True</property>
     <property name="default_width">450</property>
     <property name="destroy_with_parent">True</property>
@@ -872,7 +872,7 @@ You should have received a copy of the GNU General Public License along with Nau
     <property name="visible">True</property>
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
     <property name="border_width">3</property>
-    <property name="title" translatable="yes">GRepTool - Page Properties</property>
+    <property name="title" translatable="yes">Page Properties - GRepTool</property>
     <property name="modal">True</property>
     <property name="default_width">300</property>
     <property name="destroy_with_parent">True</property>
@@ -3312,7 +3312,7 @@ Custom</property>
                       <placeholder/>
                     </child>
                     <child>
-                      <widget class="GtkColorButton" id="cbtn_rect_stroke_color">
+                      <widget class="GtkColorButton" id="ctbn_rect_stroke_color">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">True</property>
index 7b9067b7d70e4440a6b2503d8368e18fd9b04d20..de2260b6f58e3f2804b4bcfe5a7db1e6e2daee70 100644 (file)
@@ -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
index 8c46ba0c8e486f3a2ea369577b0c2910bc5a2c29..139f545d841cd005469a23257f9c30c3d9a202ce 100644 (file)
@@ -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);
 
index 74bac8ea9f49f8cc7ed57990c6c46b6f5ec0584d..ccc4dd725c338619540ef5e7822266f6c06c8905 100644 (file)
@@ -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;
                                }
index f7a6d1ce2666bec24740508467ced8754910b343..e9b2a55a2e39cd024e72171c2012dc065a1a39df 100644 (file)
@@ -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
index f3fafecd114e4fa0c32d31aaa79e438dde6e98ac..235c517d7901bf2a44572a1dae8aaf640dc19bba 100644 (file)
@@ -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);
index b2cd275202f2e604fe5db9df4df214731e72a8bd..6e775eb017f7c803f9461766b7054530798e35ce 100644 (file)
@@ -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)
index 9760544cf7195a7ccf91079e0e4403d542b71090..08f3d4042b76996c2254d12db486118eae15d4ff 100644 (file)
@@ -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);
index a1f5e94afe33bd671fbd1be73cebf3a8632c0b91..43ddef692c48155731ff36c6df75751256d93479 100644 (file)
 
 #include <gtk/gtk.h>
 #include <glade/glade.h>
-#include <libreptool.h>
 
-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);