aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-item.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-06-13 22:39:13 +0800
committerChris Lahey <clahey@src.gnome.org>2000-06-13 22:39:13 +0800
commit6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317 (patch)
tree8ebee5432533bb35834cbbea0b75f6ed5d110938 /widgets/table/e-table-item.c
parentc9bdd525e41cd0e2392da161dde2cf6aa72d8b4d (diff)
downloadgsoc2013-evolution-6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317.tar
gsoc2013-evolution-6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317.tar.gz
gsoc2013-evolution-6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317.tar.bz2
gsoc2013-evolution-6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317.tar.lz
gsoc2013-evolution-6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317.tar.xz
gsoc2013-evolution-6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317.tar.zst
gsoc2013-evolution-6b9eb3dbe7fb37acb324d8fe6c03daf3382d8317.zip
Clip the contained text.
2000-06-13 Christopher James Lahey <clahey@helixcode.com> * e-cell-text.c: Clip the contained text. * e-table-group-container.c: Did a first pass at grouped printing. This works, but there's no fancy boxes or headers around the groups. * e-table-item.c: Added will_fit function and added quantize function to _height. svn path=/trunk/; revision=3552
Diffstat (limited to 'widgets/table/e-table-item.c')
-rw-r--r--widgets/table/e-table-item.c70
1 files changed, 67 insertions, 3 deletions
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index 0de4181cdf..5167c794e6 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1804,7 +1804,7 @@ e_table_item_print_page (EPrintable *ep,
yd--;
for (row = rows_printed; row < rows; row++){
- gdouble xd = 0, row_height;
+ gdouble xd = 1, row_height;
row_height = eti_printed_row_height(item, widths, context, row);
if (quantize) {
@@ -1894,6 +1894,7 @@ e_table_item_height (EPrintable *ep,
GnomePrintContext *context,
gdouble width,
gdouble max_height,
+ gboolean quantize,
ETableItemPrintContext *itemcontext)
{
ETableItem *item = itemcontext->item;
@@ -1914,8 +1915,14 @@ e_table_item_height (EPrintable *ep,
gdouble row_height;
row_height = eti_printed_row_height(item, widths, context, row);
- if (max_height != -1 && yd + row_height + 1 > max_height && row != rows_printed) {
- break;
+ if (quantize) {
+ if (max_height != -1 && yd + row_height + 1 > max_height && row != rows_printed) {
+ break;
+ }
+ } else {
+ if (max_height != -1 && yd > max_height) {
+ break;
+ }
}
yd += row_height;
@@ -1924,11 +1931,64 @@ e_table_item_height (EPrintable *ep,
}
g_free (widths);
+
+ if (max_height != -1 && (!quantize) && yd > max_height)
+ yd = max_height;
gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "height");
return yd;
}
+static gboolean
+e_table_item_will_fit (EPrintable *ep,
+ GnomePrintContext *context,
+ gdouble width,
+ gdouble max_height,
+ gboolean quantize,
+ ETableItemPrintContext *itemcontext)
+{
+ ETableItem *item = itemcontext->item;
+ const int rows = item->rows;
+ int rows_printed = itemcontext->rows_printed;
+ gdouble *widths;
+ int row;
+ gdouble yd = 0;
+ gboolean ret_val = TRUE;
+
+ widths = e_table_item_calculate_print_widths (itemcontext->item->header, width);
+
+ /*
+ * Draw cells
+ */
+ yd++;
+
+ for (row = rows_printed; row < rows; row++){
+ gdouble row_height;
+
+ row_height = eti_printed_row_height(item, widths, context, row);
+ if (quantize) {
+ if (max_height != -1 && yd + row_height + 1 > max_height && row != rows_printed) {
+ ret_val = FALSE;
+ break;
+ }
+ } else {
+ if (max_height != -1 && yd > max_height) {
+ ret_val = FALSE;
+ break;
+ }
+ }
+
+ yd += row_height;
+
+ yd++;
+ }
+
+ g_free (widths);
+
+ gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "will_fit");
+ return ret_val;
+}
+
static void
e_table_item_printable_destroy (GtkObject *object,
ETableItemPrintContext *itemcontext)
@@ -1965,6 +2025,10 @@ e_table_item_get_printable (ETableItem *item)
GTK_SIGNAL_FUNC(e_table_item_height),
itemcontext);
gtk_signal_connect (GTK_OBJECT(printable),
+ "will_fit",
+ GTK_SIGNAL_FUNC(e_table_item_will_fit),
+ itemcontext);
+ gtk_signal_connect (GTK_OBJECT(printable),
"destroy",
GTK_SIGNAL_FUNC(e_table_item_printable_destroy),
itemcontext);