diff options
author | JP Rosevear <jpr@ximian.com> | 2004-01-18 05:06:14 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-01-18 05:06:14 +0800 |
commit | d8c28801a75106daf09303a1cdcae6814fc91773 (patch) | |
tree | 685bf8a1c8321ed09e299e7e0f2397f84f9263ab /calendar | |
parent | fe09d1e6a6f00ee603d678a10673e2c50986e14e (diff) | |
download | gsoc2013-evolution-d8c28801a75106daf09303a1cdcae6814fc91773.tar gsoc2013-evolution-d8c28801a75106daf09303a1cdcae6814fc91773.tar.gz gsoc2013-evolution-d8c28801a75106daf09303a1cdcae6814fc91773.tar.bz2 gsoc2013-evolution-d8c28801a75106daf09303a1cdcae6814fc91773.tar.lz gsoc2013-evolution-d8c28801a75106daf09303a1cdcae6814fc91773.tar.xz gsoc2013-evolution-d8c28801a75106daf09303a1cdcae6814fc91773.tar.zst gsoc2013-evolution-d8c28801a75106daf09303a1cdcae6814fc91773.zip |
update protos
004-01-17 JP Rosevear <jpr@ximian.com>
* gui/print.h: update protos
* gui/print.c (print_title): util routine to print a title
(print_table): print out an etable
* gui/calendar-commands.c (print): handle printing the list view
* gui/e-cal-list-view.etspec: draw the grid to mimic tasks
* gui/tasks-control.c (tasks_control_print_cmd): use print_table
Fixes #51751, #52958
svn path=/trunk/; revision=24290
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 20 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.c | 11 | ||||
-rw-r--r-- | calendar/gui/e-cal-list-view.etspec | 2 | ||||
-rw-r--r-- | calendar/gui/print.c | 92 | ||||
-rw-r--r-- | calendar/gui/print.h | 5 | ||||
-rw-r--r-- | calendar/gui/tasks-control.c | 95 |
6 files changed, 135 insertions, 90 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 89e7425238..4c1ff80a2d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,23 @@ +2004-01-17 JP Rosevear <jpr@ximian.com> + + * gui/print.h: update protos + + * gui/print.c (print_title): util routine to print a title + (print_table): print out an etable + + * gui/calendar-commands.c (print): handle printing the list view + + * gui/e-cal-list-view.etspec: draw the grid to mimic tasks + + * gui/tasks-control.c (tasks_control_print_cmd): use print_table + + Fixes #51751, #52958 + +2004-01-16 JP Rosevear <jpr@ximian.com> + + * gui/calendar-commands.c (print): handle list view by printing + the month + 2004-01-16 JP Rosevear <jpr@ximian.com> * gui/e-itip-control.c (find_server): we actually want to not diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 1ff2a3a0a8..5058b1c66a 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -61,6 +61,7 @@ #include "dialogs/cal-prefs-dialog.h" #include "itip-utils.h" #include "e-pub-utils.h" +#include "e-cal-list-view.h" #include "evolution-shell-component-utils.h" /* Focusing information for the calendar view. We have to keep track of this @@ -89,7 +90,9 @@ print (GnomeCalendar *gcal, gboolean preview) time_t start; GnomeCalendarViewType view_type; PrintView print_view; - + ECalListView *list_view; + ETable *etable; + gnome_calendar_get_current_time_range (gcal, &start, NULL); view_type = gnome_calendar_get_view (gcal); @@ -107,6 +110,12 @@ print (GnomeCalendar *gcal, gboolean preview) print_view = PRINT_VIEW_MONTH; break; + case GNOME_CAL_LIST_VIEW: + list_view = E_CAL_LIST_VIEW (gnome_calendar_get_current_view_widget (gcal)); + etable = e_table_scrolled_get_table (list_view->table_scrolled); + print_table (etable, _("Calendar"), preview); + return; + default: g_assert_not_reached (); return; diff --git a/calendar/gui/e-cal-list-view.etspec b/calendar/gui/e-cal-list-view.etspec index e5a2cc0b6d..49a12bc849 100644 --- a/calendar/gui/e-cal-list-view.etspec +++ b/calendar/gui/e-cal-list-view.etspec @@ -1,4 +1,4 @@ -<ETableSpecification draw-grid="false" alternating-row-colors="true"> +<ETableSpecification draw-grid="true" alternating-row-colors="true"> <ETableColumn model_col="0" _title="Categories" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/> <ETableColumn model_col="1" _title="Classification" expansion="1.0" minimum_width="10" resizable="true" cell="classification" compare="string" priority="-1"/> <ETableColumn model_col="2" _title="color" cell="calcolor" priority="-4"/> diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 1e978d8694..2d8ef720c4 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -2619,6 +2619,98 @@ print_comp (ECalComponent *comp, ECal *client, gboolean preview) g_object_unref (gpm); } +static void +print_title (GnomePrintContext *pc, const char *title, + double page_width, double page_height) +{ + GnomeFont *font; + double w, x, y; + + font = gnome_font_find_closest ("Sans Bold", 18); + + w = gnome_font_get_width_utf8 (font, title); + + x = (page_width - w) / 2; + y = page_height - gnome_font_get_ascender (font); + + gnome_print_moveto (pc, x, y); + gnome_print_setfont (pc, font); + gnome_print_setrgbcolor (pc, 0, 0, 0); + gnome_print_show (pc, title); + + g_object_unref (font); +} + +void +print_table (ETable *etable, const char *title, gboolean preview) +{ + EPrintable *printable; + GnomePrintContext *pc; + GnomePrintJob *gpm; + double l, r, t, b, page_width, page_height, left_margin, bottom_margin; + + if (!print_config) + print_config = gnome_print_config_default (); + + printable = e_table_get_printable (etable); + g_object_ref (printable); + gtk_object_sink (GTK_OBJECT (printable)); + e_printable_reset (printable); + + gpm = gnome_print_job_new (print_config); + pc = gnome_print_job_get_context (gpm); + + gnome_print_config_get_page_size (print_config, &r, &t); + +#if 0 + gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &temp_d); + t -= temp_d; + gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &temp_d); + r -= temp_d; + gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &b); + gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &l); +#endif + + b = t * TEMP_MARGIN; + l = r * TEMP_MARGIN; + t *= (1.0 - TEMP_MARGIN); + r *= (1.0 - TEMP_MARGIN); + + page_width = r - l; + page_height = t - b; + left_margin = l; + bottom_margin = b; + + do { + gnome_print_beginpage (pc, "Tasks"); + gnome_print_gsave (pc); + + gnome_print_translate (pc, left_margin, bottom_margin); + + print_title (pc, title, page_width, page_height); + + if (e_printable_data_left (printable)) + e_printable_print_page (printable, pc, + page_width, page_height - 24, TRUE); + + gnome_print_grestore (pc); + gnome_print_showpage (pc); + } while (e_printable_data_left (printable)); + + gnome_print_job_close (gpm); + + if (preview) { + GtkWidget *gpmp; + gpmp = gnome_print_job_preview_new (gpm, _("Print Preview")); + gtk_widget_show (gpmp); + } else { + gnome_print_job_print (gpm); + } + + g_object_unref (gpm); + g_object_unref (printable); +} + void print_setup (void) { diff --git a/calendar/gui/print.h b/calendar/gui/print.h index 495007d81d..52db38c371 100644 --- a/calendar/gui/print.h +++ b/calendar/gui/print.h @@ -30,11 +30,14 @@ typedef enum { PRINT_VIEW_DAY, PRINT_VIEW_WEEK, PRINT_VIEW_MONTH, - PRINT_VIEW_YEAR + PRINT_VIEW_YEAR, + PRINT_VIEW_LIST } PrintView; void print_calendar (GnomeCalendar *gcal, gboolean preview, time_t at, PrintView default_view); void print_comp (ECalComponent *comp, ECal *client, gboolean preview); +void print_table (ETable *etable, const char *title, gboolean preview); + void print_setup (void); diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 23a24e97fc..f0064d0789 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -48,6 +48,7 @@ #include "calendar-commands.h" #include "e-tasks.h" #include "e-calendar-table.h" +#include "print.h" #include "tasks-control.h" #include "evolution-shell-component-utils.h" @@ -493,103 +494,17 @@ tasks_control_purge_cmd (BonoboUIComponent *uic, static void -print_title (GnomePrintContext *pc, - double page_width, double page_height) -{ - GnomeFont *font; - char *text; - double w, x, y; - - font = gnome_font_find_closest ("Sans Bold", 18); - - text = _("Tasks"); - w = gnome_font_get_width_utf8 (font, text); - - x = (page_width - w) / 2; - y = page_height - gnome_font_get_ascender (font); - - gnome_print_moveto (pc, x, y); - gnome_print_setfont (pc, font); - gnome_print_setrgbcolor (pc, 0, 0, 0); - gnome_print_show (pc, text); - - g_object_unref (font); -} - -static void print_tasks (ETasks *tasks, gboolean preview) { ECalendarTable *cal_table; - EPrintable *printable; ETable *etable; - GnomePrintContext *pc; - GnomePrintJob *gpm; - double l, r, t, b, page_width, page_height, left_margin, bottom_margin; - - if (!print_config) - print_config = gnome_print_config_default (); cal_table = e_tasks_get_calendar_table (tasks); etable = e_calendar_table_get_table (E_CALENDAR_TABLE (cal_table)); - printable = e_table_get_printable (etable); - g_object_ref (printable); - gtk_object_sink (GTK_OBJECT (printable)); - e_printable_reset (printable); - - gpm = gnome_print_job_new (print_config); - pc = gnome_print_job_get_context (gpm); - - gnome_print_config_get_page_size (print_config, &r, &t); - -#if 0 - gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_TOP, &temp_d); - t -= temp_d; - gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_RIGHT, &temp_d); - r -= temp_d; - gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_BOTTOM, &b); - gnome_print_config_get_double (print_config, GNOME_PRINT_KEY_PAGE_MARGIN_LEFT, &l); -#endif - b = t * FIXED_MARGIN; - l = r * FIXED_MARGIN; - t *= (1.0 - FIXED_MARGIN); - r *= (1.0 - FIXED_MARGIN); - - page_width = r - l; - page_height = t - b; - left_margin = l; - bottom_margin = b; - - while (e_printable_data_left (printable)) { - gnome_print_beginpage (pc, "Tasks"); - gnome_print_gsave (pc); - - gnome_print_translate (pc, left_margin, bottom_margin); - - print_title (pc, page_width, page_height); - - e_printable_print_page (printable, pc, - page_width, page_height - 24, TRUE); - - gnome_print_grestore (pc); - gnome_print_showpage (pc); - } - - gnome_print_job_close (gpm); - - if (preview) { - GtkWidget *gpmp; - gpmp = gnome_print_job_preview_new (gpm, _("Print Preview")); - gtk_widget_show (gpmp); - } else { - gnome_print_job_print (gpm); - } - - g_object_unref (gpm); - g_object_unref (printable); + print_table (etable, _("Tasks"), preview); } - /* File/Print callback */ static void tasks_control_print_cmd (BonoboUIComponent *uic, @@ -600,6 +515,8 @@ tasks_control_print_cmd (BonoboUIComponent *uic, GtkWidget *gpd; gboolean preview = FALSE; GnomePrintJob *gpm; + ECalendarTable *cal_table; + ETable *etable; tasks = E_TASKS (data); @@ -628,7 +545,11 @@ tasks_control_print_cmd (BonoboUIComponent *uic, return; } + cal_table = e_tasks_get_calendar_table (tasks); + etable = e_calendar_table_get_table (E_CALENDAR_TABLE (cal_table)); + gtk_widget_destroy (gpd); + print_tasks (tasks, preview); } |