struct output_item *item;
GtkWidget *drawing_area;
int width, height;
+ int nesting_depth;
};
struct psppire_output_view
static bool
init_output_view_item (struct output_view_item *view_item,
struct psppire_output_view *view,
- const struct output_item *item)
+ const struct output_item *item,
+ int nesting_depth)
{
- *view_item = (struct output_view_item) { .item = output_item_ref (item) };
+ *view_item = (struct output_view_item) {
+ .item = output_item_ref (item),
+ .nesting_depth = nesting_depth
+ };
GdkWindow *win = gtk_widget_get_window (GTK_WIDGET (view->output));
if (win && item->type != OUTPUT_ITEM_GROUP)
view->items = x2nrealloc (view->items, &view->allocated_items,
sizeof *view->items);
struct output_view_item *view_item = &view->items[view->n_items];
- if (!init_output_view_item (view_item, view, item))
+ if (!init_output_view_item (view_item, view, item,
+ gtk_tree_path_get_depth (parent_path)))
return;
view->n_items++;
size_t i;
for (i = 0; i < view->n_items; i++)
- driver->class->submit (driver, view->items[i].item);
+ if (view->items[i].nesting_depth == 0)
+ driver->class->submit (driver, view->items[i].item);
output_driver_destroy (driver);
}
}
complete. Don't let that screw up printing. */
return TRUE;
}
- else if (view->print_item < view->n_items)
+
+ while (view->print_item < view->n_items)
{
- xr_pager_add_item (view->pager, view->items[view->print_item++].item);
- while (xr_pager_needs_new_page (view->pager))
- {
- xr_pager_add_page (view->pager,
- get_cairo_context_from_print_context (context));
- view->print_n_pages ++;
- }
- return FALSE;
+ const struct output_view_item *item = &view->items[view->print_item++];
+ if (item->nesting_depth == 0)
+ {
+ xr_pager_add_item (view->pager, item->item);
+ while (xr_pager_needs_new_page (view->pager))
+ {
+ xr_pager_add_page (view->pager,
+ get_cairo_context_from_print_context (context));
+ view->print_n_pages ++;
+ }
+ return FALSE;
+ }
}
- else
- {
- gtk_print_operation_set_n_pages (operation, MAX (1, view->print_n_pages));
- /* Re-create the driver to do the real printing. */
- xr_pager_destroy (view->pager);
- view->pager = xr_pager_create (view->page_style, view->fsm_style);
- view->print_item = 0;
- view->paginated = TRUE;
+ gtk_print_operation_set_n_pages (operation, MAX (1, view->print_n_pages));
- return TRUE;
- }
+ /* Re-create the driver to do the real printing. */
+ xr_pager_destroy (view->pager);
+ view->pager = xr_pager_create (view->page_style, view->fsm_style);
+ view->print_item = 0;
+ view->paginated = TRUE;
+
+ return TRUE;
}
static void
get_cairo_context_from_print_context (context));
while (!xr_pager_needs_new_page (view->pager)
&& view->print_item < view->n_items)
- xr_pager_add_item (view->pager, view->items [view->print_item++].item);
+ {
+ const struct output_view_item *item = &view->items [view->print_item++];
+ if (item->nesting_depth == 0)
+ xr_pager_add_item (view->pager, item->item);
+ }
}