report.c File Reference


Detailed Description

Report support (GtkHTML) - incomplete.

Author:
Copyright 2006, 2007 Neil Williams <linux@codehelp.co.uk>

Copyright 1999 Robert Lissner, Jay MacDonald,

Copyright 1999 Sam Phillips, Keith Wesolowski.

The intention is to migrate the entire report functionality to a combination of GtkHTML and QOF. For now, it remains borked.

Definition in file report.c.

#include "config.h"
#include <math.h>
#include <string.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gtkextra/gtksheet.h>
#include <gtkhtml/gtkhtml.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-paper.h>
#include <libgnomeprint/gnome-print-job.h>
#include <libgnomeprintui/gnome-print-preview.h>
#include <libgnomeprintui/gnome-print-job-preview.h>
#include "types.h"
#include "dim_list_menu.h"
#include "edit.h"
#include "filter.h"
#include "main.h"
#include "menus.h"
#include "field.h"
#include "sort.h"
#include "fileout.h"

Go to the source code of this file.

Data Structures

struct  QlColInfo
struct  QlTHead
 report header More...

Defines

#define WRITETAG(x)   gtk_html_write (html, handle, (x), strlen((x)));

Enumerations

enum  { REPORT_COL, FROM_COL, LAST_COL }

Functions

static void close_filetab (GtkWidget G_GNUC_UNUSED *w, gpointer data)
 checks to see if the file should be saved.
static void close_report (GtkWidget G_GNUC_UNUSED *w, gpointer data)
GtkWidget * tab_label_box (QlTabData *tab, const gchar *label_text)
static void thead_cb (gpointer theadp, gpointer tabp)
 Print each row according to the column specifiers.
static void tbl_row_cb (gpointer theadp, gpointer tabp)
static void html_on_screen (QlTabData *tab)
 Add a new HTML table.
static void print_footer (GtkHTML G_GNUC_UNUSED *fhtml, GnomePrintContext *context, gdouble x, gdouble y, gdouble width, gdouble G_GNUC_UNUSED height, gpointer G_GNUC_UNUSED user_data)
void print_cb (GtkWidget G_GNUC_UNUSED *widget, gpointer G_GNUC_UNUSED data)
void print_preview_cb (GtkWidget G_GNUC_UNUSED *widget, gpointer G_GNUC_UNUSED data)
static void report_set_col_field (QlTabData *tab, gint col)
static void display_column (QlTabData *tab, gint colx)
static void display_all_columns (QlTabData *tab)
static void new_report_column_width (GtkSheet G_GNUC_UNUSED *sheet, gint col, gint width, gpointer data)
static gint pick6rows (QlTabData *tab)
static void pos_delete (GtkObject G_GNUC_UNUSED *object, gpointer data)
static void pos_get_dim (QlTabData *tab)
static void pos_list_mode (GtkObject G_GNUC_UNUSED *object, gpointer data)
void pos_justify (gint jx)
static gboolean report_activate (GtkSheet G_GNUC_UNUSED *sheet, gint rrow, gint col, gpointer data)
static void select_report_range (GtkSheet G_GNUC_UNUSED *sheet, GtkSheetRange *range, gpointer data)
static void sort_change (QlTabData *tab, GtkObject G_GNUC_UNUSED *object, gpointer entry)
static void filter_change (QlTabData *tab, GtkObject G_GNUC_UNUSED *object, gpointer entry)
static GtkWidget * sort_filter_menu (QlTabData *tab)
static void adjust_preview (GtkObject G_GNUC_UNUSED *object, gpointer data)
static void adjust_report (QlTabData *tab)
static void add_ok (GtkWidget G_GNUC_UNUSED *w, gpointer data)
static G_GNUC_UNUSED void col_from_clicked (GtkWidget G_GNUC_UNUSED *widget, gint G_GNUC_UNUSED rrow, gint G_GNUC_UNUSED col, GdkEventButton G_GNUC_UNUSED *event, gpointer G_GNUC_UNUSED data)
static G_GNUC_UNUSED void from_clicked (GtkWidget G_GNUC_UNUSED *widget, gint G_GNUC_UNUSED rrow, gint G_GNUC_UNUSED col, GdkEventButton G_GNUC_UNUSED *event, gpointer G_GNUC_UNUSED data)
static void report_dlg_cancel (GtkWidget G_GNUC_UNUSED *w, gpointer data)
static void report_add_cancel (GtkWidget G_GNUC_UNUSED *w, gpointer data)
void report_add (GtkAction G_GNUC_UNUSED *w, gpointer data)
void report_col_add (GtkAction G_GNUC_UNUSED *w, gpointer data)
static void swap_columns (QlTabData *tab, gint from, gint to)
void report_col_left (GtkAction G_GNUC_UNUSED *w, gpointer data)
void report_col_right (GtkAction G_GNUC_UNUSED *w, gpointer data)
void report_go_to (QlTabData *tab, gint row0, gint rowi, gint col0, gint coli)
void report_col_del (GtkAction G_GNUC_UNUSED *w, gpointer data)
static void select_ok (GtkButton G_GNUC_UNUSED *button, gpointer data)
 User clicked OK to select a specific report format, go print on screen.
void report_select (GtkAction G_GNUC_UNUSED *w, gpointer data)
 Offer the list of reports for the user to select.
void report_totals_group (GtkAction G_GNUC_UNUSED *w, gpointer data)
void report_totals_total (GtkAction G_GNUC_UNUSED *w, gpointer data)
static G_GNUC_UNUSED void to_clicked (GtkWidget G_GNUC_UNUSED *widget, gint G_GNUC_UNUSED rrow, gint G_GNUC_UNUSED col, GdkEventButton *event, gpointer G_GNUC_UNUSED data)

Variables

static GtkWidget * select_dlg = NULL
static GList * thead_list = NULL
static GtkWidget * entry1 = NULL
gchar * newrow [2]
static gint widthx
static gchar * spaces
static gchar * pos_text
static size_t local_len
static GtkTextBuffer * buffer
static gint page_num
static gint pages
static GnomeFont * font
static GtkHTML * html
static gshort row = 0


Function Documentation

static void add_ok ( GtkWidget G_GNUC_UNUSED *  w,
gpointer  data 
) [static]

Bug:
tab->view is not being created.

Definition at line 927 of file report.c.

00928 {
00929     gchar *text;
00930     QlTabData * tab;
00931 
00932     tab = (QlTabData *)g_object_get_data (G_OBJECT(data), QLTABID);
00933     g_return_if_fail (tab);
00935     if (strcmp(gtk_entry_get_text (GTK_ENTRY (entry1)), "") == 0)
00936         return;
00937     text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry1)));
00938     if (check_entry (tab, text))
00939     {
00940         g_free (text);
00941         return;
00942     }
00943     front_is_changed (tab);
00944     strcpy (tab->file->report_ptr->name, text);
00945     adjust_report (tab);
00946     g_free (text);
00947     gtk_widget_destroy (GTK_WIDGET(data));
00948 }

static void html_on_screen ( QlTabData tab  )  [static]

Add a new HTML table.

Parameters:
tab - the noteboook tab of the file view.
Creates a new tab for the report view.

Bug:
QlReportColumn starts at 1, not zero.

Bug:
data appears set but is not being displayed

Definition at line 235 of file report.c.

00236 {
00237     GtkWidget *scrolled_window;
00238     GtkWidget *html_widget;
00239     gchar * buf;
00240     gshort c, field_num;
00241     GtkHTMLStream * handle = NULL;
00242 
00243     scrolled_window = gtk_scrolled_window_new (NULL, NULL);
00244     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
00245         GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
00246     html_widget = gtk_html_new ();
00247     html = GTK_HTML (html_widget);
00248     gtk_html_set_allow_frameset (html, FALSE);
00249     gtk_html_load_empty (html);
00250     gtk_html_set_editable (html, FALSE);
00251     gtk_container_add (GTK_CONTAINER (scrolled_window), html_widget);
00252     handle = gtk_html_begin_content (html, "text/html; charset=UTF-8");
00253     WRITETAG("<html><head>\n");
00254     WRITETAG("<meta name=\"Generator\" content=\"QUICKLIST\">\n");
00255     WRITETAG("</head><body>\n");
00256     buf = g_strconcat ("<h1>", tab->file->report_ptr->header, "</h1>\n", NULL);
00257     WRITETAG(buf);
00258     g_free (buf);
00259     buf = g_strconcat ("<h2>", tab->file->report_ptr->name, "</h2>\n", NULL);
00260     WRITETAG(buf);
00261     g_free (buf);
00262     for (c = 0; c < tab->file->report_ptr->last_column; c++)
00263     {
00264         QlFieldInfo * field;
00265         QlTHead * thead = g_new0 (QlTHead, 1);
00267         field = g_new0(QlFieldInfo, 1);
00268         thead->field_info = field;
00269         thead->field_info->sheet_column = c + 1;
00270         field_num = tab->file->report_ptr->column[c+1].field;
00271         field = ql_get_fieldinfo (tab, field_num);
00272         thead->field_info->type = field->type;
00273         thead->temp = handle;
00274         /* not used yet - could support alternative formatting in report. */
00275         switch (thead->field_info->type)
00276         {
00277             case FIELD_TYPE_NUMERIC :
00278             {
00279                 thead->curr_fmt = field->formatting;
00280                 break;
00281             }
00282             case FIELD_TYPE_DATE :
00283             {
00284                 thead->date_fmt = field->formatting;
00285                 break;
00286             }
00287             case FIELD_TYPE_TIME :
00288             {
00289                 thead->time_fmt = field->formatting;
00290                 break;
00291             }
00292             case FIELD_TYPE_TEXT :
00293             {
00294                 thead->txt_format = field->formatting;
00295                 break;
00296             }
00297         }
00298         thead_list = g_list_append (thead_list, thead);
00299     }
00300     /* write the table headers */
00301     WRITETAG ("<table border=\"1\"><tr>\n");
00302     g_list_foreach (thead_list, thead_cb, tab);
00303     WRITETAG ("</tr>\n");
00304     /* <table> needs data in rows 
00305     so write HTML by column, one row at a time. */
00306     for (row = 0; row < tab->file->last_row; row++)
00307     {
00308         WRITETAG ("<tr>\n");
00309         g_list_foreach (thead_list, tbl_row_cb, tab);
00310         WRITETAG ("</tr>\n");
00311     }
00312     WRITETAG("</table>\n</body></html>\n");
00314     gtk_notebook_append_page (tab->qlc->notebook, scrolled_window, 
00315         tab_label_box(tab, tab->file->report_ptr->name));
00316     gtk_widget_show_all (scrolled_window);
00317 }

static void pos_delete ( GtkObject G_GNUC_UNUSED *  object,
gpointer  data 
) [static]

Todo:
move to a GList and do this properly!

Definition at line 512 of file report.c.

00513 {
00514     gint reportx;
00515     QlTabData * tab = (QlTabData*) data;
00516 
00517     /* move all others down one spot.  There may be none to move */
00519     for (reportx = tab->file->report_no; reportx < tab->file->report_ct - 1;
00520         reportx++)
00521         memcpy (&tab->file->reports[reportx], &tab->file->reports[reportx + 1],
00522             sizeof (QlReportInfo));
00523     tab->file->report_ct--;
00524 }

void report_col_add ( GtkAction G_GNUC_UNUSED *  w,
gpointer  data 
)

Todo:
same as below, abstract this routine

Todo:
use a callback here

Definition at line 1155 of file report.c.

01156 {
01157     gint colx, fieldx;
01158     guint width;
01159     GtkWidget *top_vbox;
01160     GtkWidget *hbox2;           /* treeview and header */
01161     GtkTreeView * treeview;
01162     GtkTreeModel * model;
01163     GtkTreeStore * treestore;
01164     GtkTreeIter parent_iter, child_iter;
01165     GtkCellRenderer *renderer;
01166     GtkTreeViewColumn *column;
01167     GtkTreeSortable * sort;
01168     GtkTreeSelection * rselect;
01169     GtkWidget *hbox6;           /* same as action area */
01170     GtkWidget *done_button;
01171     GtkWidget * report_dlg;
01172     QlContext * qlc;
01173     QlTabData * tab;
01174 
01175     qlc = ql_get_context (GTK_WIDGET(data));
01176     tab = ql_get_tabdata (qlc);
01177     width = 0;
01178     report_dlg = gtk_dialog_new ();
01179     gtk_window_set_modal (GTK_WINDOW (report_dlg), TRUE);
01180     gtk_window_set_position (GTK_WINDOW (report_dlg), GTK_WIN_POS_CENTER);
01181     gtk_window_set_resizable (GTK_WINDOW (report_dlg), TRUE);
01182     gtk_container_set_border_width (GTK_CONTAINER (report_dlg), 5);
01183 
01184     gtk_window_set_title (GTK_WINDOW (report_dlg),
01185         _("Add columns to report"));
01186     top_vbox = GTK_DIALOG (report_dlg)->vbox;
01187     gtk_box_set_spacing (GTK_BOX (top_vbox), 10);
01188     hbox6 = GTK_DIALOG (report_dlg)->action_area;
01189 
01190     /* now the area containing tree of fields that can be added */
01191     /*  The horizontal box containing the from and to listboxes  */
01192     hbox2 = gtk_hbox_new (FALSE, 5);
01193     gtk_box_pack_start (GTK_BOX (top_vbox), hbox2, TRUE, TRUE, 0);
01194 
01195     /* The from (column names) treeview */
01197     treeview = GTK_TREE_VIEW (gtk_tree_view_new ());
01198     model = gtk_tree_view_get_model (treeview);
01199     treestore = gtk_tree_store_new (SINGLE_COL, G_TYPE_STRING);
01200     sort = GTK_TREE_SORTABLE (treestore);
01201     gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), 
01202         GTK_TREE_MODEL (sort));
01203     gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
01204     gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE);
01205     gtk_tree_store_append (treestore, &parent_iter, NULL);
01206     gtk_tree_store_set (treestore, &parent_iter, FROM_COL,
01207         _("Available columns"), -1);
01208     renderer = gtk_cell_renderer_text_new ();
01209     column = gtk_tree_view_column_new_with_attributes
01210         (_("Column Name"), renderer, "text", FROM_COL, NULL);
01211     gtk_tree_view_column_set_sort_column_id (column, FROM_COL);
01212     gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
01213     rselect = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
01214     gtk_tree_selection_set_mode (rselect, GTK_SELECTION_SINGLE);
01215 
01216     /* Now do OK, Done and Cancel buttons */
01217     done_button = gtk_button_new_from_stock (GTK_STOCK_APPLY);
01218     gtk_box_pack_start (GTK_BOX (hbox6), done_button, TRUE, TRUE, 0);
01219     g_signal_connect (GTK_OBJECT (done_button), "clicked",
01220         G_CALLBACK (gtk_widget_destroy), report_dlg);
01221 
01222     g_signal_connect (GTK_OBJECT (report_dlg),
01223         "delete_event", G_CALLBACK (report_dlg_cancel), report_dlg);
01224     /* now populate the tree of column names */
01225     newrow[1] = NULL;
01226     for (colx = 0; colx <= tab->file->last_field; colx++)
01227     {
01228         QlFieldInfo * field;
01230         fieldx = tab->file->col_to_field[colx];
01231         field = ql_get_fieldinfo (tab, fieldx);
01232         newrow[0] = field->name;
01233         gtk_tree_store_append (treestore, &child_iter, &parent_iter);
01234         gtk_tree_store_set (treestore, &child_iter, FROM_COL, 
01235             newrow[0], -1);
01236         width = (strlen(newrow[0]) > width) ? 
01237             strlen(newrow[0]) : width;
01238     }
01239     gtk_widget_set_size_request (GTK_WIDGET(treeview), 
01240         width + 200, 200);
01241     gtk_tree_view_expand_all (GTK_TREE_VIEW(treeview));
01242 
01243     gtk_widget_show_all (report_dlg);
01244 }                               /* End of Report_col_add */

void report_col_del ( GtkAction G_GNUC_UNUSED *  w,
gpointer  data 
)

Todo:
use a GList instead.

Definition at line 1297 of file report.c.

01298 {
01299     gint colx;
01300     gint this_col;
01301     QlContext * qlc;
01302     QlTabData * tab;
01303 
01304     qlc = ql_get_context (GTK_WIDGET(data));
01305     tab = ql_get_tabdata (qlc);
01306     this_col = tab->view->report_sel_col;
01307     /* someday we should have code to ask if the user really wants this */
01308     gtk_sheet_delete_columns (tab->view->report_sheet,
01309         this_col, 1);
01310 
01312     /* remove entry from report->column by moving down all higher */
01313     for (colx = this_col; colx < tab->file->report_ptr->last_column; colx++)
01314         tab->file->report_ptr->column[colx] =
01315             tab->file->report_ptr->column[colx + 1];
01316     tab->file->report_ptr->last_column--;
01317     if (this_col > tab->file->report_ptr->last_column)
01318         this_col = tab->file->report_ptr->last_column;
01319     report_go_to (tab, 0, 0, this_col, this_col);
01320 }                               /* end of report_col_del */

void report_select ( GtkAction G_GNUC_UNUSED *  w,
gpointer  data 
)

Offer the list of reports for the user to select.

Todo:
Convert tab->file->reports to a GHashTable

Definition at line 1362 of file report.c.

01363 {
01364     gint reportx;
01365     guint width;
01366     GtkWidget *top_vbox;
01367     GtkWidget *hbox2;           /* treeview and header */
01368     GtkWidget *scrwin_from;
01369     GtkTreeStore * treestore;
01370     GtkTreeIter parent_iter, child_iter;
01371     GtkCellRenderer *renderer;
01372     GtkTreeViewColumn *column;
01373     GtkTreeView * treeview;
01374     GtkTreeModel * treemodel;
01375     GtkTreeSortable * sort;
01376     GtkTreeSelection * rselect;
01377     GtkWidget *hbox6;           /* same as action area */
01378     GtkWidget *cancel_button, * ok_button;
01379     QlContext * qlc;
01380     QlTabData * tab;
01381 
01382     qlc = ql_get_context (GTK_WIDGET(data));
01383     tab = ql_get_tabdata (qlc);
01384 
01385     g_return_if_fail (tab);
01386     CHECK_CHANGED(tab);
01387     select_dlg = gtk_dialog_new ();
01388     gtk_window_set_modal (GTK_WINDOW (select_dlg), TRUE);
01389     gtk_window_set_position (GTK_WINDOW (select_dlg), GTK_WIN_POS_CENTER);
01390     gtk_window_set_resizable (GTK_WINDOW (select_dlg), TRUE);
01391     gtk_container_set_border_width (GTK_CONTAINER (select_dlg), 5);
01392 
01393     width = 0;
01394     gtk_window_set_title (GTK_WINDOW (select_dlg), _("Select a report"));
01395     top_vbox = GTK_DIALOG (select_dlg)->vbox;
01396     gtk_box_set_spacing (GTK_BOX (top_vbox), 10);
01397     hbox6 = GTK_DIALOG (select_dlg)->action_area;
01398 
01399     treeview = GTK_TREE_VIEW(gtk_tree_view_new ());
01400     treemodel = gtk_tree_view_get_model (treeview);
01401     /* one column, name of report */
01402     treestore = gtk_tree_store_new (SINGLE_COL, G_TYPE_STRING);
01403     sort = GTK_TREE_SORTABLE (treestore);
01404     gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), 
01405         GTK_TREE_MODEL (sort));
01406     gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);
01407     gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE);
01408     gtk_tree_store_append (treestore, &parent_iter, NULL);
01409     gtk_tree_store_set (treestore, &parent_iter, REPORT_COL, 
01410         _("Available reports"), -1);
01411     renderer = gtk_cell_renderer_text_new ();
01412     column = gtk_tree_view_column_new_with_attributes
01413         (_("Report Name"), renderer, "text", REPORT_COL, NULL);
01414     gtk_tree_view_column_set_sort_column_id (column, REPORT_COL);
01415     gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
01416     /*  The horizontal box containing the from and to listboxes  */
01417     hbox2 = gtk_hbox_new (FALSE, 5);
01418     gtk_box_pack_start (GTK_BOX (top_vbox), hbox2, TRUE, TRUE, 0);
01419 
01420     /* The report names tree */
01421     scrwin_from = gtk_scrolled_window_new (NULL, NULL);
01422     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrwin_from),
01423         GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
01424     gtk_container_set_border_width (GTK_CONTAINER (scrwin_from), 5);
01425     gtk_box_pack_start (GTK_BOX (hbox2), scrwin_from, TRUE, TRUE, 0);
01426     gtk_container_add (GTK_CONTAINER (scrwin_from), 
01427         GTK_WIDGET(treeview));
01428 
01429     ok_button = gtk_button_new_from_stock (GTK_STOCK_OK);
01430     rselect = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
01431     gtk_tree_selection_set_mode (rselect, GTK_SELECTION_SINGLE);
01432     g_object_set_data (G_OBJECT(rselect), QLTABID, tab);
01433     g_signal_connect (G_OBJECT (ok_button), "clicked",
01434         G_CALLBACK (select_ok), rselect);
01435     gtk_window_set_resizable (GTK_WINDOW(select_dlg), TRUE);
01436     cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
01437     gtk_box_pack_start (GTK_BOX (hbox6), ok_button, TRUE, TRUE, 0);
01438     gtk_box_pack_start (GTK_BOX (hbox6), cancel_button, TRUE, TRUE, 0);
01439     g_signal_connect (GTK_OBJECT (cancel_button), "clicked",
01440         G_CALLBACK (report_dlg_cancel), select_dlg);
01441     g_signal_connect (GTK_OBJECT (select_dlg), "delete_event", 
01442         G_CALLBACK(report_dlg_cancel), select_dlg);
01443     /* now populate the model with report names */
01445     newrow[1] = NULL;
01446     for (reportx = 0; reportx < tab->file->report_ct; reportx++)
01447     {
01448         newrow[0] = tab->file->reports[reportx].name;
01449         gtk_tree_store_append (treestore, &child_iter, &parent_iter);
01450         gtk_tree_store_set (treestore, &child_iter, REPORT_COL, 
01451             newrow[0], -1);
01452         width = (strlen(newrow[0]) > width) ? 
01453             strlen(newrow[0]) : width;
01454     }
01455     gtk_widget_set_size_request (GTK_WIDGET(treeview), 
01456         width + 200, 200);
01457     gtk_tree_view_expand_all (GTK_TREE_VIEW(treeview));
01458     gtk_widget_show_all (select_dlg);
01459 }                               /* End of Report_select */

static void report_set_col_field ( QlTabData tab,
gint  col 
) [static]

Todo:
remove old report_set_col_field code

Definition at line 394 of file report.c.

00395 {
00396     tab->view->report_sel_col = col;
00397     tab->view->report_sel_field = tab->file->report_ptr->column[col].field;
00398 }

void report_totals_group ( GtkAction G_GNUC_UNUSED *  w,
gpointer  data 
)

Todo:
WTF? group = !group ?

Definition at line 1463 of file report.c.

01464 {
01465     QlContext * qlc;
01466     QlTabData * tab;
01467 
01468     qlc = ql_get_context (GTK_WIDGET(data));
01469     tab = ql_get_tabdata (qlc);
01470     tab->file->report_ptr->column[tab->view->report_sel_col].group =
01471         !tab->file->report_ptr->column[tab->view->report_sel_col].group;
01472     display_column (tab, tab->view->report_sel_col);
01473 }

void report_totals_total ( GtkAction G_GNUC_UNUSED *  w,
gpointer  data 
)

Todo:
WTF? total = !total?

Definition at line 1477 of file report.c.

01478 {
01479     QlContext * qlc;
01480     QlTabData * tab;
01481 
01482     qlc = ql_get_context (GTK_WIDGET(data));
01483     tab = ql_get_tabdata (qlc);
01484     tab->file->report_ptr->column[tab->view->report_sel_col].total =
01485         !tab->file->report_ptr->column[tab->view->report_sel_col].total;
01486     display_column (tab, tab->view->report_sel_col);
01487 }

static void select_report_range ( GtkSheet G_GNUC_UNUSED *  sheet,
GtkSheetRange *  range,
gpointer  data 
) [static]

Bug:
#456095 setting negative value in array is impossible. This cannot be a sane way of unsetting the selection. else report_set_col_field (tab, -1);

Definition at line 595 of file report.c.

00597 {
00598     QlTabData * tab;
00599     GtkSheetRange local_range;
00600 
00601     tab = (QlTabData*)data;
00602     local_range = *range;
00603     if (local_range.col0 == local_range.coli)
00604     {
00605         report_set_col_field (tab, local_range.col0);
00606         dim_all_menus (tab->qlc);
00607     }/* no selection */
00612 }

static GtkWidget* sort_filter_menu ( QlTabData tab  )  [static]

Todo:
create a drop-down toolbar button + suitable menu?

Definition at line 637 of file report.c.

00638 {
00639 /*  GtkTreeView * treeview;
00640     GtkTreeModel * model;
00641     GtkTreeStore * treestore;
00642     GtkTreeIter parent_iter, child_iter;
00643     GtkCellRenderer *renderer;
00644     GtkTreeViewColumn *column;
00645     GtkTreeSortable * sort;
00646     GtkTreeSelection * select;
00647 */
00649 //  GtkWidget *hbox2;
00650     GtkWidget *menu, *menu_item, *name_label;
00651     gint sortx;
00652     gint filterx;
00653 //  GtkWidget *sort_button;
00654 //  GtkWidget *filter_button;
00655 /*
00656     make_basic_dialog1 ();
00657 
00658     gtk_window_set_title (GTK_WINDOW (dialog1_win),
00659         _("New report"));
00660     top_vbox = GTK_DIALOG (dialog1_win)->vbox;
00661     gtk_box_set_spacing (GTK_BOX (top_vbox), 10);
00662     hbox6 = GTK_DIALOG (dialog1_win)->action_area;
00663     hbox2 = gtk_hbox_new (FALSE, 5);
00664     gtk_box_pack_start (GTK_BOX (top_vbox), hbox2, TRUE, TRUE, 0);
00665 */
00666     menu = gtk_menu_new ();
00667     menu_item = gtk_menu_item_new_with_label (_("-Do not sort-"));
00668     gtk_widget_show (menu_item);
00669     g_signal_connect (GTK_OBJECT (menu_item),
00670         "activate", G_CALLBACK (sort_change), GINT_TO_POINTER (0));
00671     gtk_menu_attach (GTK_MENU (menu), menu_item, 0, 1, 0, 1);
00672     /* add the individual sorts to the menu */
00673     for (sortx = 0; sortx < tab->file->sort_ct; sortx++)
00674     {
00675         menu_item =
00676             gtk_menu_item_new_with_label (tab->file->sorts[sortx].name);
00677         gtk_widget_show (menu_item);
00678         {
00679             /* workaround */
00680             gint t;
00681             t = sortx + 1;
00682             g_signal_connect (GTK_OBJECT (menu_item), "activate", 
00683                 G_CALLBACK (sort_change), GINT_TO_POINTER (t));
00684         }
00685         gtk_menu_attach (GTK_MENU (menu), menu_item, 0, 1, 0, 1);
00686     }
00687 
00688 /*  sort_button = gtk_option_menu_new ();
00689    gtk_option_menu_set_menu (GTK_OPTION_MENU (sort_button), menu);
00690    gtk_option_menu_set_history (GTK_OPTION_MENU (sort_button), 
00691                 front->report_ptr->sort + 1);
00692    hbox3 = gtk_hbox_new (FALSE, 5);
00693 */
00694     /* Pack Widgets into boxes */
00695     name_label = gtk_label_new (_("Sort rule: "));
00696 /*  gtk_box_pack_start (GTK_BOX (hbox3), name_label, FALSE, FALSE, 0);
00697   gtk_box_pack_start (GTK_BOX (hbox3), sort_button, FALSE, FALSE, 0);
00698 */
00699     menu = gtk_menu_new ();
00700     menu_item = gtk_menu_item_new_with_label (_("-Print all rows-"));
00701     gtk_widget_show (menu_item);
00702     g_signal_connect (GTK_OBJECT (menu_item), "activate", 
00703         G_CALLBACK (filter_change), GINT_TO_POINTER (0));
00704     gtk_menu_attach (GTK_MENU (menu), menu_item, 0, 1, 0, 1);
00705 
00706     /* add the individual filters to the menu */
00707     for (filterx = 0; filterx < tab->file->filter_ct; filterx++)
00708     {
00709         menu_item = gtk_menu_item_new_with_label (tab->file->filters
00710             [filterx].name);
00711         gtk_widget_show (menu_item);
00712         {
00713             /* workaround */
00714             gint t;
00715             t = filterx + 1;
00716             g_signal_connect (GTK_OBJECT (menu_item), "activate", 
00717                 G_CALLBACK (filter_change), GINT_TO_POINTER (t));
00718         }
00719         gtk_menu_attach (GTK_MENU (menu), menu_item, 0, 1, 0, 1);
00720     }
00721 
00722 /*  filter_button = gtk_option_menu_new ();
00723    gtk_option_menu_set_menu (GTK_OPTION_MENU (filter_button), menu);
00724    gtk_option_menu_set_history (GTK_OPTION_MENU (filter_button), 
00725                     front->report_ptr->filter + 1);
00726 *//* Pack Widgets into boxes */
00727     name_label = gtk_label_new (_("Filter: "));
00728 /*  gtk_box_pack_end (GTK_BOX (hbox3), filter_button, FALSE, FALSE, 0);
00729    gtk_box_pack_end (GTK_BOX (hbox3), name_label, FALSE, FALSE, 0);
00730    return (hbox3);
00731 */
00732     return NULL;
00733 }                               /* end of sort_filter_menu () */

GtkWidget* tab_label_box ( QlTabData tab,
const gchar *  label_text 
)

Todo:
enable tooltip via context

Definition at line 158 of file report.c.

00159 {
00160     GtkWidget * label_box, * label, * tab_close;
00161     GtkWidget * tab_image;
00162     GtkRcStyle *rcstyle;
00163 
00164     label_box = gtk_hbox_new (FALSE, 0);
00165     label = gtk_label_new (label_text);
00166     gtk_box_pack_start (GTK_BOX(label_box), label, FALSE, FALSE, 5);
00167     tab_close = gtk_button_new();
00168     gtk_button_set_relief(GTK_BUTTON(tab_close), GTK_RELIEF_NONE);
00169     gtk_button_set_focus_on_click (GTK_BUTTON (tab_close), FALSE);
00171     rcstyle = gtk_rc_style_new ();
00172     rcstyle->xthickness = rcstyle->ythickness = 0; 
00173     gtk_widget_modify_style (tab_close, rcstyle);
00174     g_object_unref (rcstyle);
00175     tab_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
00176     gtk_container_add(GTK_CONTAINER(tab_close), tab_image);
00177     gtk_box_pack_start (GTK_BOX(label_box), tab_close, FALSE, FALSE, 0);
00178     gtk_widget_show_all (label_box);
00179     /* closing a report does not ask about save */
00180     if ((tab->file->file_path) && (!tab->file->report_ptr))
00181         g_signal_connect (tab_close, "clicked", G_CALLBACK (close_filetab), tab);
00182     else
00183         g_signal_connect (tab_close, "clicked", G_CALLBACK (close_report), tab);
00184     return label_box;
00185 }

static void tbl_row_cb ( gpointer  theadp,
gpointer  tabp 
) [static]

Bug:
buf is always empty

Definition at line 209 of file report.c.

00210 {
00211     gchar * buf, * tag;
00212     QlTabData * tab = (QlTabData*) tabp;
00213     QlTHead * thead = (QlTHead*)theadp;
00214     GtkHTMLStream * handle = thead->temp;
00215 
00216     buf = NULL;
00217     /* <table> needs data in rows */
00219     buf = gtk_sheet_cell_get_text (tab->view->sheet, row,
00220         thead->field_info->sheet_column);
00221     if (!buf)
00222         buf = "&nbsp;";
00223     tag = g_strconcat ("<td>", buf, "</td>\n", NULL);
00224     WRITETAG(tag);
00225     g_free (buf);
00226 }

static void thead_cb ( gpointer  theadp,
gpointer  tabp 
) [static]

Print each row according to the column specifiers.

Parameters:
thead - the QlTHead information for this column
tab - the QlTabData context.

Definition at line 194 of file report.c.

00195 {
00196     gchar * buf;
00197     QlTabData * tab = (QlTabData*) tabp;
00198     QlFieldInfo * field;
00199     QlTHead * thead = (QlTHead*)theadp;
00200     GtkHTMLStream * handle = thead->temp;
00201 
00202     field = ql_get_fieldinfo (tab, thead->field_info->sheet_column);
00203     buf = g_strconcat ("<td><b>", field->name, "</b></td>\n", NULL);
00204     WRITETAG(buf);
00205     g_free (buf);
00206 }

static G_GNUC_UNUSED void to_clicked ( GtkWidget G_GNUC_UNUSED *  widget,
gint G_GNUC_UNUSED  rrow,
gint G_GNUC_UNUSED  col,
GdkEventButton *  event,
gpointer G_GNUC_UNUSED  data 
) [static]

Todo:
revise as treeview selection handler.

Definition at line 1492 of file report.c.

01494 {
01495 //  gint colx;
01496     if (event->type != GDK_2BUTTON_PRESS)
01497         return;
01498     
01499 /*  for (colx = row; colx < front->report_ptr->last_column; colx++)
01500         front->report_ptr->column[colx] =
01501             front->report_ptr->column[colx + 1];
01502     front->report_ptr->last_column--;*/
01503 }


Variable Documentation

gchar* newrow[2]

Todo:
replace with dynamic allocation.

Definition at line 72 of file report.c.

gint page_num [static]

Todo:
migrate into the tab context

Definition at line 63 of file report.c.

GList* thead_list = NULL [static]

replaces QLFieldInfo fields[MAX_FIELDS + 1]

Definition at line 69 of file report.c.


Generated on Mon Jan 28 22:02:11 2008 for quicklist by  doxygen 1.5.4