1 /* 2 * Copyright © 2004 Noah Levitt 3 * Copyright © 2007 Christian Persch 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 3 of the License, or (at your 8 * option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 18 */ 19 20 #include <gtk/gtk.h> 21 22 #define I_(string) g_intern_static_string (string) 23 24 /* The last unicode character we support */ 25 #define UNICHAR_MAX (0x0010FFFFUL) 26 27 G_GNUC_INTERNAL void _gucharmap_intl_ensure_initialized (void); 28 29 G_GNUC_INTERNAL gboolean _gucharmap_unicode_has_nameslist_entry (gunichar uc); 30 31 #define _GUCHARMAP_CHAPTERS_MODEL_COLUMN_LABEL_ATTRS (2) 32 33 struct _GucharmapChaptersModelPrivate { 34 GucharmapCodepointList *book_list; 35 int sort_column; 36 }; 37 38 struct _GucharmapChartablePrivate { 39 /* scrollable implementation */ 40 GtkAdjustment *vadjustment; 41 gulong vadjustment_changed_handler_id; 42 /* GtkScrollable impl */ 43 GtkAdjustment *hadjustment; /* unused */ 44 guint hscroll_policy : 1; /* unused */ 45 guint vscroll_policy : 1; 46 47 /* Font */ 48 PangoFontDescription *font_desc; 49 50 /* Geometry */ 51 int minimal_column_width; /* depends on font_desc and size allocation */ 52 int minimal_row_height; /* depends on font_desc and size allocation */ 53 int n_padded_columns; /* columns 0..n-1 will be 1px wider than minimal_column_width */ 54 int n_padded_rows; /* rows 0..n-1 will be 1px taller than minimal_row_height */ 55 int rows; 56 int cols; 57 int page_size; /* rows * cols */ 58 59 int page_first_cell; /* the cell index of the top left corner */ 60 int active_cell; /* the active cell index */ 61 62 /* Drawing */ 63 PangoLayout *pango_layout; 64 65 /* Zoom popup */ 66 GtkWidget *zoom_window; 67 int zoom_image_width; 68 int zoom_image_height; 69 70 /* for dragging (#114534) */ 71 gdouble click_x, click_y; 72 73 GtkTargetList *target_list; 74 75 GucharmapCodepointList *codepoint_list; 76 int last_cell; /* from gucharmap_codepoint_list_get_last_index */ 77 gboolean codepoint_list_changed; 78 79 /* Settings */ 80 guint snap_pow2_enabled : 1; 81 guint zoom_mode_enabled : 1; 82 guint font_fallback : 1; 83 }; 84 85 gint _gucharmap_chartable_cell_column (GucharmapChartable *chartable, 86 guint cell); 87 gint _gucharmap_chartable_column_width (GucharmapChartable *chartable, 88 gint col); 89 gint _gucharmap_chartable_x_offset (GucharmapChartable *chartable, 90 gint col); 91 gint _gucharmap_chartable_row_height (GucharmapChartable *chartable, 92 gint row); 93 gint _gucharmap_chartable_y_offset (GucharmapChartable *chartable, 94 gint row); 95 void _gucharmap_chartable_redraw (GucharmapChartable *chartable, 96 gboolean move_zoom); 97