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,
#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
{
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;
/* to do style */
GtkWidget *cb_image_adapt;
+ GtkListStore *lstore_image_adapt;
+
GRptCanvasItem *grpt_canvas_item;
RptObject *rpt_obj;
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);
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",
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);
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");
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);
}
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));
}
}
- if (align!= NULL)
+ if (align != NULL)
{
}
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);
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);
#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;
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,
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));
}
}
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)),
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)));
}
}
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);