diff options
author | Laurent Napias <[email protected]> | 2019-06-29 10:43:23 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-07-01 17:07:40 +0200 |
commit | aa24676651f8bd3e8b434f72d5aac98e84c0867d (patch) | |
tree | 37693766ecb4733c6061dcc2ddc26954fab5ca01 | |
parent | 6741c5db1e5c48c01b25bb7900dc40d48552925d (diff) | |
download | atril-aa24676651f8bd3e8b434f72d5aac98e84c0867d.tar.bz2 atril-aa24676651f8bd3e8b434f72d5aac98e84c0867d.tar.xz |
Remove trailing whitespaces
165 files changed, 2351 insertions, 2351 deletions
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c index 4d4d2939..ae37d23a 100644 --- a/backend/comics/comics-document.c +++ b/backend/comics/comics-document.c @@ -73,7 +73,7 @@ struct _ComicsDocument #define OFFSET_ZIP 2 #define NO_OFFSET 0 -/* For perfomance reasons of 7z* we've choosen to decompress on the temporary +/* For perfomance reasons of 7z* we've choosen to decompress on the temporary * directory instead of decompressing on the stdout */ /** @@ -138,7 +138,7 @@ EV_BACKEND_REGISTER_WITH_CODE (ComicsDocument, comics_document, * @unquoted_string: a literal string * * Quotes a string so unzip will not interpret the regex expressions of - * @unquoted_string. Basically, this functions uses [] to disable regex + * @unquoted_string. Basically, this functions uses [] to disable regex * expressions. The return value must be freed with * g_free() * * Return value: quoted and disabled-regex string @@ -188,22 +188,22 @@ comics_regex_quote (const gchar *unquoted_string) /* This function manages the command for decompressing a comic book */ -static gboolean +static gboolean comics_decompress_temp_dir (const gchar *command_decompress_tmp, - const gchar *command, + const gchar *command, GError **error) { gboolean success; gchar *std_out, *basename; GError *err = NULL; gint retval; - - success = g_spawn_command_line_sync (command_decompress_tmp, &std_out, + + success = g_spawn_command_line_sync (command_decompress_tmp, &std_out, NULL, &retval, &err); basename = g_path_get_basename (command); if (!success) { g_set_error (error, - EV_DOCUMENT_ERROR, + EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, _("Error launching the command ā%sā in order to " "decompress the comic book: %s"), @@ -237,16 +237,16 @@ comics_decompress_temp_dir (const gchar *command_decompress_tmp, } /* This function shows how to use the choosen command for decompressing a - * comic book file. It modifies fields of the ComicsDocument struct with + * comic book file. It modifies fields of the ComicsDocument struct with * this information */ -static gboolean -comics_generate_command_lines (ComicsDocument *comics_document, +static gboolean +comics_generate_command_lines (ComicsDocument *comics_document, GError **error) { gchar *quoted_file, *quoted_file_aux; gchar *quoted_command; ComicBookDecompressType type; - + type = comics_document->command_usage; comics_document->regex_arg = command_usage_def[type].regex_arg; quoted_command = g_shell_quote (comics_document->selected_command); @@ -276,7 +276,7 @@ comics_generate_command_lines (ComicsDocument *comics_document, /* unrar-free can't create directories, but ev_mkdtemp already created the dir */ comics_document->decompress_tmp = - g_strdup_printf (command_usage_def[type].decompress_tmp, + g_strdup_printf (command_usage_def[type].decompress_tmp, quoted_command, quoted_file, comics_document->dir); g_free (quoted_file); @@ -295,10 +295,10 @@ comics_generate_command_lines (ComicsDocument *comics_document, } -/* This function chooses an external command for decompressing a comic +/* This function chooses an external command for decompressing a comic * book based on its mime tipe. */ -static gboolean -comics_check_decompress_command (gchar *mime_type, +static gboolean +comics_check_decompress_command (gchar *mime_type, ComicsDocument *comics_document, GError **error) { @@ -306,38 +306,38 @@ comics_check_decompress_command (gchar *mime_type, gchar *std_out, *std_err; gint retval; GError *err = NULL; - + /* FIXME, use proper cbr/cbz mime types once they're * included in shared-mime-info */ - + if (g_content_type_is_a (mime_type, "application/x-cbr") || g_content_type_is_a (mime_type, "application/x-rar")) { - /* The RARLAB provides a no-charge proprietary (freeware) - * decompress-only client for Linux called unrar. Another - * option is a GPLv2-licensed command-line tool developed by - * the Gna! project. Confusingly enough, the free software RAR - * decoder is also named unrar. For this reason we need to add - * some lines for disambiguation. Sorry for the added the + /* The RARLAB provides a no-charge proprietary (freeware) + * decompress-only client for Linux called unrar. Another + * option is a GPLv2-licensed command-line tool developed by + * the Gna! project. Confusingly enough, the free software RAR + * decoder is also named unrar. For this reason we need to add + * some lines for disambiguation. Sorry for the added the * complexity but it's life :) - * Finally, some distributions, like Debian, rename this free - * option as unrar-free. + * Finally, some distributions, like Debian, rename this free + * option as unrar-free. * */ - comics_document->selected_command = + comics_document->selected_command = g_find_program_in_path ("unrar"); if (comics_document->selected_command) { - /* We only use std_err to avoid printing useless error + /* We only use std_err to avoid printing useless error * messages on the terminal */ - success = + success = g_spawn_command_line_sync ( - comics_document->selected_command, + comics_document->selected_command, &std_out, &std_err, &retval, &err); if (!success) { g_propagate_error (error, err); g_error_free (err); return FALSE; - /* I don't check retval status because RARLAB unrar - * doesn't have a way to return 0 without involving an + /* I don't check retval status because RARLAB unrar + * doesn't have a way to return 0 without involving an * operation with a file*/ } else if (WIFEXITED (retval)) { if (g_strrstr (std_out,"freeware") != NULL) @@ -353,7 +353,7 @@ comics_check_decompress_command (gchar *mime_type, } } /* The Gna! free software client with Debian naming convention */ - comics_document->selected_command = + comics_document->selected_command = g_find_program_in_path ("unrar-free"); if (comics_document->selected_command) { comics_document->command_usage = GNAUNRAR; @@ -375,7 +375,7 @@ comics_check_decompress_command (gchar *mime_type, } else if (g_content_type_is_a (mime_type, "application/x-cbz") || g_content_type_is_a (mime_type, "application/zip")) { /* InfoZIP's unzip program */ - comics_document->selected_command = + comics_document->selected_command = g_find_program_in_path ("unzip"); comics_document->alternative_command = g_find_program_in_path ("zipnote"); @@ -399,8 +399,8 @@ comics_check_decompress_command (gchar *mime_type, } else if (g_content_type_is_a (mime_type, "application/x-cb7") || g_content_type_is_a (mime_type, "application/x-7z-compressed")) { - /* 7zr, 7za and 7z are the commands from the p7zip project able - * to decompress .7z files */ + /* 7zr, 7za and 7z are the commands from the p7zip project able + * to decompress .7z files */ comics_document->selected_command = g_find_program_in_path ("7zr"); if (comics_document->selected_command) { @@ -496,7 +496,7 @@ sort_page_names (gconstpointer a, else if (!sort_last_1 && sort_last_2) { compare = -1; - } + } else { key_1 = g_utf8_collate_key_for_filename (name_1, -1); @@ -542,9 +542,9 @@ comics_document_load (EvDocument *document, return FALSE; } - - if (!comics_check_decompress_command (mime_type, comics_document, - error)) { + + if (!comics_check_decompress_command (mime_type, comics_document, + error)) { g_free (mime_type); return FALSE; } else if (!comics_generate_command_lines (comics_document, error)) { @@ -586,10 +586,10 @@ comics_document_load (EvDocument *document, supported_extensions = get_supported_image_extensions (); for (i = 0; cb_files[i] != NULL; i++) { if (comics_document->offset != NO_OFFSET) { - if (g_utf8_strlen (cb_files[i],-1) > + if (g_utf8_strlen (cb_files[i],-1) > comics_document->offset) { - cb_file = - g_utf8_offset_to_pointer (cb_files[i], + cb_file = + g_utf8_offset_to_pointer (cb_files[i], comics_document->offset); } else { continue; @@ -665,11 +665,11 @@ comics_document_get_page_size (EvDocument *document, GdkPixbuf *pixbuf; gchar *filename; ComicsDocument *comics_document = COMICS_DOCUMENT (document); - + if (!comics_document->decompress_tmp) { argv = extract_argv (document, page->index); success = g_spawn_async_with_pipes (NULL, argv, NULL, - G_SPAWN_SEARCH_PATH | + G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, &child_pid, @@ -684,7 +684,7 @@ comics_document_get_page_size (EvDocument *document, while (outpipe >= 0) { bytes = read (outpipe, buf, 1024); - + if (bytes > 0) gdk_pixbuf_loader_write (loader, buf, bytes, NULL); if (bytes <= 0 || got_size) { @@ -741,11 +741,11 @@ comics_document_render_pixbuf (EvDocument *document, gint width, height; gchar *filename; ComicsDocument *comics_document = COMICS_DOCUMENT (document); - + if (!comics_document->decompress_tmp) { argv = extract_argv (document, rc->page->index); success = g_spawn_async_with_pipes (NULL, argv, NULL, - G_SPAWN_SEARCH_PATH | + G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, &child_pid, @@ -755,14 +755,14 @@ comics_document_render_pixbuf (EvDocument *document, loader = gdk_pixbuf_loader_new (); g_signal_connect (loader, "size-prepared", - G_CALLBACK (render_pixbuf_size_prepared_cb), + G_CALLBACK (render_pixbuf_size_prepared_cb), &rc->scale); while (outpipe >= 0) { bytes = read (outpipe, buf, 4096); if (bytes > 0) { - gdk_pixbuf_loader_write (loader, buf, bytes, + gdk_pixbuf_loader_write (loader, buf, bytes, NULL); } else if (bytes <= 0) { close (outpipe); @@ -777,13 +777,13 @@ comics_document_render_pixbuf (EvDocument *document, g_spawn_close_pid (child_pid); g_object_unref (loader); } else { - filename = + filename = g_build_filename (comics_document->dir, (char *) comics_document->page_names->pdata[rc->page->index], NULL); - + gdk_pixbuf_get_file_info (filename, &width, &height); - + tmp_pixbuf = gdk_pixbuf_new_from_file_at_size ( filename, width * (rc->scale) + 0.5, @@ -807,7 +807,7 @@ comics_document_render (EvDocument *document, pixbuf = comics_document_render_pixbuf (document, rc); surface = ev_document_misc_surface_from_pixbuf (pixbuf); g_object_unref (pixbuf); - + return surface; } @@ -825,24 +825,24 @@ render_pixbuf_size_prepared_cb (GdkPixbufLoader *loader, } /** - * comics_remove_dir: Removes a directory recursively. + * comics_remove_dir: Removes a directory recursively. * Returns: * 0 if it was successfully deleted, - * -1 if an error occurred + * -1 if an error occurred */ -static int -comics_remove_dir (gchar *path_name) +static int +comics_remove_dir (gchar *path_name) { GDir *content_dir; const gchar *filename; gchar *filename_with_path; - + if (g_file_test (path_name, G_FILE_TEST_IS_DIR)) { content_dir = g_dir_open (path_name, 0, NULL); filename = g_dir_read_name (content_dir); while (filename) { - filename_with_path = - g_build_filename (path_name, + filename_with_path = + g_build_filename (path_name, filename, NULL); comics_remove_dir (filename_with_path); g_free (filename_with_path); @@ -850,8 +850,8 @@ comics_remove_dir (gchar *path_name) } g_dir_close (content_dir); } - /* Note from g_remove() documentation: on Windows, it is in general not - * possible to remove a file that is open to some process, or mapped + /* Note from g_remove() documentation: on Windows, it is in general not + * possible to remove a file that is open to some process, or mapped * into memory.*/ return (g_remove (path_name)); } @@ -860,14 +860,14 @@ static void comics_document_finalize (GObject *object) { ComicsDocument *comics_document = COMICS_DOCUMENT (object); - + if (comics_document->decompress_tmp) { if (comics_remove_dir (comics_document->dir) == -1) g_warning (_("There was an error deleting ā%sā."), comics_document->dir); g_free (comics_document->dir); } - + if (comics_document->page_names) { g_ptr_array_foreach (comics_document->page_names, (GFunc) g_free, NULL); g_ptr_array_free (comics_document->page_names, TRUE); @@ -940,7 +940,7 @@ comics_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, if (border) { GdkPixbuf *tmp_pixbuf = thumbnail; - + thumbnail = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf); g_object_unref (tmp_pixbuf); } @@ -955,7 +955,7 @@ comics_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, gint *height) { gdouble page_width, page_height; - + comics_document_get_page_size (EV_DOCUMENT (document), rc->page, &page_width, &page_height); diff --git a/backend/comics/comics-document.h b/backend/comics/comics-document.h index 6cc55f00..f6a4b440 100644 --- a/backend/comics/comics-document.h +++ b/backend/comics/comics-document.h @@ -32,7 +32,7 @@ typedef struct _ComicsDocument ComicsDocument; GType comics_document_get_type (void) G_GNUC_CONST; G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); - + G_END_DECLS #endif /* __COMICS_DOCUMENT_H__ */ diff --git a/backend/djvu/djvu-document-private.h b/backend/djvu/djvu-document-private.h index 2ec9b67a..92bc0f6d 100644 --- a/backend/djvu/djvu-document-private.h +++ b/backend/djvu/djvu-document-private.h @@ -1,6 +1,6 @@ -/* +/* * Declarations used throughout the djvu classes - * + * * Copyright (C) 2006, Michael Hofmann <[email protected]> * * This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - + #ifndef __DJVU_DOCUMENT_INTERNAL_H__ #define __DJVU_DOCUMENT_INTERNAL_H__ @@ -41,7 +41,7 @@ struct _DjvuDocument { }; int djvu_document_get_n_pages (EvDocument *document); -void djvu_handle_events (DjvuDocument *djvu_document, +void djvu_handle_events (DjvuDocument *djvu_document, int wait, GError **error); diff --git a/backend/djvu/djvu-document.c b/backend/djvu/djvu-document.c index 65f7f0f4..b3e41a8d 100644 --- a/backend/djvu/djvu-document.c +++ b/backend/djvu/djvu-document.c @@ -75,7 +75,7 @@ ev_djvu_error_quark (void) static GQuark q = 0; if (q == 0) q = g_quark_from_string ("ev-djvu-quark"); - + return q; } @@ -85,7 +85,7 @@ handle_message (const ddjvu_message_t *msg, GError **error) switch (msg->m_any.tag) { case DDJVU_ERROR: { gchar *error_str; - + if (msg->m_error.filename) { error_str = g_strdup_printf ("DjvuLibre error: %s:%d", msg->m_error.filename, @@ -94,16 +94,16 @@ handle_message (const ddjvu_message_t *msg, GError **error) error_str = g_strdup_printf ("DjvuLibre error: %s", msg->m_error.message); } - + if (error) { g_set_error_literal (error, EV_DJVU_ERROR, 0, error_str); } else { g_warning ("%s", error_str); } - + g_free (error_str); return; - } + } break; default: break; @@ -115,7 +115,7 @@ djvu_handle_events (DjvuDocument *djvu_document, int wait, GError **error) { ddjvu_context_t *ctx = djvu_document->d_context; const ddjvu_message_t *msg; - + if (!ctx) return; @@ -162,7 +162,7 @@ djvu_document_load (EvDocument *document, filename = g_filename_from_uri (uri, NULL, error); if (!filename) return FALSE; - + doc = ddjvu_document_create_by_filename (djvu_document->d_context, filename, TRUE); if (!doc) { @@ -205,10 +205,10 @@ djvu_document_load (EvDocument *document, g_free (filename); ddjvu_document_release (djvu_document->d_document); djvu_document->d_document = NULL; - + return FALSE; } - + g_free (djvu_document->uri); djvu_document->uri = g_strdup (uri); @@ -223,7 +223,7 @@ djvu_document_load (EvDocument *document, for (i = 0; i < n_files; i++) { struct ddjvu_fileinfo_s fileinfo; gchar *file; - + ddjvu_document_get_fileinfo (djvu_document->d_document, i, &fileinfo); @@ -234,7 +234,7 @@ djvu_document_load (EvDocument *document, if (!g_file_test (file, G_FILE_TEST_EXISTS)) { missing_files = TRUE; g_free (file); - + break; } g_free (file); @@ -271,9 +271,9 @@ int djvu_document_get_n_pages (EvDocument *document) { DjvuDocument *djvu_document = DJVU_DOCUMENT (document); - + g_return_val_if_fail (djvu_document->d_document, 0); - + return ddjvu_document_get_pagenum (djvu_document->d_document); } @@ -285,14 +285,14 @@ document_get_page_size (DjvuDocument *djvu_document, { ddjvu_pageinfo_t info; ddjvu_status_t r; - + while ((r = ddjvu_document_get_pageinfo(djvu_document->d_document, page, &info)) < DDJVU_JOB_OK) djvu_handle_events(djvu_document, TRUE, NULL); - + if (r >= DDJVU_JOB_FAILED) djvu_handle_events(djvu_document, TRUE, NULL); - *width = info.width * SCALE_FACTOR; + *width = info.width * SCALE_FACTOR; *height = info.height * SCALE_FACTOR; } @@ -311,7 +311,7 @@ djvu_document_get_page_size (EvDocument *document, } static cairo_surface_t * -djvu_document_render (EvDocument *document, +djvu_document_render (EvDocument *document, EvRenderContext *rc) { DjvuDocument *djvu_document = DJVU_DOCUMENT (document); @@ -325,31 +325,31 @@ djvu_document_render (EvDocument *document, double page_width, page_height, tmp; d_page = ddjvu_page_create_by_pageno (djvu_document->d_document, rc->page->index); - + while (!ddjvu_page_decoding_done (d_page)) djvu_handle_events(djvu_document, TRUE, NULL); page_width = ddjvu_page_get_width (d_page) * rc->scale * SCALE_FACTOR + 0.5; page_height = ddjvu_page_get_height (d_page) * rc->scale * SCALE_FACTOR + 0.5; - + switch (rc->rotation) { case 90: rotation = DDJVU_ROTATE_90; tmp = page_height; page_height = page_width; page_width = tmp; - + break; case 180: rotation = DDJVU_ROTATE_180; - + break; case 270: rotation = DDJVU_ROTATE_270; tmp = page_height; page_height = page_width; page_width = tmp; - + break; default: rotation = DDJVU_ROTATE_0; @@ -367,7 +367,7 @@ djvu_document_render (EvDocument *document, rrect = prect; ddjvu_page_set_rotation (d_page, rotation); - + ddjvu_page_render (d_page, DDJVU_RENDER_COLOR, &prect, &rrect, @@ -387,18 +387,18 @@ djvu_document_finalize (GObject *object) if (djvu_document->d_document) ddjvu_document_release (djvu_document->d_document); - + if (djvu_document->opts) g_string_free (djvu_document->opts, TRUE); if (djvu_document->ps_filename) g_free (djvu_document->ps_filename); - + ddjvu_context_release (djvu_document->d_context); ddjvu_format_release (djvu_document->d_format); ddjvu_format_release (djvu_document->thumbs_format); g_free (djvu_document->uri); - + G_OBJECT_CLASS (djvu_document_parent_class)->finalize (object); } @@ -432,7 +432,7 @@ djvu_text_copy (DjvuDocument *djvu_document, if (page_text != miniexp_nil) { DjvuTextPage *page = djvu_text_page_new (page_text); - + text = djvu_text_page_copy (page, rectangle); djvu_text_page_free (page); ddjvu_miniexp_release (djvu_document->d_document, page_text); @@ -451,19 +451,19 @@ djvu_selection_get_selected_text (EvSelection *selection, double width, height; EvRectangle rectangle; gchar *text; - + djvu_document_get_page_size (EV_DOCUMENT (djvu_document), page, &width, &height); rectangle.x1 = points->x1 / SCALE_FACTOR; rectangle.y1 = (height - points->y2) / SCALE_FACTOR; rectangle.x2 = points->x2 / SCALE_FACTOR; rectangle.y2 = (height - points->y1) / SCALE_FACTOR; - + text = djvu_text_copy (djvu_document, page->index, &rectangle); - + if (text == NULL) text = g_strdup (""); - + return text; } @@ -475,13 +475,13 @@ djvu_selection_iface_init (EvSelectionInterface *iface) static void djvu_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gint *width, gint *height) { - DjvuDocument *djvu_document = DJVU_DOCUMENT (document); + DjvuDocument *djvu_document = DJVU_DOCUMENT (document); gdouble page_width, page_height; - + djvu_document_get_page_size (EV_DOCUMENT(djvu_document), rc->page, &page_width, &page_height); @@ -504,12 +504,12 @@ djvu_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, gdouble page_width, page_height; gint thumb_width, thumb_height; guchar *pixels; - + g_return_val_if_fail (djvu_document->d_document, NULL); djvu_document_get_page_size (EV_DOCUMENT(djvu_document), rc->page, &page_width, &page_height); - + thumb_width = (gint) (page_width * rc->scale); thumb_height = (gint) (page_height * rc->scale); @@ -517,14 +517,14 @@ djvu_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, thumb_width, thumb_height); gdk_pixbuf_fill (pixbuf, 0xffffffff); pixels = gdk_pixbuf_get_pixels (pixbuf); - + while (ddjvu_thumbnail_status (djvu_document->d_document, rc->page->index, 1) < DDJVU_JOB_OK) djvu_handle_events(djvu_document, TRUE, NULL); - - ddjvu_thumbnail_render (djvu_document->d_document, rc->page->index, + + ddjvu_thumbnail_render (djvu_document->d_document, rc->page->index, &thumb_width, &thumb_height, djvu_document->thumbs_format, - gdk_pixbuf_get_rowstride (pixbuf), + gdk_pixbuf_get_rowstride (pixbuf), (gchar *)pixels); rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation); @@ -532,11 +532,11 @@ djvu_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, if (border) { GdkPixbuf *tmp_pixbuf = rotated_pixbuf; - + rotated_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf); g_object_unref (tmp_pixbuf); } - + return rotated_pixbuf; } @@ -553,9 +553,9 @@ djvu_document_file_exporter_begin (EvFileExporter *exporter, EvFileExporterContext *fc) { DjvuDocument *djvu_document = DJVU_DOCUMENT (exporter); - + if (djvu_document->ps_filename) - g_free (djvu_document->ps_filename); + g_free (djvu_document->ps_filename); djvu_document->ps_filename = g_strdup (fc->filename); g_string_assign (djvu_document->opts, "-page="); @@ -566,14 +566,14 @@ djvu_document_file_exporter_do_page (EvFileExporter *exporter, EvRenderContext *rc) { DjvuDocument *djvu_document = DJVU_DOCUMENT (exporter); - - g_string_append_printf (djvu_document->opts, "%d,", (rc->page->index) + 1); + + g_string_append_printf (djvu_document->opts, "%d,", (rc->page->index) + 1); } static void djvu_document_file_exporter_end (EvFileExporter *exporter) { - int d_optc = 1; + int d_optc = 1; const char *d_optv[d_optc]; DjvuDocument *djvu_document = DJVU_DOCUMENT (exporter); @@ -583,15 +583,15 @@ djvu_document_file_exporter_end (EvFileExporter *exporter) g_warning ("Cannot open file ā%sā.", djvu_document->ps_filename); return; } - - d_optv[0] = djvu_document->opts->str; + + d_optv[0] = djvu_document->opts->str; ddjvu_job_t * job = ddjvu_document_print(djvu_document->d_document, fn, d_optc, d_optv); - while (!ddjvu_job_done(job)) { + while (!ddjvu_job_done(job)) { djvu_handle_events (djvu_document, TRUE, NULL); } - fclose(fn); + fclose(fn); } static EvFileExporterCapabilities @@ -617,7 +617,7 @@ static void djvu_document_init (DjvuDocument *djvu_document) { guint masks[4] = { 0xff0000, 0xff00, 0xff, 0xff000000 }; - + djvu_document->d_context = ddjvu_context_create ("Atril"); djvu_document->d_format = ddjvu_format_create (DDJVU_FORMAT_RGBMASK32, 4, masks); ddjvu_format_set_row_order (djvu_document->d_format, 1); @@ -627,7 +627,7 @@ djvu_document_init (DjvuDocument *djvu_document) djvu_document->ps_filename = NULL; djvu_document->opts = g_string_new (""); - + djvu_document->d_document = NULL; } @@ -651,7 +651,7 @@ djvu_document_find_find_text (EvDocumentFind *document, if (page_text != miniexp_nil) { DjvuTextPage *tpage = djvu_text_page_new (page_text); - + djvu_text_page_prepare_search (tpage, case_sensitive); if (tpage->links->len > 0) { djvu_text_page_search (tpage, text, case_sensitive); @@ -675,7 +675,7 @@ djvu_document_find_find_text (EvDocumentFind *document, r->y1 = height - r->y2 * SCALE_FACTOR; r->y2 = height - tmp * SCALE_FACTOR; } - + return matches; } diff --git a/backend/djvu/djvu-document.h b/backend/djvu/djvu-document.h index 76ec8765..72f01ba5 100644 --- a/backend/djvu/djvu-document.h +++ b/backend/djvu/djvu-document.h @@ -32,7 +32,7 @@ typedef struct _DjvuDocument DjvuDocument; GType djvu_document_get_type (void) G_GNUC_CONST; G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); - + G_END_DECLS #endif /* __DJVU_DOCUMENT_H__ */ diff --git a/backend/djvu/djvu-links.c b/backend/djvu/djvu-links.c index 5999ebcd..da871dac 100644 --- a/backend/djvu/djvu-links.c +++ b/backend/djvu/djvu-links.c @@ -176,12 +176,12 @@ build_tree (const DjvuDocument *djvu_document, iter = miniexp_cdr (iter); } else if ( miniexp_length (iter) >= 2 ) { gchar *utf8_title = NULL; - + /* An entry */ if (!string_from_miniexp (miniexp_car (iter), &title)) goto unknown_entry; if (!string_from_miniexp (miniexp_cadr (iter), &link_dest)) goto unknown_entry; - + if (!g_utf8_validate (title, -1, NULL)) { utf8_title = str_to_utf8 (title); title_markup = g_markup_escape_text (utf8_title, -1); @@ -190,7 +190,7 @@ build_tree (const DjvuDocument *djvu_document, } ev_action = get_djvu_link_action (djvu_document, link_dest, -1); - + if (g_str_has_suffix (link_dest, ".djvu")) { /* FIXME: component file identifiers */ } else if (ev_action) { @@ -236,7 +236,7 @@ get_djvu_hyperlink_area (ddjvu_pageinfo_t *page_info, miniexp_t iter; iter = sexp; - + if ((miniexp_car (iter) == miniexp_symbol ("rect") || miniexp_car (iter) == miniexp_symbol ("oval")) && miniexp_length (iter) == 5) { /* FIXME: get bounding box for (oval) since Atril doesn't support shaped links */ @@ -257,7 +257,7 @@ get_djvu_hyperlink_area (ddjvu_pageinfo_t *page_info, ev_link_mapping->area.y2 = (page_info->height - miny); } else if (miniexp_car (iter) == miniexp_symbol ("poly") && miniexp_length (iter) >= 5 && miniexp_length (iter) % 2 == 1) { - + /* FIXME: get bounding box since Atril doesn't support shaped links */ int minx = G_MAXINT, miny = G_MAXINT; int maxx = G_MININT, maxy = G_MININT; @@ -287,7 +287,7 @@ get_djvu_hyperlink_area (ddjvu_pageinfo_t *page_info, } return TRUE; - + unknown_link: g_warning("DjvuLibre error: Unknown hyperlink area %s", miniexp_to_name(miniexp_car(sexp))); return FALSE; @@ -333,7 +333,7 @@ get_djvu_hyperlink_mapping (DjvuDocument *djvu_document, if (!ev_action) goto unknown_mapping; ev_link_mapping->data = ev_link_new (comment, ev_action); - + return ev_link_mapping; unknown_mapping: @@ -356,7 +356,7 @@ djvu_links_has_document_links (EvDocumentLinks *document_links) ddjvu_miniexp_release (djvu_document->d_document, outline); return TRUE; } - + return FALSE; } @@ -395,7 +395,7 @@ djvu_links_get_links (EvDocumentLinks *document_links, } ddjvu_miniexp_release (djvu_document->d_document, page_annotations); } - + return ev_mapping_list_new (page, retval, (GDestroyNotify)g_object_unref); } @@ -405,13 +405,13 @@ djvu_links_find_link_dest (EvDocumentLinks *document_links, { DjvuDocument *djvu_document = DJVU_DOCUMENT (document_links); EvLinkDest *ev_dest = NULL; - + ev_dest = get_djvu_link_dest (djvu_document, link_name, -1); if (!ev_dest) { g_warning ("DjvuLibre error: unknown link destination %s", link_name); } - + return ev_dest; } @@ -451,6 +451,6 @@ djvu_links_get_links_model (EvDocumentLinks *document_links) ddjvu_miniexp_release (djvu_document->d_document, outline); } - + return model; } diff --git a/backend/djvu/djvu-links.h b/backend/djvu/djvu-links.h index 6cacdd36..151db677 100644 --- a/backend/djvu/djvu-links.h +++ b/backend/djvu/djvu-links.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2006 Pauli Virtanen <[email protected]> * * This program is free software; you can redistribute it and/or modify diff --git a/backend/djvu/djvu-text-page.c b/backend/djvu/djvu-text-page.c index d74a3983..90bce25e 100644 --- a/backend/djvu/djvu-text-page.c +++ b/backend/djvu/djvu-text-page.c @@ -29,13 +29,13 @@ * @page: #DjvuTextPage instance * @p: s-expression to append * @delimit: character/word/... delimiter - * + * * Appends the string in @p to the page text. - * + * * Returns: whether the end was not reached in this s-expression */ static gboolean -djvu_text_page_selection_process (DjvuTextPage *page, +djvu_text_page_selection_process (DjvuTextPage *page, miniexp_t p, int delimit) { @@ -43,7 +43,7 @@ djvu_text_page_selection_process (DjvuTextPage *page, char *token_text = (char *) miniexp_to_str (miniexp_nth (5, p)); if (page->text) { char *new_text = - g_strjoin (delimit & 2 ? "\n" : + g_strjoin (delimit & 2 ? "\n" : delimit & 1 ? " " : NULL, page->text, token_text, NULL); @@ -51,7 +51,7 @@ djvu_text_page_selection_process (DjvuTextPage *page, page->text = new_text; } else page->text = g_strdup (token_text); - if (p == page->end) + if (p == page->end) return FALSE; } return TRUE; @@ -62,24 +62,24 @@ djvu_text_page_selection_process (DjvuTextPage *page, * @page: #DjvuTextPage instance * @p: tree to append * @delimit: character/word/... delimiter - * + * * Walks the tree in @p and appends the text with - * djvu_text_page_selection_process() for all s-expressions + * djvu_text_page_selection_process() for all s-expressions * between the start and end fields. - * + * * Returns: whether the end was not reached in this subtree */ static gboolean -djvu_text_page_selection (DjvuTextPage *page, +djvu_text_page_selection (DjvuTextPage *page, miniexp_t p, int delimit) { g_return_val_if_fail (miniexp_consp (p) && miniexp_symbolp (miniexp_car (p)), FALSE); - if (miniexp_car (p) != page->char_symbol) + if (miniexp_car (p) != page->char_symbol) delimit |= miniexp_car (p) == page->word_symbol ? 1 : 2; - + miniexp_t deeper = miniexp_cddr (miniexp_cdddr (p)); while (deeper != miniexp_nil) { miniexp_t str = miniexp_car (deeper); @@ -100,11 +100,11 @@ djvu_text_page_selection (DjvuTextPage *page, static void djvu_text_page_limits_process (DjvuTextPage *page, - miniexp_t p, + miniexp_t p, EvRectangle *rect) { EvRectangle current; - + current.x1 = miniexp_to_int (miniexp_nth (1, p)); current.y1 = miniexp_to_int (miniexp_nth (2, p)); current.x2 = miniexp_to_int (miniexp_nth (3, p)); @@ -120,10 +120,10 @@ djvu_text_page_limits_process (DjvuTextPage *page, static void djvu_text_page_limits (DjvuTextPage *page, - miniexp_t p, + miniexp_t p, EvRectangle *rect) { - g_return_if_fail (miniexp_consp (p) && + g_return_if_fail (miniexp_consp (p) && miniexp_symbolp (miniexp_car (p))); miniexp_t deeper = miniexp_cddr (miniexp_cdddr (p)); @@ -139,20 +139,20 @@ djvu_text_page_limits (DjvuTextPage *page, } char * -djvu_text_page_copy (DjvuTextPage *page, +djvu_text_page_copy (DjvuTextPage *page, EvRectangle *rectangle) { char* text; - + page->start = miniexp_nil; page->end = miniexp_nil; djvu_text_page_limits (page, page->text_structure, rectangle); djvu_text_page_selection (page, page->text_structure, 0); - - /* Do not free the string */ + + /* Do not free the string */ text = page->text; page->text = NULL; - + return text; } @@ -160,14 +160,14 @@ djvu_text_page_copy (DjvuTextPage *page, * djvu_text_page_position: * @page: #DjvuTextPage instance * @position: index in the page text - * - * Returns the closest s-expression that contains the given position in + * + * Returns the closest s-expression that contains the given position in * the page text. - * + * * Returns: closest s-expression */ static miniexp_t -djvu_text_page_position (DjvuTextPage *page, +djvu_text_page_position (DjvuTextPage *page, int position) { GArray *links = page->links; @@ -197,12 +197,12 @@ djvu_text_page_position (DjvuTextPage *page, * djvu_text_page_union: * @target: first rectangle and result * @source: second rectangle - * - * Calculates the bounding box of two rectangles and stores the reuslt + * + * Calculates the bounding box of two rectangles and stores the reuslt * in the first. */ static void -djvu_text_page_union (EvRectangle *target, +djvu_text_page_union (EvRectangle *target, EvRectangle *source) { if (source->x1 < target->x1) @@ -221,15 +221,15 @@ djvu_text_page_union (EvRectangle *target, * @p: s-expression to append * @start: first s-expression in the selection * @end: last s-expression in the selection - * + * * Appends the rectangle defined by @p to the internal bounding box rectangle. - * + * * Returns: whether the end was not reached in this s-expression */ static gboolean -djvu_text_page_sexpr_process (DjvuTextPage *page, +djvu_text_page_sexpr_process (DjvuTextPage *page, miniexp_t p, - miniexp_t start, + miniexp_t start, miniexp_t end) { if (page->bounding_box || p == start) { @@ -256,16 +256,16 @@ djvu_text_page_sexpr_process (DjvuTextPage *page, * @p: tree to append * @start: first s-expression in the selection * @end: last s-expression in the selection - * - * Walks the tree in @p and extends the rectangle with + * + * Walks the tree in @p and extends the rectangle with * djvu_text_page_process() for all s-expressions between @start and @end. - * + * * Returns: whether the end was not reached in this subtree */ static gboolean -djvu_text_page_sexpr (DjvuTextPage *page, +djvu_text_page_sexpr (DjvuTextPage *page, miniexp_t p, - miniexp_t start, + miniexp_t start, miniexp_t end) { g_return_val_if_fail (miniexp_consp (p) && miniexp_symbolp @@ -293,12 +293,12 @@ djvu_text_page_sexpr (DjvuTextPage *page, * @page: #DjvuTextPage instance * @start: first s-expression in the selection * @end: last s-expression in the selection - * + * * Builds a rectangle that contains all s-expressions in the given range. */ static EvRectangle * djvu_text_page_box (DjvuTextPage *page, - miniexp_t start, + miniexp_t start, miniexp_t end) { page->bounding_box = NULL; @@ -312,22 +312,22 @@ djvu_text_page_box (DjvuTextPage *page, * @p: tree to append * @case_sensitive: do not ignore case * @delimit: insert spaces because of higher (sentence/paragraph/...) break - * - * Appends the tree in @p to the internal text string. + * + * Appends the tree in @p to the internal text string. */ static void djvu_text_page_append_text (DjvuTextPage *page, - miniexp_t p, - gboolean case_sensitive, + miniexp_t p, + gboolean case_sensitive, gboolean delimit) { char *token_text; - - g_return_if_fail (miniexp_consp (p) && + + g_return_if_fail (miniexp_consp (p) && miniexp_symbolp (miniexp_car (p))); delimit |= page->char_symbol != miniexp_car (p); - + miniexp_t deeper = miniexp_cddr (miniexp_cdddr (p)); while (deeper != miniexp_nil) { miniexp_t data = miniexp_car (deeper); @@ -354,7 +354,7 @@ djvu_text_page_append_text (DjvuTextPage *page, if (!case_sensitive) g_free (token_text); } else - djvu_text_page_append_text (page, data, + djvu_text_page_append_text (page, data, case_sensitive, delimit); delimit = FALSE; deeper = miniexp_cdr (deeper); @@ -366,12 +366,12 @@ djvu_text_page_append_text (DjvuTextPage *page, * @page: #DjvuTextPage instance * @text: text to search * @case_sensitive: do not ignore case - * - * Searches the page for the given text. The results list has to be + * + * Searches the page for the given text. The results list has to be * externally freed afterwards. */ -void -djvu_text_page_search (DjvuTextPage *page, +void +djvu_text_page_search (DjvuTextPage *page, const char *text, gboolean case_sensitive) { @@ -409,23 +409,23 @@ djvu_text_page_search (DjvuTextPage *page, * djvu_text_page_prepare_search: * @page: #DjvuTextPage instance * @case_sensitive: do not ignore case - * + * * Indexes the page text and prepares the page for subsequent searches. */ void djvu_text_page_prepare_search (DjvuTextPage *page, gboolean case_sensitive) { - djvu_text_page_append_text (page, page->text_structure, - case_sensitive, FALSE); + djvu_text_page_append_text (page, page->text_structure, + case_sensitive, FALSE); } /** * djvu_text_page_new: * @text: S-expression of the page text - * - * Creates a new page to search. - * + * + * Creates a new page to search. + * * Returns: new #DjvuTextPage instance */ DjvuTextPage * @@ -444,10 +444,10 @@ djvu_text_page_new (miniexp_t text) /** * djvu_text_page_free: * @page: #DjvuTextPage instance - * + * * Frees the given #DjvuTextPage instance. */ -void +void djvu_text_page_free (DjvuTextPage *page) { g_free (page->text); diff --git a/backend/djvu/djvu-text-page.h b/backend/djvu/djvu-text-page.h index 5ee85a3e..a25284f5 100644 --- a/backend/djvu/djvu-text-page.h +++ b/backend/djvu/djvu-text-page.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2006 Michael Hofmann <[email protected]> * * This program is free software; you can redistribute it and/or modify @@ -46,11 +46,11 @@ struct _DjvuTextLink { miniexp_t pair; }; -char * djvu_text_page_copy (DjvuTextPage *page, +char * djvu_text_page_copy (DjvuTextPage *page, EvRectangle *rectangle); void djvu_text_page_prepare_search (DjvuTextPage *page, gboolean case_sensitive); -void djvu_text_page_search (DjvuTextPage *page, +void djvu_text_page_search (DjvuTextPage *page, const char *text, gboolean case_sensitive); DjvuTextPage* djvu_text_page_new (miniexp_t text); diff --git a/backend/dvi/cairo-device.c b/backend/dvi/cairo-device.c index 9f4badb2..7a639bde 100644 --- a/backend/dvi/cairo-device.c +++ b/backend/dvi/cairo-device.c @@ -33,7 +33,7 @@ typedef struct { gint ymargin; gdouble scale; - + Ulong fg; Ulong bg; @@ -102,7 +102,7 @@ dvi_cairo_draw_rule (DviContext *dvi, cairo_device = (DviCairoDevice *) dvi->device.device_data; color = cairo_device->fg; - + cairo_save (cairo_device->cr); cairo_set_line_width (cairo_device->cr, @@ -158,7 +158,7 @@ dvi_cairo_draw_ps (DviContext *dvi, spectre_render_context_set_scale (rc, (double)width / w, (double)height / h); - spectre_document_render_full (psdoc, rc, &data, &row_length); + spectre_document_render_full (psdoc, rc, &data, &row_length); status = spectre_document_status (psdoc); spectre_render_context_free (rc); @@ -168,7 +168,7 @@ dvi_cairo_draw_ps (DviContext *dvi, g_warning ("Error rendering PS document %s: %s\n", filename, spectre_status_to_string (status)); free (data); - + return; } @@ -182,7 +182,7 @@ dvi_cairo_draw_ps (DviContext *dvi, cairo_translate (cairo_device->cr, x + cairo_device->xmargin, y + cairo_device->ymargin); - cairo_set_source_surface (cairo_device->cr, image, 0, 0); + cairo_set_source_surface (cairo_device->cr, image, 0, 0); cairo_paint (cairo_device->cr); cairo_restore (cairo_device->cr); @@ -215,7 +215,7 @@ dvi_cairo_alloc_colors (void *device_data, frac = (gamma > 0) ? pow ((double)i / n, 1 / gamma) : 1 - pow ((double)(n - i) / n, -gamma); - + color.red = frac * color_fg.red; color.green = frac * color_fg.green; color.blue = frac * color_fg.blue; diff --git a/backend/dvi/dvi-document.c b/backend/dvi/dvi-document.c index 6051b7b1..1a84fe72 100644 --- a/backend/dvi/dvi-document.c +++ b/backend/dvi/dvi-document.c @@ -54,11 +54,11 @@ struct _DviDocument DviContext *context; DviPageSpec *spec; DviParams *params; - + /* To let document scale we should remember width and height */ double base_width; double base_height; - + gchar *uri; /* PDF exporter */ @@ -87,11 +87,11 @@ dvi_document_load (EvDocument *document, { gchar *filename; DviDocument *dvi_document = DVI_DOCUMENT(document); - + filename = g_filename_from_uri (uri, NULL, error); if (!filename) return FALSE; - + g_mutex_lock (&dvi_context_mutex); if (dvi_document->context) mdvi_destroy_context (dvi_document->context); @@ -99,7 +99,7 @@ dvi_document_load (EvDocument *document, dvi_document->context = mdvi_init_context(dvi_document->params, dvi_document->spec, filename); g_mutex_unlock (&dvi_context_mutex); g_free (filename); - + if (!dvi_document->context) { g_set_error_literal (error, EV_DOCUMENT_ERROR, @@ -107,19 +107,19 @@ dvi_document_load (EvDocument *document, _("DVI document has incorrect format")); return FALSE; } - + mdvi_cairo_device_init (&dvi_document->context->device); - - - dvi_document->base_width = dvi_document->context->dvi_page_w * dvi_document->context->params.conv + + + dvi_document->base_width = dvi_document->context->dvi_page_w * dvi_document->context->params.conv + 2 * unit2pix(dvi_document->params->dpi, MDVI_HMARGIN) / dvi_document->params->hshrink; - - dvi_document->base_height = dvi_document->context->dvi_page_h * dvi_document->context->params.vconv + + dvi_document->base_height = dvi_document->context->dvi_page_h * dvi_document->context->params.vconv + 2 * unit2pix(dvi_document->params->vdpi, MDVI_VMARGIN) / dvi_document->params->vshrink; - + g_free (dvi_document->uri); dvi_document->uri = g_strdup (uri); - + return TRUE; } @@ -138,7 +138,7 @@ static int dvi_document_get_n_pages (EvDocument *document) { DviDocument *dvi_document = DVI_DOCUMENT (document); - + return dvi_document->context->npages; } @@ -148,7 +148,7 @@ dvi_document_get_page_size (EvDocument *document, double *width, double *height) { - DviDocument *dvi_document = DVI_DOCUMENT (document); + DviDocument *dvi_document = DVI_DOCUMENT (document); *width = dvi_document->base_width; *height = dvi_document->base_height;; @@ -165,15 +165,15 @@ dvi_document_render (EvDocument *document, gint proposed_width, proposed_height; gint xmargin = 0, ymargin = 0; - /* We should protect our context since it's not - * thread safe. The work to the future - + /* We should protect our context since it's not + * thread safe. The work to the future - * let context render page independently */ g_mutex_lock (&dvi_context_mutex); - + mdvi_setpage (dvi_document->context, rc->page->index); - - mdvi_set_shrink (dvi_document->context, + + mdvi_set_shrink (dvi_document->context, (int)((dvi_document->params->hshrink - 1) / rc->scale) + 1, (int)((dvi_document->params->vshrink - 1) / rc->scale) + 1); @@ -181,12 +181,12 @@ dvi_document_render (EvDocument *document, required_height = dvi_document->base_height * rc->scale + 0.5; proposed_width = dvi_document->context->dvi_page_w * dvi_document->context->params.conv; proposed_height = dvi_document->context->dvi_page_h * dvi_document->context->params.vconv; - + if (required_width >= proposed_width) xmargin = (required_width - proposed_width) / 2; if (required_height >= proposed_height) ymargin = (required_height - proposed_height) / 2; - + mdvi_cairo_device_set_margins (&dvi_document->context->device, xmargin, ymargin); mdvi_cairo_device_set_scale (&dvi_document->context->device, rc->scale); mdvi_cairo_device_render (dvi_document->context); @@ -196,18 +196,18 @@ dvi_document_render (EvDocument *document, rotated_surface = ev_document_misc_surface_rotate_and_scale (surface, required_width, - required_height, + required_height, rc->rotation); cairo_surface_destroy (surface); - + return rotated_surface; } static void dvi_document_finalize (GObject *object) -{ +{ DviDocument *dvi_document = DVI_DOCUMENT(object); - + g_mutex_lock (&dvi_context_mutex); if (dvi_document->context) { mdvi_cairo_device_free (&dvi_document->context->device); @@ -220,12 +220,12 @@ dvi_document_finalize (GObject *object) if (dvi_document->exporter_filename) g_free (dvi_document->exporter_filename); - + if (dvi_document->exporter_opts) g_string_free (dvi_document->exporter_opts, TRUE); g_free (dvi_document->uri); - + G_OBJECT_CLASS (dvi_document_parent_class)->finalize (object); } @@ -258,10 +258,10 @@ dvi_document_class_init (DviDocumentClass *klass) static void dvi_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gint *width, gint *height) -{ +{ DviDocument *dvi_document = DVI_DOCUMENT (document); gdouble page_width = dvi_document->base_width; gdouble page_height = dvi_document->base_height; @@ -277,7 +277,7 @@ dvi_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, static GdkPixbuf * dvi_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gboolean border) { DviDocument *dvi_document = DVI_DOCUMENT (document); @@ -291,24 +291,24 @@ dvi_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, thumb_height = (gint) (dvi_document->base_height * rc->scale); g_mutex_lock (&dvi_context_mutex); - + mdvi_setpage (dvi_document->context, rc->page->index); - mdvi_set_shrink (dvi_document->context, + mdvi_set_shrink (dvi_document->context, (int)dvi_document->base_width * dvi_document->params->hshrink / thumb_width, (int)dvi_document->base_height * dvi_document->params->vshrink / thumb_height); proposed_width = dvi_document->context->dvi_page_w * dvi_document->context->params.conv; proposed_height = dvi_document->context->dvi_page_h * dvi_document->context->params.vconv; - + if (border) { - mdvi_cairo_device_set_margins (&dvi_document->context->device, + mdvi_cairo_device_set_margins (&dvi_document->context->device, MAX (thumb_width - proposed_width, 0) / 2, - MAX (thumb_height - proposed_height, 0) / 2); + MAX (thumb_height - proposed_height, 0) / 2); } else { - mdvi_cairo_device_set_margins (&dvi_document->context->device, + mdvi_cairo_device_set_margins (&dvi_document->context->device, MAX (thumb_width - proposed_width - 2, 0) / 2, - MAX (thumb_height - proposed_height - 2, 0) / 2); + MAX (thumb_height - proposed_height - 2, 0) / 2); } mdvi_cairo_device_set_scale (&dvi_document->context->device, rc->scale); @@ -345,11 +345,11 @@ dvi_document_file_exporter_begin (EvFileExporter *exporter, EvFileExporterContext *fc) { DviDocument *dvi_document = DVI_DOCUMENT(exporter); - + if (dvi_document->exporter_filename) - g_free (dvi_document->exporter_filename); + g_free (dvi_document->exporter_filename); dvi_document->exporter_filename = g_strdup (fc->filename); - + if (dvi_document->exporter_opts) { g_string_free (dvi_document->exporter_opts, TRUE); } @@ -372,16 +372,16 @@ dvi_document_file_exporter_end (EvFileExporter *exporter) gint exit_stat; GError *err = NULL; gboolean success; - + DviDocument *dvi_document = DVI_DOCUMENT(exporter); gchar* quoted_filename = g_shell_quote (dvi_document->context->filename); - + command_line = g_strdup_printf ("dvipdfm %s -o %s %s", /* dvipdfm -s 1,2,.., -o exporter_filename dvi_filename */ dvi_document->exporter_opts->str, dvi_document->exporter_filename, quoted_filename); g_free (quoted_filename); - + success = g_spawn_command_line_sync (command_line, NULL, NULL, @@ -469,7 +469,7 @@ hsb2rgb (float h, float s, float v, guchar *red, guchar *green, guchar *blue) *red = (guchar)floor(r * 255.0); *green = (guchar)floor(g * 255.0); *blue = (guchar)floor(b * 255.0); - + return TRUE; } @@ -498,7 +498,7 @@ dvi_document_do_color_special (DviContext *dvi, const char *prefix, const char * } else if (strncmp (arg, "push", 4) == 0) { /* Find color source: Named, CMYK or RGB */ const char *tmp = arg + 4; - + while (isspace (*tmp)) tmp++; if (!strncmp ("rgb", tmp, 3)) { @@ -506,7 +506,7 @@ dvi_document_do_color_special (DviContext *dvi, const char *prefix, const char * guchar red, green, blue; parse_color (tmp + 4, rgb, 3); - + red = 255 * rgb[0]; green = 255 * rgb[1]; blue = 255 * rgb[2]; @@ -517,14 +517,14 @@ dvi_document_do_color_special (DviContext *dvi, const char *prefix, const char * guchar red, green, blue; parse_color (tmp + 4, hsb, 3); - + if (hsb2rgb (hsb[0], hsb[1], hsb[2], &red, &green, &blue)) mdvi_push_color (dvi, RGB2ULONG (red, green, blue), 0xFFFFFFFF); } else if (!strncmp ("cmyk", tmp, 4)) { gdouble cmyk[4]; double r, g, b; guchar red, green, blue; - + parse_color (tmp + 5, cmyk, 4); r = 1.0 - cmyk[0] - cmyk[3]; @@ -540,7 +540,7 @@ dvi_document_do_color_special (DviContext *dvi, const char *prefix, const char * red = r * 255 + 0.5; green = g * 255 + 0.5; blue = b * 255 + 0.5; - + mdvi_push_color (dvi, RGB2ULONG (red, green, blue), 0xFFFFFFFF); } else if (!strncmp ("gray ", tmp, 5)) { gdouble gray; @@ -553,7 +553,7 @@ dvi_document_do_color_special (DviContext *dvi, const char *prefix, const char * mdvi_push_color (dvi, RGB2ULONG (rgb, rgb, rgb), 0xFFFFFFFF); } else { GdkColor color; - + if (gdk_color_parse (tmp, &color)) { guchar red, green, blue; @@ -569,8 +569,8 @@ dvi_document_do_color_special (DviContext *dvi, const char *prefix, const char * static void dvi_document_init_params (DviDocument *dvi_document) -{ - dvi_document->params = g_new0 (DviParams, 1); +{ + dvi_document->params = g_new0 (DviParams, 1); dvi_document->params->dpi = MDVI_DPI; dvi_document->params->vdpi = MDVI_VDPI; @@ -585,7 +585,7 @@ dvi_document_init_params (DviDocument *dvi_document) dvi_document->params->orientation = MDVI_ORIENT_TBLR; dvi_document->spec = NULL; - + dvi_document->params->bg = 0xffffffff; dvi_document->params->fg = 0xff000000; } diff --git a/backend/dvi/dvi-document.h b/backend/dvi/dvi-document.h index a84e892d..d39c39ea 100644 --- a/backend/dvi/dvi-document.h +++ b/backend/dvi/dvi-document.h @@ -32,7 +32,7 @@ typedef struct _DviDocument DviDocument; GType dvi_document_get_type (void) G_GNUC_CONST; G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); - + G_END_DECLS #endif /* __DVI_DOCUMENT_H__ */ diff --git a/backend/dvi/fonts.c b/backend/dvi/fonts.c index 99be63ce..7c15f8d7 100644 --- a/backend/dvi/fonts.c +++ b/backend/dvi/fonts.c @@ -44,7 +44,7 @@ static struct fontinfo { void mdvi_register_fonts (void) { struct fontinfo *type; - + if (!registered) { for(type = known_fonts; type->info; type++) { mdvi_register_font_type(type->info, type->klass); diff --git a/backend/dvi/mdvi-lib/afmparse.c b/backend/dvi/mdvi-lib/afmparse.c index f90e5575..f8d840b7 100644 --- a/backend/dvi/mdvi-lib/afmparse.c +++ b/backend/dvi/mdvi-lib/afmparse.c @@ -2,25 +2,25 @@ * (C) 1988, 1989, 1990 by Adobe Systems Incorporated. All rights reserved. * * This file may be freely copied and redistributed as long as: - * 1) This entire notice continues to be included in the file, + * 1) This entire notice continues to be included in the file, * 2) If the file has been modified in any way, a notice of such * modification is conspicuously indicated. * * PostScript, Display PostScript, and Adobe are registered trademarks of * Adobe Systems Incorporated. - * + * * ************************************************************************ * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS - * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR - * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY - * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, - * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, + * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR + * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY + * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, + * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. * ************************************************************************ */ -/* +/* * modified for MDVI: * - some names changed to avoid conflicts with T1lib * - changed to ANSI C prototypes, as used by MDVI @@ -28,13 +28,13 @@ */ /* parseAFM.c - * + * * This file is used in conjuction with the parseAFM.h header file. * This file contains several procedures that are used to parse AFM * files. It is intended to work with an application program that needs * font metric information. The program can be used as is by making a * procedure call to "parseFile" (passing in the expected parameters) - * and having it fill in a data structure with the data from the + * and having it fill in a data structure with the data from the * AFM file, or an application developer may wish to customize this * code. * @@ -70,7 +70,7 @@ #include <math.h> #include "afmparse.h" #undef VERSION - + #define lineterm EOL /* line terminating character */ #define normalEOF 1 /* return code from parsing routines used only */ /* in this module */ @@ -88,39 +88,39 @@ static char *ident = NULL; /* storage buffer for keywords */ -/* "shorts" for fast case statement +/* "shorts" for fast case statement * The values of each of these enumerated items correspond to an entry in the - * table of strings defined below. Therefore, if you add a new string as + * table of strings defined below. Therefore, if you add a new string as * new keyword into the keyStrings table, you must also add a corresponding * parseKey AND it MUST be in the same position! * * IMPORTANT: since the sorting algorithm is a binary search, the strings of - * keywords must be placed in lexicographical order, below. [Therefore, the - * enumerated items are not necessarily in lexicographical order, depending - * on the name chosen. BUT, they must be placed in the same position as the - * corresponding key string.] The NOPE shall remain in the last position, - * since it does not correspond to any key string, and it is used in the + * keywords must be placed in lexicographical order, below. [Therefore, the + * enumerated items are not necessarily in lexicographical order, depending + * on the name chosen. BUT, they must be placed in the same position as the + * corresponding key string.] The NOPE shall remain in the last position, + * since it does not correspond to any key string, and it is used in the * "recognize" procedure to calculate how many possible keys there are. */ enum parseKey { - ASCENDER, CHARBBOX, CODE, COMPCHAR, CAPHEIGHT, COMMENT, - DESCENDER, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES, - ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN, - FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISFIXEDPITCH, - ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, CHARNAME, - NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES, - STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS, - STARTTRACKKERN, TRACKKERN, UNDERLINEPOSITION, + ASCENDER, CHARBBOX, CODE, COMPCHAR, CAPHEIGHT, COMMENT, + DESCENDER, ENCODINGSCHEME, ENDCHARMETRICS, ENDCOMPOSITES, + ENDFONTMETRICS, ENDKERNDATA, ENDKERNPAIRS, ENDTRACKKERN, + FAMILYNAME, FONTBBOX, FONTNAME, FULLNAME, ISFIXEDPITCH, + ITALICANGLE, KERNPAIR, KERNPAIRXAMT, LIGATURE, CHARNAME, + NOTICE, COMPCHARPIECE, STARTCHARMETRICS, STARTCOMPOSITES, + STARTFONTMETRICS, STARTKERNDATA, STARTKERNPAIRS, + STARTTRACKKERN, TRACKKERN, UNDERLINEPOSITION, UNDERLINETHICKNESS, VERSION, XYWIDTH, XWIDTH, WEIGHT, XHEIGHT, NOPE } ; -/* keywords for the system: +/* keywords for the system: * This a table of all of the current strings that are vaild AFM keys. * Each entry can be referenced by the appropriate parseKey value (an - * enumerated data type defined above). If you add a new keyword here, + * enumerated data type defined above). If you add a new keyword here, * a corresponding parseKey MUST be added to the enumerated data type - * defined above, AND it MUST be added in the same position as the + * defined above, AND it MUST be added in the same position as the * string is in this table. * * IMPORTANT: since the sorting algorithm is a binary search, the keywords @@ -130,36 +130,36 @@ enum parseKey { static char *keyStrings[] = { "Ascender", "B", "C", "CC", "CapHeight", "Comment", - "Descender", "EncodingScheme", "EndCharMetrics", "EndComposites", - "EndFontMetrics", "EndKernData", "EndKernPairs", "EndTrackKern", - "FamilyName", "FontBBox", "FontName", "FullName", "IsFixedPitch", - "ItalicAngle", "KP", "KPX", "L", "N", - "Notice", "PCC", "StartCharMetrics", "StartComposites", - "StartFontMetrics", "StartKernData", "StartKernPairs", - "StartTrackKern", "TrackKern", "UnderlinePosition", + "Descender", "EncodingScheme", "EndCharMetrics", "EndComposites", + "EndFontMetrics", "EndKernData", "EndKernPairs", "EndTrackKern", + "FamilyName", "FontBBox", "FontName", "FullName", "IsFixedPitch", + "ItalicAngle", "KP", "KPX", "L", "N", + "Notice", "PCC", "StartCharMetrics", "StartComposites", + "StartFontMetrics", "StartKernData", "StartKernPairs", + "StartTrackKern", "TrackKern", "UnderlinePosition", "UnderlineThickness", "Version", "W", "WX", "Weight", "XHeight", NULL }; - -/*************************** PARSING ROUTINES **************/ - + +/*************************** PARSING ROUTINES **************/ + /*************************** token *************************/ /* A "AFM File Conventions" tokenizer. That means that it will * return the next token delimited by white space. See also - * the `linetoken' routine, which does a similar thing but + * the `linetoken' routine, which does a similar thing but * reads all tokens until the next end-of-line. */ - + static char *token(FILE *stream) { int ch, idx; /* skip over white space */ - while ((ch = fgetc(stream)) == ' ' || ch == lineterm || + while ((ch = fgetc(stream)) == ' ' || ch == lineterm || ch == ',' || ch == '\t' || ch == ';'); - + idx = 0; - while (ch != EOF && ch != ' ' && ch != lineterm + while (ch != EOF && ch != ' ' && ch != lineterm && ch != '\t' && ch != ':' && ch != ';' && idx < (MAX_NAME - 1)) { ident[idx++] = ch; @@ -170,7 +170,7 @@ static char *token(FILE *stream) if (idx >= 1 && ch != ':' ) ungetc(ch, stream); if (idx < 1 ) ident[idx++] = ch; /* single-character token */ ident[idx] = 0; - + return(ident); /* returns pointer to the token */ } /* token */ @@ -187,15 +187,15 @@ static char *linetoken(FILE *stream) { int ch, idx; - while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); - + while ((ch = fgetc(stream)) == ' ' || ch == '\t' ); + idx = 0; while (ch != EOF && ch != lineterm && idx < (MAX_NAME - 1)) { ident[idx++] = ch; ch = fgetc(stream); } /* while */ - + ungetc(ch, stream); ident[idx] = 0; @@ -207,7 +207,7 @@ static char *linetoken(FILE *stream) /*************************** recognize *************************/ /* This function tries to match a string to a known list of - * valid AFM entries (check the keyStrings array above). + * valid AFM entries (check the keyStrings array above). * "ident" contains everything from white space through the * next space, tab, or ":" character. * @@ -231,7 +231,7 @@ static enum parseKey recognize(char *ident) if (found) return (enum parseKey) midpoint; else return NOPE; - + } /* recognize */ @@ -240,32 +240,32 @@ static enum parseKey recognize(char *ident) /* This function is called by "parseFile". It will parse the AFM File * up to the "StartCharMetrics" keyword, which essentially marks the * end of the Global Font Information and the beginning of the character - * metrics information. + * metrics information. * * If the caller of "parseFile" specified that it wanted the Global * Font Information (as defined by the "AFM File Specification" - * document), then that information will be stored in the returned + * document), then that information will be stored in the returned * data structure. * - * Any Global Font Information entries that are not found in a + * Any Global Font Information entries that are not found in a * given file, will have the usual default initialization value * for its type (i.e. entries of type int will be 0, etc). * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by * parseFile to determine if there is more file to parse. */ - + static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi) -{ +{ BOOL cont = TRUE, save = (gfi != NULL); int error = ok; register char *keyword; - + while (cont) { keyword = token(fp); - + if (keyword == NULL) /* Have reached an early and unexpected EOF. */ /* Set flag and stop parsing */ @@ -273,15 +273,15 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi) error = earlyEOF; break; /* get out of loop */ } - if (!save) + if (!save) /* get tokens until the end of the Global Font info section */ /* without saving any of the data */ - switch (recognize(keyword)) - { + switch (recognize(keyword)) + { case STARTCHARMETRICS: cont = FALSE; break; - case ENDFONTMETRICS: + case ENDFONTMETRICS: cont = FALSE; error = normalEOF; break; @@ -308,20 +308,20 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi) break; case ENCODINGSCHEME: keyword = token(fp); - gfi->encodingScheme = (char *) + gfi->encodingScheme = (char *) malloc(strlen(keyword) + 1); strcpy(gfi->encodingScheme, keyword); - break; + break; case FULLNAME: keyword = linetoken(fp); gfi->fullName = (char *) malloc(strlen(keyword) + 1); strcpy(gfi->fullName, keyword); - break; - case FAMILYNAME: + break; + case FAMILYNAME: keyword = linetoken(fp); gfi->familyName = (char *) malloc(strlen(keyword) + 1); strcpy(gfi->familyName, keyword); - break; + break; case WEIGHT: keyword = token(fp); gfi->weight = (char *) malloc(strlen(keyword) + 1); @@ -336,13 +336,13 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi) keyword = token(fp); if (MATCH(keyword, False)) gfi->isFixedPitch = 0; - else + else gfi->isFixedPitch = 1; - break; + break; case UNDERLINEPOSITION: keyword = token(fp); gfi->underlinePosition = atoi(keyword); - break; + break; case UNDERLINETHICKNESS: keyword = token(fp); gfi->underlineThickness = atoi(keyword); @@ -351,12 +351,12 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi) keyword = token(fp); gfi->version = (char *) malloc(strlen(keyword) + 1); strcpy(gfi->version, keyword); - break; + break; case NOTICE: keyword = linetoken(fp); gfi->notice = (char *) malloc(strlen(keyword) + 1); strcpy(gfi->notice, keyword); - break; + break; case FONTBBOX: keyword = token(fp); gfi->fontBBox.llx = atoi(keyword); @@ -396,10 +396,10 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi) break; } /* switch */ } /* while */ - + return(error); - -} /* parseGlobals */ + +} /* parseGlobals */ @@ -409,26 +409,26 @@ static BOOL parseGlobals(FILE *fp, GlobalFontInfo *gfi) /* Unmapped character codes are (at Adobe Systems) assigned the * width of the space character (if one exists) else they get the * value of 250 ems. This function initializes all entries in the - * char widths array to have this value. Then any mapped character - * codes will be replaced with the width of the appropriate character + * char widths array to have this value. Then any mapped character + * codes will be replaced with the width of the appropriate character * when parsing the character metric section. - + * This function parses the Character Metrics Section looking * for a space character (by comparing character names). If found, * the width of the space character will be used to initialize the - * values in the array of character widths. + * values in the array of character widths. * * Before returning, the position of the read/write pointer of the * file is reset to be where it was upon entering this function. */ - + static int initializeArray(FILE *fp, int *cwi) -{ +{ BOOL cont = TRUE, found = FALSE; long opos = ftell(fp); int code = 0, width = 0, i = 0, error = 0; register char *keyword; - + while (cont) { keyword = token(fp); @@ -448,67 +448,67 @@ static int initializeArray(FILE *fp, int *cwi) case XWIDTH: width = atoi(token(fp)); break; - case CHARNAME: + case CHARNAME: keyword = token(fp); if (MATCH(keyword, Space)) - { + { cont = FALSE; found = TRUE; - } - break; + } + break; case ENDCHARMETRICS: cont = FALSE; - break; + break; case ENDFONTMETRICS: cont = FALSE; error = normalEOF; break; case NOPE: - default: + default: error = parseError; break; } /* switch */ } /* while */ - + if (!found) width = 250; - + for (i = 0; i < 256; ++i) cwi[i] = width; - + fseek(fp, opos, 0); - + return(error); - -} /* initializeArray */ + +} /* initializeArray */ #endif /* unused */ /************************* parseCharWidths **************************/ /* This function is called by "parseFile". It will parse the AFM File - * up to the "EndCharMetrics" keyword. It will save the character + * up to the "EndCharMetrics" keyword. It will save the character * width info (as opposed to all of the character metric information) * if requested by the caller of parseFile. Otherwise, it will just * parse through the section without saving any information. * - * If data is to be saved, parseCharWidths is passed in a pointer + * If data is to be saved, parseCharWidths is passed in a pointer * to an array of widths that has already been initialized by the * standard value for unmapped character codes. This function parses * the Character Metrics section only storing the width information * for the encoded characters into the array using the character code * as the index into that array. * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by * parseFile to determine if there is more file to parse. */ - + static int parseCharWidths(FILE *fp, int *cwi) -{ +{ BOOL cont = TRUE, save = (cwi != NULL); int pos = 0, error = ok; register char *keyword; - + while (cont) { keyword = token(fp); @@ -519,19 +519,19 @@ static int parseCharWidths(FILE *fp, int *cwi) error = earlyEOF; break; /* get out of loop */ } - if (!save) + if (!save) /* get tokens until the end of the Char Metrics section without */ /* saving any of the data*/ - switch (recognize(keyword)) - { + switch (recognize(keyword)) + { case ENDCHARMETRICS: cont = FALSE; - break; + break; case ENDFONTMETRICS: cont = FALSE; error = normalEOF; break; - default: + default: break; } /* switch */ else @@ -558,15 +558,15 @@ static int parseCharWidths(FILE *fp, int *cwi) break; case ENDCHARMETRICS: cont = FALSE; - break; + break; case ENDFONTMETRICS: cont = FALSE; error = normalEOF; break; case CHARNAME: /* eat values (so doesn't cause parseError) */ - keyword = token(fp); + keyword = token(fp); break; - case CHARBBOX: + case CHARBBOX: keyword = token(fp); keyword = token(fp); keyword = token(fp); keyword = token(fp); break; @@ -574,15 +574,15 @@ static int parseCharWidths(FILE *fp, int *cwi) keyword = token(fp); keyword = token(fp); break; case NOPE: - default: + default: error = parseError; break; } /* switch */ } /* while */ - + return(error); - -} /* parseCharWidths */ + +} /* parseCharWidths */ /************************* parseCharMetrics ************************/ @@ -594,21 +594,21 @@ static int parseCharWidths(FILE *fp, int *cwi) * parseCharMetrics is passed in a pointer to an array of records * to hold information on a per character basis. This function * parses the Character Metrics section storing all character - * metric information for the ALL characters (mapped and unmapped) + * metric information for the ALL characters (mapped and unmapped) * into the array. * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by * parseFile to determine if there is more file to parse. */ - + static int parseCharMetrics(FILE *fp, FontInfo *fi) -{ +{ BOOL cont = TRUE, firstTime = TRUE; int error = ok, count = 0; register CharMetricInfo *temp = fi->cmi; register char *keyword; - + while (cont) { keyword = token(fp); @@ -621,10 +621,10 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi) { case COMMENT: keyword = linetoken(fp); - break; + break; case CODE: if (count < fi->numOfChars) - { + { if (firstTime) firstTime = FALSE; else temp++; temp->code = atoi(token(fp)); @@ -639,16 +639,16 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi) case XYWIDTH: temp->wx = atoi(token(fp)); temp->wy = atoi(token(fp)); - break; - case XWIDTH: + break; + case XWIDTH: temp->wx = atoi(token(fp)); break; - case CHARNAME: + case CHARNAME: keyword = token(fp); temp->name = (char *) malloc(strlen(keyword) + 1); strcpy(temp->name, keyword); - break; - case CHARBBOX: + break; + case CHARBBOX: temp->charBBox.llx = atoi(token(fp)); temp->charBBox.lly = atoi(token(fp)); temp->charBBox.urx = atoi(token(fp)); @@ -657,14 +657,14 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi) case LIGATURE: { Ligature **tail = &(temp->ligs); Ligature *node = *tail; - + if (*tail != NULL) { while (node->next != NULL) node = node->next; - tail = &(node->next); + tail = &(node->next); } - + *tail = (Ligature *) calloc(1, sizeof(Ligature)); keyword = token(fp); (*tail)->succ = (char *) malloc(strlen(keyword) + 1); @@ -675,52 +675,52 @@ static int parseCharMetrics(FILE *fp, FontInfo *fi) break; } case ENDCHARMETRICS: cont = FALSE;; - break; - case ENDFONTMETRICS: + break; + case ENDFONTMETRICS: cont = FALSE; error = normalEOF; - break; + break; case NOPE: default: - error = parseError; - break; + error = parseError; + break; } /* switch */ } /* while */ - + if ((error == ok) && (count != fi->numOfChars)) error = parseError; - + return(error); - -} /* parseCharMetrics */ + +} /* parseCharMetrics */ /************************* parseTrackKernData ***********************/ -/* This function is called by "parseFile". It will parse the AFM File +/* This function is called by "parseFile". It will parse the AFM File * up to the "EndTrackKern" or "EndKernData" keywords. It will save the * track kerning data if requested by the caller of parseFile. * * parseTrackKernData is passed in a pointer to the FontInfo record. - * If data is to be saved, the FontInfo record will already contain + * If data is to be saved, the FontInfo record will already contain * a valid pointer to storage for the track kerning data. * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by * parseFile to determine if there is more file to parse. */ - + static int parseTrackKernData(FILE *fp, FontInfo *fi) -{ +{ BOOL cont = TRUE, save = (fi->tkd != NULL); int pos = 0, error = ok, tcount = 0; register char *keyword; - + while (cont) { keyword = token(fp); - + if (keyword == NULL) { error = earlyEOF; @@ -789,40 +789,40 @@ static int parseTrackKernData(FILE *fp, FontInfo *fi) break; } /* switch */ } /* while */ - + if (error == ok && tcount != fi->numOfTracks) error = parseError; - + return(error); - -} /* parseTrackKernData */ + +} /* parseTrackKernData */ /************************* parsePairKernData ************************/ -/* This function is called by "parseFile". It will parse the AFM File +/* This function is called by "parseFile". It will parse the AFM File * up to the "EndKernPairs" or "EndKernData" keywords. It will save * the pair kerning data if requested by the caller of parseFile. * * parsePairKernData is passed in a pointer to the FontInfo record. - * If data is to be saved, the FontInfo record will already contain + * If data is to be saved, the FontInfo record will already contain * a valid pointer to storage for the pair kerning data. * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by * parseFile to determine if there is more file to parse. */ - + static int parsePairKernData(FILE *fp, FontInfo *fi) -{ +{ BOOL cont = TRUE, save = (fi->pkd != NULL); int pos = 0, error = ok, pcount = 0; register char *keyword; - + while (cont) { keyword = token(fp); - + if (keyword == NULL) { error = earlyEOF; @@ -856,11 +856,11 @@ static int parsePairKernData(FILE *fp, FontInfo *fi) if (pcount < fi->numOfPairs) { keyword = token(fp); - fi->pkd[pos].name1 = (char *) + fi->pkd[pos].name1 = (char *) malloc(strlen(keyword) + 1); strcpy(fi->pkd[pos].name1, keyword); keyword = token(fp); - fi->pkd[pos].name2 = (char *) + fi->pkd[pos].name2 = (char *) malloc(strlen(keyword) + 1); strcpy(fi->pkd[pos].name2, keyword); keyword = token(fp); @@ -879,11 +879,11 @@ static int parsePairKernData(FILE *fp, FontInfo *fi) if (pcount < fi->numOfPairs) { keyword = token(fp); - fi->pkd[pos].name1 = (char *) + fi->pkd[pos].name1 = (char *) malloc(strlen(keyword) + 1); strcpy(fi->pkd[pos].name1, keyword); keyword = token(fp); - fi->pkd[pos].name2 = (char *) + fi->pkd[pos].name2 = (char *) malloc(strlen(keyword) + 1); strcpy(fi->pkd[pos].name2, keyword); keyword = token(fp); @@ -910,39 +910,39 @@ static int parsePairKernData(FILE *fp, FontInfo *fi) break; } /* switch */ } /* while */ - + if (error == ok && pcount != fi->numOfPairs) error = parseError; - + return(error); - -} /* parsePairKernData */ + +} /* parsePairKernData */ /************************* parseCompCharData **************************/ -/* This function is called by "parseFile". It will parse the AFM File - * up to the "EndComposites" keyword. It will save the composite +/* This function is called by "parseFile". It will parse the AFM File + * up to the "EndComposites" keyword. It will save the composite * character data if requested by the caller of parseFile. * - * parseCompCharData is passed in a pointer to the FontInfo record, and + * parseCompCharData is passed in a pointer to the FontInfo record, and * a boolean representing if the data should be saved. * * This function will create the appropriate amount of storage for * the composite character data and store a pointer to the storage * in the FontInfo record. * - * This function returns an error code specifying whether there was - * a premature EOF or a parsing error. This return value is used by + * This function returns an error code specifying whether there was + * a premature EOF or a parsing error. This return value is used by * parseFile to determine if there is more file to parse. */ - + static int parseCompCharData(FILE *fp, FontInfo *fi) -{ +{ BOOL cont = TRUE, firstTime = TRUE, save = (fi->ccd != NULL); int pos = 0, j = 0, error = ok, ccount = 0, pcount = 0; register char *keyword; - + while (cont) { keyword = token(fp); @@ -990,7 +990,7 @@ static int parseCompCharData(FILE *fp, FontInfo *fi) pcount = 0; if (firstTime) firstTime = FALSE; else pos++; - fi->ccd[pos].ccName = (char *) + fi->ccd[pos].ccName = (char *) malloc(strlen(keyword) + 1); strcpy(fi->ccd[pos].ccName, keyword); keyword = token(fp); @@ -1010,7 +1010,7 @@ static int parseCompCharData(FILE *fp, FontInfo *fi) if (pcount < fi->ccd[pos].numOfPieces) { keyword = token(fp); - fi->ccd[pos].pieces[j].pccName = (char *) + fi->ccd[pos].pieces[j].pccName = (char *) malloc(strlen(keyword) + 1); strcpy(fi->ccd[pos].pieces[j].pccName, keyword); keyword = token(fp); @@ -1035,23 +1035,23 @@ static int parseCompCharData(FILE *fp, FontInfo *fi) break; } /* switch */ } /* while */ - + if (error == ok && ccount != fi->numOfComps) error = parseError; - + return(error); - -} /* parseCompCharData */ + +} /* parseCompCharData */ -/*************************** 'PUBLIC' FUNCTION ********************/ +/*************************** 'PUBLIC' FUNCTION ********************/ /*************************** parseFile *****************************/ -/* parseFile is the only 'public' procedure available. It is called +/* parseFile is the only 'public' procedure available. It is called * from an application wishing to get information from an AFM file. * The caller of this function is responsible for locating and opening * an AFM file and handling all errors associated with that task. @@ -1061,43 +1061,43 @@ static int parseCompCharData(FILE *fp, FontInfo *fi) * the data requested filled in), and a mask specifying which * data from the AFM File should be saved in the FontInfo structure. * - * The file will be parsed and the requested data will be stored in + * The file will be parsed and the requested data will be stored in * a record of type FontInfo (refer to ParseAFM.h). * - * parseFile returns an error code as defined in parseAFM.h. + * parseFile returns an error code as defined in parseAFM.h. * - * The position of the read/write pointer associated with the file + * The position of the read/write pointer associated with the file * pointer upon return of this function is undefined. */ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags) { - + int code = ok; /* return code from each of the parsing routines */ int error = ok; /* used as the return code from this function */ - - register char *keyword; /* used to store a token */ - - - /* storage data for the global variable ident */ - ident = (char *) calloc(MAX_NAME, sizeof(char)); - if (ident == NULL) {error = storageProblem; return(error);} - + + register char *keyword; /* used to store a token */ + + + /* storage data for the global variable ident */ + ident = (char *) calloc(MAX_NAME, sizeof(char)); + if (ident == NULL) {error = storageProblem; return(error);} + (*fi) = (FontInfo *) calloc(1, sizeof(FontInfo)); - if ((*fi) == NULL) {error = storageProblem; return(error);} - - if (flags & P_G) + if ((*fi) == NULL) {error = storageProblem; return(error);} + + if (flags & P_G) { (*fi)->gfi = (GlobalFontInfo *) calloc(1, sizeof(GlobalFontInfo)); - if ((*fi)->gfi == NULL) {error = storageProblem; return(error);} + if ((*fi)->gfi == NULL) {error = storageProblem; return(error);} } - + /* The AFM File begins with Global Font Information. This section */ - /* will be parsed whether or not information should be saved. */ - code = parseGlobals(fp, (*fi)->gfi); - + /* will be parsed whether or not information should be saved. */ + code = parseGlobals(fp, (*fi)->gfi); + if (code < 0) error = code; - + /* The Global Font Information is followed by the Character Metrics */ /* section. Which procedure is used to parse this section depends on */ /* how much information should be saved. If all of the metrics info */ @@ -1105,25 +1105,25 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags) /* is wanted, parseCharWidths is called. parseCharWidths will also */ /* be called in the case that no character data is to be saved, just */ /* to parse through the section. */ - + if ((code != normalEOF) && (code != earlyEOF)) { (*fi)->numOfChars = atoi(token(fp)); if (flags & (P_M ^ P_W)) { - (*fi)->cmi = (CharMetricInfo *) + (*fi)->cmi = (CharMetricInfo *) calloc((*fi)->numOfChars, sizeof(CharMetricInfo)); if ((*fi)->cmi == NULL) {error = storageProblem; return(error);} - code = parseCharMetrics(fp, *fi); + code = parseCharMetrics(fp, *fi); } else { if (flags & P_W) - { - (*fi)->cwi = (int *) calloc(256, sizeof(int)); - if ((*fi)->cwi == NULL) + { + (*fi)->cwi = (int *) calloc(256, sizeof(int)); + if ((*fi)->cwi == NULL) { - error = storageProblem; + error = storageProblem; return(error); } } @@ -1131,15 +1131,15 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags) code = parseCharWidths(fp, (*fi)->cwi); } /* else */ } /* if */ - + if ((error != earlyEOF) && (code < 0)) error = code; - + /* The remaining sections of the AFM are optional. This code will */ /* look at the next keyword in the file to determine what section */ /* is next, and then allocate the appropriate amount of storage */ /* for the data (if the data is to be saved) and call the */ /* appropriate parsing routine to parse the section. */ - + while ((code != normalEOF) && (code != earlyEOF)) { keyword = token(fp); @@ -1161,11 +1161,11 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags) if (flags & P_T) { (*fi)->numOfTracks = atoi(keyword); - (*fi)->tkd = (TrackKernData *) + (*fi)->tkd = (TrackKernData *) calloc((*fi)->numOfTracks, sizeof(TrackKernData)); - if ((*fi)->tkd == NULL) + if ((*fi)->tkd == NULL) { - error = storageProblem; + error = storageProblem; return(error); } } /* if */ @@ -1176,11 +1176,11 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags) if (flags & P_P) { (*fi)->numOfPairs = atoi(keyword); - (*fi)->pkd = (PairKernData *) + (*fi)->pkd = (PairKernData *) calloc((*fi)->numOfPairs, sizeof(PairKernData)); - if ((*fi)->pkd == NULL) + if ((*fi)->pkd == NULL) { - error = storageProblem; + error = storageProblem; return(error); } } /* if */ @@ -1189,18 +1189,18 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags) case STARTCOMPOSITES: keyword = token(fp); if (flags & P_C) - { + { (*fi)->numOfComps = atoi(keyword); - (*fi)->ccd = (CompCharData *) + (*fi)->ccd = (CompCharData *) calloc((*fi)->numOfComps, sizeof(CompCharData)); - if ((*fi)->ccd == NULL) + if ((*fi)->ccd == NULL) { - error = storageProblem; + error = storageProblem; return(error); } } /* if */ - code = parseCompCharData(fp, *fi); - break; + code = parseCompCharData(fp, *fi); + break; case ENDFONTMETRICS: code = normalEOF; break; @@ -1209,17 +1209,17 @@ extern int afm_parse_file(FILE *fp, FontInfo **fi, FLAGS flags) code = parseError; break; } /* switch */ - + if ((error != earlyEOF) && (code < 0)) error = code; - + } /* while */ - + if ((error != earlyEOF) && (code < 0)) error = code; - + if (ident != NULL) { free(ident); ident = NULL; } - + return(error); - + } /* parseFile */ /* added for MDVI: this function was copied from `parseAFMclient.c' */ @@ -1229,7 +1229,7 @@ void afm_free_fontinfo(FontInfo *fi) if (fi != NULL) { if (fi->gfi != NULL) - { + { free(fi->gfi->afmVersion); fi->gfi->afmVersion = NULL; free(fi->gfi->fontName); fi->gfi->fontName = NULL; free(fi->gfi->fullName); fi->gfi->fullName = NULL; @@ -1240,16 +1240,16 @@ void afm_free_fontinfo(FontInfo *fi) free(fi->gfi->encodingScheme); fi->gfi->encodingScheme = NULL; free(fi->gfi); fi->gfi = NULL; } - + if (fi->cwi != NULL) { free(fi->cwi); fi->cwi = NULL; } if (fi->cmi != NULL) - { + { int i = 0; CharMetricInfo *temp = fi->cmi; Ligature *node = temp->ligs; - + for (i = 0; i < fi->numOfChars; ++i) { for (node = temp->ligs; node != NULL; node = node->next) @@ -1257,47 +1257,47 @@ void afm_free_fontinfo(FontInfo *fi) free(node->succ); node->succ = NULL; free(node->lig); node->lig = NULL; } - + free(temp->name); temp->name = NULL; temp++; } - + free(fi->cmi); fi->cmi = NULL; } if (fi->tkd != NULL) { free(fi->tkd); fi->tkd = NULL; } - + if (fi->pkd != NULL) - { + { free(fi->pkd->name1); fi->pkd->name1 = NULL; free(fi->pkd->name2); fi->pkd->name2 = NULL; free(fi->pkd); fi->pkd = NULL; } if (fi->ccd != NULL) - { + { int i = 0, j = 0; CompCharData *ccd = fi->ccd; - + for (i = 0; i < fi->numOfComps; ++i) { for (j = 0; j < ccd[i].numOfPieces; ++j) { - free(ccd[i].pieces[j].pccName); + free(ccd[i].pieces[j].pccName); ccd[i].pieces[j].pccName = NULL; } - + free(ccd[i].ccName); ccd[i].ccName = NULL; } - + free(fi->ccd); fi->ccd = NULL; } - + free(fi); - } /* if */ - + } /* if */ + } /* afm_free_fontinfo */ #endif /* WITH_AFM_FILES */ diff --git a/backend/dvi/mdvi-lib/afmparse.h b/backend/dvi/mdvi-lib/afmparse.h index 6cce780c..164c3567 100644 --- a/backend/dvi/mdvi-lib/afmparse.h +++ b/backend/dvi/mdvi-lib/afmparse.h @@ -3,20 +3,20 @@ * (C) 1988, 1989 by Adobe Systems Incorporated. All rights reserved. * * This file may be freely copied and redistributed as long as: - * 1) This entire notice continues to be included in the file, + * 1) This entire notice continues to be included in the file, * 2) If the file has been modified in any way, a notice of such * modification is conspicuously indicated. * * PostScript, Display PostScript, and Adobe are registered trademarks of * Adobe Systems Incorporated. - * + * * ************************************************************************ * THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO CHANGE WITHOUT * NOTICE, AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY ADOBE SYSTEMS - * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR - * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY - * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, - * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, + * INCORPORATED. ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY OR + * LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO WARRANTY OF ANY + * KIND (EXPRESS, IMPLIED OR STATUTORY) WITH RESPECT TO THIS INFORMATION, + * AND EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. * ************************************************************************ */ @@ -27,23 +27,23 @@ * Together these files provide the functionality to parse Adobe Font * Metrics files and store the information in predefined data structures. * It is intended to work with an application program that needs font metric - * information. The program can be used as is by making a procedure call to + * information. The program can be used as is by making a procedure call to * parse an AFM file and have the data stored, or an application developer - * may wish to customize the code. + * may wish to customize the code. * - * This header file defines the data structures used as well as the key + * This header file defines the data structures used as well as the key * strings that are currently recognized by this version of the AFM parser. - * This program is based on the document "Adobe Font Metrics Files, + * This program is based on the document "Adobe Font Metrics Files, * Specification Version 2.0". * * AFM files are separated into distinct sections of different data. Because * of this, the parseAFM program can parse a specified file to only save - * certain sections of information based on the application's needs. A record + * certain sections of information based on the application's needs. A record * containing the requested information will be returned to the application. - * + * * AFM files are divided into five sections of data: * 1) The Global Font Information - * 2) The Character Metrics Information + * 2) The Character Metrics Information * 3) The Track Kerning Data * 4) The Pair-Wise Kerning Data * 5) The Composite Character Data @@ -52,22 +52,22 @@ * of what other sections are requested. In addition, in recognizing that * many applications will want ONLY the x-width of characters and not all * of the other character metrics information, there is a way to receive - * only the width information so as not to pay the storage cost for the - * unwanted data. An application should never request both the - * "quick and dirty" char metrics (widths only) and the Character Metrics - * Information since the Character Metrics Information will contain all + * only the width information so as not to pay the storage cost for the + * unwanted data. An application should never request both the + * "quick and dirty" char metrics (widths only) and the Character Metrics + * Information since the Character Metrics Information will contain all * of the character widths as well. - * - * There is a procedure in parseAFM.c, called parseFile, that can be + * + * There is a procedure in parseAFM.c, called parseFile, that can be * called from any application wishing to get information from the AFM File. * This procedure expects 3 parameters: a vaild file descriptor, a pointer - * to a (FontInfo *) variable (for which space will be allocated and then + * to a (FontInfo *) variable (for which space will be allocated and then * will be filled in with the data requested), and a mask specifying * which data from the AFM File should be saved in the FontInfo structure. - * + * * The flags that can be used to set the appropriate mask are defined below. - * In addition, several commonly used masks have already been defined. - * + * In addition, several commonly used masks have already been defined. + * * History: * original: DSM Thu Oct 20 17:39:59 PDT 1988 * modified: DSM Mon Jul 3 14:17:50 PDT 1989 @@ -99,25 +99,25 @@ #define P_C 0x20 /* 0010 0000 */ /* Composite Char Info */ /* Commonly used flags */ -#define P_GW (P_G | P_W) +#define P_GW (P_G | P_W) #define P_GM (P_G | P_M) #define P_GMP (P_G | P_M | P_P) -#define P_GMK (P_G | P_M | P_P | P_T) +#define P_GMK (P_G | P_M | P_P | P_T) #define P_ALL (P_G | P_M | P_P | P_T | P_C) /* Possible return codes from the parseFile procedure. - * + * * ok means there were no problems parsing the file. * * parseError means that there was some kind of parsing error, but the * parser went on. This could include problems like the count for any given * section does not add up to how many entries there actually were, or * there was a key that was not recognized. The return record may contain - * vaild data or it may not. + * vaild data or it may not. * * earlyEOF means that an End of File was encountered before expected. This * may mean that the AFM file had been truncated, or improperly formed. - * + * * storageProblem means that there were problems allocating storage for * the data structures that would have contained the AFM data. */ @@ -128,15 +128,15 @@ /************************* TYPES *********************************/ /* Below are all of the data structure definitions. These structures - * try to map as closely as possible to grouping and naming of data + * try to map as closely as possible to grouping and naming of data * in the AFM Files. */ -/* Bounding box definition. Used for the Font BBox as well as the +/* Bounding box definition. Used for the Font BBox as well as the * Character BBox. */ typedef struct -{ +{ int llx; /* lower left x-position */ int lly; /* lower left y-position */ int urx; /* upper right x-position */ @@ -144,12 +144,12 @@ typedef struct } BBox; /* Global Font information. - * The key that each field is associated with is in comments. For an + * The key that each field is associated with is in comments. For an * explanation about each key and its value please refer to the AFM - * documentation (full title & version given above). + * documentation (full title & version given above). */ typedef struct -{ +{ char *afmVersion; /* key: StartFontMetrics */ char *fontName; /* key: FontName */ char *fullName; /* key: FullName */ @@ -178,15 +178,15 @@ typedef struct _t_ligature struct _t_ligature *next; } Ligature; -/* Character Metric Information. This structure is used only if ALL +/* Character Metric Information. This structure is used only if ALL * character metric information is requested. If only the character * widths is requested, then only an array of the character x-widths * is returned. * - * The key that each field is associated with is in comments. For an - * explanation about each key and its value please refer to the + * The key that each field is associated with is in comments. For an + * explanation about each key and its value please refer to the * Character Metrics section of the AFM documentation (full title - * & version given above). + * & version given above). */ typedef struct { @@ -199,19 +199,19 @@ typedef struct } CharMetricInfo; /* Track kerning data structure. - * The fields of this record are the five values associated with every + * The fields of this record are the five values associated with every * TrackKern entry. - * - * For an explanation about each value please refer to the + * + * For an explanation about each value please refer to the * Track Kerning section of the AFM documentation (full title - * & version given above). + * & version given above). */ -typedef struct +typedef struct { - int degree; - float minPtSize, - minKernAmt, - maxPtSize, + int degree; + float minPtSize, + minKernAmt, + maxPtSize, maxKernAmt; } TrackKernData; @@ -219,11 +219,11 @@ typedef struct * The fields of this record are the four values associated with every * KP entry. For KPX entries, the yamt will be zero. * - * For an explanation about each value please refer to the + * For an explanation about each value please refer to the * Pair Kerning section of the AFM documentation (full title - * & version given above). + * & version given above). */ -typedef struct +typedef struct { char *name1; char *name2; @@ -234,10 +234,10 @@ typedef struct /* PCC is a piece of a composite character. This is a sub structure of a * compCharData described below. * These fields will be filled in with the values from the key PCC. - * - * For an explanation about each key and its value please refer to the + * + * For an explanation about each key and its value please refer to the * Composite Character section of the AFM documentation (full title - * & version given above). + * & version given above). */ typedef struct { @@ -246,15 +246,15 @@ typedef struct deltay; } Pcc; -/* Composite Character Information data structure. +/* Composite Character Information data structure. * The fields ccName and numOfPieces are filled with the values associated * with the key CC. The field pieces points to an array (size = numOfPieces) * of information about each of the parts of the composite character. That * array is filled in with the values from the key PCC. - * - * For an explanation about each key and its value please refer to the + * + * For an explanation about each key and its value please refer to the * Composite Character section of the AFM documentation (full title - * & version given above). + * & version given above). */ typedef struct { @@ -270,9 +270,9 @@ typedef struct * parseFile function. */ typedef struct -{ +{ GlobalFontInfo *gfi; /* ptr to a GlobalFontInfo record */ - int *cwi; /* ptr to 256 element array of just char widths */ + int *cwi; /* ptr to 256 element array of just char widths */ int numOfChars; /* number of entries in char metrics array */ CharMetricInfo *cmi; /* ptr to char metrics array */ int numOfTracks; /* number to entries in track kerning array */ @@ -289,7 +289,7 @@ typedef struct * * "fp" should be a valid file pointer to an AFM file. * - * "fi" is a pointer to a pointer to a FontInfo record sturcture + * "fi" is a pointer to a pointer to a FontInfo record sturcture * (defined above). Storage for the FontInfo structure will be * allocated in parseFile and the structure will be filled in * with the requested data from the AFM File. @@ -301,7 +301,7 @@ typedef struct * The possible return codes from parseFile are defined above. */ -extern int afm_parse_file __PROTO((FILE *, FontInfo **, FLAGS)); +extern int afm_parse_file __PROTO((FILE *, FontInfo **, FLAGS)); extern void afm_free_fontinfo __PROTO((FontInfo *)); #endif /* _MDVI_PARSEAFM_H */ diff --git a/backend/dvi/mdvi-lib/bitmap.c b/backend/dvi/mdvi-lib/bitmap.c index 4417a75b..de1de6a7 100644 --- a/backend/dvi/mdvi-lib/bitmap.c +++ b/backend/dvi/mdvi-lib/bitmap.c @@ -48,7 +48,7 @@ static BmUnit bit_masks[] = { #define SHOW_OP_DATA (DEBUGGING(BITMAP_OPS) && DEBUGGING(BITMAP_DATA)) #endif -/* +/* * Some useful macros to manipulate bitmap data * SEGMENT(m,n) = bit mask for a segment of `m' contiguous bits * starting at column `n'. These macros assume that @@ -118,7 +118,7 @@ static Uchar bit_swap[] = { }; -/* +/* * next we have three bitmap functions to convert bitmaps in LSB bit order * with 8, 16 and 32 bits per unit, to our internal format. The differences * are minimal, but writing a generic function to handle all unit sizes is @@ -132,8 +132,8 @@ BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h, int stride) Uchar *unit; register Uchar *curr; int bytes; - - DEBUG((DBG_BITMAP_OPS, "convert LSB %dx%d@8 -> bitmap\n", w, h)); + + DEBUG((DBG_BITMAP_OPS, "convert LSB %dx%d@8 -> bitmap\n", w, h)); bm = bitmap_alloc_raw(w, h); @@ -141,14 +141,14 @@ BITMAP *bitmap_convert_lsb8(Uchar *bits, int w, int h, int stride) bytes = ROUND(w, 8); unit = (Uchar *)bm->data; curr = bits; - /* we try to do this as fast as we can */ + /* we try to do this as fast as we can */ for(i = 0; i < h; i++) { #ifdef WORD_LITTLE_ENDIAN memcpy(unit, curr, bytes); curr += stride; #else int j; - + for(j = 0; j < bytes; curr++, j++) unit[j] = bit_swap[*curr]; cur += stride - bytes; @@ -168,7 +168,7 @@ BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h, int stride) Uchar *curr; int i; int bytes; - + bm = bitmap_alloc(w, h); bytes = ROUND(w, 8); unit = (Uchar *)bm->data; @@ -176,7 +176,7 @@ BITMAP *bitmap_convert_msb8(Uchar *data, int w, int h, int stride) for(i = 0; i < h; i++) { #ifdef WORD_LITTLE_ENDIAN int j; - + for(j = 0; j < bytes; curr++, j++) unit[j] = bit_swap[*curr]; curr += stride - bytes; @@ -197,7 +197,7 @@ BITMAP *bitmap_copy(BITMAP *bm) { BITMAP *nb = bitmap_alloc(bm->width, bm->height); - DEBUG((DBG_BITMAP_OPS, "copy %dx%d\n", bm->width, bm->height)); + DEBUG((DBG_BITMAP_OPS, "copy %dx%d\n", bm->width, bm->height)); memcpy(nb->data, bm->data, bm->height * bm->stride); return nb; } @@ -205,7 +205,7 @@ BITMAP *bitmap_copy(BITMAP *bm) BITMAP *bitmap_alloc(int w, int h) { BITMAP *bm; - + bm = xalloc(BITMAP); bm->width = w; bm->height = h; @@ -214,14 +214,14 @@ BITMAP *bitmap_alloc(int w, int h) bm->data = (BmUnit *)mdvi_calloc(h, bm->stride); else bm->data = NULL; - + return bm; } BITMAP *bitmap_alloc_raw(int w, int h) { BITMAP *bm; - + bm = xalloc(BITMAP); bm->width = w; bm->height = h; @@ -230,7 +230,7 @@ BITMAP *bitmap_alloc_raw(int w, int h) bm->data = (BmUnit *)mdvi_malloc(h * bm->stride); else bm->data = NULL; - + return bm; } @@ -250,7 +250,7 @@ void bitmap_print(FILE *out, BITMAP *bm) }; int sub; - a = bm->data; + a = bm->data; fprintf(out, " "); if(bm->width > 10) { putchar('0'); @@ -292,10 +292,10 @@ void bitmap_set_col(BITMAP *bm, int row, int col, int count, int state) { BmUnit *ptr; BmUnit mask; - + ptr = __bm_unit_ptr(bm, col, row); mask = FIRSTMASKAT(col); - + while(count-- > 0) { if(state) *ptr |= mask; @@ -306,7 +306,7 @@ void bitmap_set_col(BITMAP *bm, int row, int col, int count, int state) } } -/* +/* * to use this function you should first make sure that * there is room for `count' bits in the scanline * @@ -333,11 +333,11 @@ void bitmap_paint_bits(BmUnit *ptr, int n, int count) *ptr++ = bit_masks[BITMAP_BITS]; /* paint the tail */ - if(count > 0) + if(count > 0) *ptr |= SEGMENT(count, 0); } -/* +/* * same as paint_bits but clears pixels instead of painting them. Written * as a separate function for efficiency reasons. */ @@ -365,7 +365,7 @@ void bitmap_clear_bits(BmUnit *ptr, int n, int count) void bitmap_set_row(BITMAP *bm, int row, int col, int count, int state) { BmUnit *ptr; - + ptr = __bm_unit_ptr(bm, col, row); if(state) bitmap_paint_bits(ptr, col & (BITMAP_BITS-1), count); @@ -388,13 +388,13 @@ void bitmap_flip_horizontally(BITMAP *bm) nb.height = bm->height; nb.stride = bm->stride; nb.data = mdvi_calloc(bm->height, bm->stride); - + fptr = bm->data; tptr = __bm_unit_ptr(&nb, nb.width-1, 0); for(h = 0; h < bm->height; h++) { BmUnit *fline, *tline; - - fline = fptr; + + fline = fptr; tline = tptr; fmask = FIRSTMASK; tmask = FIRSTMASKAT(nb.width-1); @@ -434,13 +434,13 @@ void bitmap_flip_vertically(BITMAP *bm) nb.height = bm->height; nb.stride = bm->stride; nb.data = mdvi_calloc(bm->height, bm->stride); - + fptr = bm->data; tptr = __bm_unit_ptr(&nb, 0, nb.height-1); for(h = 0; h < bm->height; h++) { BmUnit *fline, *tline; - - fline = fptr; + + fline = fptr; tline = tptr; fmask = FIRSTMASK; for(w = 0; w < bm->width; w++) { @@ -470,18 +470,18 @@ void bitmap_flip_diagonally(BITMAP *bm) BmUnit *fptr, *tptr; BmUnit fmask, tmask; int w, h; - + nb.width = bm->width; nb.height = bm->height; nb.stride = bm->stride; nb.data = mdvi_calloc(bm->height, bm->stride); - + fptr = bm->data; tptr = __bm_unit_ptr(&nb, nb.width-1, nb.height-1); for(h = 0; h < bm->height; h++) { BmUnit *fline, *tline; - - fline = fptr; + + fline = fptr; tline = tptr; fmask = FIRSTMASK; tmask = FIRSTMASKAT(nb.width-1); @@ -516,19 +516,19 @@ void bitmap_rotate_clockwise(BITMAP *bm) BmUnit *fptr, *tptr; BmUnit fmask, tmask; int w, h; - + nb.width = bm->height; nb.height = bm->width; nb.stride = BM_BYTES_PER_LINE(&nb); nb.data = mdvi_calloc(nb.height, nb.stride); - + fptr = bm->data; tptr = __bm_unit_ptr(&nb, nb.width - 1, 0); - + tmask = FIRSTMASKAT(nb.width-1); for(h = 0; h < bm->height; h++) { BmUnit *fline, *tline; - + fmask = FIRSTMASK; fline = fptr; tline = tptr; @@ -556,7 +556,7 @@ void bitmap_rotate_clockwise(BITMAP *bm) mdvi_free(bm->data); bm->data = nb.data; bm->width = nb.width; - bm->height = nb.height; + bm->height = nb.height; bm->stride = nb.stride; if(SHOW_OP_DATA) bitmap_print(stderr, bm); @@ -568,19 +568,19 @@ void bitmap_rotate_counter_clockwise(BITMAP *bm) BmUnit *fptr, *tptr; BmUnit fmask, tmask; int w, h; - + nb.width = bm->height; nb.height = bm->width; nb.stride = BM_BYTES_PER_LINE(&nb); nb.data = mdvi_calloc(nb.height, nb.stride); - + fptr = bm->data; tptr = __bm_unit_ptr(&nb, 0, nb.height - 1); tmask = FIRSTMASK; for(h = 0; h < bm->height; h++) { BmUnit *fline, *tline; - + fmask = FIRSTMASK; fline = fptr; tline = tptr; @@ -608,7 +608,7 @@ void bitmap_rotate_counter_clockwise(BITMAP *bm) mdvi_free(bm->data); bm->data = nb.data; bm->width = nb.width; - bm->height = nb.height; + bm->height = nb.height; bm->stride = nb.stride; if(SHOW_OP_DATA) bitmap_print(stderr, bm); @@ -620,16 +620,16 @@ void bitmap_flip_rotate_clockwise(BITMAP *bm) BmUnit *fptr, *tptr; BmUnit fmask, tmask; int w, h; - + nb.width = bm->height; nb.height = bm->width; nb.stride = BM_BYTES_PER_LINE(&nb); nb.data = mdvi_calloc(nb.height, nb.stride); - + fptr = bm->data; tptr = __bm_unit_ptr(&nb, nb.width-1, nb.height-1); - tmask = FIRSTMASKAT(nb.width-1); + tmask = FIRSTMASKAT(nb.width-1); for(h = 0; h < bm->height; h++) { BmUnit *fline, *tline; @@ -659,7 +659,7 @@ void bitmap_flip_rotate_clockwise(BITMAP *bm) mdvi_free(bm->data); bm->data = nb.data; bm->width = nb.width; - bm->height = nb.height; + bm->height = nb.height; bm->stride = nb.stride; if(SHOW_OP_DATA) bitmap_print(stderr, bm); @@ -671,16 +671,16 @@ void bitmap_flip_rotate_counter_clockwise(BITMAP *bm) BmUnit *fptr, *tptr; BmUnit fmask, tmask; int w, h; - + nb.width = bm->height; nb.height = bm->width; nb.stride = BM_BYTES_PER_LINE(&nb); nb.data = mdvi_calloc(nb.height, nb.stride); - + fptr = bm->data; tptr = nb.data; tmask = FIRSTMASK; - + for(h = 0; h < bm->height; h++) { BmUnit *fline, *tline; @@ -711,7 +711,7 @@ void bitmap_flip_rotate_counter_clockwise(BITMAP *bm) mdvi_free(bm->data); bm->data = nb.data; bm->width = nb.width; - bm->height = nb.height; + bm->height = nb.height; bm->stride = nb.stride; if(SHOW_OP_DATA) bitmap_print(stderr, bm); @@ -751,7 +751,7 @@ void bitmap_transform(BITMAP *map, DviOrientation orient) /* * Count the number of non-zero bits in a box of dimensions w x h, starting * at column `step' in row `data'. - * + * * Shamelessly stolen from xdvi. */ static int do_sample(BmUnit *data, int stride, int step, int w, int h) @@ -760,7 +760,7 @@ static int do_sample(BmUnit *data, int stride, int step, int w, int h) int shift, n; int bits_left; int wid; - + ptr = data + step / BITMAP_BITS; end = bm_offset(data, h * stride); shift = FIRSTSHIFTAT(step); @@ -800,17 +800,17 @@ static int do_sample(BmUnit *data, int stride, int step, int w, int h) return n; } -void mdvi_shrink_box(DviContext *dvi, DviFont *font, +void mdvi_shrink_box(DviContext *dvi, DviFont *font, DviFontChar *pk, DviGlyph *dest) { int x, y, z; DviGlyph *glyph; int hs, vs; - + hs = dvi->params.hshrink; vs = dvi->params.vshrink; glyph = &pk->glyph; - + x = (int)glyph->x / hs; if((int)glyph->x - x * hs > 0) x++; @@ -844,15 +844,15 @@ void mdvi_shrink_glyph(DviContext *dvi, DviFont *font, int x, y; int w, h; int hs, vs; - + hs = dvi->params.hshrink; vs = dvi->params.vshrink; - + min_sample = vs * hs * dvi->params.density / 100; glyph = &pk->glyph; oldmap = (BITMAP *)glyph->data; - + x = (int)glyph->x / hs; init_cols = (int)glyph->x - x * hs; if(init_cols <= 0) @@ -910,7 +910,7 @@ void mdvi_shrink_glyph(DviContext *dvi, DviFont *font, old_ptr = bm_offset(old_ptr, rows * old_stride); rows_left -= rows; rows = vs; - } + } DEBUG((DBG_BITMAPS, "shrink_glyph: (%dw,%dh,%dx,%dy) -> (%dw,%dh,%dx,%dy)\n", glyph->w, glyph->h, glyph->x, glyph->y, dest->w, dest->h, dest->x, dest->y)); @@ -939,10 +939,10 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font, hs = dvi->params.hshrink; vs = dvi->params.vshrink; dev = &dvi->device; - + glyph = &pk->glyph; map = (BITMAP *)glyph->data; - + x = (int)glyph->x / hs; init_cols = (int)glyph->x - x * hs; if(init_cols <= 0) @@ -960,18 +960,18 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font, } h = y + ROUND((int)glyph->h - cols, vs) + 1; ASSERT(w && h); - + /* before touching anything, do this */ image = dev->create_image(dev->device_data, w, h, BITMAP_BITS); if(image == NULL) { mdvi_shrink_glyph(dvi, font, pk, dest); return; } - + /* save these colors */ pk->fg = MDVI_CURRFG(dvi); pk->bg = MDVI_CURRBG(dvi); - + samplemax = vs * hs; npixels = samplemax + 1; pixels = get_color_table(&dvi->device, npixels, pk->fg, pk->bg, @@ -982,7 +982,7 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font, colortab[1] = pk->bg; pixels = &colortab[0]; } - + /* setup the new glyph */ dest->data = image; dest->x = x; @@ -1021,7 +1021,7 @@ void mdvi_shrink_glyph_grey(DviContext *dvi, DviFont *font, rows = vs; y++; } - + for(; y < h; y++) { for(x = 0; x < w; x++) dev->put_pixel(image, x, y, pixels[0]); diff --git a/backend/dvi/mdvi-lib/bitmap.h b/backend/dvi/mdvi-lib/bitmap.h index 4d98fecd..7b722bb4 100644 --- a/backend/dvi/mdvi-lib/bitmap.h +++ b/backend/dvi/mdvi-lib/bitmap.h @@ -54,7 +54,7 @@ typedef struct { #define __bm_unit_ptr(b,x,y) \ bm_offset((b)->data, (y) * (b)->stride + \ ((x) / BITMAP_BITS) * BITMAP_BYTES) - + #define __bm_unit(b,x,y) __bm_unit_ptr((b), (x), (y))[0] #define BM_GETPIXEL(b,x,y) __bm_unit((b), (x), (y)) @@ -91,7 +91,7 @@ typedef struct { } } /* end of sample code */ -#endif +#endif /* bitmaps are stored in native byte order */ #ifdef WORD_BIG_ENDIAN @@ -116,9 +116,9 @@ extern BITMAP *bitmap_alloc __PROTO((int, int)); extern BITMAP *bitmap_alloc_raw __PROTO((int, int)); extern void bitmap_destroy __PROTO((BITMAP *)); -/* - * set_row(bm, row, col, count, state): - * sets `count' pixels to state `onoff', starting from pixel +/* + * set_row(bm, row, col, count, state): + * sets `count' pixels to state `onoff', starting from pixel * at position (col, row). All pixels must lie in the same * row. */ diff --git a/backend/dvi/mdvi-lib/color.c b/backend/dvi/mdvi-lib/color.c index c28107fd..ef6036a9 100644 --- a/backend/dvi/mdvi-lib/color.c +++ b/backend/dvi/mdvi-lib/color.c @@ -47,7 +47,7 @@ void mdvi_push_color(DviContext *dvi, Ulong fg, Ulong bg) void mdvi_pop_color(DviContext *dvi) { Ulong fg, bg; - + if(dvi->color_top == 0) return; dvi->color_top--; @@ -81,7 +81,7 @@ static int cc_entries; /* create a color table */ -Ulong *get_color_table(DviDevice *dev, +Ulong *get_color_table(DviDevice *dev, int nlevels, Ulong fg, Ulong bg, double gamma, int density) { ColorCache *cc, *tofree; @@ -109,7 +109,7 @@ Ulong *get_color_table(DviDevice *dev, DEBUG((DBG_DEVICE, "Adding color table to cache (fg=%lu, bg=%lu, n=%d)\n", fg, bg, nlevels)); - + /* no entry was found in the cache, create a new one */ if(cc_entries < CCSIZE) { cc = &color_cache[cc_entries++]; @@ -119,7 +119,7 @@ Ulong *get_color_table(DviDevice *dev, mdvi_free(cc->pixels); } pixels = xnalloc(Ulong, nlevels); - status = dev->alloc_colors(dev->device_data, + status = dev->alloc_colors(dev->device_data, pixels, nlevels, fg, bg, gamma, density); if(status < 0) { mdvi_free(pixels); @@ -132,5 +132,5 @@ Ulong *get_color_table(DviDevice *dev, cc->nlevels = nlevels; cc->pixels = pixels; cc->hits = 1; - return pixels; + return pixels; } diff --git a/backend/dvi/mdvi-lib/color.h b/backend/dvi/mdvi-lib/color.h index 35b2f923..cbc3c0ef 100644 --- a/backend/dvi/mdvi-lib/color.h +++ b/backend/dvi/mdvi-lib/color.h @@ -22,7 +22,7 @@ #include "common.h" -extern Ulong *get_color_table(DviDevice *dev, +extern Ulong *get_color_table(DviDevice *dev, int nlevels, Ulong fg, Ulong bg, double gamma, int density); extern void mdvi_set_color __PROTO((DviContext *, Ulong, Ulong)); diff --git a/backend/dvi/mdvi-lib/common.c b/backend/dvi/mdvi-lib/common.c index 97b34b56..847a307d 100644 --- a/backend/dvi/mdvi-lib/common.c +++ b/backend/dvi/mdvi-lib/common.c @@ -25,8 +25,8 @@ long fsgetn(FILE *p, size_t n) { long v; - - v = fgetbyte(p); + + v = fgetbyte(p); if(v & 0x80) v -= 0x100; while(--n > 0) @@ -37,7 +37,7 @@ long fsgetn(FILE *p, size_t n) Ulong fugetn(FILE *p, size_t n) { Ulong v; - + v = fgetbyte(p); while(--n > 0) v = (v << 8) | fgetbyte(p); @@ -47,7 +47,7 @@ Ulong fugetn(FILE *p, size_t n) long msgetn(const Uchar *p, size_t n) { long v = (long)*p++; - + if(v & 0x80) v -= 0x100; while(--n > 0) @@ -68,7 +68,7 @@ char *read_string(FILE *in, int s, char *buffer, size_t len) { int n; char *str; - + n = fugetn(in, s ? s : 1); if((str = buffer) == NULL || n + 1 > len) str = mdvi_malloc(n + 1); @@ -83,7 +83,7 @@ char *read_string(FILE *in, int s, char *buffer, size_t len) size_t read_bcpl(FILE *in, char *buffer, size_t maxlen, size_t wanted) { size_t i; - + i = (int)fuget1(in); if(maxlen && i > maxlen) i = maxlen; @@ -99,7 +99,7 @@ char *read_alloc_bcpl(FILE *in, size_t maxlen, size_t *size) { size_t i; char *buffer; - + i = (size_t)fuget1(in); if(maxlen && i > maxlen) i = maxlen; @@ -121,7 +121,7 @@ void buff_free(Buffer *buf) { if(buf->data) mdvi_free(buf->data); - buff_init(buf); + buff_init(buf); } void buff_init(Buffer *buf) @@ -149,7 +149,7 @@ char *buff_gets(Buffer *buf, size_t *length) char *ptr; char *ret; size_t len; - + ptr = strchr(buf->data, '\n'); if(ptr == NULL) return NULL; @@ -163,6 +163,6 @@ char *buff_gets(Buffer *buf, size_t *length) } ret[len] = 0; if(length) *length = len; - return ret; + return ret; } diff --git a/backend/dvi/mdvi-lib/dviread.c b/backend/dvi/mdvi-lib/dviread.c index d0143205..c1cb21f6 100644 --- a/backend/dvi/mdvi-lib/dviread.c +++ b/backend/dvi/mdvi-lib/dviread.c @@ -53,37 +53,37 @@ DVICMDDEF(undefined); DVICMDDEF(unexpected); static const DviCommand dvi_commands[] = { - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, - set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, + set_char, set_char, set_char, set_char, set_char, set_char, set_char, set_char, /* 0 - 127 */ set_char, set_char, set_char, set_char, /* 128 - 131 */ set_rule, /* 132 */ @@ -122,7 +122,7 @@ static const DviCommand dvi_commands[] = { unexpected, /* 247 (PRE) */ unexpected, /* 248 (POST) */ unexpected, /* 249 (POST_POST) */ - undefined, undefined, undefined, + undefined, undefined, undefined, undefined, undefined, undefined /* 250 - 255 */ }; @@ -172,7 +172,7 @@ static void dummy_dev_set_color(void *a, Ulong b, Ulong c) static void dvierr(DviContext *dvi, const char *format, ...) { va_list ap; - + va_start(ap, format); fprintf(stderr, "%s[%d]: Error: ", dvi->filename, dvi->currpage); @@ -183,7 +183,7 @@ static void dvierr(DviContext *dvi, const char *format, ...) static void dviwarn(DviContext *dvi, const char *format, ...) { va_list ap; - + fprintf(stderr, "%s[%d]: Warning: ", dvi->filename, dvi->currpage); va_start(ap, format); @@ -195,15 +195,15 @@ static void dviwarn(DviContext *dvi, const char *format, ...) ((d)->buffer.pos + (n) > (d)->buffer.length) static int get_bytes(DviContext *dvi, size_t n) -{ - /* +{ + /* * caller wants to read `n' bytes from dvi->buffer + dvi->pos. - * Make sure there is enough data to satisfy the request + * Make sure there is enough data to satisfy the request */ if(NEEDBYTES(dvi, n)) { size_t required; int newlen; - + if(dvi->buffer.frozen || dvi->in == NULL || feof(dvi->in)) { /* this is EOF */ dviwarn(dvi, _("unexpected EOF\n")); @@ -251,7 +251,7 @@ static int get_bytes(DviContext *dvi, size_t n) static int dskip(DviContext *dvi, long offset) { ASSERT(offset > 0); - + if(NEEDBYTES(dvi, offset) && get_bytes(dvi, offset) == -1) return -1; dvi->buffer.pos += offset; @@ -283,8 +283,8 @@ static long dugetn(DviContext *dvi, size_t n) { long val; - if(NEEDBYTES(dvi, n) && get_bytes(dvi, n) == -1) - return -1; + if(NEEDBYTES(dvi, n) && get_bytes(dvi, n) == -1) + return -1; val = mugetn(dvi->buffer.data + dvi->buffer.pos, n); dvi->buffer.pos += n; return val; @@ -292,8 +292,8 @@ static long dugetn(DviContext *dvi, size_t n) static long dtell(DviContext *dvi) { - return dvi->depth ? - dvi->buffer.pos : + return dvi->depth ? + dvi->buffer.pos : ftell(dvi->in) - dvi->buffer.length + dvi->buffer.pos; } @@ -321,7 +321,7 @@ static void dviprint(DviContext *dvi, const char *command, int sub, const char * { int i; va_list ap; - + printf("%s: ", dvi->filename); for(i = 0; i < dvi->depth; i++) printf(" "); @@ -341,7 +341,7 @@ static void dviprint(DviContext *dvi, const char *command, int sub, const char * int mdvi_find_tex_page(DviContext *dvi, int tex_page) { int i; - + for(i = 0; i < dvi->npages; i++) if(dvi->pagemap[i][1] == tex_page) return i; @@ -373,7 +373,7 @@ static int sort_dvi_down(const void *p1, const void *p2) void mdvi_sort_pages(DviContext *dvi, DviPageSort type) { int (*sortfunc) __PROTO((const void *, const void *)); - + switch(type) { case MDVI_PAGE_SORT_UP: sortfunc = sort_up; @@ -395,7 +395,7 @@ void mdvi_sort_pages(DviContext *dvi, DviPageSort type) sortfunc = NULL; break; } - + if(sortfunc) qsort(dvi->pagemap, dvi->npages, sizeof(PageNum), sortfunc); } @@ -411,7 +411,7 @@ static DviFontRef *define_font(DviContext *dvi, int op) int n; char *name; DviFontRef *ref; - + arg = dugetn(dvi, op - DVI_FNT_DEF1 + 1); checksum = duget4(dvi); scale = duget4(dvi); @@ -439,7 +439,7 @@ static char *opendvi(const char *name) { int len; char *file; - + len = strlen(name); /* if file ends with .dvi and it exists, that's it */ if(len >= 4 && STREQ(name+len-4, ".dvi")) { @@ -447,7 +447,7 @@ static char *opendvi(const char *name) if(access(name, R_OK) == 0) return mdvi_strdup(name); } - + /* try appending .dvi */ file = mdvi_malloc(len + 5); strcpy(file, name); @@ -468,7 +468,7 @@ int mdvi_reload(DviContext *dvi, DviParams *np) { DviContext *newdvi; DviParams *pars; - + /* close our file */ if(dvi->in) { fclose(dvi->in); @@ -476,8 +476,8 @@ int mdvi_reload(DviContext *dvi, DviParams *np) } pars = np ? np : &dvi->params; - DEBUG((DBG_DVI, "%s: reloading\n", dvi->filename)); - + DEBUG((DBG_DVI, "%s: reloading\n", dvi->filename)); + /* load it again */ newdvi = mdvi_init_context(pars, dvi->pagesel, dvi->filename); if(newdvi == NULL) { @@ -508,7 +508,7 @@ int mdvi_reload(DviContext *dvi, DviParams *np) if(dvi->fileid) mdvi_free(dvi->fileid); dvi->fileid = newdvi->fileid; - + dvi->dvi_page_w = newdvi->dvi_page_w; dvi->dvi_page_h = newdvi->dvi_page_h; @@ -517,25 +517,25 @@ int mdvi_reload(DviContext *dvi, DviParams *np) dvi->npages = newdvi->npages; if(dvi->currpage > dvi->npages-1) dvi->currpage = 0; - + mdvi_free(dvi->stack); dvi->stack = newdvi->stack; dvi->stacksize = newdvi->stacksize; /* remove fonts that are not being used anymore */ font_free_unused(&dvi->device); - - mdvi_free(newdvi->filename); + + mdvi_free(newdvi->filename); mdvi_free(newdvi); DEBUG((DBG_DVI, "%s: reload successful\n", dvi->filename)); if(dvi->device.refresh) dvi->device.refresh(dvi, dvi->device.device_data); - + return 0; } -/* function to change parameters ia DVI context +/* function to change parameters ia DVI context * The DVI context is modified ONLY if this function is successful */ int mdvi_configure(DviContext *dvi, DviParamCode option, ...) { @@ -543,12 +543,12 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...) int reset_all; int reset_font; DviParams np; - + va_start(ap, option); reset_font = 0; reset_all = 0; - np = dvi->params; /* structure copy */ + np = dvi->params; /* structure copy */ while(option != MDVI_PARAM_LAST) { switch(option) { case MDVI_SET_DPI: @@ -613,7 +613,7 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...) option = va_arg(ap, DviParamCode); } va_end(ap); - + /* check that all values make sense */ if(np.dpi <= 0 || np.vdpi <= 0) return -1; @@ -624,11 +624,11 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...) if(np.hshrink < 1 || np.vshrink < 1) return -1; if(np.hdrift < 0 || np.vdrift < 0) - return -1; + return -1; if(np.fg == np.bg) return -1; - /* + /* * If the dpi or the magnification change, we basically have to reload * the DVI file again from scratch. */ @@ -650,7 +650,7 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...) if(reset_font) { font_reset_chain_glyphs(&dvi->device, dvi->fonts, reset_font); } - dvi->params = np; + dvi->params = np; if((reset_font & MDVI_FONTSEL_GLYPH) && dvi->device.refresh) { dvi->device.refresh(dvi, dvi->device.device_data); return 0; @@ -659,8 +659,8 @@ int mdvi_configure(DviContext *dvi, DviParamCode option, ...) return 1; } /* - * Read the initial data from the DVI file. If something is wrong with the - * file, we just spit out an error message and refuse to load the file, + * Read the initial data from the DVI file. If something is wrong with the + * file, we just spit out an error message and refuse to load the file, * without giving any details. This makes sense because DVI files are ok * 99.99% of the time, and dvitype(1) can be used to check the other 0.01%. */ @@ -677,7 +677,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil /* * 1. Open the file and initialize the DVI context - */ + */ filename = opendvi(file); if(filename == NULL) { @@ -695,13 +695,13 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil dvi->pagemap = NULL; dvi->filename = filename; dvi->stack = NULL; - dvi->modtime = get_mtime(fileno(p)); + dvi->modtime = get_mtime(fileno(p)); dvi->buffer.data = NULL; dvi->pagesel = spec; dvi->in = p; /* now we can use the dget*() functions */ - /* - * 2. Read the preamble, extract scaling information, and + /* + * 2. Read the preamble, extract scaling information, and * setup the DVI parameters. */ @@ -710,7 +710,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil if((arg = fuget1(p)) != DVI_ID) { mdvi_error(_("%s: unsupported DVI format (version %u)\n"), file, arg); - goto error; /* jump to the end of this routine, + goto error; /* jump to the end of this routine, * where we handle errors */ } /* get dimensions */ @@ -721,8 +721,8 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil /* check that these numbers make sense */ if(!dvi->num || !dvi->den || !dvi->dvimag) goto bad_dvi; - - dvi->params.mag = + + dvi->params.mag = (par->mag > 0 ? par->mag : (double)dvi->dvimag / 1000.0); dvi->params.hdrift = par->hdrift; dvi->params.vdrift = par->vdrift; @@ -764,7 +764,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil fread(dvi->fileid, 1, n, p); dvi->fileid[n] = 0; DEBUG((DBG_DVI, "%s: %s\n", filename, dvi->fileid)); - + /* * 3. Read postamble, extract page information (number of * pages, dimensions) and stack depth. @@ -772,7 +772,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil /* jump to the end of the file */ if(fseek(p, (long)-1, SEEK_END) == -1) - goto error; + goto error; for(n = 0; (op = fuget1(p)) == DVI_TRAILER; n++) if(fseek(p, (long)-2, SEEK_CUR) < 0) break; @@ -795,7 +795,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil dvi->npages = fuget2(p); DEBUG((DBG_DVI, "%s: from postamble: stack depth %d, %d page%s\n", filename, dvi->stacksize, dvi->npages, dvi->npages > 1 ? "s" : "")); - + /* * 4. Process font definitions. */ @@ -803,7 +803,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil /* process font definitions */ dvi->nfonts = 0; dvi->fontmap = NULL; - /* + /* * CAREFUL: here we need to use the dvi->buffer, but it might leave the * the file cursor in the wrong position after reading fonts (because of * buffering). It's ok, though, because after the font definitions we read @@ -812,7 +812,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil */ while((op = duget1(dvi)) != DVI_POST_POST) { DviFontRef *ref; - + if(op == DVI_NOOP) continue; else if(op < DVI_FNT_DEF1 || op > DVI_FNT_DEF4) @@ -826,7 +826,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil } /* we don't need the buffer anymore */ dreset(dvi); - + if(op != DVI_POST_POST) goto bad_dvi; font_finish_definitions(dvi); @@ -840,14 +840,14 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil dvi->pagemap = xnalloc(PageNum, dvi->npages); memzero(dvi->pagemap, sizeof(PageNum) * dvi->npages); - + n = dvi->npages - 1; pagecount = n; while(offset != -1) { int i; PageNum page; - fseek(p, offset, SEEK_SET); + fseek(p, offset, SEEK_SET); op = fuget1(p); if(op != DVI_BOP || n < 0) goto bad_dvi; @@ -875,7 +875,7 @@ DviContext *mdvi_init_context(DviParams *par, DviPageSpec *spec, const char *fil DEBUG((DBG_DVI, "%d of %d pages selected\n", dvi->npages - pagecount, dvi->npages)); dvi->npages -= pagecount; - memmove(dvi->pagemap, &dvi->pagemap[pagecount], + memmove(dvi->pagemap, &dvi->pagemap[pagecount], dvi->npages * sizeof(PageNum)); } @@ -934,7 +934,7 @@ void mdvi_destroy_context(DviContext *dvi) mdvi_free(dvi->buffer.data); if(dvi->color_stack) mdvi_free(dvi->color_stack); - + mdvi_free(dvi); } @@ -955,13 +955,13 @@ static int mdvi_run_macro(DviContext *dvi, Uchar *macro, size_t len) int opcode; int oldtop; - dvi->depth++; + dvi->depth++; push(dvi, DVI_PUSH); dvi->pos.w = 0; dvi->pos.x = 0; dvi->pos.y = 0; dvi->pos.z = 0; - + /* save our state */ curr = dvi->currfont; fonts = dvi->fonts; @@ -982,7 +982,7 @@ static int mdvi_run_macro(DviContext *dvi, Uchar *macro, size_t len) break; } if(opcode != DVI_EOP) - dviwarn(dvi, _("%s: vf macro had errors\n"), + dviwarn(dvi, _("%s: vf macro had errors\n"), curr->ref->fontname); if(dvi->stacktop != oldtop) dviwarn(dvi, _("%s: stack not empty after vf macro\n"), @@ -1005,7 +1005,7 @@ int mdvi_dopage(DviContext *dvi, int pageno) int ppi; int reloaded = 0; -again: +again: if(dvi->in == NULL) { /* try reopening the file */ dvi->in = fopen(dvi->filename, "rb"); @@ -1017,7 +1017,7 @@ again: } DEBUG((DBG_FILES, "reopen(%s) -> Ok\n", dvi->filename)); } - + /* check if we need to reload the file */ if(!reloaded && get_mtime(fileno(dvi->in)) > dvi->modtime) { mdvi_reload(dvi, &dvi->params); @@ -1025,20 +1025,20 @@ again: reloaded = 1; goto again; } - + if(pageno < 0 || pageno > dvi->npages-1) { mdvi_error(_("%s: page %d out of range\n"), dvi->filename, pageno); return -1; } - + fseek(dvi->in, (long)dvi->pagemap[pageno][0], SEEK_SET); if((op = fuget1(dvi->in)) != DVI_BOP) { mdvi_error(_("%s: bad offset at page %d\n"), dvi->filename, pageno+1); return -1; } - + /* skip bop */ fseek(dvi->in, (long)44, SEEK_CUR); @@ -1048,7 +1048,7 @@ again: dvi->stacktop = 0; dvi->currpage = pageno; dvi->curr_layer = 0; - + if(dvi->buffer.data && !dvi->buffer.frozen) mdvi_free(dvi->buffer.data); @@ -1062,7 +1062,7 @@ again: /* reset color stack */ mdvi_reset_color(dvi); #endif - + /* set max horizontal and vertical drift (from dvips) */ if(dvi->params.hdrift < 0) { ppi = dvi->params.dpi / dvi->params.hshrink; /* shrunk pixels per inch */ @@ -1085,13 +1085,13 @@ again: dvi->params.thinsp = FROUND(0.025 * dvi->params.dpi / dvi->params.conv); dvi->params.vsmallsp = FROUND(0.025 * dvi->params.vdpi / dvi->params.vconv); - + /* execute all the commands in the page */ while((op = duget1(dvi)) != DVI_EOP) { if(dvi_commands[op](dvi, op) < 0) break; } - + fflush(stdout); fflush(stderr); if(op != DVI_EOP) @@ -1104,7 +1104,7 @@ again: static int inline move_vertical(DviContext *dvi, int amount) { int rvv; - + dvi->pos.v += amount; rvv = vpixel_round(dvi, dvi->pos.v); if(!dvi->params.vdrift) @@ -1113,7 +1113,7 @@ static int inline move_vertical(DviContext *dvi, int amount) return rvv; else { int newvv; - + newvv = dvi->pos.vv + vpixel_round(dvi, amount); if(rvv - newvv > dvi->params.vdrift) return rvv - dvi->params.vdrift; @@ -1121,13 +1121,13 @@ static int inline move_vertical(DviContext *dvi, int amount) return rvv + dvi->params.vdrift; else return newvv; - } + } } static int inline move_horizontal(DviContext *dvi, int amount) { int rhh; - + dvi->pos.h += amount; rhh = pixel_round(dvi, dvi->pos.h); if(!dvi->params.hdrift) @@ -1136,7 +1136,7 @@ static int inline move_horizontal(DviContext *dvi, int amount) return rhh; else { int newhh; - + newhh = dvi->pos.hh + pixel_round(dvi, amount); if(rhh - newhh > dvi->params.hdrift) return rhh - dvi->params.hdrift; @@ -1144,7 +1144,7 @@ static int inline move_horizontal(DviContext *dvi, int amount) return rhh + dvi->params.hdrift; else return newhh; - } + } } static void inline fix_after_horizontal(DviContext *dvi) @@ -1167,7 +1167,7 @@ static void inline fix_after_horizontal(DviContext *dvi) (b) > 0 ? (b) : -(b), (c) static void draw_shrink_rule (DviContext *dvi, int x, int y, Uint w, Uint h, int f) -{ +{ Ulong fg, bg; fg = dvi->curr_fg; @@ -1176,11 +1176,11 @@ static void draw_shrink_rule (DviContext *dvi, int x, int y, Uint w, Uint h, int mdvi_push_color (dvi, fg, bg); dvi->device.draw_rule(dvi, x, y, w, h, f); mdvi_pop_color (dvi); - + return; } -/* +/* * The only commands that actually draw something are: * set_char, set_rule */ @@ -1189,7 +1189,7 @@ static void draw_box(DviContext *dvi, DviFontChar *ch) { DviGlyph *glyph = NULL; int x, y, w, h; - + if(!MDVI_GLYPH_UNSET(ch->shrunk.data)) glyph = &ch->shrunk; else if(!MDVI_GLYPH_UNSET(ch->grey.data)) @@ -1237,7 +1237,7 @@ static void draw_box(DviContext *dvi, DviFontChar *ch) y = h - y; break; } - + draw_shrink_rule(dvi, dvi->pos.hh - x, dvi->pos.vv - y, w, h, 1); } @@ -1248,7 +1248,7 @@ int set_char(DviContext *dvi, int opcode) int hh; DviFontChar *ch; DviFont *font; - + if(opcode < 128) num = opcode; else @@ -1263,18 +1263,18 @@ int set_char(DviContext *dvi, int opcode) /* try to display something anyway */ ch = FONTCHAR(font, num); if(!glyph_present(ch)) { - dviwarn(dvi, - _("requested character %d does not exist in `%s'\n"), + dviwarn(dvi, + _("requested character %d does not exist in `%s'\n"), num, font->fontname); return 0; } draw_box(dvi, ch); } else if(dvi->curr_layer <= dvi->params.layer) { if(ISVIRTUAL(font)) - mdvi_run_macro(dvi, (Uchar *)font->private + + mdvi_run_macro(dvi, (Uchar *)font->private + ch->offset, ch->width); else if(ch->width && ch->height) - dvi->device.draw_glyph(dvi, ch, + dvi->device.draw_glyph(dvi, ch, dvi->pos.hh, dvi->pos.vv); } if(opcode >= DVI_PUT1 && opcode <= DVI_PUT4) { @@ -1292,7 +1292,7 @@ int set_char(DviContext *dvi, int opcode) dvi->pos.hh = hh; fix_after_horizontal(dvi); } - + return 0; } @@ -1300,11 +1300,11 @@ int set_rule(DviContext *dvi, int opcode) { Int32 a, b; int h, w; - + a = dsget4(dvi); b = dsget4(dvi); w = rule_round(dvi, b); if(a > 0 && b > 0) { - h = vrule_round(dvi, a); + h = vrule_round(dvi, a); SHOWCMD((dvi, opcode == DVI_SET_RULE ? "setrule" : "putrule", -1, "width %d, height %d (%dx%d pixels)\n", b, a, w, h)); @@ -1314,11 +1314,11 @@ int set_rule(DviContext *dvi, int opcode) draw_shrink_rule(dvi, dvi->pos.hh, dvi->pos.vv - h + 1, w, h, 1); } - } else { + } else { SHOWCMD((dvi, opcode == DVI_SET_RULE ? "setrule" : "putrule", -1, "(moving left only, by %d)\n", b)); } - + if(opcode == DVI_SET_RULE) { dvi->pos.h += b; dvi->pos.hh += w; @@ -1345,7 +1345,7 @@ int push(DviContext *dvi, int opcode) memcpy(&dvi->stack[dvi->stacktop], &dvi->pos, sizeof(DviState)); SHOWCMD((dvi, "push", -1, "level %d: (h=%d,v=%d,w=%d,x=%d,y=%d,z=%d,hh=%d,vv=%d)\n", - dvi->stacktop, + dvi->stacktop, dvi->pos.h, dvi->pos.v, dvi->pos.w, dvi->pos.x, dvi->pos.y, dvi->pos.z, dvi->pos.hh, dvi->pos.vv)); dvi->stacktop++; @@ -1361,7 +1361,7 @@ int pop(DviContext *dvi, int opcode) memcpy(&dvi->pos, &dvi->stack[dvi->stacktop-1], sizeof(DviState)); SHOWCMD((dvi, "pop", -1, "level %d: (h=%d,v=%d,w=%d,x=%d,y=%d,z=%d,hh=%d,vv=%d)\n", - dvi->stacktop, + dvi->stacktop, dvi->pos.h, dvi->pos.v, dvi->pos.w, dvi->pos.x, dvi->pos.y, dvi->pos.z, dvi->pos.hh, dvi->pos.vv)); dvi->stacktop--; @@ -1372,7 +1372,7 @@ int move_right(DviContext *dvi, int opcode) { Int32 arg; int h, hh; - + arg = dsgetn(dvi, opcode - DVI_RIGHT1 + 1); h = dvi->pos.h; hh = move_horizontal(dvi, arg); @@ -1387,7 +1387,7 @@ int move_down(DviContext *dvi, int opcode) { Int32 arg; int v, vv; - + arg = dsgetn(dvi, opcode - DVI_DOWN1 + 1); v = dvi->pos.v; vv = move_vertical(dvi, arg); @@ -1401,7 +1401,7 @@ int move_down(DviContext *dvi, int opcode) int move_w(DviContext *dvi, int opcode) { int h, hh; - + if(opcode != DVI_W0) dvi->pos.w = dsgetn(dvi, opcode - DVI_W0); h = dvi->pos.h; @@ -1416,13 +1416,13 @@ int move_w(DviContext *dvi, int opcode) int move_x(DviContext *dvi, int opcode) { int h, hh; - + if(opcode != DVI_X0) dvi->pos.x = dsgetn(dvi, opcode - DVI_X0); h = dvi->pos.h; hh = move_horizontal(dvi, dvi->pos.x); SHOWCMD((dvi, "x", opcode - DVI_X0, - "%d h:=%d%c%d=%d, hh:=%d\n", + "%d h:=%d%c%d=%d, hh:=%d\n", dvi->pos.x, DBGSUM(h, dvi->pos.x, dvi->pos.h), hh)); dvi->pos.hh = hh; return 0; @@ -1431,13 +1431,13 @@ int move_x(DviContext *dvi, int opcode) int move_y(DviContext *dvi, int opcode) { int v, vv; - + if(opcode != DVI_Y0) dvi->pos.y = dsgetn(dvi, opcode - DVI_Y0); v = dvi->pos.v; vv = move_vertical(dvi, dvi->pos.y); SHOWCMD((dvi, "y", opcode - DVI_Y0, - "%d h:=%d%c%d=%d, hh:=%d\n", + "%d h:=%d%c%d=%d, hh:=%d\n", dvi->pos.y, DBGSUM(v, dvi->pos.y, dvi->pos.v), vv)); dvi->pos.vv = vv; return 0; @@ -1452,7 +1452,7 @@ int move_z(DviContext *dvi, int opcode) v = dvi->pos.v; vv = move_vertical(dvi, dvi->pos.z); SHOWCMD((dvi, "z", opcode - DVI_Z0, - "%d h:=%d%c%d=%d, hh:=%d\n", + "%d h:=%d%c%d=%d, hh:=%d\n", dvi->pos.z, DBGSUM(v, dvi->pos.z, dvi->pos.v), vv)); dvi->pos.vv = vv; return 0; @@ -1462,7 +1462,7 @@ int sel_font(DviContext *dvi, int opcode) { DviFontRef *ref; int ndx; - + ndx = opcode - DVI_FNT_NUM0; if(dvi->depth) ref = font_find_flat(dvi, ndx); @@ -1484,7 +1484,7 @@ int sel_fontn(DviContext *dvi, int opcode) { Int32 arg; DviFontRef *ref; - + arg = dugetn(dvi, opcode - DVI_FNT1 + 1); if(dvi->depth) ref = font_find_flat(dvi, arg); @@ -1495,7 +1495,7 @@ int sel_fontn(DviContext *dvi, int opcode) return -1; } SHOWCMD((dvi, "fnt", opcode - DVI_FNT1 + 1, - "current font is %s (id %d)\n", + "current font is %s (id %d)\n", ref->ref->fontname, arg)); dvi->currfont = ref; return 0; @@ -1505,7 +1505,7 @@ int special(DviContext *dvi, int opcode) { char *s; Int32 arg; - + arg = dugetn(dvi, opcode - DVI_XXX1 + 1); if (arg <= 0) { dvierr(dvi, _("malformed special length\n")); @@ -1525,7 +1525,7 @@ int def_font(DviContext *dvi, int opcode) { DviFontRef *ref; Int32 arg; - + arg = dugetn(dvi, opcode - DVI_FNT_DEF1 + 1); if(dvi->depth) ref = font_find_flat(dvi, arg); diff --git a/backend/dvi/mdvi-lib/files.c b/backend/dvi/mdvi-lib/files.c index b7065068..fd88be69 100644 --- a/backend/dvi/mdvi-lib/files.c +++ b/backend/dvi/mdvi-lib/files.c @@ -26,13 +26,13 @@ char *dgets(Dstring *dstr, FILE *in) { char buffer[256]; - + dstr->length = 0; if(feof(in)) return NULL; while(fgets(buffer, 256, in) != NULL) { int len = strlen(buffer); - + if(buffer[len-1] == '\n') { dstring_append(dstr, buffer, len - 1); break; @@ -49,21 +49,21 @@ char *dgets(Dstring *dstr, FILE *in) const char *file_basename(const char *filename) { const char *ptr = strrchr(filename, '/'); - + return (ptr ? ptr + 1 : filename); } const char *file_extension(const char *filename) { const char *ptr = strchr(file_basename(filename), '.'); - + return (ptr ? ptr + 1 : NULL); } int file_readable(const char *filename) { int status = (access(filename, R_OK) == 0); - + DEBUG((DBG_FILES, "file_redable(%s) -> %s\n", filename, status ? "Yes" : "No")); return status; @@ -72,7 +72,7 @@ int file_readable(const char *filename) int file_exists(const char *filename) { int status = (access(filename, F_OK) == 0); - + DEBUG((DBG_FILES, "file_exists(%s) -> %s\n", filename, status ? "Yes" : "No")); return status; diff --git a/backend/dvi/mdvi-lib/font.c b/backend/dvi/mdvi-lib/font.c index 2f655df0..56e7bae4 100644 --- a/backend/dvi/mdvi-lib/font.c +++ b/backend/dvi/mdvi-lib/font.c @@ -48,7 +48,7 @@ int font_reopen(DviFont *font) static int load_font_file(DviParams *params, DviFont *font) { int status; - + if(SEARCH_DONE(font->search)) return -1; if(font->in == NULL && font_reopen(font) < 0) @@ -73,7 +73,7 @@ static int load_font_file(DviParams *params, DviFont *font) void font_drop_one(DviFontRef *ref) { DviFont *font; - + font = ref->ref; mdvi_free(ref); /* drop all children */ @@ -82,7 +82,7 @@ void font_drop_one(DviFontRef *ref) ref->ref->links--; } if(--font->links == 0) { - /* + /* * this font doesn't have any more references, but * we still keep it around in case a virtual font * requests it. @@ -104,7 +104,7 @@ void font_drop_one(DviFontRef *ref) void font_drop_chain(DviFontRef *head) { DviFontRef *ptr; - + for(; (ptr = head); ) { head = ptr->next; font_drop_one(ptr); @@ -116,15 +116,15 @@ int font_free_unused(DviDevice *dev) DviFont *font, *next; int count = 0; - DEBUG((DBG_FONTS, "destroying unused fonts\n")); + DEBUG((DBG_FONTS, "destroying unused fonts\n")); for(font = (DviFont *)fontlist.head; font; font = next) { DviFontRef *ref; - + next = font->next; if(font->links) continue; count++; - DEBUG((DBG_FONTS, "removing unused %s font `%s'\n", + DEBUG((DBG_FONTS, "removing unused %s font `%s'\n", TYPENAME(font), font->fontname)); listh_remove(&fontlist, LIST(font)); if(font->in) @@ -164,7 +164,7 @@ font_reference( DviFont *font; DviFontRef *ref; DviFontRef *subfont_ref; - + /* see if there is a font with the same characteristics */ for(font = (DviFont *)fontlist.head; font; font = font->next) { if(strcmp(name, font->fontname) == 0 @@ -210,7 +210,7 @@ void font_transform_glyph(DviOrientation orient, DviGlyph *g) { BITMAP *map; int x, y; - + map = (BITMAP *)g->data; if(MDVI_GLYPH_ISEMPTY(map)) map = NULL; @@ -240,7 +240,7 @@ void font_transform_glyph(DviOrientation orient, DviGlyph *g) g->y = x; SWAPINT(g->w, g->h); break; - case MDVI_ORIENT_RM90: + case MDVI_ORIENT_RM90: if(map) bitmap_rotate_clockwise(map); y = g->h - g->y; x = g->x; @@ -303,7 +303,7 @@ static int load_one_glyph(DviContext *dvi, DviFont *font, int code) /* check if we have to scale it */ if(!font->finfo->scalable && font->hdpi != font->vdpi) { int hs, vs, d; - + /* we scale it ourselves */ d = Max(font->hdpi, font->vdpi); hs = d / font->hdpi; @@ -311,8 +311,8 @@ static int load_one_glyph(DviContext *dvi, DviFont *font, int code) if(ch->width && ch->height && (hs > 1 || vs > 1)) { int h, v; DviGlyph glyph; - - DEBUG((DBG_FONTS, + + DEBUG((DBG_FONTS, "%s: scaling glyph %d to resolution %dx%d\n", font->fontname, code, font->hdpi, font->vdpi)); h = dvi->params.hshrink; @@ -336,10 +336,10 @@ static int load_one_glyph(DviContext *dvi, DviFont *font, int code) ch->glyph.w = glyph.w; ch->glyph.h = glyph.h; } - + } font_transform_glyph(dvi->params.orientation, &ch->glyph); - + return 0; } @@ -351,7 +351,7 @@ again: /* if we have not loaded the font yet, do so now */ if(!font->chars && load_font_file(&dvi->params, font) < 0) return NULL; - + /* get the unscaled glyph, maybe loading it from disk */ ch = FONTCHAR(font, code); if(!ch || !glyph_present(ch)) @@ -371,16 +371,16 @@ again: font->finfo->getglyph == NULL || (dvi->params.hshrink == 1 && dvi->params.vshrink == 1)) return ch; - + /* If the glyph is empty, we just need to shrink the box */ if(ch->missing || MDVI_GLYPH_ISEMPTY(ch->glyph.data)) { if(MDVI_GLYPH_UNSET(ch->shrunk.data)) mdvi_shrink_box(dvi, font, ch, &ch->shrunk); return ch; } else if(MDVI_ENABLED(dvi, MDVI_PARAM_ANTIALIASED)) { - if(ch->grey.data && + if(ch->grey.data && !MDVI_GLYPH_ISEMPTY(ch->grey.data) && - ch->fg == dvi->curr_fg && + ch->fg == dvi->curr_fg && ch->bg == dvi->curr_bg) return ch; if(ch->grey.data && @@ -424,12 +424,12 @@ void font_reset_font_glyphs(DviDevice *dev, DviFont *font, int what) { int i; DviFontChar *ch; - + if(what & MDVI_FONTSEL_GLYPH) - what |= MDVI_FONTSEL_BITMAP|MDVI_FONTSEL_GREY; + what |= MDVI_FONTSEL_BITMAP|MDVI_FONTSEL_GREY; if(font->subfonts) { DviFontRef *ref; - + for(ref = font->subfonts; ref; ref = ref->next) font_reset_font_glyphs(dev, ref->ref, what); } @@ -447,12 +447,12 @@ void font_reset_font_glyphs(DviDevice *dev, DviFont *font, int what) } if((what & MDVI_FONTSEL_GLYPH) && font->finfo->reset) font->finfo->reset(font); -} +} void font_reset_chain_glyphs(DviDevice *dev, DviFontRef *head, int what) { DviFontRef *ref; - + for(ref = head; ref; ref = ref->next) font_reset_font_glyphs(dev, ref->ref, what); } @@ -466,7 +466,7 @@ void font_finish_definitions(DviContext *dvi) { int count; DviFontRef **map, *ref; - + /* first get rid of unused fonts */ font_free_unused(&dvi->device); @@ -485,7 +485,7 @@ void font_finish_definitions(DviContext *dvi) DviFontRef *font_find_flat(DviContext *dvi, Int32 id) { DviFontRef *ref; - + for(ref = dvi->fonts; ref; ref = ref->next) if(ref->fontid == id) break; @@ -496,13 +496,13 @@ DviFontRef *font_find_mapped(DviContext *dvi, Int32 id) { int lo, hi, n; DviFontRef **map; - + /* do a binary search */ lo = 0; hi = dvi->nfonts; map = dvi->fontmap; while(lo < hi) { int sign; - + n = (hi + lo) >> 1; sign = (map[n]->fontid - id); if(sign == 0) diff --git a/backend/dvi/mdvi-lib/fontmap.c b/backend/dvi/mdvi-lib/fontmap.c index 20537c85..553b49da 100644 --- a/backend/dvi/mdvi-lib/fontmap.c +++ b/backend/dvi/mdvi-lib/fontmap.c @@ -61,7 +61,7 @@ static int fontmaps_loaded = 0; #define ENC_HASH_SIZE 31 #define PSMAP_HASH_SIZE 57 -/* this hash table should be big enough to +/* this hash table should be big enough to * hold (ideally) one glyph name per bucket */ #define ENCNAME_HASH_SIZE 131 /* most TeX fonts have 128 glyphs */ @@ -70,7 +70,7 @@ static DviEncoding *tex_text_encoding = NULL; static DviEncoding *default_encoding = NULL; /* we keep two hash tables for encodings: one for their base files (e.g. - * "8r.enc"), and another one for their names (e.g. "TeXBase1Encoding") */ + * "8r.enc"), and another one for their names (e.g. "TeXBase1Encoding") */ static DviHashTable enctable = MDVI_EMPTY_HASH_TABLE; static DviHashTable enctable_file = MDVI_EMPTY_HASH_TABLE; @@ -104,7 +104,7 @@ static void ps_init_default_paths __PROTO((void)); static int mdvi_set_default_encoding __PROTO((const char *name)); static int mdvi_init_fontmaps __PROTO((void)); -/* +/* * What we do here is allocate one block large enough to hold the entire * file (these files are small) minus the leading comments. This is much * better than allocating up to 256 tiny strings per encoding vector. */ @@ -116,7 +116,7 @@ static int read_encoding(DviEncoding *enc) char *name; char *next; struct stat st; - + ASSERT(enc->private == NULL); in = fopen(enc->filename, "rb"); @@ -153,7 +153,7 @@ static int read_encoding(DviEncoding *enc) curr = 0; next = name = NULL; - DEBUG((DBG_FMAP, "%s: reading encoding vector\n", enc->name)); + DEBUG((DBG_FMAP, "%s: reading encoding vector\n", enc->name)); for(line = enc->private; *line && curr < 256; line = next) { SKIPSP(line); if(*line == ']') { @@ -176,13 +176,13 @@ static int read_encoding(DviEncoding *enc) /* got a name */ if(*next) *next++ = 0; - + if(*name == '/') name++; enc->vector[curr] = name; /* add it to the hash table */ if(!STREQ(name, ".notdef")) { - mdvi_hash_add(&enc->nametab, MDVI_KEY(name), + mdvi_hash_add(&enc->nametab, MDVI_KEY(name), Int2Ptr(curr + 1), MDVI_HASH_REPLACE); } curr++; @@ -200,7 +200,7 @@ static int read_encoding(DviEncoding *enc) static DviEncoding *find_encoding(const char *name) { - return (DviEncoding *)(encodings.count ? + return (DviEncoding *)(encodings.count ? mdvi_hash_lookup(&enctable, MDVI_KEY(name)) : NULL); } @@ -249,15 +249,15 @@ static DviEncoding *register_encoding(const char *basefile, int replace) DEBUG((DBG_FMAP, "%s: already there\n", basefile)); return enc; /* no error */ } - } + } /* try our own files first */ - filename = kpse_find_file(basefile, + filename = kpse_find_file(basefile, kpse_program_text_format, 0); /* then try the system-wide ones */ if(filename == NULL) - filename = kpse_find_file(basefile, + filename = kpse_find_file(basefile, kpse_tex_ps_header_format, 0); if(filename == NULL) filename = kpse_find_file(basefile, @@ -272,7 +272,7 @@ static DviEncoding *register_encoding(const char *basefile, int replace) mdvi_free(filename); return NULL; } - + /* just lookup the name of the encoding */ name = NULL; dstring_init(&input); @@ -297,13 +297,13 @@ static DviEncoding *register_encoding(const char *basefile, int replace) offset = ftell(in); fclose(in); if(name == NULL || *name == 0) { - DEBUG((DBG_FMAP, + DEBUG((DBG_FMAP, "%s: could not determine name of encoding\n", basefile)); mdvi_free(filename); return NULL; } - + /* check if the encoding is already there */ enc = find_encoding(name); if(enc == tex_text_encoding) { @@ -347,9 +347,9 @@ static DviEncoding *register_encoding(const char *basefile, int replace) dstring_reset(&input); if(default_encoding == NULL) default_encoding = enc; - mdvi_hash_add(&enctable, MDVI_KEY(enc->name), + mdvi_hash_add(&enctable, MDVI_KEY(enc->name), enc, MDVI_HASH_UNCHECKED); - mdvi_hash_add(&enctable_file, MDVI_KEY(mdvi_strdup(basefile)), + mdvi_hash_add(&enctable_file, MDVI_KEY(mdvi_strdup(basefile)), enc, MDVI_HASH_REPLACE); listh_prepend(&encodings, LIST(enc)); DEBUG((DBG_FMAP, "%s: encoding `%s' registered\n", @@ -377,7 +377,7 @@ DviEncoding *mdvi_request_encoding(const char *name) if(enc->nametab.nkeys == 0) { int i; - DEBUG((DBG_FMAP, "%s: rehashing\n", enc->name)); + DEBUG((DBG_FMAP, "%s: rehashing\n", enc->name)); for(i = 0; i < 256; i++) { if(enc->vector[i] == NULL) continue; @@ -404,7 +404,7 @@ void mdvi_release_encoding(DviEncoding *enc, int should_free) int mdvi_encode_glyph(DviEncoding *enc, const char *name) { void *data; - + data = mdvi_hash_lookup(&enc->nametab, MDVI_KEY(name)); if(data == NULL) return -1; @@ -420,7 +420,7 @@ int mdvi_encode_glyph(DviEncoding *enc, const char *name) static void parse_spec(DviFontMapEnt *ent, char *spec) { char *arg, *command; - + /* this is a ridiculously simple parser, and recognizes only * things of the form <argument> <command>. Of these, only * command=SlantFont, ExtendFont and ReEncodeFont are handled */ @@ -429,16 +429,16 @@ static void parse_spec(DviFontMapEnt *ent, char *spec) if(*spec) *spec++ = 0; command = getword(spec, " \t", &spec); if(*spec) *spec++ = 0; - if(!arg || !command) + if(!arg || !command) continue; if(STREQ(command, "SlantFont")) { double x = 10000 * strtod(arg, 0); - - /* SFROUND evaluates arguments twice */ + + /* SFROUND evaluates arguments twice */ ent->slant = SFROUND(x); } else if(STREQ(command, "ExtendFont")) { double x = 10000 * strtod(arg, 0); - + ent->extend = SFROUND(x); } else if(STREQ(command, "ReEncodeFont")) { if(ent->encoding) @@ -485,13 +485,13 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) } if(in == NULL) return NULL; - + ent = NULL; listh_init(&list); dstring_init(&input); last_encoding = NULL; last_encfile = NULL; - + while((ptr = dgets(&input, in)) != NULL) { char *font_file; char *tex_name; @@ -502,12 +502,12 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) lineno++; SKIPSP(ptr); - + /* we skip what dvips does */ - if(*ptr <= ' ' || *ptr == '*' || *ptr == '#' || + if(*ptr <= ' ' || *ptr == '*' || *ptr == '#' || *ptr == ';' || *ptr == '%') continue; - + font_file = NULL; tex_name = NULL; ps_name = NULL; @@ -522,14 +522,14 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) } while(*ptr) { char *hdr_name = NULL; - + while(*ptr && *ptr <= ' ') ptr++; if(*ptr == 0) break; if(*ptr == '"') { char *str; - + str = getstring(ptr, " \t", &ptr); if(*ptr) *ptr++ = 0; parse_spec(ent, str); @@ -557,7 +557,7 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) if(hdr_name) { const char *ext = file_extension(hdr_name); - + if(is_encoding || (ext && STRCEQ(ext, "enc"))) vec_name = hdr_name; else @@ -576,7 +576,7 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) /* if we have an encoding file, register it */ if(ent->encfile) { - /* register_encoding is smart enough not to load the + /* register_encoding is smart enough not to load the * same file twice */ if(!last_encfile || !STREQ(last_encfile, ent->encfile)) { last_encfile = ent->encfile; @@ -584,7 +584,7 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) } enc = last_encoding; } - if(ent->encfile && enc){ + if(ent->encfile && enc){ if(ent->encoding && !STREQ(ent->encoding, enc->name)) { mdvi_warning( _("%s: %d: [%s] requested encoding `%s' does not match vector `%s'\n"), @@ -593,15 +593,15 @@ DviFontMapEnt *mdvi_load_fontmap(const char *file) } else if(!ent->encoding) ent->encoding = mdvi_strdup(enc->name); } - + /* add it to the list */ /*print_ent(ent);*/ listh_append(&list, LIST(ent)); ent = NULL; } - dstring_reset(&input); + dstring_reset(&input); fclose(in); - + return (DviFontMapEnt *)list.head; } @@ -629,7 +629,7 @@ void mdvi_install_fontmap(DviFontMapEnt *head) for(ent = head; ent; ent = next) { /* add all the entries, overriding old ones */ DviFontMapEnt *old; - + old = (DviFontMapEnt *) mdvi_hash_remove(&maptable, MDVI_KEY(ent->fontname)); if(old != NULL) { @@ -639,7 +639,7 @@ void mdvi_install_fontmap(DviFontMapEnt *head) free_ent(old); } next = ent->next; - mdvi_hash_add(&maptable, MDVI_KEY(ent->fontname), + mdvi_hash_add(&maptable, MDVI_KEY(ent->fontname), ent, MDVI_HASH_UNCHECKED); listh_append(&fontmaps, LIST(ent)); } @@ -650,7 +650,7 @@ static void init_static_encoding() DviEncoding *encoding; int i; - DEBUG((DBG_FMAP, "installing static TeX text encoding\n")); + DEBUG((DBG_FMAP, "installing static TeX text encoding\n")); encoding = xalloc(DviEncoding); encoding->private = ""; encoding->filename = ""; @@ -671,7 +671,7 @@ static void init_static_encoding() mdvi_hash_create(&enctable, ENC_HASH_SIZE); mdvi_hash_create(&enctable_file, ENC_HASH_SIZE); enctable_file.hash_free = file_hash_free; - mdvi_hash_add(&enctable, MDVI_KEY(encoding->name), + mdvi_hash_add(&enctable, MDVI_KEY(encoding->name), encoding, MDVI_HASH_UNCHECKED); listh_prepend(&encodings, LIST(encoding)); tex_text_encoding = encoding; @@ -720,7 +720,7 @@ static int mdvi_init_fontmaps(void) /* create the fontmap hash table */ mdvi_hash_create(&maptable, MAP_HASH_SIZE); - + /* get the name of our configuration file */ config = kpse_cnf_get("mdvi-config"); if(config == NULL) @@ -738,13 +738,13 @@ static int mdvi_init_fontmaps(void) dstring_init(&input); while((line = dgets(&input, in)) != NULL) { char *arg, *map_file; - + SKIPSP(line); if(*line < ' ' || *line == '#' || *line == '%') continue; if(STRNEQ(line, "fontmap", 7)) { DviFontMapEnt *ent; - + arg = getstring(line + 7, " \t", &line); *line = 0; DEBUG((DBG_FMAP, "%s: loading fontmap\n", arg)); ent = mdvi_load_fontmap(arg); @@ -756,7 +756,7 @@ static int mdvi_init_fontmaps(void) if(ent == NULL) mdvi_warning(_("%s: could not load fontmap\n"), arg); else { - DEBUG((DBG_FMAP, + DEBUG((DBG_FMAP, "%s: installing fontmap\n", arg)); mdvi_install_fontmap(ent); count++; @@ -804,7 +804,7 @@ int mdvi_query_fontmap(DviFontMapInfo *info, const char *fontname) DviFontMapEnt *ent; if(!fontmaps_loaded && mdvi_init_fontmaps() < 0) - return -1; + return -1; ent = (DviFontMapEnt *)mdvi_hash_lookup(&maptable, MDVI_KEY(fontname)); if(ent == NULL) @@ -815,14 +815,14 @@ int mdvi_query_fontmap(DviFontMapInfo *info, const char *fontname) info->extend = ent->extend; info->slant = ent->slant; info->fullfile = ent->fullfile; - - return 0; + + return 0; } int mdvi_add_fontmap_file(const char *name, const char *fullpath) { DviFontMapEnt *ent; - + if(!fontmaps_loaded && mdvi_init_fontmaps() < 0) return -1; ent = (DviFontMapEnt *)mdvi_hash_lookup(&maptable, MDVI_KEY(name)); @@ -856,13 +856,13 @@ void mdvi_flush_encodings(void) if(tex_text_encoding->nametab.buckets) mdvi_hash_reset(&tex_text_encoding->nametab, 0); mdvi_hash_reset(&enctable, 0); - mdvi_hash_reset(&enctable_file, 0); + mdvi_hash_reset(&enctable_file, 0); } void mdvi_flush_fontmaps(void) { DviFontMapEnt *ent; - + if(!fontmaps_loaded) return; @@ -885,7 +885,7 @@ void ps_init_default_paths(void) ASSERT(psinitialized == 0); kppath = getenv("GS_LIB"); - kfpath = getenv("GS_FONTPATH"); + kfpath = getenv("GS_FONTPATH"); if(kppath != NULL) pslibdir = kpse_path_expand(kppath); @@ -904,7 +904,7 @@ int mdvi_ps_read_fontmap(const char *name) Dstring dstr; char *line; int count = 0; - + if(!psinitialized) ps_init_default_paths(); if(pslibdir) @@ -918,17 +918,17 @@ int mdvi_ps_read_fontmap(const char *name) return -1; } dstring_init(&dstr); - + while((line = dgets(&dstr, in)) != NULL) { char *name; char *mapname; const char *ext; PSFontMap *ps; - + SKIPSP(line); /* we're looking for lines of the form * /FONT-NAME (fontfile) - * /FONT-NAME /FONT-ALIAS + * /FONT-NAME /FONT-ALIAS */ if(*line != '/') continue; @@ -936,12 +936,12 @@ int mdvi_ps_read_fontmap(const char *name) if(*line) *line++ = 0; mapname = getword(line, " \t", &line); if(*line) *line++ = 0; - + if(!name || !mapname || !*name) continue; if(*mapname == '(') { char *end; - + mapname++; for(end = mapname; *end && *end != ')'; end++); *end = 0; @@ -960,7 +960,7 @@ int mdvi_ps_read_fontmap(const char *name) if(ps != NULL) { if(STREQ(ps->mapname, mapname)) continue; - DEBUG((DBG_FMAP, + DEBUG((DBG_FMAP, "(ps) replacing font `%s' (%s) by `%s'\n", name, ps->mapname, mapname)); mdvi_free(ps->mapname); @@ -984,7 +984,7 @@ int mdvi_ps_read_fontmap(const char *name) } fclose(in); dstring_reset(&dstr); - + DEBUG((DBG_FMAP, "(ps) %s: %d PostScript fonts registered\n", fullname, count)); return 0; @@ -993,7 +993,7 @@ int mdvi_ps_read_fontmap(const char *name) void mdvi_ps_flush_fonts(void) { PSFontMap *map; - + if(!psinitialized) return; DEBUG((DBG_FMAP, "(ps) flushing PS font map (%d) entries\n", @@ -1037,11 +1037,11 @@ char *mdvi_ps_find_font(const char *psname) /* is it an alias? */ smap = map; while(recursion_limit-- > 0 && smap && *smap->mapname == '/') - smap = (PSFontMap *)mdvi_hash_lookup(&pstable, + smap = (PSFontMap *)mdvi_hash_lookup(&pstable, MDVI_KEY(smap->mapname + 1)); if(smap == NULL) { if(recursion_limit == 0) - DEBUG((DBG_FMAP, + DEBUG((DBG_FMAP, "(ps) %s: possible loop in PS font map\n", psname)); return NULL; @@ -1055,7 +1055,7 @@ char *mdvi_ps_find_font(const char *psname) filename = NULL; if(filename) map->fullname = mdvi_strdup(filename); - + return filename; } @@ -1071,7 +1071,7 @@ char *mdvi_ps_find_font(const char *psname) * cache, so the next time it will be found at the first step (when we look * up NAME.afm). * - * The name `_ps_' in this function is not meant to imply that it can be + * The name `_ps_' in this function is not meant to imply that it can be * used for Type1 fonts only. It should be usable for TrueType fonts as well. * * The returned metric info is subjected to the same caching mechanism as @@ -1094,7 +1094,7 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname) double efactor; double sfactor; - DEBUG((DBG_FMAP, "(ps) %s: looking for metric data\n", fontname)); + DEBUG((DBG_FMAP, "(ps) %s: looking for metric data\n", fontname)); info = get_font_metrics(fontname, DviFontAny, NULL); if(info != NULL) return info; @@ -1102,7 +1102,7 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname) /* query the fontmap */ if(mdvi_query_fontmap(&map, fontname) < 0 || !map.psname) return NULL; - + /* get the PS font */ psfont = mdvi_ps_find_font(map.psname); if(psfont == NULL) @@ -1140,9 +1140,9 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname) if(info == NULL || (!map.extend && !map.slant)) return info; - /* - * transform the data as prescribed -- keep in mind that `info' - * points to CACHED data, so we're modifying the metric cache + /* + * transform the data as prescribed -- keep in mind that `info' + * points to CACHED data, so we're modifying the metric cache * in place. */ @@ -1174,6 +1174,6 @@ TFMInfo *mdvi_ps_get_metrics(const char *fontname) ch->right = TRANSFORM(ch->right, ch->height); } } - + return info; } diff --git a/backend/dvi/mdvi-lib/fontsrch.c b/backend/dvi/mdvi-lib/fontsrch.c index 8ebaa5ca..77cd8704 100644 --- a/backend/dvi/mdvi-lib/fontsrch.c +++ b/backend/dvi/mdvi-lib/fontsrch.c @@ -72,7 +72,7 @@ static int initialized = 0; static void init_font_classes(void) { int i; - + for(i = 0; i < MAX_CLASS; i++) listh_init(&font_classes[i]); initialized = 1; @@ -88,7 +88,7 @@ char **mdvi_list_font_class(int klass) char **list; int i, n; DviFontClass *fc; - + if(klass == -1) klass = MAX_CLASS-1; if(klass < 0 || klass >= MAX_CLASS) @@ -137,7 +137,7 @@ int mdvi_unregister_font_type(const char *name, int klass) if(klass == -1) klass = MAX_CLASS - 1; - + if(klass >= 0 && klass < MAX_CLASS) { k = klass; LIST_FOREACH(fc, DviFontClass, &font_classes[k]) { @@ -154,12 +154,12 @@ int mdvi_unregister_font_type(const char *name, int klass) } } else return -1; - + if(fc == NULL || fc->links) return -1; /* remove it */ listh_remove(&font_classes[k], LIST(fc)); - + /* and destroy it */ mdvi_free(fc->info.name); mdvi_free(fc); @@ -171,9 +171,9 @@ static char *lookup_font(DviFontClass *ptr, const char *name, Ushort *h, Ushort char *filename; /* - * If the font type registered a function to do the lookup, use that. + * If the font type registered a function to do the lookup, use that. * Otherwise we use kpathsea. - */ + */ if(ptr->info.lookup) filename = ptr->info.lookup(name, h, v); else if(ptr->info.kpse_type <= kpse_any_glyph_format) { @@ -208,7 +208,7 @@ char *mdvi_lookup_font(DviFontSearch *search) if(search->id < 0) return NULL; - + if(search->curr == NULL) { /* this is the initial search */ name = search->wanted_name; @@ -312,7 +312,7 @@ metrics: search->id = -1; search->actual_name = NULL; - + /* tough luck, nothing found */ return NULL; } @@ -322,7 +322,7 @@ DviFont *mdvi_add_font(const char *name, Int32 sum, int hdpi, int vdpi, Int32 scale) { DviFont *font; - + font = xalloc(DviFont); font->fontname = mdvi_strdup(name); SEARCH_INIT(font->search, font->fontname, hdpi, vdpi); @@ -354,7 +354,7 @@ int mdvi_font_retry(DviParams *params, DviFont *font) /* try the search again */ char *filename; - ASSERT(font->search.curr != NULL); + ASSERT(font->search.curr != NULL); /* we won't be using this class anymore */ font->search.curr->links--; diff --git a/backend/dvi/mdvi-lib/gf.c b/backend/dvi/mdvi-lib/gf.c index 00607ff6..d890e156 100644 --- a/backend/dvi/mdvi-lib/gf.c +++ b/backend/dvi/mdvi-lib/gf.c @@ -88,7 +88,7 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch) Int32 par; BmUnit *line; BITMAP *map; - + fseek(p, (long)ch->offset, SEEK_SET); op = fuget1(p); if(op == GF_BOC) { @@ -106,7 +106,7 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch) min_m = fuget1(p); /* this is max_m - min_m */ max_m = fuget1(p); min_n = fuget1(p); /* this is max_n - min_n */ - max_n = fuget1(p); + max_n = fuget1(p); min_m = max_m - min_m; min_n = max_n - min_n; } else { @@ -136,18 +136,18 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch) DEBUG((DBG_BITMAPS, "(gf) reading character %d\n", ch->code)); while((op = fuget1(p)) != GF_EOC) { Int32 n; - + if(feof(p)) break; if(op == GF_PAINT0) { DEBUG((DBG_BITMAPS, "(gf) Paint0 %s -> %s\n", - COLOR(paint_switch), COLOR(!paint_switch))); + COLOR(paint_switch), COLOR(!paint_switch))); paint_switch = !paint_switch; } else if(op <= GF_PAINT3) { if(op < GF_PAINT1) par = op; else - par = fugetn(p, op - GF_PAINT1 + 1); + par = fugetn(p, op - GF_PAINT1 + 1); if(y >= ch->height || x + par >= ch->width) goto toobig; /* paint everything between columns x and x + par - 1 */ @@ -159,14 +159,14 @@ static int gf_read_bitmap(FILE *p, DviFontChar *ch) paint_switch = !paint_switch; x += par; } else if(op >= GF_NEW_ROW_0 && op <= GF_NEW_ROW_MAX) { - y++; + y++; line = bm_offset(line, bpl); x = op - GF_NEW_ROW_0; paint_switch = BLACK; DEBUG((DBG_BITMAPS, "(gf) new_row_%d\n", x)); } else switch(op) { case GF_SKIP0: - y++; + y++; line = bm_offset(line, bpl); x = 0; paint_switch = WHITE; @@ -264,7 +264,7 @@ static int gf_load_font(DviParams *unused, DviFont *font) /* now read character locators in postamble */ if(fseek(p, (long)-1, SEEK_END) == -1) return -1; - + n = 0; while((op = fuget1(p)) == GF_TRAILER) { if(fseek(p, (long)-2, SEEK_CUR) < 0) @@ -306,7 +306,7 @@ static int gf_load_font(DviParams *unused, DviFont *font) DviFontChar *ch; int cc; - /* get the character code */ + /* get the character code */ cc = fuget1(p); if(cc < loc) loc = cc; @@ -342,11 +342,11 @@ static int gf_load_font(DviParams *unused, DviFont *font) ch->grey.data = NULL; ch->flags = 0; ch->loaded = 0; - } + } if(op != GF_POST_POST) goto badgf; - + if(loc > 0 || hic < 255) { /* shrink to optimal size */ memmove(font->chars, font->chars + loc, @@ -373,11 +373,11 @@ error: static int gf_font_get_glyph(DviParams *params, DviFont *font, int code) { DviFontChar *ch; - + if(code < font->loc || code > font->hic || !font->chars) return -1; ch = &font->chars[code - font->loc]; - + if(!ch->loaded) { if(ch->offset == 0) return -1; diff --git a/backend/dvi/mdvi-lib/hash.c b/backend/dvi/mdvi-lib/hash.c index d359e3c8..3327fa58 100644 --- a/backend/dvi/mdvi-lib/hash.c +++ b/backend/dvi/mdvi-lib/hash.c @@ -33,7 +33,7 @@ static Ulong hash_string(DviHashKey key) { Uchar *p; Ulong h, g; - + for(h = 0, p = (Uchar *)key; *p; p++) { h = (h << 4UL) + *p; if((g = h & 0xf0000000L) != 0) { @@ -41,7 +41,7 @@ static Ulong hash_string(DviHashKey key) h ^= g; } } - + return h; } @@ -63,7 +63,7 @@ void mdvi_hash_init(DviHashTable *hash) void mdvi_hash_create(DviHashTable *hash, int size) { int i; - + hash->nbucks = size; hash->buckets = xnalloc(DviHashBucket *, size); for(i = 0; i < size; i++) @@ -78,9 +78,9 @@ static DviHashBucket *hash_find(DviHashTable *hash, DviHashKey key) { Ulong hval; DviHashBucket *buck; - + hval = (hash->hash_func(key) % hash->nbucks); - + for(buck = hash->buckets[hval]; buck; buck = buck->next) if(hash->hash_comp(buck->key, key) == 0) break; @@ -92,7 +92,7 @@ int mdvi_hash_add(DviHashTable *hash, DviHashKey key, void *data, int rep) { DviHashBucket *buck = NULL; Ulong hval; - + if(rep != MDVI_HASH_UNCHECKED) { buck = hash_find(hash, key); if(buck != NULL) { @@ -112,11 +112,11 @@ int mdvi_hash_add(DviHashTable *hash, DviHashKey key, void *data, int rep) hash->buckets[hval] = buck; hash->nkeys++; } - + /* save key and data */ buck->key = key; buck->data = data; - + return 0; } @@ -131,10 +131,10 @@ static DviHashBucket *hash_remove(DviHashTable *hash, DviHashKey key) { DviHashBucket *buck, *last; Ulong hval; - + hval = hash->hash_func(key); hval %= hash->nbucks; - + for(last = NULL, buck = hash->buckets[hval]; buck; buck = buck->next) { if(hash->hash_comp(buck->key, key) == 0) break; @@ -167,10 +167,10 @@ void *mdvi_hash_remove_ptr(DviHashTable *hash, DviHashKey key) DviHashBucket *buck, *last; Ulong hval; void *ptr; - + hval = hash->hash_func(key); hval %= hash->nbucks; - + for(last = NULL, buck = hash->buckets[hval]; buck; buck = buck->next) { if(buck->key == key) break; @@ -192,20 +192,20 @@ void *mdvi_hash_remove_ptr(DviHashTable *hash, DviHashKey key) int mdvi_hash_destroy_key(DviHashTable *hash, DviHashKey key) { DviHashBucket *buck = hash_remove(hash, key); - + if(buck == NULL) return -1; if(hash->hash_free) hash->hash_free(buck->key, buck->data); mdvi_free(buck); - return 0; + return 0; } void mdvi_hash_reset(DviHashTable *hash, int reuse) { int i; DviHashBucket *buck; - + /* remove all keys in the hash table */ for(i = 0; i < hash->nbucks; i++) { for(; (buck = hash->buckets[i]); ) { diff --git a/backend/dvi/mdvi-lib/mdvi.h b/backend/dvi/mdvi-lib/mdvi.h index 37664a76..a05f9278 100644 --- a/backend/dvi/mdvi-lib/mdvi.h +++ b/backend/dvi/mdvi-lib/mdvi.h @@ -62,34 +62,34 @@ typedef Ulong DviColor; typedef enum { FALSE = 0, - TRUE = 1 + TRUE = 1 } DviBool; #include "hash.h" #include "paper.h" -/* +/* * information about a page: * pagenum[0] = offset to BOP * pagenum[1], ..., pagenum[10] = TeX \counters */ typedef long PageNum[11]; -/* this structure contains the platform-specific information +/* this structure contains the platform-specific information * required to interpret a DVI file */ -typedef void (*DviGlyphDraw) __PROTO((DviContext *context, +typedef void (*DviGlyphDraw) __PROTO((DviContext *context, DviFontChar *glyph, int x, int y)); typedef void (*DviRuleDraw) __PROTO((DviContext *context, - int x, int y, + int x, int y, Uint width, Uint height, int fill)); typedef int (*DviColorScale) __PROTO((void *device_data, - Ulong *pixels, + Ulong *pixels, int npixels, - Ulong foreground, + Ulong foreground, Ulong background, double gamma, int density)); @@ -104,7 +104,7 @@ typedef void (*DviDevDestroy) __PROTO((void *data)); typedef void (*DviRefresh) __PROTO((DviContext *dvi, void *device_data)); typedef void (*DviSetColor) __PROTO((void *device_data, Ulong, Ulong)); typedef void (*DviPSDraw) __PROTO((DviContext *context, - const char *filename, + const char *filename, int x, int y, Uint width, Uint height)); @@ -155,7 +155,7 @@ struct _DviGlyph { void *data; /* bitmap or XImage */ }; -typedef void (*DviFontShrinkFunc) +typedef void (*DviFontShrinkFunc) __PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *)); typedef int (*DviFontLoadFunc) __PROTO((DviParams *, DviFont *)); typedef int (*DviFontGetGlyphFunc) __PROTO((DviParams *, DviFont *, int)); @@ -351,7 +351,7 @@ struct _DviState { int w; int x; int y; - int z; + int z; }; struct _DviColorPair { @@ -415,7 +415,7 @@ struct _DviRange { }; -typedef void (*DviSpecialHandler) +typedef void (*DviSpecialHandler) __PROTO((DviContext *dvi, const char *prefix, const char *arg)); #define RANGE_HAS_LOWER(x) \ @@ -433,7 +433,7 @@ typedef void (*DviSpecialHandler) #define MDVI_PARAM_SHOWUNDEF 8 #define MDVI_PARAM_DELAYFONTS 16 -/* +/* * The FALLBACK priority class is reserved for font formats that * contain no glyph information and are to be used as a last * resort (e.g. TFM, AFM) @@ -553,10 +553,10 @@ extern void mdvi_flush_specials __PROTO((void)); #define glyph_present(x) ((x) && (x)->offset) /* create a reference to a font */ -extern DviFontRef *font_reference __PROTO((DviParams *params, - Int32 dvi_id, - const char *font_name, - Int32 checksum, +extern DviFontRef *font_reference __PROTO((DviParams *params, + Int32 dvi_id, + const char *font_name, + Int32 checksum, int xdpi, int ydpi, Int32 scale_factor)); diff --git a/backend/dvi/mdvi-lib/pagesel.c b/backend/dvi/mdvi-lib/pagesel.c index 5a153955..82c59a37 100644 --- a/backend/dvi/mdvi-lib/pagesel.c +++ b/backend/dvi/mdvi-lib/pagesel.c @@ -47,7 +47,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha char * text; DviRange one; DviRange *range; - + quoted = (*format == '{'); if(quoted) format++; @@ -59,7 +59,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha lower = 0; upper = 0; type = MDVI_RANGE_UNBOUNDED; - + if(limit) { switch(limit->type) { case MDVI_RANGE_BOUNDED: @@ -96,7 +96,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha int this_type; int lower_given = 0; int upper_given = 0; - + if(*cp == 0 || *cp == '.' || (*cp == '}' && quoted)) done = 1; else if(*cp != ',') @@ -109,7 +109,7 @@ DviRange *mdvi_parse_range(const char *format, DviRange *limit, int *nitems, cha f = lower; t = upper; s = 1; - + p = strchr(text, ':'); if(p) *p++ = 0; if(*text) { @@ -165,7 +165,7 @@ finish: one.to = t; one.from = f; one.step = s; - + if(curr == size) { size += 8; range = mdvi_realloc(range, size * sizeof(DviRange)); @@ -174,7 +174,7 @@ finish: *cp = ch; text = cp + 1; } - if(done) + if(done) cp--; if(quoted && *cp == '}') cp++; @@ -189,7 +189,7 @@ finish: DviPageSpec *mdvi_parse_page_spec(const char *format) { - /* + /* * a page specification looks like this: * '{'RANGE_SPEC'}' for a DVI spec * '{'RANGE_SPEC'}' '.' ... for a TeX spec @@ -199,7 +199,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) int count; int i; char *ptr; - + spec = xnalloc(struct _DviPageSpec *, 11); for(i = 0; i < 11; i++) spec[i] = NULL; @@ -214,7 +214,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) } } else range = NULL; - + if(*format == 'D' || *format == 'd' || *ptr != '.') i = 0; else @@ -226,13 +226,13 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) spec[i]->nranges = count; } else spec[i] = NULL; - + if(*ptr != '.') { if(*ptr) mdvi_warning(_("garbage after DVI page specification ignored\n")); return spec; } - + for(i++; *ptr == '.' && i <= 10; i++) { ptr++; if(*ptr == '*') { @@ -240,7 +240,7 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) range = NULL; } else { char *end; - + range = mdvi_parse_range(ptr, NULL, &count, &end); if(end == ptr) { if(range) mdvi_free(range); @@ -255,13 +255,13 @@ DviPageSpec *mdvi_parse_page_spec(const char *format) } else spec[i] = NULL; } - + if(i > 10) mdvi_warning(_("more than 10 counters in page specification\n")); else if(*ptr) mdvi_warning(_("garbage after TeX page specification ignored\n")); - - return spec; + + return spec; } /* returns non-zero if the given page is included by `spec' */ @@ -269,11 +269,11 @@ int mdvi_page_selected(DviPageSpec *spec, PageNum page, int dvipage) { int i; int not_found; - + if(spec == NULL) return 1; if(spec[0]) { - not_found = mdvi_in_range(spec[0]->ranges, + not_found = mdvi_in_range(spec[0]->ranges, spec[0]->nranges, dvipage); if(not_found < 0) return 0; @@ -281,7 +281,7 @@ int mdvi_page_selected(DviPageSpec *spec, PageNum page, int dvipage) for(i = 1; i <= 10; i++) { if(spec[i] == NULL) continue; - not_found = mdvi_in_range(spec[i]->ranges, + not_found = mdvi_in_range(spec[i]->ranges, spec[i]->nranges, (int)page[i]); if(not_found < 0) return 0; @@ -292,7 +292,7 @@ int mdvi_page_selected(DviPageSpec *spec, PageNum page, int dvipage) void mdvi_free_page_spec(DviPageSpec *spec) { int i; - + for(i = 0; i < 11; i++) if(spec[i]) { mdvi_free(spec[i]->ranges); @@ -304,7 +304,7 @@ void mdvi_free_page_spec(DviPageSpec *spec) int mdvi_in_range(DviRange *range, int nitems, int value) { DviRange *r; - + for(r = range; r < range + nitems; r++) { int cond; @@ -330,7 +330,7 @@ int mdvi_in_range(DviRange *range, int nitems, int value) return (r - range); break; case MDVI_RANGE_UPPER: - if(value == r->to) + if(value == r->to) return (r - range); if(r->step < 0) cond = (value > r->to); @@ -352,12 +352,12 @@ int mdvi_range_length(DviRange *range, int nitems) { int count = 0; DviRange *r; - + for(r = range; r < range + nitems; r++) { int n; if(r->type != MDVI_RANGE_BOUNDED) - return -2; + return -2; n = (r->to - r->from) / r->step; if(n < 0) n = 0; @@ -395,7 +395,7 @@ int main() #if 0 char buf[256]; DviRange limit; - + limit.from = 0; limit.to = 100; limit.step = 2; @@ -405,7 +405,7 @@ int main() char *end; int count; int i; - + printf("Range> "); fflush(stdout); if(fgets(buf, 256, stdin) == NULL) break; @@ -419,20 +419,20 @@ int main() printf("range is empty\n"); continue; } - + for(i = 0; i < count; i++) { - printf("Range %d (%d elements):\n", + printf("Range %d (%d elements):\n", i, mdvi_range_length(&range[i], 1)); print_range(&range[i]); } if(end && *end) printf("Tail: [%s]\n", end); - printf("range has %d elements\n", + printf("range has %d elements\n", mdvi_range_length(range, count)); #if 1 while(1) { int v; - + printf("Value: "); fflush(stdout); if(fgets(buf, 256, stdin) == NULL) break; @@ -455,7 +455,7 @@ int main() #else DviPageSpec *spec; char buf[256]; - + while(1) { printf("Spec> "); fflush(stdout); if(fgets(buf, 256, stdin) == NULL) @@ -469,13 +469,13 @@ int main() printf("no spec parsed\n"); else { int i; - + printf("spec = "); for(i = 0; i < 11; i++) { printf("Counter %d:\n", i); if(spec[i]) { int k; - + for(k = 0; k < spec[i]->nranges; k++) print_range(&spec[i]->ranges[k]); } else diff --git a/backend/dvi/mdvi-lib/paper.c b/backend/dvi/mdvi-lib/paper.c index 42cbcd3f..7ba454ab 100644 --- a/backend/dvi/mdvi-lib/paper.c +++ b/backend/dvi/mdvi-lib/paper.c @@ -75,7 +75,7 @@ static const DviPaperSpec papers[] = { {"ledger", "17in", "11in"}, {"note", "7.5in", "10in"}, {"tabloid", "11in", "17in"}, - {"statement", "5.5in", "8.5in"}, + {"statement", "5.5in", "8.5in"}, {0, 0, 0} }; @@ -111,7 +111,7 @@ int mdvi_get_paper_size(const char *name, DviPaper *paper) paper->name = _("custom"); return 0; } - + for(sp = &papers[0]; sp->name; sp++) { if(!sp->width || !sp->height) { paper->pclass = str2class(sp->name); @@ -132,10 +132,10 @@ DviPaperSpec *mdvi_get_paper_specs(DviPaperClass pclass) int i; int first, count; DviPaperSpec *spec, *ptr; - + first = -1; count = 0; - if(pclass == MDVI_PAPER_CLASS_ANY || + if(pclass == MDVI_PAPER_CLASS_ANY || pclass == MDVI_PAPER_CLASS_CUSTOM) { first = 0; count = (sizeof(papers) / sizeof(papers[0])) - 3; diff --git a/backend/dvi/mdvi-lib/pk.c b/backend/dvi/mdvi-lib/pk.c index 1b42a319..5e8da5bb 100644 --- a/backend/dvi/mdvi-lib/pk.c +++ b/backend/dvi/mdvi-lib/pk.c @@ -112,7 +112,7 @@ static char *pk_lookup(const char *name, Ushort *hdpi, Ushort *vdpi) } else if(filename) { *hdpi = *vdpi = type.dpi; } - return filename; + return filename; } static char *pk_lookupn(const char *name, Ushort *hdpi, Ushort *vdpi) @@ -132,7 +132,7 @@ static char *pk_lookupn(const char *name, Ushort *hdpi, Ushort *vdpi) } else if(filename) { *hdpi = *vdpi = type.dpi; } - return filename; + return filename; } static inline int pk_get_nyb(FILE *p, pkread *pk) @@ -140,10 +140,10 @@ static inline int pk_get_nyb(FILE *p, pkread *pk) unsigned t; int nb; char c; - + t = c = pk->currbyte; nb = pk->nybpos; - + switch(nb) { case 0: c = pk->currbyte = fuget1(p); @@ -157,7 +157,7 @@ static inline int pk_get_nyb(FILE *p, pkread *pk) return (t & 0xf); } -/* +/* * this is a bit cumbersome because we have to pass around * the `pkread' data... */ @@ -165,7 +165,7 @@ static int pk_packed_num(FILE *p, pkread *pkr, int *repeat) { int i, j; int dyn_f = pkr->dyn_f; - + i = pk_get_nyb(p, pkr); if(i == 0) { do { @@ -174,12 +174,12 @@ static int pk_packed_num(FILE *p, pkread *pkr, int *repeat) } while(j == 0); while(i-- > 0) j = (j << 4) + pk_get_nyb(p, pkr); - return (j - 15 + ((13 - dyn_f) << 4) + + return (j - 15 + ((13 - dyn_f) << 4) + dyn_f); } else if(i <= dyn_f) return i; else if(i < 14) - return ((i - dyn_f - 1) << 4) + + return ((i - dyn_f - 1) << 4) + pk_get_nyb(p, pkr) + dyn_f + 1; else { *repeat = 1; @@ -198,7 +198,7 @@ static BITMAP *get_bitmap(FILE *p, int w, int h, int flags) BITMAP *bm; int bitpos; int currch; - + flags = 0; /* shut up that compiler */ bitpos = -1; if((bm = bitmap_alloc(w, h)) == NULL) @@ -209,7 +209,7 @@ static BITMAP *get_bitmap(FILE *p, int w, int h, int flags) currch = 0; for(i = 0; i < h; i++) { BmUnit mask; - + mask = FIRSTMASK; for(j = 0; j < w; j++) { if(bitpos < 0) { @@ -238,7 +238,7 @@ static BITMAP *get_packed(FILE *p, int w, int h, int flags) int repeat_count; int paint; pkread pkr; - + pkr.nybpos = 0; pkr.currbyte = 0; pkr.dyn_f = PK_DYN_F(flags); @@ -253,7 +253,7 @@ static BITMAP *get_packed(FILE *p, int w, int h, int flags) w, h, flags)); while(row < h) { int i = 0; - + count = pk_packed_num(p, &pkr, &i); if(i > 0) { if(repeat_count) @@ -261,11 +261,11 @@ static BITMAP *get_packed(FILE *p, int w, int h, int flags) repeat_count, i); repeat_count = i; } - + if(count >= inrow) { Uchar *r, *t; BmUnit *a, mask; - + /* first finish current row */ if(paint) bitmap_set_row(bm, row, w - inrow, inrow, paint); @@ -369,11 +369,11 @@ static int pk_load_font(DviParams *unused, DviFont *font) fuget4(p); fuget4(p); if(feof(p)) - goto badpk; + goto badpk; /* now start reading the font */ loc = 256; hic = -1; maxch = 256; - + /* initialize alpha and beta for TFM width computation */ TFMPREPARE(font->scale, z, alpha, beta); @@ -389,7 +389,7 @@ static int pk_load_font(DviParams *unused, DviFont *font) #ifndef NODEBUG char *t; int n; - + i = fugetn(p, flag_byte - PK_X1 + 1); if(i < 256) t = &s[0]; @@ -428,7 +428,7 @@ static int pk_load_font(DviParams *unused, DviFont *font) int x, y; int offset; long tfm; - + switch(flag_byte & 0x7) { case 7: pl = fuget4(p); @@ -438,13 +438,13 @@ static int pk_load_font(DviParams *unused, DviFont *font) fsget4(p); /* skip dx */ fsget4(p); /* skip dy */ w = fuget4(p); - h = fuget4(p); + h = fuget4(p); x = fsget4(p); y = fsget4(p); break; case 4: case 5: - case 6: + case 6: pl = (flag_byte % 4) * 65536 + fuget2(p); cc = fuget1(p); offset = ftell(p) + pl; @@ -484,7 +484,7 @@ static int pk_load_font(DviParams *unused, DviFont *font) if(cc > hic) hic = cc; if(cc > maxch) { - font->chars = xresize(font->chars, + font->chars = xresize(font->chars, DviFontChar, cc + 16); for(i = maxch; i < cc + 16; i++) font->chars[i].offset = 0; @@ -523,13 +523,13 @@ static int pk_load_font(DviParams *unused, DviFont *font) /* resize font char data */ if(loc > 0 || hic < maxch-1) { - memmove(font->chars, font->chars + loc, + memmove(font->chars, font->chars + loc, (hic - loc + 1) * sizeof(DviFontChar)); font->chars = xresize(font->chars, DviFontChar, hic - loc + 1); } font->loc = loc; - font->hic = hic; + font->hic = hic; return 0; badpk: @@ -547,7 +547,7 @@ static int pk_font_get_glyph(DviParams *params, DviFont *font, int code) if((ch = FONTCHAR(font, code)) == NULL) return -1; - + if(ch->offset == 0) return -1; DEBUG((DBG_GLYPHS, "(pk) loading glyph for character %d (%dx%d) in font `%s'\n", @@ -561,11 +561,11 @@ static int pk_font_get_glyph(DviParams *params, DviFont *font, int code) ch->glyph.w = ch->width; ch->glyph.h = ch->height; ch->glyph.data = NULL; - return 0; + return 0; } if(fseek(font->in, ch->offset, SEEK_SET) == -1) return -1; - ch->glyph.data = get_char(font->in, + ch->glyph.data = get_char(font->in, ch->width, ch->height, ch->flags); if(ch->glyph.data) { /* restore original settings */ diff --git a/backend/dvi/mdvi-lib/setup.c b/backend/dvi/mdvi-lib/setup.c index ba0c545d..881bed50 100644 --- a/backend/dvi/mdvi-lib/setup.c +++ b/backend/dvi/mdvi-lib/setup.c @@ -25,7 +25,7 @@ #include "mdvi.h" #include "private.h" -void mdvi_init_kpathsea(const char *program, +void mdvi_init_kpathsea(const char *program, const char *mfmode, const char *font, int dpi, const char *texmfcnf) { @@ -33,7 +33,7 @@ void mdvi_init_kpathsea(const char *program, /* Stop meaningless output generation. */ kpse_make_tex_discard_errors = FALSE; - + p = strrchr(program, '/'); p = (p ? p + 1 : program); kpse_set_program_name(program, p); diff --git a/backend/dvi/mdvi-lib/sp-epsf.c b/backend/dvi/mdvi-lib/sp-epsf.c index 4f1b49cb..104c955b 100644 --- a/backend/dvi/mdvi-lib/sp-epsf.c +++ b/backend/dvi/mdvi-lib/sp-epsf.c @@ -53,7 +53,7 @@ typedef struct { void epsf_special __PROTO((DviContext *dvi, char *prefix, char *arg)); /* Note: the given strings are modified in place */ -static char *parse_epsf_special(EpsfBox *box, char **ret, +static char *parse_epsf_special(EpsfBox *box, char **ret, char *prefix, char *arg) { static struct { @@ -90,11 +90,11 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, double vsize; double hscale; double vscale; - + /* this special has the form * ["]file.ps["] [key=valye]* */ - + /* scan the filename */ while(*arg == ' ' || *arg == '\t') arg++; @@ -116,7 +116,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, value[i] = atof(keys[i].value); present[i] = 0; } - + buff_init(&buffer); buff_add(&buffer, "@beginspecial ", 0); @@ -128,13 +128,13 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, while(*ptr == ' ' || *ptr == '\t') ptr++; keyname = ptr; - + /* get the whole key=value pair */ for(; *ptr && *ptr != ' ' && *ptr != '\t'; ptr++); - + if(*ptr) *ptr++ = 0; /* now we shouldn't touch `ptr' anymore */ - + /* now work on this pair */ p = strchr(keyname, '='); if(p == NULL) @@ -174,18 +174,18 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, } if(val) value[i] = atof(val); - + /* put the argument */ buff_add(&buffer, val, 0); buff_add(&buffer, " @", 2); buff_add(&buffer, keyname, 0); buff_add(&buffer, " ", 1); - + /* remember that this option was given */ present[i] = 0xff; } buff_add(&buffer, " @setspecial", 0); - + /* now compute the bounding box (code comes from dvips) */ originx = 0; originy = 0; @@ -193,7 +193,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, vscale = 1; hsize = 0; vsize = 0; - + if(present[HSIZE]) hsize = value[HSIZE]; if(present[VSIZE]) @@ -220,7 +220,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, vscale = value[RHI] / (10.0 * vsize); } } - + box->ox = originx; box->oy = originy; box->bw = hsize * hscale; @@ -228,7 +228,7 @@ static char *parse_epsf_special(EpsfBox *box, char **ret, box->angle = value[ANGLE]; *ret = buffer.data; - + return filename; } @@ -243,7 +243,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg) int w, h; double xf, vf; struct stat buf; - + file = parse_epsf_special(&box, &special, prefix, arg); if (file != NULL) mdvi_free (special); @@ -272,7 +272,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg) if (tmp) { /* Document directory */ int path_len = strlen (dvi->filename) - strlen (tmp + 1); int file_len = strlen (file); - + psfile = mdvi_malloc (path_len + file_len + 1); psfile[0] = '\0'; strncat (psfile, dvi->filename, path_len); @@ -287,7 +287,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg) mdvi_free (psfile); } - + psfile = mdvi_build_path_from_cwd (file); if (stat (psfile, &buf) == 0) { /* Current working dir */ dvi->device.draw_ps (dvi, psfile, x, y, w, h); @@ -297,7 +297,7 @@ void epsf_special(DviContext *dvi, char *prefix, char *arg) } mdvi_free (psfile); - + psfile = kpse_find_pict (file); if (psfile) { /* kpse */ dvi->device.draw_ps (dvi, psfile, x, y, w, h); diff --git a/backend/dvi/mdvi-lib/special.c b/backend/dvi/mdvi-lib/special.c index e4832544..e1f1a618 100644 --- a/backend/dvi/mdvi-lib/special.c +++ b/backend/dvi/mdvi-lib/special.c @@ -39,7 +39,7 @@ typedef struct _DviSpecial { #endif DviSpecialHandler handler; } DviSpecial; - + static ListHead specials = {NULL, NULL, 0}; #define SPECIAL(x) \ @@ -65,7 +65,7 @@ static void register_builtin_specials(void) { int i; - ASSERT(registered_builtins == 0); + ASSERT(registered_builtins == 0); registered_builtins = 1; for(i = 0; i < NSPECIALS; i++) mdvi_register_special( @@ -79,7 +79,7 @@ static void register_builtin_specials(void) static DviSpecial *find_special_prefix(const char *prefix) { DviSpecial *sp; - + /* should have a hash table here, but I'm so lazy */ for(sp = (DviSpecial *)specials.head; sp; sp = sp->next) { if(STRCEQ(sp->prefix, prefix)) @@ -88,7 +88,7 @@ static DviSpecial *find_special_prefix(const char *prefix) return sp; } -int mdvi_register_special(const char *label, const char *prefix, +int mdvi_register_special(const char *label, const char *prefix, const char *regex, DviSpecialHandler handler, int replace) { DviSpecial *sp; @@ -127,9 +127,9 @@ int mdvi_register_special(const char *label, const char *prefix, sp->label = mdvi_strdup(label); sp->plen = strlen(prefix); if(newsp) - listh_prepend(&specials, LIST(sp)); - DEBUG((DBG_SPECIAL, - "New \\special handler `%s' with prefix `%s'\n", + listh_prepend(&specials, LIST(sp)); + DEBUG((DBG_SPECIAL, + "New \\special handler `%s' with prefix `%s'\n", label, prefix)); return 0; } @@ -137,8 +137,8 @@ int mdvi_register_special(const char *label, const char *prefix, int mdvi_unregister_special(const char *prefix) { DviSpecial *sp; - - sp = find_special_prefix(prefix); + + sp = find_special_prefix(prefix); if(sp == NULL) return -1; mdvi_free(sp->prefix); @@ -156,7 +156,7 @@ int mdvi_unregister_special(const char *prefix) int mdvi_do_special(DviContext *dvi, char *string) { char *prefix; - char *ptr; + char *ptr; DviSpecial *sp; if(!registered_builtins) { @@ -170,7 +170,7 @@ int mdvi_do_special(DviContext *dvi, char *string) string++; DEBUG((DBG_SPECIAL, "Looking for a handler for `%s'\n", string)); - + /* now try to find a match */ ptr = string; for(sp = (DviSpecial *)specials.head; sp; sp = sp->next) { @@ -193,13 +193,13 @@ int mdvi_do_special(DviContext *dvi, char *string) /* extract the prefix */ if(ptr == string) { prefix = NULL; - DEBUG((DBG_SPECIAL, + DEBUG((DBG_SPECIAL, "REGEX match with `%s' (arg `%s')\n", sp->label, ptr)); } else { if(*ptr) *ptr++ = 0; prefix = string; - DEBUG((DBG_SPECIAL, + DEBUG((DBG_SPECIAL, "PREFIX match with `%s' (prefix `%s', arg `%s')\n", sp->label, prefix, ptr)); } @@ -213,8 +213,8 @@ int mdvi_do_special(DviContext *dvi, char *string) void mdvi_flush_specials(void) { DviSpecial *sp, *list; - - + + for(list = (DviSpecial *)specials.head; (sp = list); ) { list = sp->next; if(sp->prefix) mdvi_free(sp->prefix); diff --git a/backend/dvi/mdvi-lib/sysdeps.h b/backend/dvi/mdvi-lib/sysdeps.h index c77d7651..3955c0dd 100644 --- a/backend/dvi/mdvi-lib/sysdeps.h +++ b/backend/dvi/mdvi-lib/sysdeps.h @@ -18,7 +18,7 @@ #ifndef _SYSDEP_H #define _SYSDEP_H 1 -/* +/* * The purpose of this file is to define symbols that describe the * system-dependent features we use. Namely, byte order, native integer * types of various sizes, and safe pointer<->integer conversion. @@ -75,7 +75,7 @@ typedef short Int16; #endif /* SIZEOF_INT != 2 */ #endif /* SIZEOF_SHORT != 2 */ -/* +/* * An integer type to convert to and from pointers safely. All we do here is * look for an integer type with the same size as a pointer. */ diff --git a/backend/dvi/mdvi-lib/t1.c b/backend/dvi/mdvi-lib/t1.c index d63f055c..12bb01fa 100644 --- a/backend/dvi/mdvi-lib/t1.c +++ b/backend/dvi/mdvi-lib/t1.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* +/* * Type1 font support for MDVI * * We use T1lib only as a rasterizer, not to draw glyphs. @@ -37,7 +37,7 @@ typedef struct t1info { struct t1info *next; struct t1info *prev; char *fontname; /* (short) name of this font */ - int t1id; /* T1lib's id for this font */ + int t1id; /* T1lib's id for this font */ int hasmetrics; /* have we processed this font? */ TFMInfo *tfminfo; /* TFM data is shared */ DviFontMapInfo mapinfo; @@ -47,7 +47,7 @@ typedef struct t1info { static void t1_font_remove __PROTO((T1Info *)); static int t1_load_font __PROTO((DviParams *, DviFont *)); static int t1_font_get_glyph __PROTO((DviParams *, DviFont *, int)); -static void t1_font_shrink_glyph +static void t1_font_shrink_glyph __PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *)); static void t1_free_data __PROTO((DviFont *)); static void t1_reset_font __PROTO((DviFont *)); @@ -79,10 +79,10 @@ static int t1lib_ydpi = -1; static ListHead t1fonts = {NULL, NULL, 0}; static DviHashTable t1hash; -/* Type1 fonts need their own `lookup' function. Here is how it works: +/* Type1 fonts need their own `lookup' function. Here is how it works: * First we try to find the font by its given name. If that fails, we * query the font maps. A typical font map entry may contain the line - * + * * ptmr8rn Times-Roman ".82 ExtendFont TeXBase1Encoding ReEncodeFont" <8r.enc <ptmr * * which means: If you're looking for the font `ptmr8rn' load `Times-Roman' @@ -112,13 +112,13 @@ char *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi) return filename; } - DEBUG((DBG_TYPE1, "(t1) %s: not found, querying font maps\n", name)); + DEBUG((DBG_TYPE1, "(t1) %s: not found, querying font maps\n", name)); /* now query the fontmap */ if(mdvi_query_fontmap(&info, name) < 0) { /* it's not there either */ return NULL; } - + /* check what we got */ if(info.fullfile) { DEBUG((DBG_TYPE1, "(t1) %s: found `%s' (cached)\n", @@ -126,15 +126,15 @@ char *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi) /* this is a cached lookup */ return mdvi_strdup(info.fullfile); } - + /* no file associated to this font? */ if(info.fontfile == NULL) return info.psname ? mdvi_ps_find_font(info.psname) : NULL; - + /* let's extract the extension */ ext = file_extension(info.fontfile); if(ext && !STREQ(ext, "pfa") && !STREQ(ext, "pfb")) { - DEBUG((DBG_TYPE1, + DEBUG((DBG_TYPE1, "(t1) %s: associated name `%s' is not Type1\n", name, info.fontfile)); /* it's not a Type1 font */ @@ -160,7 +160,7 @@ char *t1_lookup_font(const char *name, Ushort *hdpi, Ushort *vdpi) DEBUG((DBG_TYPE1, "(t1) %s: not found\n", name)); return NULL; } - + DEBUG((DBG_TYPE1, "(t1) %s: found as `%s'\n", name, filename)); /* got it! let's remember this */ mdvi_add_fontmap_file(name, filename); @@ -178,7 +178,7 @@ static void t1_reset_resolution(int xdpi, int ydpi) nfonts = T1_Get_no_fonts(); #else nfonts = T1_GetNoFonts(); -#endif +#endif for(i = 0; i < nfonts; i++) T1_DeleteAllSizes(i); @@ -186,7 +186,7 @@ static void t1_reset_resolution(int xdpi, int ydpi) if(T1_SetDeviceResolutions((float)xdpi, (float)ydpi) < 0) mdvi_warning(_("(t1) failed to reset device resolution\n")); else - DEBUG((DBG_TYPE1, + DEBUG((DBG_TYPE1, "(t1) reset successful, new resolution is (%d, %d)\n", xdpi, ydpi)); t1lib_xdpi = xdpi; @@ -196,7 +196,7 @@ static void t1_reset_resolution(int xdpi, int ydpi) static void t1_reset_font(DviFont *font) { T1Info *info = (T1Info *)font->private; - + if(info == NULL) return; DEBUG((DBG_FONTS, "(t1) resetting font `%s'\n", font->fontname)); @@ -215,19 +215,19 @@ static void t1_transform_font(T1Info *info) mdvi_warning(_("%s: could not encode font\n"), info->fontname); } if(info->mapinfo.slant) { - DEBUG((DBG_TYPE1, "(t1) %s: slanting by %.3f\n", + DEBUG((DBG_TYPE1, "(t1) %s: slanting by %.3f\n", info->fontname, MDVI_FMAP_SLANT(&info->mapinfo))); - T1_SlantFont(info->t1id, + T1_SlantFont(info->t1id, MDVI_FMAP_SLANT(&info->mapinfo)); } if(info->mapinfo.extend) { DEBUG((DBG_TYPE1, "(t1) %s: extending by %.3f\n", info->fontname, MDVI_FMAP_EXTEND(&info->mapinfo))); - T1_ExtendFont(info->t1id, + T1_ExtendFont(info->t1id, MDVI_FMAP_EXTEND(&info->mapinfo)); - } + } } /* if this function is called, we really need this font */ @@ -257,7 +257,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info) * data for it */ info->tfminfo = mdvi_ps_get_metrics(info->fontname); if(info->tfminfo == NULL) { - DEBUG((DBG_FONTS, + DEBUG((DBG_FONTS, "(t1) %s: no metric data, font ignored\n", info->fontname)); goto t1_error; @@ -274,7 +274,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info) if(old && old->t1id != -1) { /* let's take advantage of T1lib's font sharing */ t1id = T1_CopyFont(old->t1id); - DEBUG((DBG_TYPE1, "(t1) %s -> %d (CopyFont)\n", + DEBUG((DBG_TYPE1, "(t1) %s -> %d (CopyFont)\n", info->fontname, t1id)); copied = 1; } else { @@ -287,7 +287,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info) goto t1_error; info->t1id = t1id; - /* + /* * a minor optimization: If the old font in the hash table has * not been loaded yet, replace it by this one, so we can use * CopyFont later. @@ -296,7 +296,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info) DEBUG((DBG_TYPE1, "(t1) font `%s' exchanged in hash table\n", info->fontname)); mdvi_hash_remove(&t1hash, (unsigned char *)old->fontname); - mdvi_hash_add(&t1hash, (unsigned char *)info->fontname, + mdvi_hash_add(&t1hash, (unsigned char *)info->fontname, info, MDVI_HASH_UNCHECKED); } @@ -323,7 +323,7 @@ static int t1_really_load_font(DviParams *params, DviFont *font, T1Info *info) /* get the scaled characters metrics */ get_tfm_chars(params, font, info->tfminfo, 0); info->hasmetrics = 1; - + DEBUG((DBG_TYPE1, "(t1) font `%s' really-loaded\n", info->fontname)); return 0; @@ -331,7 +331,7 @@ t1_error: /* some error does not allows us to use this font. We need to reset * the font structure, so the font system can try to read this * font in a different class */ - + /* first destroy the private data */ t1_font_remove(info); /* now reset all chars -- this is the important part */ @@ -365,7 +365,7 @@ static int init_t1lib(DviParams *params) mdvi_hash_init(&t1hash); DEBUG((DBG_TYPE1, "(t1) t1lib %s initialized -- resolution is (%d, %d), pad is %d bits\n", T1_GetLibIdent(), params->dpi, params->vdpi, T1_GetBitmapPad())); - t1lib_initialized = 1; + t1lib_initialized = 1; t1lib_xdpi = params->dpi; t1lib_ydpi = params->vdpi; return 0; @@ -375,7 +375,7 @@ static int t1_load_font(DviParams *params, DviFont *font) { T1Info *info; int i; - + if(t1lib_initialized < 0) return -1; else if(t1lib_initialized == 0 && init_t1lib(params) < 0) @@ -389,7 +389,7 @@ static int t1_load_font(DviParams *params, DviFont *font) info = xalloc(T1Info); - /* + /* * mark the font as `unregistered' with T1lib. It will * be added when we actually use it */ @@ -405,15 +405,15 @@ static int t1_load_font(DviParams *params, DviFont *font) info->mapinfo.extend = 0; info->mapinfo.slant = 0; info->encoding = NULL; - + /* create the hash table if we have not done so yet */ if(t1hash.nbucks == 0) mdvi_hash_create(&t1hash, T1_HASH_SIZE); - mdvi_hash_add(&t1hash, (unsigned char *) info->fontname, info, MDVI_HASH_UNIQUE); + mdvi_hash_add(&t1hash, (unsigned char *) info->fontname, info, MDVI_HASH_UNIQUE); listh_append(&t1fonts, LIST(info)); font->private = info; - + /* reset everything */ font->chars = xnalloc(DviFontChar, 256); font->loc = 0; @@ -426,7 +426,7 @@ static int t1_load_font(DviParams *params, DviFont *font) font->chars[i].shrunk.data = NULL; font->chars[i].grey.data = NULL; } - + return 0; } @@ -438,7 +438,7 @@ static int t1_load_font(DviParams *params, DviFont *font) static inline BITMAP *t1_glyph_bitmap(GLYPH *glyph) { int w, h, pad; - + w = GLYPH_WIDTH(glyph); h = GLYPH_HEIGHT(glyph); @@ -455,12 +455,12 @@ static void t1_font_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch GLYPH *glyph; T1Info *info; T1_TMATRIX matrix; - + info = (T1Info *)font->private; ASSERT(info != NULL); DEBUG((DBG_TYPE1, "(t1) shrinking glyph for character %d in `%s' (%d,%d)\n", - ch->code, font->fontname, ch->width, ch->height)); + ch->code, font->fontname, ch->width, ch->height)); size = (double)font->scale / (dvi->params.tfm_conv * 0x100000); size = 72.0 * size / 72.27; matrix.cxx = 1.0/(double)dvi->params.hshrink; @@ -477,7 +477,7 @@ static void t1_font_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch #ifndef NODEBUG if(DEBUGGING(BITMAP_DATA)) { - DEBUG((DBG_BITMAP_DATA, + DEBUG((DBG_BITMAP_DATA, "(t1) %s: t1_shrink_glyph(%d): (%dw,%dh,%dx,%dy) -> (%dw,%dh,%dx,%dy)\n", ch->glyph.w, ch->glyph.h, ch->glyph.x, ch->glyph.y, dest->w, dest->h, dest->x, dest->y)); @@ -497,11 +497,11 @@ static int t1_font_get_glyph(DviParams *params, DviFont *font, int code) double size; T1_TMATRIX matrix; int dpi; - + ASSERT(info != NULL); if(!info->hasmetrics && t1_really_load_font(params, font, info) < 0) return -1; - ch = FONTCHAR(font, code); + ch = FONTCHAR(font, code); if(!ch || !glyph_present(ch)) return -1; ch->loaded = 1; @@ -522,7 +522,7 @@ static int t1_font_get_glyph(DviParams *params, DviFont *font, int code) size = 72.0 * size / 72.27; dpi = Max(font->hdpi, font->vdpi); - /* we don't want the glyph to be cached twice (once by us, another by + /* we don't want the glyph to be cached twice (once by us, another by * T1lib), so we use an identity matrix to tell T1lib not to keep the * glyph around */ matrix.cxx = (double)font->hdpi / dpi; @@ -545,21 +545,21 @@ static int t1_font_get_glyph(DviParams *params, DviFont *font, int code) ch->glyph.w = GLYPH_WIDTH(glyph); ch->glyph.h = GLYPH_HEIGHT(glyph); - /* let's also fix the glyph's origin + /* let's also fix the glyph's origin * (which is not contained in the TFM) */ ch->x = ch->glyph.x; ch->y = ch->glyph.y; /* let's fix these too */ ch->width = ch->glyph.w; ch->height = ch->glyph.h; - + return 0; } static void t1_font_remove(T1Info *info) { T1Info *old; - + /* first remove it from our list */ listh_remove(&t1fonts, LIST(info)); @@ -567,13 +567,13 @@ static void t1_font_remove(T1Info *info) old = (T1Info *)mdvi_hash_lookup(&t1hash, (unsigned char *)info->fontname); if(old == info) { mdvi_hash_remove(&t1hash, (unsigned char *) info->fontname); - /* go through the list and see if there is another + /* go through the list and see if there is another * font with this name */ for(old = (T1Info *)t1fonts.head; old; old = old->next) if(STREQ(old->fontname, info->fontname)) break; if(old != NULL) - mdvi_hash_add(&t1hash, (unsigned char *) old->fontname, old, + mdvi_hash_add(&t1hash, (unsigned char *) old->fontname, old, MDVI_HASH_UNCHECKED); } /* release our encoding vector */ @@ -603,17 +603,17 @@ static void t1_free_data(DviFont *font) /* called after all the glyphs are destroyed */ if(font->private == NULL) { - /* this is perfectly normal, it just means the font has + /* this is perfectly normal, it just means the font has * not been requested by MDVI yet */ return; } - + /* destroy this data */ t1_font_remove((T1Info *)font->private); font->private = NULL; - /* + /* * if this is the last T1 font, reset the T1 library * It is important that we do this, because this is will be called * when the resolution or the magnification changes. diff --git a/backend/dvi/mdvi-lib/tfm.c b/backend/dvi/mdvi-lib/tfm.c index f37de0be..f87140d2 100644 --- a/backend/dvi/mdvi-lib/tfm.c +++ b/backend/dvi/mdvi-lib/tfm.c @@ -74,7 +74,7 @@ DviFontInfo afm_font_info = { #define TYPENAME(font) \ ((font)->search.info ? (font)->search.info : "none") -/* +/* * Although it does not seem that way, this conversion is independent of the * shrinking factors, within roundoff (that's because `conv' and `vconv' * have already been scaled by hshrink and vshrink, repsectively). We @@ -91,14 +91,14 @@ int get_tfm_chars(DviParams *params, DviFont *font, TFMInfo *info, int loaded) int n; DviFontChar *ch; TFMChar *ptr; - + n = info->hic - info->loc + 1; if(n != FONT_GLYPH_COUNT(font)) { font->chars = mdvi_realloc(font->chars, n * sizeof(DviFontChar)); } font->loc = info->loc; - font->hic = info->hic; + font->hic = info->hic; ch = font->chars; ptr = info->chars; @@ -120,14 +120,14 @@ int get_tfm_chars(DviParams *params, DviFont *font, TFMInfo *info, int loaded) c = TFMSCALE(z, ptr->height, alpha, beta); d = TFMSCALE(z, ptr->depth, alpha, beta); - /* now convert to unscaled pixels */ + /* now convert to unscaled pixels */ ch->width = XCONV(b - a); ch->height = YCONV(c - d); if(ch->height < 0) ch->height = -ch->height; ch->x = XCONV(a); ch->y = YCONV(c); /* - * the offset is not used, but we might as well set it to + * the offset is not used, but we might as well set it to * something meaningful (and it MUST be non-zero) */ ch->flags = 0; @@ -173,10 +173,10 @@ static int tfm_load_font(DviParams *params, DviFont *font) tfm = get_font_metrics(font->fontname, type, font->filename); if(tfm == NULL) return -1; - + if(tfm->checksum && font->checksum && tfm->checksum != font->checksum) { mdvi_warning(_("%s: Checksum mismatch (got %u, expected %u)\n"), - font->fontname, (unsigned)tfm->checksum, + font->fontname, (unsigned)tfm->checksum, (unsigned)font->checksum); } font->checksum = tfm->checksum; @@ -185,17 +185,17 @@ static int tfm_load_font(DviParams *params, DviFont *font) font->hic = 0; font->chars = NULL; get_tfm_chars(params, font, tfm, 1); - + /* free everything */ free_font_metrics(tfm); - + return 0; } static int tfm_font_get_glyph(DviParams *params, DviFont *font, int code) { DviFontChar *ch; - + ch = FONTCHAR(font, code); if(!glyph_present(ch)) return -1; @@ -203,9 +203,9 @@ static int tfm_font_get_glyph(DviParams *params, DviFont *font, int code) ch->glyph.y = ch->y; ch->glyph.w = ch->width; ch->glyph.h = ch->height; - /* + /* * This has two purposes: (1) avoid unnecessary calls to this function, - * and (2) detect when the glyph data for a TFM font is actually used + * and (2) detect when the glyph data for a TFM font is actually used * (we'll get a SEGV). Any occurrence of that is a bug. */ ch->glyph.data = MDVI_GLYPH_EMPTY; diff --git a/backend/dvi/mdvi-lib/tfmfile.c b/backend/dvi/mdvi-lib/tfmfile.c index c23d9fe0..f7ba251f 100644 --- a/backend/dvi/mdvi-lib/tfmfile.c +++ b/backend/dvi/mdvi-lib/tfmfile.c @@ -51,7 +51,7 @@ static DviHashTable tfmhash; static inline void swap_array(Uint32 *ptr, int n) { Uint32 i; - + while(n-- > 0) { i = *ptr; *ptr++ = ((i & 0xff000000) >> 24) @@ -80,7 +80,7 @@ int afm_load_file(const char *filename, TFMInfo *info) int status; CharMetricInfo *cm; FILE *in; - + in = fopen(filename, "rb"); if(in == NULL) return -1; @@ -91,7 +91,7 @@ int afm_load_file(const char *filename, TFMInfo *info) mdvi_error(_("%s: Error reading AFM data\n"), filename); return -1; } - + /* aim high */ info->chars = xnalloc(TFMChar, 256); info->loc = 256; @@ -106,7 +106,7 @@ int afm_load_file(const char *filename, TFMInfo *info) for(cm = fi->cmi; cm < fi->cmi + fi->numOfChars; cm++) { int code; TFMChar *ch; - + code = cm->code; if(code < 0 || code > 255) continue; /* ignore it */ @@ -179,7 +179,7 @@ int tfm_load_file(const char *filename, TFMInfo *info) /* allocate a word-aligned buffer to hold the file */ size = 4 * ROUND(st.st_size, 4); if(size != st.st_size) - mdvi_warning(_("Warning: TFM file `%s' has suspicious size\n"), + mdvi_warning(_("Warning: TFM file `%s' has suspicious size\n"), filename); tfm = (Uchar *)mdvi_malloc(size); if(fread(tfm, st.st_size, 1, in) != 1) @@ -190,12 +190,12 @@ int tfm_load_file(const char *filename, TFMInfo *info) /* not a checksum, but serves a similar purpose */ checksum = 0; - + ptr = tfm; /* get the counters */ lf = muget2(ptr); lh = muget2(ptr); checksum += 6 + lh; - bc = muget2(ptr); + bc = muget2(ptr); ec = muget2(ptr); checksum += ec - bc + 1; nw = muget2(ptr); checksum += nw; nh = muget2(ptr); checksum += nh; @@ -213,7 +213,7 @@ int tfm_load_file(const char *filename, TFMInfo *info) heights = cb; cb += nh; depths = cb; - if(widths[0] || heights[0] || depths[0] || + if(widths[0] || heights[0] || depths[0] || checksum != lf || bc - 1 > ec || ec > 255 || ne > 256) goto bad_tfm; @@ -250,7 +250,7 @@ int tfm_load_file(const char *filename, TFMInfo *info) ptr += n; } /* now we don't read from `ptr' anymore */ - + info->loc = bc; info->hic = ec; info->type = DviFontTFM; @@ -285,7 +285,7 @@ int tfm_load_file(const char *filename, TFMInfo *info) /* free everything */ mdvi_free(tfm); - + return 0; bad_tfm: @@ -293,7 +293,7 @@ bad_tfm: error: if(tfm) mdvi_free(tfm); if(in) fclose(in); - return -1; + return -1; } static int ofm1_load_file(FILE *in, TFMInfo *info) @@ -309,7 +309,7 @@ static int ofm1_load_file(FILE *in, TFMInfo *info) Int32 *depths; TFMChar *tch; TFMChar *end; - + lh = fuget4(in); bc = fuget4(in); ec = fuget4(in); @@ -355,16 +355,16 @@ static int ofm1_load_file(FILE *in, TFMInfo *info) /* jump to the beginning of the char-info table */ fseek(in, 4L*nco, SEEK_SET); - size = ec - bc + 1; + size = ec - bc + 1; info->loc = bc; info->hic = ec; info->chars = xnalloc(TFMChar, size); end = info->chars + size; - + for(tch = info->chars, i = 0; i < ncw; i++) { TFMChar ch; int nr; - + /* in the characters we store the actual indices */ ch.advance = fuget2(in); ch.height = fuget1(in); @@ -383,7 +383,7 @@ static int ofm1_load_file(FILE *in, TFMInfo *info) memcpy(tch++, &ch, sizeof(TFMChar)); if(tch == end) goto bad_tfm; - } + } /* I wish we were done, but we aren't */ @@ -406,7 +406,7 @@ static int ofm1_load_file(FILE *in, TFMInfo *info) if(widths[0] || heights[0] || depths[0]) goto bad_tfm; - + /* now fix the characters */ size = ec - bc + 1; for(tch = info->chars; tch < end; tch++) { @@ -451,7 +451,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info) /* not a checksum, but serves a similar purpose */ checksum = 0; - + /* get the counters */ /* get file level */ olevel = fsget2(in); @@ -459,7 +459,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info) goto bad_tfm; olevel = fsget2(in); if(olevel != 0) { - DEBUG((DBG_FONTS, "(mt) reading Level-1 OFM file `%s'\n", + DEBUG((DBG_FONTS, "(mt) reading Level-1 OFM file `%s'\n", filename)); /* we handle level-1 files separately */ if(ofm1_load_file(in, info) < 0) @@ -471,7 +471,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info) nwords = 14; lf = fuget4(in); checksum = nwords; lh = fuget4(in); checksum += lh; - bc = fuget4(in); + bc = fuget4(in); ec = fuget4(in); checksum += 2 * (ec - bc + 1); nw = fuget4(in); checksum += nw; nh = fuget4(in); checksum += nh; @@ -482,7 +482,7 @@ static int ofm_load_file(const char *filename, TFMInfo *info) checksum += 2*fuget4(in); /* skip extensible recipe count */ checksum += fuget4(in); /* skip # of font parameters */ - /* I have found several .ofm files that seem to have the + /* I have found several .ofm files that seem to have the * font-direction word missing, so we try to detect that here */ if(checksum == lf + 1) { DEBUG((DBG_FONTS, "(mt) font direction missing in `%s'\n", @@ -553,12 +553,12 @@ static int ofm_load_file(const char *filename, TFMInfo *info) } /* from this point on, no error checking is done */ - + /* we don't need this anymore */ fclose(in); /* now we don't read from `ptr' anymore */ - + info->loc = bc; info->hic = ec; info->type = DviFontTFM; @@ -589,13 +589,13 @@ static int ofm_load_file(const char *filename, TFMInfo *info) bad_tfm: mdvi_error(_("%s: File corrupted, or not a TFM file\n"), filename); fclose(in); - return -1; + return -1; } char *lookup_font_metrics(const char *name, int *type) { char *file; - + switch(*type) { #ifndef WITH_AFM_FILES case DviFontAny: @@ -617,7 +617,7 @@ char *lookup_font_metrics(const char *name, int *type) #ifdef WITH_AFM_FILES case DviFontAFM: file = kpse_find_file(name, kpse_afm_format, 0); - break; + break; case DviFontAny: file = kpse_find_file(name, kpse_afm_format, 0); *type = DviFontAFM; @@ -634,8 +634,8 @@ char *lookup_font_metrics(const char *name, int *type) return file; } -/* - * The next two functions are just wrappers for the font metric loaders, +/* + * The next two functions are just wrappers for the font metric loaders, * and use the pool of TFM data */ @@ -652,9 +652,9 @@ TFMInfo *get_font_metrics(const char *short_name, int type, const char *filename TFMPool *tfm = NULL; int status; char *file; - + if(tfmpool.count) { - tfm = (TFMPool *)mdvi_hash_lookup(&tfmhash, + tfm = (TFMPool *)mdvi_hash_lookup(&tfmhash, MDVI_KEY(short_name)); if(tfm != NULL) { DEBUG((DBG_FONTS, "(mt) reusing metric file `%s' (%d links)\n", @@ -693,11 +693,11 @@ TFMInfo *get_font_metrics(const char *short_name, int type, const char *filename return NULL; } tfm->short_name = mdvi_strdup(short_name); - + /* add it to the pool */ if(tfmpool.count == 0) mdvi_hash_create(&tfmhash, TFM_HASH_SIZE); - mdvi_hash_add(&tfmhash, MDVI_KEY(tfm->short_name), + mdvi_hash_add(&tfmhash, MDVI_KEY(tfm->short_name), tfm, MDVI_HASH_UNCHECKED); listh_prepend(&tfmpool, LIST(tfm)); tfm->links = 1; @@ -719,7 +719,7 @@ void free_font_metrics(TFMInfo *info) if(tfm == NULL) return; if(--tfm->links > 0) { - DEBUG((DBG_FONTS, "(mt) %s not removed, still in use\n", + DEBUG((DBG_FONTS, "(mt) %s not removed, still in use\n", tfm->short_name)); return; } @@ -729,16 +729,16 @@ void free_font_metrics(TFMInfo *info) listh_remove(&tfmpool, LIST(tfm)); mdvi_free(tfm->short_name); mdvi_free(tfm->tfminfo.chars); - mdvi_free(tfm); + mdvi_free(tfm); } void flush_font_metrics(void) { TFMPool *ptr; - + for(; (ptr = (TFMPool *)tfmpool.head); ) { tfmpool.head = LIST(ptr->next); - + mdvi_free(ptr->short_name); mdvi_free(ptr->tfminfo.chars); mdvi_free(ptr); diff --git a/backend/dvi/mdvi-lib/tt.c b/backend/dvi/mdvi-lib/tt.c index e85d8e70..28ce3204 100644 --- a/backend/dvi/mdvi-lib/tt.c +++ b/backend/dvi/mdvi-lib/tt.c @@ -51,7 +51,7 @@ static int tt_load_font __PROTO((DviParams *, DviFont *)); static int tt_font_get_glyph __PROTO((DviParams *, DviFont *, int)); static void tt_free_data __PROTO((DviFont *)); static void tt_reset_font __PROTO((DviFont *)); -static void tt_shrink_glyph +static void tt_shrink_glyph __PROTO((DviContext *, DviFont *, DviFontChar *, DviGlyph *)); static void tt_font_remove __PROTO((FTInfo *)); @@ -97,14 +97,14 @@ static void tt_encode_font(DviFont *font, FTInfo *info) { TT_Face_Properties prop; int i; - + if(TT_Get_Face_Properties(info->face, &prop)) return; - + for(i = 0; i < prop.num_Glyphs; i++) { char *string; int ndx; - + if(TT_Get_PS_Name(info->face, i, &string)) continue; ndx = mdvi_encode_glyph(info->encoding, string); @@ -127,9 +127,9 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) TT_CharMap cmap; TT_Face_Properties props; int map_found; - + DEBUG((DBG_TT, "(tt) really_load_font(%s)\n", info->fontname)); - + /* get the point size */ point_size = (double)font->scale / (params->tfm_conv * 0x100000); point_size = 72.0 * point_size / 72.27; @@ -142,7 +142,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) info->hasmetrics = 1; return 0; } - + /* load the face */ DEBUG((DBG_TT, "(tt) loading new face `%s'\n", info->fontname)); @@ -152,11 +152,11 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) info->fontname, TT_ErrToString18(status)); return -1; } - + /* create a new instance of this face */ status = TT_New_Instance(info->face, &info->instance); if(status) { - mdvi_warning(_("(tt) %s: could not create face: %s\n"), + mdvi_warning(_("(tt) %s: could not create face: %s\n"), info->fontname, TT_ErrToString18(status)); TT_Close_Face(info->face); return -1; @@ -165,12 +165,12 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) /* create a glyph */ status = TT_New_Glyph(info->face, &info->glyph); if(status) { - mdvi_warning(_("(tt) %s: could not create glyph: %s\n"), + mdvi_warning(_("(tt) %s: could not create glyph: %s\n"), info->fontname, TT_ErrToString18(status)); goto tt_error; } - /* + /* * We'll try to find a Unicode charmap. It's not that important that we * actually find one, especially if the fontmap files are installed * properly, but it's good to have some predefined behaviour @@ -180,14 +180,14 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) map_found = -1; for(i = 0; map_found < 0 && i < props.num_CharMaps; i++) { TT_UShort pid, eid; - + TT_Get_CharMap_ID(info->face, i, &pid, &eid); switch(pid) { case TT_PLATFORM_APPLE_UNICODE: map_found = i; break; case TT_PLATFORM_ISO: - if(eid == TT_ISO_ID_7BIT_ASCII || + if(eid == TT_ISO_ID_7BIT_ASCII || eid == TT_ISO_ID_8859_1) map_found = 1; break; @@ -205,7 +205,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) DEBUG((DBG_TT, "(tt) %s: using charmap #%d\n", info->fontname, map_found)); TT_Get_CharMap(info->face, map_found, &cmap); - + DEBUG((DBG_TT, "(tt) %s: Set_Char_Size(%.2f, %d, %d)\n", font->fontname, point_size, font->hdpi, font->vdpi)); status = TT_Set_Instance_Resolutions(info->instance, @@ -215,7 +215,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) info->fontname, TT_ErrToString18(status)); goto tt_error; } - status = TT_Set_Instance_CharSize(info->instance, + status = TT_Set_Instance_CharSize(info->instance, FROUND(point_size * 64)); if(status) { error(_("(tt) %s: could not set point size: %s\n"), @@ -234,7 +234,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) if(info->encoding != NULL) { TT_Post post; - + status = TT_Load_PS_Names(info->face, &post); if(status) { mdvi_warning(_("(tt) %s: could not load PS name table\n"), @@ -245,7 +245,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) } /* get the metrics. If this fails, it's not fatal, but certainly bad */ - info->tfminfo = get_font_metrics(info->fontname, + info->tfminfo = get_font_metrics(info->fontname, info->fmftype, info->fmfname); if(info->tfminfo == NULL) { @@ -269,7 +269,7 @@ static int tt_really_load_font(DviParams *params, DviFont *font, FTInfo *info) font->chars[i - font->loc].code = TT_Char_Index(cmap, i); } - info->loaded = 1; + info->loaded = 1; info->hasmetrics = 1; return 0; @@ -285,10 +285,10 @@ static int tt_load_font(DviParams *params, DviFont *font) { int i; FTInfo *info; - + if(!initialized && init_freetype() < 0) return -1; - + if(font->in != NULL) { fclose(font->in); font->in = NULL; @@ -297,7 +297,7 @@ static int tt_load_font(DviParams *params, DviFont *font) info = xalloc(FTInfo); memzero(info, sizeof(FTInfo)); - info->fmftype = DviFontAny; /* any metrics type will do */ + info->fmftype = DviFontAny; /* any metrics type will do */ info->fmfname = lookup_font_metrics(font->fontname, &info->fmftype); info->fontname = font->fontname; info->hasmetrics = 0; @@ -320,17 +320,17 @@ static int tt_load_font(DviParams *params, DviFont *font) font->chars[i].shrunk.data = NULL; font->chars[i].grey.data = NULL; } - + if(info->fmfname == NULL) mdvi_warning(_("(tt) %s: no font metric data\n"), font->fontname); - + listh_append(&ttfonts, LIST(info)); font->private = info; return 0; } -static int tt_get_bitmap(DviParams *params, DviFont *font, +static int tt_get_bitmap(DviParams *params, DviFont *font, int code, double xscale, double yscale, DviGlyph *glyph) { TT_Outline outline; @@ -379,18 +379,18 @@ static int tt_get_bitmap(DviParams *params, DviFont *font, raster.size = h * raster.cols; raster.flow = TT_Flow_Down; raster.bitmap = mdvi_calloc(h, raster.cols); - + TT_Translate_Outline(&outline, -bbox.xMin, -bbox.yMin); TT_Get_Outline_Bitmap(tt_handle, &outline, &raster); glyph->data = bitmap_convert_msb8(raster.bitmap, w, h, ROUND(w, 8)); TT_Done_Outline(&outline); mdvi_free(raster.bitmap); - + return 0; tt_error: if(have_outline) TT_Done_Outline(&outline); - return -1; + return -1; } static int tt_font_get_glyph(DviParams *params, DviFont *font, int code) @@ -400,7 +400,7 @@ static int tt_font_get_glyph(DviParams *params, DviFont *font, int code) int error; double xs, ys; int dpi; - + ASSERT(info != NULL); if(!info->hasmetrics && tt_really_load_font(params, font, info) < 0) return -1; @@ -420,11 +420,11 @@ static int tt_font_get_glyph(DviParams *params, DviFont *font, int code) (double)font->hdpi / dpi, (double)font->vdpi / dpi, &ch->glyph); - if(error) + if(error) goto missing; ch->x = ch->glyph.x; ch->y = ch->glyph.y; - + return 0; missing: @@ -452,10 +452,10 @@ static void tt_shrink_glyph(DviContext *dvi, DviFont *font, DviFontChar *ch, Dvi static void tt_reset_font(DviFont *font) { FTInfo *info = (FTInfo *)font->private; - + if(info == NULL) return; - info->hasmetrics = 0; + info->hasmetrics = 0; } static void tt_font_remove(FTInfo *info) @@ -483,7 +483,7 @@ static void tt_free_data(DviFont *font) { if(font->private == NULL) return; - + tt_font_remove((FTInfo *)font->private); if(initialized && ttfonts.count == 0) { DEBUG((DBG_TT, "(tt) last font removed -- closing FreeType\n")); diff --git a/backend/dvi/mdvi-lib/util.c b/backend/dvi/mdvi-lib/util.c index 349d273a..15b53f13 100644 --- a/backend/dvi/mdvi-lib/util.c +++ b/backend/dvi/mdvi-lib/util.c @@ -85,7 +85,7 @@ int mdvi_set_logstream(FILE *file) int mdvi_set_loglevel(int level) { int old = _mdvi_log_level; - + _mdvi_log_level = level; return old; } @@ -96,7 +96,7 @@ Uint32 _mdvi_debug_mask = 0; void __debug(int mask, const char *format, ...) { va_list ap; - + va_start(ap, format); if(_mdvi_debug_mask & mask) { if(!DEBUGGING(SILENT)) { @@ -118,7 +118,7 @@ void __debug(int mask, const char *format, ...) void mdvi_message(const char *format, ...) { va_list ap; - + va_start(ap, format); if(_mdvi_log_level >= LOG_INFO) { fprintf(stderr, "%s: ", program_name); @@ -135,10 +135,10 @@ void mdvi_message(const char *format, ...) void mdvi_crash(const char *format, ...) { va_list ap; - + va_start(ap, format); - fprintf(stderr, "%s: %s: ", - program_name, + fprintf(stderr, "%s: %s: ", + program_name, gettext(messages[(int)time(NULL) % NMSGS])); vfprintf(stderr, format, ap); #ifndef __GNUC__ @@ -154,7 +154,7 @@ void mdvi_crash(const char *format, ...) void mdvi_error(const char *format, ...) { va_list ap; - + va_start(ap, format); fprintf(stderr, _("%s: Error: "), program_name); vfprintf(stderr, format, ap); @@ -170,7 +170,7 @@ void mdvi_error(const char *format, ...) void mdvi_warning(const char *format, ...) { va_list ap; - + va_start(ap, format); fprintf(stderr, _("%s: Warning: "), program_name); vfprintf(stderr, format, ap); @@ -186,7 +186,7 @@ void mdvi_warning(const char *format, ...) void mdvi_fatal(const char *format, ...) { va_list ap; - + va_start(ap, format); fprintf(stderr, _("%s: Fatal: "), program_name); vfprintf(stderr, format, ap); @@ -207,7 +207,7 @@ void mdvi_fatal(const char *format, ...) void *mdvi_malloc(size_t nelems) { void *ptr = malloc(nelems); - + if(ptr == NULL) mdvi_fatal(_("out of memory allocating %u bytes\n"), (unsigned)nelems); @@ -217,19 +217,19 @@ void *mdvi_malloc(size_t nelems) void *mdvi_realloc(void *data, size_t newsize) { void *ptr; - + if(newsize == 0) mdvi_crash(_("attempted to reallocate with zero size\n")); ptr = realloc(data, newsize); if(ptr == NULL) mdvi_fatal(_("failed to reallocate %u bytes\n"), (unsigned)newsize); - return ptr; + return ptr; } void *mdvi_calloc(size_t nmemb, size_t size) { void *ptr; - + if(nmemb == 0) mdvi_crash(_("attempted to callocate 0 members\n")); if(size == 0) @@ -253,7 +253,7 @@ char *mdvi_strdup(const char *string) { int length; char *ptr; - + length = strlen(string) + 1; ptr = (char *)mdvi_malloc(length); memcpy(ptr, string, length); @@ -272,7 +272,7 @@ char *mdvi_strndup(const char *string, size_t length) { int n; char *ptr; - + n = strlen(string); if(n > length) n = length; @@ -284,7 +284,7 @@ char *mdvi_strndup(const char *string, size_t length) void *mdvi_memdup(const void *data, size_t length) { void *ptr = mdvi_malloc(length); - + memcpy(ptr, data, length); return ptr; } @@ -339,7 +339,7 @@ char *mdvi_build_path_from_cwd (const char *path) buf = mdvi_realloc (buf, strlen (buf) + strlen (path) + 2); strcat (buf, "/"); strncat (buf, path, strlen (path)); - + return buf; } @@ -349,9 +349,9 @@ double unit2pix_factor(const char *spec) double factor; const char *p, *q; static const char *units = "incmmmmtptpcddccspbpftydcs"; - + val = 0.0; - + for(p = spec; *p >= '0' && *p <= '9'; p++) val = 10.0 * val + (double)(*p - '0'); if(*p == '.') { @@ -389,14 +389,14 @@ double unit2pix_factor(const char *spec) int unit2pix(int dpi, const char *spec) { double factor = unit2pix_factor(spec); - + return (int)(factor * dpi + 0.5); } Ulong get_mtime(int fd) { struct stat st; - + if(fstat(fd, &st) == 0) return (Ulong)st.st_mtime; return 0; @@ -419,7 +419,7 @@ char *getword(char *string, const char *delim, char **end) { char *ptr; char *word; - + /* skip leading delimiters */ for(ptr = string; *ptr && strchr(delim, *ptr); ptr++); @@ -438,10 +438,10 @@ char *getstring(char *string, const char *delim, char **end) char *ptr; char *word; int quoted = 0; - + /* skip leading delimiters */ for(ptr = string; *ptr && strchr(delim, *ptr); ptr++); - + if(ptr == NULL) return NULL; quoted = (*ptr == '"'); @@ -456,7 +456,7 @@ char *getstring(char *string, const char *delim, char **end) static long pow2(size_t n) { long x = 8; /* don't bother allocating less than this */ - + while(x < n) x <<= 1L; return x; @@ -487,7 +487,7 @@ int dstring_append(Dstring *dstr, const char *string, int len) dstr->data = mdvi_malloc(8); dstr->data[0] = 0; } - + return dstr->length; } diff --git a/backend/dvi/mdvi-lib/vf.c b/backend/dvi/mdvi-lib/vf.c index a5ae3bbe..5fa5e451 100644 --- a/backend/dvi/mdvi-lib/vf.c +++ b/backend/dvi/mdvi-lib/vf.c @@ -68,11 +68,11 @@ static int vf_load_font(DviParams *params, DviFont *font) int nchars; int loc, hic; DviFontRef *last; - + macros = NULL; msize = mlen = 0; p = font->in; - + if(fuget1(p) != 247 || fuget1(p) != 202) goto badvf; mlen = fuget1(p); @@ -84,14 +84,14 @@ static int vf_load_font(DviParams *params, DviFont *font) } else if(!font->checksum) font->checksum = checksum; font->design = fuget4(p); - + /* read all the fonts in the preamble */ last = NULL; /* initialize alpha, beta and z for TFM width computation */ TFMPREPARE(font->scale, z, alpha, beta); - op = fuget1(p); + op = fuget1(p); while(op >= DVI_FNT_DEF1 && op <= DVI_FNT_DEF4) { DviFontRef *ref; Int32 scale, design; @@ -101,9 +101,9 @@ static int vf_load_font(DviParams *params, DviFont *font) int hdpi; int vdpi; char *name; - + /* process fnt_def commands */ - + id = fugetn(p, op - DVI_FNT_DEF1 + 1); checksum = fuget4(p); scale = fuget4(p); @@ -121,13 +121,13 @@ static int vf_load_font(DviParams *params, DviFont *font) fread(name, 1, n, p); name[n] = 0; DEBUG((DBG_FONTS, "(vf) %s: defined font `%s' at %.1fpt (%dx%d dpi)\n", - font->fontname, name, + font->fontname, name, (double)scale / (params->tfm_conv * 0x100000), hdpi, vdpi)); /* get the font */ ref = font_reference(params, id, name, checksum, hdpi, vdpi, scale); if(ref == NULL) { - mdvi_error(_("(vf) %s: could not load font `%s'\n"), + mdvi_error(_("(vf) %s: could not load font `%s'\n"), font->fontname, name); goto error; } @@ -139,12 +139,12 @@ static int vf_load_font(DviParams *params, DviFont *font) ref->next = NULL; op = fuget1(p); } - + if(op >= DVI_FNT_DEF1 && op <= DVI_FNT_DEF4) goto error; /* This function correctly reads both .vf and .ovf files */ - + font->chars = xnalloc(DviFontChar, 256); for(i = 0; i < 256; i++) font->chars[i].offset = 0; @@ -155,7 +155,7 @@ static int vf_load_font(DviParams *params, DviFont *font) int pl; Int32 cc; Int32 tfm; - + if(op == 242) { pl = fuget4(p); cc = fuget4(p); @@ -176,7 +176,7 @@ static int vf_load_font(DviParams *params, DviFont *font) if(hic < 0 || cc > hic) hic = cc; if(cc >= nchars) { - font->chars = xresize(font->chars, + font->chars = xresize(font->chars, DviFontChar, cc + 16); for(i = nchars; i < cc + 16; i++) font->chars[i].offset = 0; @@ -187,7 +187,7 @@ static int vf_load_font(DviParams *params, DviFont *font) font->fontname, cc); goto error; } - + DEBUG((DBG_GLYPHS, "(vf) %s: defined character %d (macro length %d)\n", font->fontname, cc, pl)); font->chars[cc].width = pl + 1; @@ -215,8 +215,8 @@ static int vf_load_font(DviParams *params, DviFont *font) macros = xresize(macros, Uchar, mlen); msize = mlen; } - - DEBUG((DBG_FONTS|DBG_GLYPHS, + + DEBUG((DBG_FONTS|DBG_GLYPHS, "(vf) %s: macros use %d bytes\n", font->fontname, msize)); if(loc > 0 || hic < nchars-1) { @@ -230,7 +230,7 @@ static int vf_load_font(DviParams *params, DviFont *font) font->private = macros; return 0; - + badvf: mdvi_error(_("%s: File corrupted, or not a VF file.\n"), font->fontname); error: @@ -243,5 +243,5 @@ error: static void vf_free_macros(DviFont *font) { - mdvi_free(font->private); + mdvi_free(font->private); } diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c index c0fa275b..a45fe935 100644 --- a/backend/epub/epub-document.c +++ b/backend/epub/epub-document.c @@ -41,13 +41,13 @@ /*For strcasestr(),strstr()*/ #include <string.h> -typedef enum _xmlParseReturnType +typedef enum _xmlParseReturnType { XML_ATTRIBUTE, XML_KEYWORD }xmlParseReturnType; -typedef struct _contentListNode { +typedef struct _contentListNode { gchar* key ; gchar* value ; gint index ; @@ -87,7 +87,7 @@ struct _EpubDocument }; static void epub_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface); -static void epub_document_document_find_iface_init (EvDocumentFindInterface *iface); +static void epub_document_document_find_iface_init (EvDocumentFindInterface *iface); static void epub_document_document_links_iface_init (EvDocumentLinksInterface *iface); EV_BACKEND_REGISTER_WITH_CODE (EpubDocument, epub_document, @@ -108,10 +108,10 @@ epub_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, gint *height) { gdouble page_width, page_height; - + page_width = 800; page_height = 1080; - + *width = MAX ((gint)(page_width * rc->scale + 0.5), 1); *height = MAX ((gint)(page_height * rc->scale + 0.5), 1); } @@ -150,7 +150,7 @@ in_tag(const char* found) return TRUE; } -static int +static int get_substr_count(const char * haystack,const char *needle,gboolean case_sensitive) { const char* tmp = haystack ; @@ -180,7 +180,7 @@ epub_document_check_hits(EvDocumentFind *document_find, gboolean case_sensitive) { gchar *filepath = g_filename_from_uri((gchar*)page->backend_page,NULL,NULL); - htmlDocPtr htmldoc = xmlParseFile(filepath); + htmlDocPtr htmldoc = xmlParseFile(filepath); htmlNodePtr htmltag = xmlDocGetRootElement(htmldoc); int count=0; htmlNodePtr bodytag = htmltag->xmlChildrenNode; @@ -188,12 +188,12 @@ epub_document_check_hits(EvDocumentFind *document_find, while ( xmlStrcmp(bodytag->name,(xmlChar*)"body") ) { bodytag = bodytag->next; } - + xmlBufferPtr bodybuffer = xmlBufferCreate(); xmlNodeDump(bodybuffer,htmldoc,bodytag,0,1); count = get_substr_count((char*)bodybuffer->content,text,case_sensitive); - + xmlBufferFree(bodybuffer); xmlFreeDoc(htmldoc); g_free (filepath); @@ -234,7 +234,7 @@ epub_document_make_tree_entry(linknode* ListData,LinksCBStruct* UserData) else { expand=FALSE; } - + EvLinkDest *ev_dest = NULL; EvLinkAction *ev_action; @@ -249,14 +249,14 @@ epub_document_make_tree_entry(linknode* ListData,LinksCBStruct* UserData) else { ev_dest = ev_link_dest_new_hlink((gchar*)ListData->pagelink,ListData->page); } - + ev_action = ev_link_action_new_dest (ev_dest); link = ev_link_new((gchar*)ListData->linktext,ev_action); gtk_tree_store_append (GTK_TREE_STORE (UserData->model), &tree_iter,(UserData->parent)); title_markup = g_strdup((gchar*)ListData->linktext); - + gtk_tree_store_set (GTK_TREE_STORE (UserData->model), &tree_iter, EV_DOCUMENT_LINKS_COLUMN_MARKUP, title_markup, EV_DOCUMENT_LINKS_COLUMN_LINK, link, @@ -269,20 +269,20 @@ epub_document_make_tree_entry(linknode* ListData,LinksCBStruct* UserData) cbstruct.model = UserData->model; g_list_foreach (ListData->children,(GFunc)epub_document_make_tree_entry,&cbstruct); } - + g_free (title_markup); - g_object_unref (link); + g_object_unref (link); } static GtkTreeModel * -epub_document_links_get_links_model(EvDocumentLinks *document_links) +epub_document_links_get_links_model(EvDocumentLinks *document_links) { GtkTreeModel *model = NULL; g_return_val_if_fail (EPUB_IS_DOCUMENT (document_links), NULL); - + EpubDocument *epub_document = EPUB_DOCUMENT(document_links); - + model = (GtkTreeModel*) gtk_tree_store_new (EV_DOCUMENT_LINKS_COLUMN_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_OBJECT, @@ -296,9 +296,9 @@ epub_document_links_get_links_model(EvDocumentLinks *document_links) GtkTreeIter parent; linkStruct.parent = &parent; - + gtk_tree_store_append (GTK_TREE_STORE (model), &parent,NULL); - + gtk_tree_store_set (GTK_TREE_STORE (model), &parent, EV_DOCUMENT_LINKS_COLUMN_MARKUP, epub_document->docTitle, EV_DOCUMENT_LINKS_COLUMN_LINK, link, @@ -306,11 +306,11 @@ epub_document_links_get_links_model(EvDocumentLinks *document_links) -1); g_object_unref(link); - + if (epub_document->index) { g_list_foreach (epub_document->index,(GFunc)epub_document_make_tree_entry,&linkStruct); } - + return model; } @@ -332,7 +332,7 @@ epub_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *ifa } static void -epub_document_document_find_iface_init (EvDocumentFindInterface *iface) +epub_document_document_find_iface_init (EvDocumentFindInterface *iface) { iface->check_for_hits = epub_document_check_hits; } @@ -341,7 +341,7 @@ static void epub_document_document_links_iface_init(EvDocumentLinksInterface *iface) { iface->has_document_links = epub_document_links_has_document_links; - iface->get_links_model = epub_document_links_get_links_model; + iface->get_links_model = epub_document_links_get_links_model; iface->get_links = epub_document_links_get_links; } @@ -361,35 +361,35 @@ epub_document_save (EvDocument *document, static int epub_document_get_n_pages (EvDocument *document) -{ +{ EpubDocument *epub_document = EPUB_DOCUMENT (document); if (epub_document-> contentList == NULL) return 0; - + return g_list_length(epub_document->contentList); } /** - * epub_remove_temporary_dir : Removes a directory recursively. + * epub_remove_temporary_dir : Removes a directory recursively. * This function is same as comics_remove_temporary_dir * Returns: * 0 if it was successfully deleted, - * -1 if an error occurred + * -1 if an error occurred */ -static int -epub_remove_temporary_dir (gchar *path_name) +static int +epub_remove_temporary_dir (gchar *path_name) { GDir *content_dir; const gchar *filename; gchar *filename_with_path; - + if (g_file_test (path_name, G_FILE_TEST_IS_DIR)) { content_dir = g_dir_open (path_name, 0, NULL); filename = g_dir_read_name (content_dir); while (filename) { - filename_with_path = - g_build_filename (path_name, + filename_with_path = + g_build_filename (path_name, filename, NULL); epub_remove_temporary_dir (filename_with_path); g_free (filename_with_path); @@ -397,8 +397,8 @@ epub_remove_temporary_dir (gchar *path_name) } g_dir_close (content_dir); } - /* Note from g_remove() documentation: on Windows, it is in general not - * possible to remove a file that is open to some process, or mapped + /* Note from g_remove() documentation: on Windows, it is in general not + * possible to remove a file that is open to some process, or mapped * into memory.*/ return (g_remove (path_name)); } @@ -408,33 +408,33 @@ static gboolean check_mime_type (const gchar* uri, GError** error); -static gboolean +static gboolean open_xml_document (const gchar* filename); -static gboolean +static gboolean set_xml_root_node (xmlChar* rootname); static xmlNodePtr xml_get_pointer_to_node (xmlChar* parserfor, xmlChar* attributename, xmlChar* attributevalue); -static void -xml_parse_children_of_node (xmlNodePtr parent, +static void +xml_parse_children_of_node (xmlNodePtr parent, xmlChar* parserfor, xmlChar* attributename, xmlChar* attributevalue); -static gboolean +static gboolean xml_check_attribute_value (xmlNode* node, xmlChar * attributename, xmlChar* attributevalue); -static xmlChar* +static xmlChar* xml_get_data_from_node (xmlNodePtr node, xmlParseReturnType rettype, xmlChar* attributename); -static void +static void xml_free_doc(); static void @@ -447,9 +447,9 @@ static xmlNodePtr xmlretval ; /* **Functions to parse the xml files. -**Open a XML document for reading +**Open a XML document for reading */ -static gboolean +static gboolean open_xml_document ( const gchar* filename ) { xmldocument = xmlParseFile(filename); @@ -466,16 +466,16 @@ open_xml_document ( const gchar* filename ) /** *Check if the root value is same as rootname . - *if supplied rootvalue = NULL ,just set root to rootnode . + *if supplied rootvalue = NULL ,just set root to rootnode . **/ -static gboolean +static gboolean set_xml_root_node(xmlChar* rootname) { xmlroot = xmlDocGetRootElement(xmldocument); - + if (xmlroot == NULL) { - xmlFreeDoc(xmldocument); + xmlFreeDoc(xmldocument); return FALSE; } @@ -492,7 +492,7 @@ set_xml_root_node(xmlChar* rootname) { return FALSE; } -} +} static xmlNodePtr xml_get_pointer_to_node(xmlChar* parserfor, @@ -517,9 +517,9 @@ xml_get_pointer_to_node(xmlChar* parserfor, if ( xml_check_attribute_value(topchild,attributename,attributevalue) == TRUE ) { xmlretval = topchild; - return xmlretval; + return xmlretval; } - else + else { /*No need to parse children node*/ topchild = topchild->next ; @@ -535,14 +535,14 @@ xml_get_pointer_to_node(xmlChar* parserfor, return xmlretval ; } -static void -xml_parse_children_of_node(xmlNodePtr parent, +static void +xml_parse_children_of_node(xmlNodePtr parent, xmlChar* parserfor, xmlChar* attributename, xmlChar* attributevalue ) { xmlNodePtr child = parent->xmlChildrenNode ; - + while ( child != NULL ) { if ( !xmlStrcmp(child->name,parserfor)) @@ -552,7 +552,7 @@ xml_parse_children_of_node(xmlNodePtr parent, xmlretval = child; return ; } - else + else { /*No need to parse children node*/ child = child->next ; @@ -571,14 +571,14 @@ xml_parse_children_of_node(xmlNodePtr parent, } } -static void +static void xml_free_doc() { xmlFreeDoc(xmldocument); xmldocument = NULL; } -static gboolean +static gboolean xml_check_attribute_value(xmlNode* node, xmlChar * attributename, xmlChar* attributevalue) @@ -586,7 +586,7 @@ xml_check_attribute_value(xmlNode* node, xmlChar* attributefromfile ; if ( attributename == NULL || attributevalue == NULL ) { - return TRUE ; + return TRUE ; } else if ( !xmlStrcmp(( attributefromfile = xmlGetProp(node,attributename)), attributevalue) ) @@ -598,7 +598,7 @@ xml_check_attribute_value(xmlNode* node, return FALSE ; } -static xmlChar* +static xmlChar* xml_get_data_from_node(xmlNodePtr node, xmlParseReturnType rettype, xmlChar* attributename) @@ -617,14 +617,14 @@ check_mime_type(const gchar* uri,GError** error) { GError * err = NULL ; const gchar* mimeFromFile = ev_file_get_mime_type(uri,FALSE,&err); - + gchar* mimetypes[] = {"application/epub+zip","application/x-booki+zip"}; int typecount = 2; if ( !mimeFromFile ) { if (err) { g_propagate_error (error, err); - } + } else { g_set_error_literal (error, EV_DOCUMENT_ERROR, @@ -658,7 +658,7 @@ extract_one_file(EpubDocument* epub_document,GError ** error) GFile * outfile ; gsize writesize = 0; GString * gfilepath ; - unz_file_info64 info ; + unz_file_info64 info ; gchar* directory; GString* dir_create; GFileOutputStream * outstream ; @@ -675,7 +675,7 @@ extract_one_file(EpubDocument* epub_document,GError ** error) directory = g_strrstr(currentfilename,"/") ; if ( directory != NULL ) - directory++; + directory++; gfilepath = g_string_new(epub_document->tmp_archive_dir) ; g_string_append_printf(gfilepath,"/%s",(gchar*)currentfilename); @@ -730,8 +730,8 @@ out: return result; } -static gboolean -extract_epub_from_container (const gchar* uri, +static gboolean +extract_epub_from_container (const gchar* uri, EpubDocument *epub_document, GError ** error) { @@ -742,7 +742,7 @@ extract_epub_from_container (const gchar* uri, { if (err) { g_propagate_error (error, err); - } + } else { g_set_error_literal (error, EV_DOCUMENT_ERROR, @@ -770,7 +770,7 @@ extract_epub_from_container (const gchar* uri, { if (err) { g_propagate_error (error, err); - } + } else { g_set_error_literal (error, EV_DOCUMENT_ERROR, @@ -786,7 +786,7 @@ extract_epub_from_container (const gchar* uri, { if (err) { g_propagate_error (error, err); - } + } else { g_set_error_literal (error, EV_DOCUMENT_ERROR, @@ -802,7 +802,7 @@ extract_epub_from_container (const gchar* uri, { if (err) { g_propagate_error (error, err); - } + } else { g_set_error_literal (error, EV_DOCUMENT_ERROR, @@ -810,7 +810,7 @@ extract_epub_from_container (const gchar* uri, _("could not extract archive")); } goto out; - } + } if ( unzGoToNextFile(epub_document->epubDocument) == UNZ_END_OF_LIST_OF_FILE ) { result = TRUE; @@ -823,18 +823,18 @@ out: return result; } -static gchar* +static gchar* get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) { gchar* tmp_archive_dir = epub_document->tmp_archive_dir; GError *err = NULL ; - + gchar *containerpath = g_filename_from_uri(uri,NULL,&err); if ( !containerpath ) { if (err) { g_propagate_error (error,err); - } + } else { g_set_error_literal (error, EV_DOCUMENT_ERROR, @@ -842,7 +842,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) _("could not retrieve container file")); } return NULL ; - } + } gboolean result = open_xml_document(containerpath); g_free (containerpath); @@ -852,7 +852,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, _("could not open container file")); - + return NULL ; } @@ -861,7 +861,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) g_set_error_literal(error, EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, - _("container file is corrupt")); + _("container file is corrupt")); return NULL ; } @@ -874,7 +874,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) _("epub file is invalid or corrupt")); return NULL ; } - + xmlChar *relativepath = xml_get_data_from_node(rootfileNode,XML_ATTRIBUTE,(xmlChar*)"full-path") ; if ( relativepath == NULL ) { @@ -916,7 +916,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) if ( !content_uri ) { if (err) { g_propagate_error (error,err); - } + } else { g_set_error_literal (error, @@ -927,7 +927,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) return NULL ; } xml_free_doc(); - return content_uri ; + return content_uri ; } static gboolean @@ -967,7 +967,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, _("could not parse content manifest")); - + return FALSE ; } if ( set_xml_root_node((xmlChar*)"package") == FALSE) { @@ -975,25 +975,25 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu g_set_error_literal(error, EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, - _("content file is invalid")); + _("content file is invalid")); return FALSE ; } - if ( ( spine = xml_get_pointer_to_node((xmlChar*)"spine",NULL,NULL) )== NULL ) + if ( ( spine = xml_get_pointer_to_node((xmlChar*)"spine",NULL,NULL) )== NULL ) { g_set_error_literal(error, EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, - _("epub file has no spine")); + _("epub file has no spine")); return FALSE ; } - - if ( ( manifest = xml_get_pointer_to_node((xmlChar*)"manifest",NULL,NULL) )== NULL ) + + if ( ( manifest = xml_get_pointer_to_node((xmlChar*)"manifest",NULL,NULL) )== NULL ) { g_set_error_literal(error, EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, - _("epub file has no manifest")); + _("epub file has no manifest")); return FALSE ; } @@ -1001,7 +1001,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu /*Get first instance of itemref from the spine*/ xml_parse_children_of_node(spine,(xmlChar*)"itemref",NULL,NULL); - + if ( xmlretval != NULL ) itemrefptr = xmlretval ; else @@ -1020,7 +1020,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu break; } if ( xmlStrcmp(itemrefptr->name,(xmlChar*)"itemref") == 0) - { + { contentListNode *newnode = g_malloc0(sizeof(newnode)); newnode->key = (gchar*)xml_get_data_from_node(itemrefptr,XML_ATTRIBUTE,(xmlChar*)"idref"); if ( newnode->key == NULL ) @@ -1031,7 +1031,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu } xmlretval=NULL ; xml_parse_children_of_node(manifest,(xmlChar*)"item",(xmlChar*)"id",(xmlChar*)newnode->key); - + if ( xmlretval != NULL ) { itemptr = xmlretval ; @@ -1059,7 +1059,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu errorflag = TRUE; break; } - + newnode->index = indexcounter++ ; newlist = g_list_prepend(newlist, newnode); @@ -1075,7 +1075,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu g_propagate_error(error,err); } else - { + { g_set_error_literal(error, EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, @@ -1221,7 +1221,7 @@ setup_index_from_navfile(gchar *tocpath) } static GList* -setup_document_index(EpubDocument *epub_document,gchar *containeruri) +setup_document_index(EpubDocument *epub_document,gchar *containeruri) { GString *tocpath = g_string_new(epub_document->documentdir); gchar *tocfilename = get_toc_file_name(containeruri); @@ -1303,7 +1303,7 @@ setup_document_index(EpubDocument *epub_document,gchar *containeruri) } uri = g_string_new(g_filename_to_uri(pagelink->str,NULL,NULL)); g_string_free(pagelink,TRUE); - + if (fragment) { g_string_append(uri,fragment); } @@ -1312,13 +1312,13 @@ setup_document_index(EpubDocument *epub_document,gchar *containeruri) g_string_free(uri,TRUE); index = g_list_prepend(index,newnode); } - + navPoint = navPoint->next; } while(navPoint != NULL); xml_free_doc(); - + return g_list_reverse(index); } @@ -1378,7 +1378,7 @@ epub_document_get_info(EvDocument *document) epubinfo->title = NULL ; else epubinfo->title = (char*)xml_get_data_from_node(metanode,XML_KEYWORD,NULL); - + metanode = xml_get_pointer_to_node((xmlChar*)"creator",NULL,NULL); if ( metanode == NULL ) epubinfo->author = g_strdup("unknown"); @@ -1394,9 +1394,9 @@ epub_document_get_info(EvDocument *document) buffer = g_string_new((gchar*)xml_get_data_from_node (xmlroot,XML_ATTRIBUTE,(xmlChar*)"version")); g_string_prepend(buffer,"epub "); epubinfo->format = g_string_free(buffer,FALSE); - + /*FIXME: Add more of these as you write the corresponding modules*/ - + epubinfo->layout = EV_DOCUMENT_LAYOUT_SINGLE_PAGE; metanode = xml_get_pointer_to_node((xmlChar*)"publisher",NULL,NULL); @@ -1411,7 +1411,7 @@ epub_document_get_info(EvDocument *document) /*Copying*/ epubinfo->permissions = EV_DOCUMENT_PERMISSIONS_OK_TO_COPY; /*TODO : Add a function to get date*/ - + if (xmldocument) xml_free_doc(); return epubinfo ; @@ -1505,7 +1505,7 @@ add_night_sheet(contentListNode *listdata,gchar *sheet) set_xml_root_node(NULL); xmlNodePtr head = xml_get_pointer_to_node((xmlChar*)"head",NULL,NULL); - + xmlNodePtr link = xmlNewTextChild(head,NULL,(xmlChar*)"link",NULL); xmlAttrPtr href = xmlNewProp(link,(xmlChar*)"href",(xmlChar*)sheeturi); xmlAttrPtr rel = xmlNewProp(link,(xmlChar*)"rel",(xmlChar*)"alternate stylesheet"); @@ -1548,7 +1548,7 @@ epub_document_check_add_night_sheet(EvDocument *document) gchar *csspath = g_strdup_printf("%s/atrilnightstyle.css",epub_document->documentdir); - + GFile *styles = g_file_new_for_path (csspath); GOutputStream *outstream = (GOutputStream*)g_file_create(styles,G_FILE_CREATE_PRIVATE,NULL,NULL); if ( g_output_stream_write((GOutputStream*)outstream,style,strlen(style),NULL,NULL) == -1 ) @@ -1571,7 +1571,7 @@ epub_document_toggle_night_mode(EvDocument *document,gboolean night) EpubDocument *epub_document = EPUB_DOCUMENT(document); g_return_if_fail(EPUB_IS_DOCUMENT(epub_document)); - if (night) + if (night) g_list_foreach(epub_document->contentList,(GFunc)change_to_night_sheet,NULL); else g_list_foreach(epub_document->contentList,(GFunc)change_to_day_sheet,NULL); @@ -1742,7 +1742,7 @@ epub_document_load (EvDocument* document, epub_document->docTitle = epub_document_set_document_title(contentOpfUri); epub_document->index = setup_document_index(epub_document,contentOpfUri); - + epub_document->contentList = setup_document_content_list (contentOpfUri,&err,epub_document->documentdir); if (epub_document->index != NULL && epub_document->contentList != NULL) @@ -1776,13 +1776,13 @@ static void epub_document_finalize (GObject *object) { EpubDocument *epub_document = EPUB_DOCUMENT (object); - + if (epub_document->epubDocument != NULL) { if (epub_remove_temporary_dir (epub_document->tmp_archive_dir) == -1) g_warning (_("There was an error deleting ā%sā."), epub_document->tmp_archive_dir); } - + if ( epub_document->contentList ) { g_list_free_full(epub_document->contentList,(GDestroyNotify)free_tree_nodes); epub_document->contentList = NULL; @@ -1819,12 +1819,12 @@ epub_document_class_init (EpubDocumentClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); EvDocumentClass *ev_document_class = EV_DOCUMENT_CLASS (klass); - + gobject_class->finalize = epub_document_finalize; ev_document_class->load = epub_document_load; ev_document_class->save = epub_document_save; ev_document_class->get_n_pages = epub_document_get_n_pages; - ev_document_class->get_info = epub_document_get_info; + ev_document_class->get_info = epub_document_get_info; ev_document_class->get_page = epub_document_get_page; ev_document_class->toggle_night_mode = epub_document_toggle_night_mode; ev_document_class->check_add_night_sheet = epub_document_check_add_night_sheet; diff --git a/backend/epub/epub-document.h b/backend/epub/epub-document.h index b1120ec7..962b829a 100644 --- a/backend/epub/epub-document.h +++ b/backend/epub/epub-document.h @@ -14,8 +14,8 @@ typedef struct _EpubDocument EpubDocument; GType epub_document_get_type (void) G_GNUC_CONST; -G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); - +G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); + G_END_DECLS #endif /* __EPUB_DOCUMENT_H__ */ diff --git a/backend/epub/minizip/ioapi.h b/backend/epub/minizip/ioapi.h index 137cd64e..7a0f44ad 100644 --- a/backend/epub/minizip/ioapi.h +++ b/backend/epub/minizip/ioapi.h @@ -19,7 +19,7 @@ */ #ifndef _ZLIBIOAPI64_H -#define _ZLIBIOAPI64_H +#define _ZLIBIOAPI64_H #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) diff --git a/backend/pixbuf/pixbuf-document.c b/backend/pixbuf/pixbuf-document.c index 065fe498..a4fe88ed 100644 --- a/backend/pixbuf/pixbuf-document.c +++ b/backend/pixbuf/pixbuf-document.c @@ -35,7 +35,7 @@ struct _PixbufDocument EvDocument parent_instance; GdkPixbuf *pixbuf; - + gchar *uri; }; @@ -46,7 +46,7 @@ static void pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnails EV_BACKEND_REGISTER_WITH_CODE (PixbufDocument, pixbuf_document, { EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, - pixbuf_document_document_thumbnails_iface_init) + pixbuf_document_document_thumbnails_iface_init) }); static gboolean @@ -55,7 +55,7 @@ pixbuf_document_load (EvDocument *document, GError **error) { PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); - + gchar *filename; GdkPixbuf *pixbuf; @@ -63,7 +63,7 @@ pixbuf_document_load (EvDocument *document, filename = g_filename_from_uri (uri, NULL, error); if (!filename) return FALSE; - + pixbuf = gdk_pixbuf_new_from_file (filename, error); if (!pixbuf) @@ -72,7 +72,7 @@ pixbuf_document_load (EvDocument *document, pixbuf_document->pixbuf = pixbuf; g_free (pixbuf_document->uri); pixbuf_document->uri = g_strdup (uri); - + return TRUE; } @@ -83,7 +83,7 @@ pixbuf_document_save (EvDocument *document, { PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); - return ev_xfer_uri_simple (pixbuf_document->uri, uri, error); + return ev_xfer_uri_simple (pixbuf_document->uri, uri, error); } static int @@ -117,7 +117,7 @@ pixbuf_document_render (EvDocument *document, (gdk_pixbuf_get_width (pixbuf_document->pixbuf) * rc->scale) + 0.5, (gdk_pixbuf_get_height (pixbuf_document->pixbuf) * rc->scale) + 0.5, GDK_INTERP_BILINEAR); - + rotated_pixbuf = gdk_pixbuf_rotate_simple (scaled_pixbuf, 360 - rc->rotation); g_object_unref (scaled_pixbuf); @@ -134,7 +134,7 @@ pixbuf_document_finalize (GObject *object) g_object_unref (pixbuf_document->pixbuf); g_free (pixbuf_document->uri); - + G_OBJECT_CLASS (pixbuf_document_parent_class)->finalize (object); } @@ -161,10 +161,10 @@ pixbuf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); GdkPixbuf *pixbuf, *rotated_pixbuf; gint width, height; - + width = (gint) (gdk_pixbuf_get_width (pixbuf_document->pixbuf) * rc->scale); height = (gint) (gdk_pixbuf_get_height (pixbuf_document->pixbuf) * rc->scale); - + pixbuf = gdk_pixbuf_scale_simple (pixbuf_document->pixbuf, width, height, GDK_INTERP_BILINEAR); @@ -177,7 +177,7 @@ pixbuf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, static void pixbuf_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gint *width, gint *height) { diff --git a/backend/pixbuf/pixbuf-document.h b/backend/pixbuf/pixbuf-document.h index a4f677cd..8166facc 100644 --- a/backend/pixbuf/pixbuf-document.h +++ b/backend/pixbuf/pixbuf-document.h @@ -31,8 +31,8 @@ typedef struct _PixbufDocument PixbufDocument; GType pixbuf_document_get_type (void) G_GNUC_CONST; -G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); - +G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); + G_END_DECLS #endif /* __PIXBUF_DOCUMENT_H__ */ diff --git a/backend/ps/ev-spectre.c b/backend/ps/ev-spectre.c index b0489b78..f29f7b2c 100644 --- a/backend/ps/ev-spectre.c +++ b/backend/ps/ev-spectre.c @@ -88,13 +88,13 @@ ps_document_load (EvDocument *document, filename = g_filename_from_uri (uri, NULL, error); if (!filename) return FALSE; - + ps->doc = spectre_document_new (); spectre_document_load (ps->doc, filename); if (spectre_document_status (ps->doc)) { gchar *filename_dsp; - + filename_dsp = g_filename_display_name (filename); g_set_error (error, G_FILE_ERROR, @@ -262,7 +262,7 @@ ps_document_get_info (EvDocument *document) ps_page = spectre_document_get_page (ps->doc, 0); spectre_page_get_size (ps_page, &width, &height); spectre_page_free (ps_page); - + info->title = g_strdup (spectre_document_get_title (ps->doc)); info->format = g_strdup (spectre_document_get_format (ps->doc)); info->creator = g_strdup (creator ? creator : spectre_document_get_for (ps->doc)); @@ -300,7 +300,7 @@ ps_document_render (EvDocument *document, static const cairo_user_data_key_t key; ps_page = (SpectrePage *)rc->page->backend_page; - + spectre_page_get_size (ps_page, &width_points, &height_points); width = (gint) ((width_points * rc->scale) + 0.5); @@ -322,7 +322,7 @@ ps_document_render (EvDocument *document, if (spectre_page_status (ps_page)) { g_warning ("%s", spectre_status_to_string (spectre_page_status (ps_page))); g_free (data); - + return NULL; } @@ -333,7 +333,7 @@ ps_document_render (EvDocument *document, swidth = width; sheight = height; } - + surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_RGB24, swidth, sheight, @@ -365,7 +365,7 @@ ps_document_class_init (PSDocumentClass *klass) /* EvDocumentThumbnailsIface */ static GdkPixbuf * ps_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails, - EvRenderContext *rc, + EvRenderContext *rc, gboolean border) { PSDocument *ps = PS_DOCUMENT (document_thumbnails); @@ -377,13 +377,13 @@ ps_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails, g_warning ("Error rendering thumbnail"); return NULL; } - + pixbuf = ev_document_misc_pixbuf_from_surface (surface); cairo_surface_destroy (surface); if (border) { GdkPixbuf *border_pixbuf; - + border_pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, pixbuf); g_object_unref (pixbuf); pixbuf = border_pixbuf; @@ -394,7 +394,7 @@ ps_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails, static void ps_document_thumbnails_get_dimensions (EvDocumentThumbnails *document_thumbnails, - EvRenderContext *rc, + EvRenderContext *rc, gint *width, gint *height) { @@ -420,7 +420,7 @@ ps_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface iface->get_thumbnail = ps_document_thumbnails_get_thumbnail; iface->get_dimensions = ps_document_thumbnails_get_dimensions; } - + /* EvFileExporterIface */ static void ps_document_file_exporter_begin (EvFileExporter *exporter, diff --git a/backend/ps/ev-spectre.h b/backend/ps/ev-spectre.h index de9b7725..cbe4e495 100644 --- a/backend/ps/ev-spectre.h +++ b/backend/ps/ev-spectre.h @@ -1,8 +1,8 @@ /* * Ghostscript widget for GTK/MATE - * + * * Copyright 1998 - 2005 The Free Software Foundation - * + * * Authors: Jaka Mocnik, Federico Mena (Quartic), Szekeres Istvan (Pista) * * This library is free software; you can redistribute it and/or diff --git a/backend/tiff/tiff-document.c b/backend/tiff/tiff-document.c index 0aa31cb6..3d273fee 100644 --- a/backend/tiff/tiff-document.c +++ b/backend/tiff/tiff-document.c @@ -47,7 +47,7 @@ struct _TiffDocument TIFF *tiff; gint n_pages; TIFF2PSContext *ps_export_ctx; - + gchar *uri; }; @@ -89,22 +89,22 @@ tiff_document_load (EvDocument *document, TiffDocument *tiff_document = TIFF_DOCUMENT (document); gchar *filename; TIFF *tiff; - + filename = g_filename_from_uri (uri, NULL, error); if (!filename) return FALSE; - + push_handlers (); tiff = TIFFOpen (filename, "r"); if (tiff) { guint32 w, h; - + /* FIXME: unused data? why bother here */ TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &h); } - + if (!tiff) { pop_handlers (); @@ -116,12 +116,12 @@ tiff_document_load (EvDocument *document, g_free (filename); return FALSE; } - + tiff_document->tiff = tiff; g_free (tiff_document->uri); g_free (filename); tiff_document->uri = g_strdup (uri); - + pop_handlers (); return TRUE; } @@ -130,24 +130,24 @@ static gboolean tiff_document_save (EvDocument *document, const char *uri, GError **error) -{ +{ TiffDocument *tiff_document = TIFF_DOCUMENT (document); - return ev_xfer_uri_simple (tiff_document->uri, uri, error); + return ev_xfer_uri_simple (tiff_document->uri, uri, error); } static int tiff_document_get_n_pages (EvDocument *document) { TiffDocument *tiff_document = TIFF_DOCUMENT (document); - + g_return_val_if_fail (TIFF_IS_DOCUMENT (document), 0); g_return_val_if_fail (tiff_document->tiff != NULL, 0); - + if (tiff_document->n_pages == -1) { push_handlers (); tiff_document->n_pages = 0; - + do { tiff_document->n_pages ++; } @@ -165,7 +165,7 @@ tiff_document_get_resolution (TiffDocument *tiff_document, { gfloat x = 72.0, y = 72.0; gushort unit; - + if (TIFFGetField (tiff_document->tiff, TIFFTAG_XRESOLUTION, &x) && TIFFGetField (tiff_document->tiff, TIFFTAG_YRESOLUTION, &y)) { if (TIFFGetFieldDefaulted (tiff_document->tiff, TIFFTAG_RESOLUTIONUNIT, &unit)) { @@ -189,24 +189,24 @@ tiff_document_get_page_size (EvDocument *document, guint32 w, h; gfloat x_res, y_res; TiffDocument *tiff_document = TIFF_DOCUMENT (document); - + g_return_if_fail (TIFF_IS_DOCUMENT (document)); g_return_if_fail (tiff_document->tiff != NULL); - + push_handlers (); if (TIFFSetDirectory (tiff_document->tiff, page->index) != 1) { pop_handlers (); return; } - + TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField (tiff_document->tiff, TIFFTAG_IMAGELENGTH, &h); tiff_document_get_resolution (tiff_document, &x_res, &y_res); h = h * (x_res / y_res); - + *width = w; *height = h; - + pop_handlers (); } @@ -224,10 +224,10 @@ tiff_document_render (EvDocument *document, cairo_surface_t *surface; cairo_surface_t *rotated_surface; static const cairo_user_data_key_t key; - + g_return_val_if_fail (TIFF_IS_DOCUMENT (document), NULL); g_return_val_if_fail (tiff_document->tiff != NULL, NULL); - + push_handlers (); if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) { pop_handlers (); @@ -252,9 +252,9 @@ tiff_document_render (EvDocument *document, } tiff_document_get_resolution (tiff_document, &x_res, &y_res); - + pop_handlers (); - + /* Sanity check the doc */ if (width <= 0 || height <= 0) { g_warning("Invalid width or height."); @@ -265,22 +265,22 @@ tiff_document_render (EvDocument *document, if (rowstride / 4 != width) { g_warning("Overflow while rendering document."); /* overflow, or cairo was changed in an unsupported way */ - return NULL; + return NULL; } - + bytes = height * rowstride; if (bytes / rowstride != height) { g_warning("Overflow while rendering document."); /* overflow */ return NULL; } - + pixels = g_try_malloc (bytes); if (!pixels) { g_warning("Failed to allocate memory for rendering."); return NULL; } - + surface = cairo_image_surface_create_for_data (pixels, CAIRO_FORMAT_RGB24, width, height, @@ -315,7 +315,7 @@ tiff_document_render (EvDocument *document, (height * rc->scale * (x_res / y_res)) + 0.5, rc->rotation); cairo_surface_destroy (surface); - + return rotated_surface; } @@ -331,7 +331,7 @@ tiff_document_render_pixbuf (EvDocument *document, GdkPixbuf *pixbuf; GdkPixbuf *scaled_pixbuf; GdkPixbuf *rotated_pixbuf; - + push_handlers (); if (TIFFSetDirectory (tiff_document->tiff, rc->page->index) != 1) { pop_handlers (); @@ -349,28 +349,28 @@ tiff_document_render_pixbuf (EvDocument *document, } tiff_document_get_resolution (tiff_document, &x_res, &y_res); - + pop_handlers (); - + /* Sanity check the doc */ if (width <= 0 || height <= 0) - return NULL; + return NULL; rowstride = width * 4; if (rowstride / 4 != width) /* overflow */ - return NULL; - + return NULL; + bytes = height * rowstride; if (bytes / rowstride != height) /* overflow */ - return NULL; - + return NULL; + pixels = g_try_malloc (bytes); if (!pixels) return NULL; - - pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8, + + pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8, width, height, rowstride, (GdkPixbufDestroyNotify) g_free, NULL); TIFFReadRGBAImageOriented (tiff_document->tiff, @@ -384,10 +384,10 @@ tiff_document_render_pixbuf (EvDocument *document, height * rc->scale * (x_res / y_res), GDK_INTERP_BILINEAR); g_object_unref (pixbuf); - + rotated_pixbuf = gdk_pixbuf_rotate_simple (scaled_pixbuf, 360 - rc->rotation); g_object_unref (scaled_pixbuf); - + return rotated_pixbuf; } @@ -437,26 +437,26 @@ tiff_document_class_init (TiffDocumentClass *klass) static GdkPixbuf * tiff_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gboolean border) { GdkPixbuf *pixbuf; pixbuf = tiff_document_render_pixbuf (EV_DOCUMENT (document), rc); - + if (border) { GdkPixbuf *tmp_pixbuf = pixbuf; - + pixbuf = ev_document_misc_get_thumbnail_frame (-1, -1, tmp_pixbuf); g_object_unref (tmp_pixbuf); } - + return pixbuf; } static void tiff_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gint *width, gint *height) { diff --git a/backend/tiff/tiff-document.h b/backend/tiff/tiff-document.h index 19db6158..b45f78c4 100644 --- a/backend/tiff/tiff-document.h +++ b/backend/tiff/tiff-document.h @@ -32,7 +32,7 @@ typedef struct _TiffDocument TiffDocument; GType tiff_document_get_type (void) G_GNUC_CONST; G_MODULE_EXPORT GType register_atril_backend (GTypeModule *module); - + G_END_DECLS #endif /* __TIFF_DOCUMENT_H__ */ diff --git a/backend/tiff/tiff2ps.c b/backend/tiff/tiff2ps.c index f8933674..bcbbf885 100644 --- a/backend/tiff/tiff2ps.c +++ b/backend/tiff/tiff2ps.c @@ -5,23 +5,23 @@ * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * - * Permission to use, copy, modify, distribute, and sell this software and + * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ @@ -827,7 +827,7 @@ PS_Lvl2ImageDict(TIFF2PSContext* ctx, TIFF* tif, uint32 w, uint32 h) * Workaround for some software that may crash when last strip * of image contains fewer number of scanlines than specified * by the `/Height' variable. So for stripped images with multiple - * strips we will set `/Height' as `im_h', because one is + * strips we will set `/Height' as `im_h', because one is * recalculated for each strip - including the (smaller) final strip. * For tiled images and images with only one strip `/Height' will * contain number of scanlines in tile (or image height in case of @@ -1722,7 +1722,7 @@ Ascii85Flush(TIFF2PSContext* ctx) fputs("~>\n", ctx->fd); } #if defined( EXP_ASCII85ENCODER) - + #define A85BREAKCNTR ctx->ascii85breaklen #define A85BREAKLEN (2*MAXLINE) diff --git a/backend/xps/xps-document.c b/backend/xps/xps-document.c index 602220ac..8db7d56c 100644 --- a/backend/xps/xps-document.c +++ b/backend/xps/xps-document.c @@ -513,13 +513,13 @@ xps_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, { GdkPixbuf *thumbnail; cairo_surface_t *surface; - + surface = xps_document_render (EV_DOCUMENT (document), rc); - + thumbnail = ev_document_misc_pixbuf_from_surface (surface); - + cairo_surface_destroy (surface); - + if (border) { GdkPixbuf *tmp_pixbuf = thumbnail; @@ -537,7 +537,7 @@ xps_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, gint *height) { gdouble page_width, page_height; - + xps_document_get_page_size (EV_DOCUMENT (document), rc->page, &page_width, &page_height); diff --git a/cut-n-paste/smclient/eggdesktopfile.c b/cut-n-paste/smclient/eggdesktopfile.c index 6fc382a0..a21846b2 100644 --- a/cut-n-paste/smclient/eggdesktopfile.c +++ b/cut-n-paste/smclient/eggdesktopfile.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ @@ -1363,7 +1363,7 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file, EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE, _("Can't pass document URIs to a 'Type=Link' desktop entry")); return FALSE; - } + } if (!parse_link (desktop_file, &app_desktop_file, &documents, error)) return FALSE; @@ -1449,10 +1449,10 @@ egg_set_desktop_file (const char *desktop_file_path) /** * egg_get_desktop_file: - * + * * Gets the application's #EggDesktopFile, as set by * egg_set_desktop_file(). - * + * * Return value: the #EggDesktopFile, or %NULL if it hasn't been set. **/ EggDesktopFile * diff --git a/cut-n-paste/smclient/eggdesktopfile.h b/cut-n-paste/smclient/eggdesktopfile.h index 2be36210..2b7d0547 100644 --- a/cut-n-paste/smclient/eggdesktopfile.h +++ b/cut-n-paste/smclient/eggdesktopfile.h @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/cut-n-paste/smclient/eggsmclient-private.h b/cut-n-paste/smclient/eggsmclient-private.h index 71ce652f..1413d0b2 100644 --- a/cut-n-paste/smclient/eggsmclient-private.h +++ b/cut-n-paste/smclient/eggsmclient-private.h @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/cut-n-paste/smclient/eggsmclient-xsmp.c b/cut-n-paste/smclient/eggsmclient-xsmp.c index 49f7296f..2f8c6655 100644 --- a/cut-n-paste/smclient/eggsmclient-xsmp.c +++ b/cut-n-paste/smclient/eggsmclient-xsmp.c @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ @@ -228,7 +228,7 @@ sm_client_xsmp_set_initial_properties (gpointer user_data) if (xsmp->restart_style == SmRestartIfRunning) { - if (egg_desktop_file_get_boolean (desktop_file, + if (egg_desktop_file_get_boolean (desktop_file, "X-MATE-AutoRestart", NULL)) xsmp->restart_style = SmRestartImmediately; } @@ -1128,7 +1128,7 @@ delete_properties (EggSMClientXSMP *xsmp, ...) * until you're done with the SmProp. */ static SmProp * -array_prop (const char *name, ...) +array_prop (const char *name, ...) { SmProp *prop; SmPropValue pv; @@ -1345,13 +1345,13 @@ ice_error_handler (IceConn ice_conn, IcePointer values) { /* Do nothing */ -} +} static void ice_io_error_handler (IceConn ice_conn) { /* Do nothing */ -} +} static void smc_error_handler (SmcConn smc_conn, diff --git a/cut-n-paste/smclient/eggsmclient.c b/cut-n-paste/smclient/eggsmclient.c index aab2d711..0691ee5b 100644 --- a/cut-n-paste/smclient/eggsmclient.c +++ b/cut-n-paste/smclient/eggsmclient.c @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ @@ -114,7 +114,7 @@ egg_sm_client_class_init (EggSMClientClass *klass) * handling this signal; if the user has requested that the session * be saved when logging out, then ::save_state will be emitted * separately. - * + * * If the application agrees to quit, it should then wait for either * the ::quit_cancelled or ::quit signals to be emitted. **/ diff --git a/cut-n-paste/smclient/eggsmclient.h b/cut-n-paste/smclient/eggsmclient.h index 65e258b3..dde282ab 100644 --- a/cut-n-paste/smclient/eggsmclient.h +++ b/cut-n-paste/smclient/eggsmclient.h @@ -12,8 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/cut-n-paste/synctex/synctex_parser.c b/cut-n-paste/synctex/synctex_parser.c index 5b28ace6..830961a3 100644 --- a/cut-n-paste/synctex/synctex_parser.c +++ b/cut-n-paste/synctex/synctex_parser.c @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr This file is part of the SyncTeX package. @@ -32,9 +32,9 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE -Except as contained in this notice, the name of the copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in this Software without prior written +Except as contained in this notice, the name of the copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in this Software without prior written authorization from the copyright holder. Acknowledgments: @@ -64,7 +64,7 @@ Thu Jun 19 09:39:21 UTC 2008 # else # define HAVE_LOCALE_H 1 # define HAVE_SETLOCALE 1 -# if defined(_MSC_VER) +# if defined(_MSC_VER) # define SYNCTEX_INLINE __inline # else # define SYNCTEX_INLINE inline @@ -572,9 +572,9 @@ typedef struct { || (NODE->class->type == synctex_node_type_void_vbox)\ || (NODE->class->type == synctex_node_type_hbox)\ || (NODE->class->type == synctex_node_type_void_hbox)) - + #define SYNCTEX_HAS_CHILDREN(NODE) (NODE && SYNCTEX_CHILD(NODE)) - + static void _synctex_log_medium_node(synctex_node_t node); typedef synctex_node_medium_t synctex_node_math_t; @@ -1394,7 +1394,7 @@ synctex_status_t _synctex_decode_int(synctex_scanner_t scanner, int* value_ref) * value_ref = result; } return SYNCTEX_STATUS_OK;/* Successfully scanned an int */ - } + } return SYNCTEX_STATUS_NOT_OK;/* Could not scan an int */ } @@ -1956,7 +1956,7 @@ scan_next_line: } else if (*SYNCTEX_CUR == SYNCTEX_CHAR_BEGIN_SHEET) { ++SYNCTEX_CUR; goto deeper; - + } else if (_synctex_next_line(scanner)<SYNCTEX_STATUS_OK) { _synctex_error("Unexpected end of nested sheet (3)."); SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR); @@ -2745,7 +2745,7 @@ return_on_error: /* remove the last path extension if any */ _synctex_strip_last_path_extension(synctex_name); if (!strlen(synctex_name)) { - goto return_on_error; + goto return_on_error; } /* now insert quotes. */ if (add_quotes) { @@ -3455,7 +3455,7 @@ synctex_status_t synctex_display_query(synctex_scanner_t scanner,const char * na SYNCTEX_CUR += SYNCTEX_END - SYNCTEX_START; SYNCTEX_START = SYNCTEX_END; SYNCTEX_END = SYNCTEX_START + size*sizeof(synctex_node_t *); - } + } *(synctex_node_t *)SYNCTEX_CUR = node; SYNCTEX_CUR += sizeof(synctex_node_t); } @@ -3473,7 +3473,7 @@ synctex_status_t synctex_display_query(synctex_scanner_t scanner,const char * na SYNCTEX_CUR += SYNCTEX_END - SYNCTEX_START; SYNCTEX_START = SYNCTEX_END; SYNCTEX_END = SYNCTEX_START + size*sizeof(synctex_node_t *); - } + } *(synctex_node_t *)SYNCTEX_CUR = node; SYNCTEX_CUR += sizeof(synctex_node_t); } @@ -3490,7 +3490,7 @@ synctex_status_t synctex_display_query(synctex_scanner_t scanner,const char * na SYNCTEX_CUR += SYNCTEX_END - SYNCTEX_START; SYNCTEX_START = SYNCTEX_END; SYNCTEX_END = SYNCTEX_START + size*sizeof(synctex_node_t *); - } + } *(synctex_node_t *)SYNCTEX_CUR = node; SYNCTEX_CUR += sizeof(synctex_node_t); } @@ -3681,7 +3681,7 @@ end: if ((other_node = SYNCTEX_NEXT_hbox(node))) { do { if (_synctex_point_in_box(hitPoint,other_node,synctex_YES)) { - node = _synctex_smallest_container(other_node,node); + node = _synctex_smallest_container(other_node,node); } } while((other_node = SYNCTEX_NEXT_hbox(other_node))); } @@ -3936,7 +3936,7 @@ synctex_bool_t _synctex_point_in_box(synctex_point_t hitPoint, synctex_node_t no return synctex_YES; } } - return synctex_NO; + return synctex_NO; } int _synctex_node_distance_to_point(synctex_point_t hitPoint, synctex_node_t node, synctex_bool_t visible) { @@ -4125,7 +4125,7 @@ SYNCTEX_INLINE static int __synctex_eq_get_closest_children_in_hbox(synctex_poin } } } else if (off7 == 0) { - /* hitPoint is inside node. */ + /* hitPoint is inside node. */ bestDistancesRef->left = bestDistancesRef->right = 0; bestNodesRef->left = node; bestNodesRef->right = NULL; @@ -4151,19 +4151,19 @@ SYNCTEX_INLINE static int __synctex_eq_get_closest_children_in_hbox(synctex_poin /* the left node is new, try to narrow the result */ if ((node = _synctex_eq_deepest_container(hitPoint,bestNodesRef->left,visible))) { bestNodesRef->left = node; - } + } if ((node = _synctex_eq_closest_child(hitPoint,bestNodesRef->left,visible))) { bestNodesRef->left = node; - } + } } if (result & SYNCTEX_MASK_RIGHT) { /* the right node is new, try to narrow the result */ if ((node = _synctex_eq_deepest_container(hitPoint,bestNodesRef->right,visible))) { bestNodesRef->right = node; - } + } if ((node = _synctex_eq_closest_child(hitPoint,bestNodesRef->right,visible))) { bestNodesRef->right = node; - } + } } } return result; @@ -4218,19 +4218,19 @@ SYNCTEX_INLINE static int __synctex_eq_get_closest_children_in_vbox(synctex_poin /* the left node is new, try to narrow the result */ if ((node = _synctex_eq_deepest_container(hitPoint,bestNodesRef->left,visible))) { bestNodesRef->left = node; - } + } if ((node = _synctex_eq_closest_child(hitPoint,bestNodesRef->left,visible))) { bestNodesRef->left = node; - } + } } if (result & SYNCTEX_MASK_RIGHT) { /* the right node is new, try to narrow the result */ if ((node = _synctex_eq_deepest_container(hitPoint,bestNodesRef->right,visible))) { bestNodesRef->right = node; - } + } if ((node = _synctex_eq_closest_child(hitPoint,bestNodesRef->right,visible))) { bestNodesRef->right = node; - } + } } } return result; diff --git a/cut-n-paste/synctex/synctex_parser.h b/cut-n-paste/synctex/synctex_parser.h index 2c1911e0..fd74bd3d 100644 --- a/cut-n-paste/synctex/synctex_parser.h +++ b/cut-n-paste/synctex/synctex_parser.h @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr This file is part of the SyncTeX package. @@ -32,9 +32,9 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE -Except as contained in this notice, the name of the copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in this Software without prior written +Except as contained in this notice, the name of the copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in this Software without prior written authorization from the copyright holder. Acknowledgments: diff --git a/cut-n-paste/synctex/synctex_parser_local.h b/cut-n-paste/synctex/synctex_parser_local.h index 89fd1369..76848181 100644 --- a/cut-n-paste/synctex/synctex_parser_local.h +++ b/cut-n-paste/synctex/synctex_parser_local.h @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr This file is part of the SyncTeX package. @@ -32,9 +32,9 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE -Except as contained in this notice, the name of the copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in this Software without prior written +Except as contained in this notice, the name of the copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in this Software without prior written authorization from the copyright holder. */ diff --git a/cut-n-paste/synctex/synctex_parser_utils.c b/cut-n-paste/synctex/synctex_parser_utils.c index 0e9fd0e5..62ac0ad2 100644 --- a/cut-n-paste/synctex/synctex_parser_utils.c +++ b/cut-n-paste/synctex/synctex_parser_utils.c @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr This file is part of the SyncTeX package. @@ -32,9 +32,9 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE -Except as contained in this notice, the name of the copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in this Software without prior written +Except as contained in this notice, the name of the copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in this Software without prior written authorization from the copyright holder. */ @@ -335,7 +335,7 @@ char * _synctex_merge_strings(const char * first,...) { _synctex_error("! _synctex_merge_strings: Memory problem"); return NULL; } - return NULL; + return NULL; } /* The purpose of _synctex_get_name is to find the name of the synctex file. @@ -506,7 +506,7 @@ int _synctex_get_name(const char * output, const char * build_directory, char ** } const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode) { - static const char * synctex_io_modes[4] = {"r","rb","a","ab"}; + static const char * synctex_io_modes[4] = {"r","rb","a","ab"}; unsigned index = ((io_mode & synctex_io_gz_mask)?1:0) + ((io_mode & synctex_io_append_mask)?2:0);// bug pointed out by Jose Alliste return synctex_io_modes[index]; } diff --git a/cut-n-paste/synctex/synctex_parser_utils.h b/cut-n-paste/synctex/synctex_parser_utils.h index 9c76ac52..86387f19 100644 --- a/cut-n-paste/synctex/synctex_parser_utils.h +++ b/cut-n-paste/synctex/synctex_parser_utils.h @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2008, 2009, 2010, 2011 jerome DOT laurens AT u-bourgogne DOT fr This file is part of the SyncTeX package. @@ -32,9 +32,9 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE -Except as contained in this notice, the name of the copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in this Software without prior written +Except as contained in this notice, the name of the copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in this Software without prior written authorization from the copyright holder. */ @@ -68,19 +68,19 @@ extern "C" { # define SYNCTEX_CASE_SENSITIVE_PATH 1 # define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c) # endif - + # if defined(_WIN32) || defined(__OS2__) # define SYNCTEX_IS_DOT(c) ('.' == c) # else # define SYNCTEX_IS_DOT(c) ('.' == c) # endif - + # if SYNCTEX_CASE_SENSITIVE_PATH # define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (left != right) # else # define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (toupper(left) != toupper(right)) # endif - + /* This custom malloc functions initializes to 0 the newly allocated memory. * There is no bzero function on windows. */ void *_synctex_malloc(size_t size); @@ -144,7 +144,7 @@ int _synctex_get_name(const char * output, const char * build_directory, char ** const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode); synctex_bool_t synctex_ignore_leading_dot_slash_in_path(const char ** name); - + #ifdef __cplusplus } #endif diff --git a/cut-n-paste/toolbar-editor/egg-toolbars-model.h b/cut-n-paste/toolbar-editor/egg-toolbars-model.h index 88f563ab..0c1a571c 100644 --- a/cut-n-paste/toolbar-editor/egg-toolbars-model.h +++ b/cut-n-paste/toolbar-editor/egg-toolbars-model.h @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * + * * $Id$ */ diff --git a/cut-n-paste/zoom-control/ephy-zoom-action.c b/cut-n-paste/zoom-control/ephy-zoom-action.c index 70376d52..537b9858 100644 --- a/cut-n-paste/zoom-control/ephy-zoom-action.c +++ b/cut-n-paste/zoom-control/ephy-zoom-action.c @@ -140,24 +140,24 @@ create_menu_item (GtkAction *action) for (i = 0; i < n_zoom_levels; i++) { - if (zoom_levels[i].level == EPHY_ZOOM_SEPARATOR) + if (zoom_levels[i].level == EPHY_ZOOM_SEPARATOR) { menu_item = gtk_separator_menu_item_new (); - } - else + } + else { - menu_item = gtk_radio_menu_item_new_with_label (group, + menu_item = gtk_radio_menu_item_new_with_label (group, _(zoom_levels[i].name)); group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item)); gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), p->zoom == zoom_levels[i].level); - + g_object_set_data (G_OBJECT (menu_item), "zoom-level", GINT_TO_POINTER (i)); g_signal_connect_object (G_OBJECT (menu_item), "activate", G_CALLBACK (proxy_menu_activate_cb), action, 0); } - + gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); } @@ -297,7 +297,7 @@ float ephy_zoom_action_get_zoom_level (EphyZoomAction *action) { g_return_val_if_fail (EPHY_IS_ZOOM_ACTION (action), 1.0); - + return action->priv->zoom; } diff --git a/cut-n-paste/zoom-control/ephy-zoom-action.h b/cut-n-paste/zoom-control/ephy-zoom-action.h index cf9f6feb..7b1abc01 100644 --- a/cut-n-paste/zoom-control/ephy-zoom-action.h +++ b/cut-n-paste/zoom-control/ephy-zoom-action.h @@ -40,7 +40,7 @@ typedef struct _EphyZoomActionPrivate EphyZoomActionPrivate; struct _EphyZoomAction { GtkAction parent; - + /*< private >*/ EphyZoomActionPrivate *priv; }; diff --git a/cut-n-paste/zoom-control/ephy-zoom-control.c b/cut-n-paste/zoom-control/ephy-zoom-control.c index d20e0d32..dc8ea3b6 100644 --- a/cut-n-paste/zoom-control/ephy-zoom-control.c +++ b/cut-n-paste/zoom-control/ephy-zoom-control.c @@ -72,7 +72,7 @@ combo_changed_cb (GtkComboBox *combo, EphyZoomControl *control) if (zoom != control->priv->zoom) { - g_signal_emit (control, signals[ZOOM_TO_LEVEL_SIGNAL], 0, zoom); + g_signal_emit (control, signals[ZOOM_TO_LEVEL_SIGNAL], 0, zoom); } } @@ -86,7 +86,7 @@ sync_zoom_cb (EphyZoomControl *control, GParamSpec *pspec, gpointer data) g_signal_handler_block (p->combo, p->handler_id); gtk_combo_box_set_active (p->combo, index); - g_signal_handler_unblock (p->combo, p->handler_id); + g_signal_handler_unblock (p->combo, p->handler_id); } static void @@ -206,7 +206,7 @@ ephy_zoom_control_init (EphyZoomControl *control) p->handler_id = g_signal_connect (p->combo, "changed", G_CALLBACK (combo_changed_cb), control); - + g_signal_connect_object (control, "notify::zoom", G_CALLBACK (sync_zoom_cb), NULL, 0); g_signal_connect_object (control, "notify::min-zoom", @@ -336,6 +336,6 @@ float ephy_zoom_control_get_zoom_level (EphyZoomControl *control) { g_return_val_if_fail (EPHY_IS_ZOOM_CONTROL (control), 1.0); - + return control->priv->zoom; } diff --git a/libdocument/ev-attachment.c b/libdocument/ev-attachment.c index ec8bd35a..bf7aede5 100644 --- a/libdocument/ev-attachment.c +++ b/libdocument/ev-attachment.c @@ -57,11 +57,11 @@ GQuark ev_attachment_error_quark (void) { static GQuark error_quark = 0; - + if (error_quark == 0) error_quark = g_quark_from_static_string ("ev-attachment-error-quark"); - + return error_quark; } @@ -174,7 +174,7 @@ ev_attachment_class_init (EvAttachmentClass *klass) g_object_class_install_property (g_object_class, PROP_MTIME, g_param_spec_ulong ("mtime", - "ModifiedTime", + "ModifiedTime", "The attachment modification date", 0, G_MAXULONG, 0, G_PARAM_WRITABLE | @@ -202,7 +202,7 @@ ev_attachment_class_init (EvAttachmentClass *klass) "The attachment data", G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY)); - + g_object_class->finalize = ev_attachment_finalize; } @@ -296,28 +296,28 @@ ev_attachment_save (EvAttachment *attachment, output_stream = g_file_replace (file, NULL, FALSE, 0, NULL, &ioerror); if (output_stream == NULL) { char *uri; - + uri = g_file_get_uri (file); g_set_error (error, - EV_ATTACHMENT_ERROR, + EV_ATTACHMENT_ERROR, ioerror->code, _("Couldn't save attachment ā%sā: %s"), - uri, + uri, ioerror->message); g_error_free (ioerror); g_free (uri); - + return FALSE; } - + written_bytes = g_output_stream_write (G_OUTPUT_STREAM (output_stream), attachment->priv->data, attachment->priv->size, NULL, &ioerror); if (written_bytes == -1) { char *uri; - + uri = g_file_get_uri (file); g_set_error (error, EV_ATTACHMENT_ERROR, @@ -325,7 +325,7 @@ ev_attachment_save (EvAttachment *attachment, _("Couldn't save attachment ā%sā: %s"), uri, ioerror->message); - + g_output_stream_close (G_OUTPUT_STREAM (output_stream), NULL, NULL); g_error_free (ioerror); g_free (uri); @@ -336,7 +336,7 @@ ev_attachment_save (EvAttachment *attachment, g_output_stream_close (G_OUTPUT_STREAM (output_stream), NULL, NULL); return TRUE; - + } static gboolean @@ -376,12 +376,12 @@ ev_attachment_launch_app (EvAttachment *attachment, g_list_free (files); g_error_free (ioerror); - + return FALSE; } g_list_free (files); - + return TRUE; } @@ -395,7 +395,7 @@ ev_attachment_open (EvAttachment *attachment, gboolean retval = FALSE; g_return_val_if_fail (EV_IS_ATTACHMENT (attachment), FALSE); - + if (!attachment->priv->app) { app_info = g_app_info_get_default_for_type (attachment->priv->mime_type, FALSE); attachment->priv->app = app_info; @@ -407,7 +407,7 @@ ev_attachment_open (EvAttachment *attachment, 0, _("Couldn't open attachment ā%sā"), attachment->priv->name); - + return FALSE; } diff --git a/libdocument/ev-attachment.h b/libdocument/ev-attachment.h index 65a255ff..17999437 100644 --- a/libdocument/ev-attachment.h +++ b/libdocument/ev-attachment.h @@ -44,7 +44,7 @@ typedef struct _EvAttachmentPrivate EvAttachmentPrivate; struct _EvAttachment { GObject base_instance; - + EvAttachmentPrivate *priv; }; diff --git a/libdocument/ev-backends-manager.c b/libdocument/ev-backends-manager.c index 53a60282..a690675b 100644 --- a/libdocument/ev-backends-manager.c +++ b/libdocument/ev-backends-manager.c @@ -100,7 +100,7 @@ ev_backends_manager_load_backend (const gchar *file) info->resident = g_key_file_get_boolean (backend_file, EV_BACKENDS_GROUP, "Resident", NULL); - + info->type_desc = g_key_file_get_locale_string (backend_file, EV_BACKENDS_GROUP, "TypeDescription", NULL, NULL); if (!info->type_desc) { @@ -146,7 +146,7 @@ ev_backends_manager_load (void) while ((dirent = g_dir_read_name (dir))) { EvBackendInfo *info; gchar *file; - + if (!g_str_has_suffix (dirent, EV_BACKENDS_EXTENSION)) continue; @@ -156,7 +156,7 @@ ev_backends_manager_load (void) if (!info) continue; - + ev_backends_list = g_list_prepend (ev_backends_list, info); } @@ -205,9 +205,9 @@ ev_backends_manager_get_backend_info (const gchar *mime_type) EvBackendInfo *info; gint i = 0; const char *mime; - + info = (EvBackendInfo *)l->data; - + while ((mime = info->mime_types[i++])) { if (g_ascii_strcasecmp (mime, mime_type) == 0) return info; @@ -229,12 +229,12 @@ ev_backends_manager_get_document (const gchar *mime_type) if (!info->module) { gchar *path; - + path = g_module_build_path (backends_dir(), info->module_name); info->module = G_TYPE_MODULE (ev_module_new (path, info->resident)); g_free (path); } - + if (!g_type_module_use (info->module)) { g_warning ("Cannot load backend '%s' since file '%s' cannot be read.", info->module_name, diff --git a/libdocument/ev-debug.c b/libdocument/ev-debug.c index 4c3554ac..1d8adb7d 100644 --- a/libdocument/ev-debug.c +++ b/libdocument/ev-debug.c @@ -4,7 +4,7 @@ * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * Copyright (C) 2002 - 2005 Paolo Maggi + * Copyright (C) 2002 - 2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,10 +21,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a - * list of people on the gedit Team. + * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a + * list of people on the gedit Team. * See the ChangeLog files for a list of changes. * * $Id: gedit-debug.c 4809 2006-04-08 14:46:31Z pborelli $ @@ -106,13 +106,13 @@ ev_debug_message (EvDebugSection section, if (format) { va_list args; - + va_start (args, format); msg = g_strdup_vprintf (format, args); va_end (args); } - g_print ("%s:%d (%s) %s\n", file, line, function, msg ? msg : ""); + g_print ("%s:%d (%s) %s\n", file, line, function, msg ? msg : ""); fflush (stdout); @@ -162,11 +162,11 @@ ev_profiler_stop (EvProfileSection section, va_start (args, format); name = g_strdup_vprintf (format, args); va_end (args); - + timer = g_hash_table_lookup (timers, name); if (!timer) return; - + g_timer_stop (timer); seconds = g_timer_elapsed (timer, NULL); g_print ("[ %s ] %f s elapsed\n", name, seconds); diff --git a/libdocument/ev-debug.h b/libdocument/ev-debug.h index 3efa598c..e1faf424 100644 --- a/libdocument/ev-debug.h +++ b/libdocument/ev-debug.h @@ -4,7 +4,7 @@ * * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi - * Copyright (C) 2002 - 2005 Paolo Maggi + * Copyright (C) 2002 - 2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,10 +21,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a - * list of people on the gedit Team. + * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a + * list of people on the gedit Team. * See the ChangeLog files for a list of changes. * * $Id: gedit-debug.h 4809 2006-04-08 14:46:31Z pborelli $ diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c index 7e96fade..b1454c64 100644 --- a/libdocument/ev-document-factory.c +++ b/libdocument/ev-document-factory.c @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ /* - * Copyright (C) 2005, Red Hat, Inc. + * Copyright (C) 2005, Red Hat, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +49,7 @@ gdk_pixbuf_mime_type_list () continue; mime_types = gdk_pixbuf_format_get_mime_types (format); - result = g_list_prepend (result, mime_types); + result = g_list_prepend (result, mime_types); } g_slist_free (formats); @@ -118,7 +118,7 @@ get_compression_from_mime_type (const gchar *mime_type) * fast or slow MIME type detection. If a document could be created, * @compression is filled in with the document's compression type. * On error, %NULL is returned and @error filled in. - * + * * Returns: a new #EvDocument instance, or %NULL on error with @error filled in */ static EvDocument * @@ -144,12 +144,12 @@ get_document_from_uri (const char *uri, } else { g_propagate_error (error, err); } - + return NULL; } document = ev_backends_manager_get_document (mime_type); - + #ifdef ENABLE_PIXBUF if (!document && mime_type_supported_by_gdk_pixbuf (mime_type)) document = ev_backends_manager_get_document ("image/*"); @@ -163,7 +163,7 @@ get_document_from_uri (const char *uri, mime_desc = g_content_type_get_description (content_type); g_set_error (error, - EV_DOCUMENT_ERROR, + EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_INVALID, _("File type %s (%s) is not supported"), mime_desc ? mime_desc : "-", mime_type); @@ -177,7 +177,7 @@ get_document_from_uri (const char *uri, *compression = get_compression_from_mime_type (mime_type); g_free (mime_type); - + return document; } @@ -248,7 +248,7 @@ ev_document_factory_get_document (const char *uri, GError **error) g_object_unref (document); document = NULL; } - + /* Try again with slow mime detection */ g_clear_error (&err); uri_unc = NULL; @@ -273,7 +273,7 @@ ev_document_factory_get_document (const char *uri, GError **error) g_object_unref (document); return NULL; } - + result = ev_document_load (document, uri_unc ? uri_unc : uri, &err); if (result == FALSE) { if (err == NULL) { @@ -294,7 +294,7 @@ ev_document_factory_get_document (const char *uri, GError **error) g_propagate_error (error, err); } - + return document; } @@ -312,10 +312,10 @@ file_filter_add_mime_types (EvTypeInfo *info, GtkFileFilter *filter) for (l = pixbuf_types; l; l = g_list_next (l)) { gchar **mime_types = (gchar **)l->data; gint j = 0; - + while ((mime_type = mime_types[j++])) gtk_file_filter_add_mime_type (filter, mime_type); - + g_strfreev (mime_types); } g_list_free (pixbuf_types); @@ -323,7 +323,7 @@ file_filter_add_mime_types (EvTypeInfo *info, GtkFileFilter *filter) return; } #endif /* ENABLE_PIXBUF */ - + while ((mime_type = info->mime_types[i++])) gtk_file_filter_add_mime_type (filter, mime_type); } @@ -334,9 +334,9 @@ file_filter_add_mime_types (EvTypeInfo *info, GtkFileFilter *filter) * @document: a #EvDocument, or %NULL * * Adds some file filters to @chooser. - + * Always add a "All documents" format. - * + * * If @document is not %NULL, adds a #GtkFileFilter for @document's MIME type. * * If @document is %NULL, adds a #GtkFileFilter for each document type that atril @@ -354,7 +354,7 @@ ev_document_factory_add_filters (GtkWidget *chooser, EvDocument *document) g_return_if_fail (document == NULL || EV_IS_DOCUMENT (document)); all_types = ev_backends_manager_get_all_types_info (); - + default_filter = document_filter = filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("All Documents")); g_list_foreach (all_types, (GFunc)file_filter_add_mime_types, filter); diff --git a/libdocument/ev-document-factory.h b/libdocument/ev-document-factory.h index 51d3569d..4c3dce59 100644 --- a/libdocument/ev-document-factory.h +++ b/libdocument/ev-document-factory.h @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ /* - * Copyright (C) 2005, Red Hat, Inc. + * Copyright (C) 2005, Red Hat, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/libdocument/ev-document-find.c b/libdocument/ev-document-find.c index 4be1b201..31e05372 100644 --- a/libdocument/ev-document-find.c +++ b/libdocument/ev-document-find.c @@ -45,7 +45,7 @@ ev_document_find_find_text (EvDocumentFind *document_find, gboolean case_sensitive) { EvDocumentFindInterface *iface = EV_DOCUMENT_FIND_GET_IFACE (document_find); - + return iface->find_text (document_find, page, text, case_sensitive); } diff --git a/libdocument/ev-document-fonts.c b/libdocument/ev-document-fonts.c index 5afe33f2..b0bc92cb 100644 --- a/libdocument/ev-document-fonts.c +++ b/libdocument/ev-document-fonts.c @@ -1,6 +1,6 @@ /* ev-document-fonts.h * this file is part of atril, a mate document_fonts viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/libdocument/ev-document-fonts.h b/libdocument/ev-document-fonts.h index 9f163485..6251644a 100644 --- a/libdocument/ev-document-fonts.h +++ b/libdocument/ev-document-fonts.h @@ -1,6 +1,6 @@ /* ev-document-fonts.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/libdocument/ev-document-forms.c b/libdocument/ev-document-forms.c index 223a0285..6ef96437 100644 --- a/libdocument/ev-document-forms.c +++ b/libdocument/ev-document-forms.c @@ -1,6 +1,6 @@ /* ev-document-forms.c * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2007 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ ev_document_forms_document_is_modified (EvDocumentForms *document_forms) } gchar * -ev_document_forms_form_field_text_get_text (EvDocumentForms *document_forms, +ev_document_forms_form_field_text_get_text (EvDocumentForms *document_forms, EvFormField *field) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -55,8 +55,8 @@ ev_document_forms_form_field_text_get_text (EvDocumentForms *document_forms, } void -ev_document_forms_form_field_text_set_text (EvDocumentForms *document_forms, - EvFormField *field, +ev_document_forms_form_field_text_set_text (EvDocumentForms *document_forms, + EvFormField *field, const gchar *text) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -74,8 +74,8 @@ ev_document_forms_form_field_button_get_state (EvDocumentForms *document_forms } void -ev_document_forms_form_field_button_set_state (EvDocumentForms *document_forms, - EvFormField *field, +ev_document_forms_form_field_button_set_state (EvDocumentForms *document_forms, + EvFormField *field, gboolean state) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -84,8 +84,8 @@ ev_document_forms_form_field_button_set_state (EvDocumentForms *document_forms } gchar * -ev_document_forms_form_field_choice_get_item (EvDocumentForms *document_forms, - EvFormField *field, +ev_document_forms_form_field_choice_get_item (EvDocumentForms *document_forms, + EvFormField *field, gint index) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -94,7 +94,7 @@ ev_document_forms_form_field_choice_get_item (EvDocumentForms *document_forms, } gint -ev_document_forms_form_field_choice_get_n_items (EvDocumentForms *document_forms, +ev_document_forms_form_field_choice_get_n_items (EvDocumentForms *document_forms, EvFormField *field) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -103,8 +103,8 @@ ev_document_forms_form_field_choice_get_n_items (EvDocumentForms *document_for } gboolean -ev_document_forms_form_field_choice_is_item_selected (EvDocumentForms *document_forms, - EvFormField *field, +ev_document_forms_form_field_choice_is_item_selected (EvDocumentForms *document_forms, + EvFormField *field, gint index) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -113,8 +113,8 @@ ev_document_forms_form_field_choice_is_item_selected (EvDocumentForms *documen } void -ev_document_forms_form_field_choice_select_item (EvDocumentForms *document_forms, - EvFormField *field, +ev_document_forms_form_field_choice_select_item (EvDocumentForms *document_forms, + EvFormField *field, gint index) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -123,8 +123,8 @@ ev_document_forms_form_field_choice_select_item (EvDocumentForms *document_for } void -ev_document_forms_form_field_choice_toggle_item (EvDocumentForms *document_forms, - EvFormField *field, +ev_document_forms_form_field_choice_toggle_item (EvDocumentForms *document_forms, + EvFormField *field, gint index) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); @@ -133,7 +133,7 @@ ev_document_forms_form_field_choice_toggle_item (EvDocumentForms *document_for } void -ev_document_forms_form_field_choice_unselect_all (EvDocumentForms *document_forms, +ev_document_forms_form_field_choice_unselect_all (EvDocumentForms *document_forms, EvFormField *field) { EvDocumentFormsInterface *iface = EV_DOCUMENT_FORMS_GET_IFACE (document_forms); diff --git a/libdocument/ev-document-forms.h b/libdocument/ev-document-forms.h index a77381ea..760fd10b 100644 --- a/libdocument/ev-document-forms.h +++ b/libdocument/ev-document-forms.h @@ -1,6 +1,6 @@ /* ev-document-forms.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2007 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it diff --git a/libdocument/ev-document-images.c b/libdocument/ev-document-images.c index 4316a19a..b095c33e 100644 --- a/libdocument/ev-document-images.c +++ b/libdocument/ev-document-images.c @@ -1,6 +1,6 @@ /* ev-document-images.c * this file is part of atril, a mate document_links viewer - * + * * Copyright (C) 2006 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it diff --git a/libdocument/ev-document-images.h b/libdocument/ev-document-images.h index ed4f534e..bbe7cd42 100644 --- a/libdocument/ev-document-images.h +++ b/libdocument/ev-document-images.h @@ -1,6 +1,6 @@ /* ev-document-images.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2006 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it diff --git a/libdocument/ev-document-layers.c b/libdocument/ev-document-layers.c index a05b1d46..4c599e25 100644 --- a/libdocument/ev-document-layers.c +++ b/libdocument/ev-document-layers.c @@ -1,6 +1,6 @@ /* ev-document-layers.c * this file is part of atril, a mate document_links viewer - * + * * Copyright (C) 2008 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it diff --git a/libdocument/ev-document-layers.h b/libdocument/ev-document-layers.h index 30063be5..8e7b74d7 100644 --- a/libdocument/ev-document-layers.h +++ b/libdocument/ev-document-layers.h @@ -1,6 +1,6 @@ /* ev-document-layers.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2008 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it diff --git a/libdocument/ev-document-links.c b/libdocument/ev-document-links.c index af41568d..87685ed0 100644 --- a/libdocument/ev-document-links.c +++ b/libdocument/ev-document-links.c @@ -1,6 +1,6 @@ /* ev-document-links.h * this file is part of atril, a mate document_links viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/libdocument/ev-document-links.h b/libdocument/ev-document-links.h index 6b561c0e..6af486bd 100644 --- a/libdocument/ev-document-links.h +++ b/libdocument/ev-document-links.h @@ -1,6 +1,6 @@ /* ev-document-links.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c index 3755f011..1a07781c 100644 --- a/libdocument/ev-document-misc.c +++ b/libdocument/ev-document-misc.c @@ -214,7 +214,7 @@ ev_document_misc_surface_from_pixbuf (GdkPixbuf *pixbuf) gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); cairo_paint (cr); cairo_destroy (cr); - + return surface; } @@ -249,7 +249,7 @@ ev_document_misc_surface_rotate_and_scale (cairo_surface_t *surface, width = cairo_image_surface_get_width (surface); height = cairo_image_surface_get_height (surface); - + if (dest_width == width && dest_height == height && dest_rotation == 0) { @@ -280,14 +280,14 @@ ev_document_misc_surface_rotate_and_scale (cairo_surface_t *surface, cairo_translate (cr, 0, 0); } cairo_rotate (cr, dest_rotation * G_PI / 180.0); - + if (dest_width != width || dest_height != height) { cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_BILINEAR); cairo_scale (cr, (gdouble)dest_width / width, (gdouble)dest_height / height); } - + cairo_set_source_surface (cr, surface, 0, 0); cairo_paint (cr); cairo_destroy (cr); diff --git a/libdocument/ev-document-security.c b/libdocument/ev-document-security.c index 6d87782d..a71b0c09 100644 --- a/libdocument/ev-document-security.c +++ b/libdocument/ev-document-security.c @@ -1,6 +1,6 @@ /* ev-document-links.h * this file is part of atril, a mate document_links viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/libdocument/ev-document-security.h b/libdocument/ev-document-security.h index 984690d3..1f411562 100644 --- a/libdocument/ev-document-security.h +++ b/libdocument/ev-document-security.h @@ -1,6 +1,6 @@ /* ev-document-security.h * this file is part of atril, a mate pdf viewer - * + * * Copyright (C) 2005 Red Hat, Inc. * * Author: diff --git a/libdocument/ev-document-thumbnails.h b/libdocument/ev-document-thumbnails.h index bebf2348..9674ba38 100644 --- a/libdocument/ev-document-thumbnails.h +++ b/libdocument/ev-document-thumbnails.h @@ -45,19 +45,19 @@ struct _EvDocumentThumbnailsInterface { /* Methods */ GdkPixbuf * (* get_thumbnail) (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gboolean border); void (* get_dimensions) (EvDocumentThumbnails *document, EvRenderContext *rc, gint *width, gint *height); - + }; GType ev_document_thumbnails_get_type (void) G_GNUC_CONST; GdkPixbuf *ev_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, - EvRenderContext *rc, + EvRenderContext *rc, gboolean border); void ev_document_thumbnails_get_dimensions (EvDocumentThumbnails *document, EvRenderContext *rc, diff --git a/libdocument/ev-document-transition.c b/libdocument/ev-document-transition.c index cf305cf4..bc0e7eb7 100644 --- a/libdocument/ev-document-transition.c +++ b/libdocument/ev-document-transition.c @@ -1,6 +1,6 @@ /* ev-document-transition.c * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2006 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it diff --git a/libdocument/ev-document-transition.h b/libdocument/ev-document-transition.h index d8289634..d89dd415 100644 --- a/libdocument/ev-document-transition.h +++ b/libdocument/ev-document-transition.h @@ -1,6 +1,6 @@ /* ev-document-transition.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2006 Carlos Garcia Campos <[email protected]> * * Atril is free software; you can redistribute it and/or modify it diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c index e7f59ded..c074b3b2 100644 --- a/libdocument/ev-document.c +++ b/libdocument/ev-document.c @@ -203,7 +203,7 @@ ev_document_fc_mutex_trylock (void) * @error: a #GError location to store an error, or %NULL * * Loads @document from @uri. - * + * * On failure, %FALSE is returned and @error is filled in. * If the document is encrypted, EV_DEFINE_ERROR_ENCRYPTED is returned. * If the backend cannot load the specific document, EV_DOCUMENT_ERROR_INVALID @@ -229,7 +229,7 @@ ev_document_load (EvDocument *document, if ( !g_strcmp0 (ev_file_get_mime_type(uri,TRUE,&err),"application/epub+zip") ) document->iswebdocument=TRUE ; - + retval = klass->load (document, uri, &err); if (!retval) { if (err) { @@ -255,7 +255,7 @@ ev_document_load (EvDocument *document, priv->uri = g_strdup (uri); priv->n_pages = _ev_document_get_n_pages (document); - + for (i = 0; i < priv->n_pages; i++) { /* @@ -263,13 +263,13 @@ ev_document_load (EvDocument *document, * We are however geeneralising the scenario by considering epub as a type of web document. * FIXME: Labels, or bookmarks though, can be done. */ - + EvPage *page = ev_document_get_page (document, i); gdouble page_width = 0; gdouble page_height = 0; EvPageSize *page_size; gchar *page_label; - + if ( document->iswebdocument == FALSE ) { _ev_document_get_page_size (document, page, &page_width, &page_height); } @@ -278,7 +278,7 @@ ev_document_load (EvDocument *document, page_width = 800; page_height= 600; } - + if (i == 0) { priv->uniform_width = page_width; priv->uniform_height = page_height; @@ -298,9 +298,9 @@ ev_document_load (EvDocument *document, priv->uniform_height != page_height)) { /* It's a different page size. Backfill the array. */ int j; - + priv->page_sizes = g_new0 (EvPageSize, priv->n_pages); - + for (j = 0; j < i; j++) { page_size = &(priv->page_sizes[j]); page_size->width = priv->uniform_width; @@ -361,7 +361,7 @@ ev_document_load (EvDocument *document, * @error: a #GError location to store an error, or %NULL * * Saves @document to @uri. - * + * * Returns: %TRUE on success, or %FALSE on error with @error filled in */ gboolean @@ -780,7 +780,7 @@ EvDocumentInfo * ev_document_info_copy (EvDocumentInfo *info) { EvDocumentInfo *copy; - + g_return_val_if_fail (info != NULL, NULL); copy = g_new0 (EvDocumentInfo, 1); @@ -793,7 +793,7 @@ ev_document_info_copy (EvDocumentInfo *info) copy->creator = g_strdup (info->creator); copy->producer = g_strdup (info->producer); copy->linearized = g_strdup (info->linearized); - + copy->creation_date = info->creation_date; copy->modified_date = info->modified_date; copy->layout = info->layout; diff --git a/libdocument/ev-document.h b/libdocument/ev-document.h index 6c492da8..43af4b58 100644 --- a/libdocument/ev-document.h +++ b/libdocument/ev-document.h @@ -115,7 +115,7 @@ struct _EvDocumentClass gboolean (* support_synctex) (EvDocument *document); void (* toggle_night_mode) (EvDocument *document,gboolean night); - void (*check_add_night_sheet)(EvDocument *document); + void (*check_add_night_sheet)(EvDocument *document); }; GType ev_document_get_type (void) G_GNUC_CONST; diff --git a/libdocument/ev-file-exporter.c b/libdocument/ev-file-exporter.c index ccb3ef09..6e79a530 100644 --- a/libdocument/ev-file-exporter.c +++ b/libdocument/ev-file-exporter.c @@ -62,7 +62,7 @@ void ev_file_exporter_end_page (EvFileExporter *exporter) { EvFileExporterInterface *iface = EV_FILE_EXPORTER_GET_IFACE (exporter); - + if (iface->end_page) iface->end_page (exporter); } diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c index 1826f8c3..9b22e93a 100644 --- a/libdocument/ev-file-helpers.c +++ b/libdocument/ev-file-helpers.c @@ -106,8 +106,8 @@ _ev_file_helpers_init (void) void _ev_file_helpers_shutdown (void) -{ - if (tmp_dir != NULL) +{ + if (tmp_dir != NULL) g_rmdir (tmp_dir); g_free (tmp_dir); @@ -339,11 +339,11 @@ ev_tmp_file_unlink (GFile *file) if (!file) return; - + res = g_file_delete (file, NULL, &error); if (!res) { char *uri; - + uri = g_file_get_uri (file); g_warning ("Unable to delete temp file %s: %s\n", uri, error->message); g_free (uri); @@ -355,17 +355,17 @@ void ev_tmp_uri_unlink (const gchar *uri) { GFile *file; - + if (!uri) return; - + file = g_file_new_for_uri (uri); if (!g_file_is_native (file)) { g_warning ("Attempting to delete non native uri: %s\n", uri); g_object_unref (file); return; } - + ev_tmp_file_unlink (file); g_object_unref (file); } @@ -407,7 +407,7 @@ ev_xfer_uri_simple (const char *from, GFile *source_file; GFile *target_file; gboolean result; - + if (!from) return TRUE; @@ -415,7 +415,7 @@ ev_xfer_uri_simple (const char *from, source_file = g_file_new_for_uri (from); target_file = g_file_new_for_uri (to); - + result = g_file_copy (source_file, target_file, G_FILE_COPY_TARGET_DEFAULT_PERMS | G_FILE_COPY_OVERWRITE, @@ -423,7 +423,7 @@ ev_xfer_uri_simple (const char *from, g_object_unref (target_file); g_object_unref (source_file); - + return result; } @@ -464,7 +464,7 @@ get_mime_type_from_data (const gchar *uri, GError **error) gchar *content_type, *mime_type; file = g_file_new_for_uri (uri); - + input_stream = g_file_read (file, NULL, error); if (!input_stream) { g_object_unref (file); @@ -505,7 +505,7 @@ get_mime_type_from_data (const gchar *uri, GError **error) * * Note: on unknown MIME types, this may return NULL without @error * being filled in. - * + * * Returns: a newly allocated string with the MIME type of the file at * @uri, or %NULL on error or if the MIME type could not be determined */ @@ -532,7 +532,7 @@ static const char *compressor_cmds[] = { static gchar * compression_run (const gchar *uri, EvCompressionType type, - gboolean compress, + gboolean compress, GError **error) { gchar *argv[N_ARGS]; @@ -659,7 +659,7 @@ ev_file_uncompress (const gchar *uri, * @error: a #GError location to store an error, or %NULL * * Compresses the file at @uri. - + * If @type is %EV_COMPRESSION_NONE, it does nothing and returns %NULL. * * Otherwise, it returns the filename of a diff --git a/libdocument/ev-form-field.c b/libdocument/ev-form-field.c index b744eb8f..e2739e79 100644 --- a/libdocument/ev-form-field.c +++ b/libdocument/ev-form-field.c @@ -150,7 +150,7 @@ ev_form_field_text_new (gint id, EvFormFieldTextType type) { EvFormField *field; - + g_return_val_if_fail (id >= 0, NULL); g_return_val_if_fail (type >= EV_FORM_FIELD_TEXT_NORMAL && type <= EV_FORM_FIELD_TEXT_FILE_SELECT, NULL); @@ -188,7 +188,7 @@ ev_form_field_choice_new (gint id, g_return_val_if_fail (id >= 0, NULL); g_return_val_if_fail (type >= EV_FORM_FIELD_CHOICE_COMBO && type <= EV_FORM_FIELD_CHOICE_LIST, NULL); - + field = EV_FORM_FIELD (g_object_new (EV_TYPE_FORM_FIELD_CHOICE, NULL)); field->id = id; EV_FORM_FIELD_CHOICE (field)->type = type; diff --git a/libdocument/ev-form-field.h b/libdocument/ev-form-field.h index a8a48ffd..c0795463 100644 --- a/libdocument/ev-form-field.h +++ b/libdocument/ev-form-field.h @@ -37,7 +37,7 @@ G_BEGIN_DECLS #define EV_FORM_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_FORM_FIELD, EvFormFieldClass)) #define EV_IS_FORM_FIELD(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_FORM_FIELD)) #define EV_IS_FORM_FIELD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_FORM_FIELD)) -#define EV_FORM_FIELD_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_FORM_FIELD, EvFormFieldClass)) +#define EV_FORM_FIELD_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_FORM_FIELD, EvFormFieldClass)) #define EV_TYPE_FORM_FIELD_TEXT (ev_form_field_text_get_type()) #define EV_FORM_FIELD_TEXT(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_FORM_FIELD_TEXT, EvFormFieldText)) @@ -119,13 +119,13 @@ struct _EvFormFieldClass { GObjectClass parent_class; }; - + struct _EvFormFieldText { EvFormField partent; - + EvFormFieldTextType type; - + gboolean do_spell_check : 1; gboolean do_scroll : 1; gboolean comb : 1; @@ -144,7 +144,7 @@ struct _EvFormFieldTextClass struct _EvFormFieldButton { EvFormField partent; - + EvFormFieldButtonType type; gboolean state; @@ -160,7 +160,7 @@ struct _EvFormFieldChoice EvFormField partent; EvFormFieldChoiceType type; - + gboolean multi_select : 1; gboolean is_editable : 1; gboolean do_spell_check : 1; @@ -178,7 +178,7 @@ struct _EvFormFieldChoiceClass struct _EvFormFieldSignature { EvFormField partent; - + /* TODO */ }; diff --git a/libdocument/ev-image.c b/libdocument/ev-image.c index 85530101..9e2525f8 100644 --- a/libdocument/ev-image.c +++ b/libdocument/ev-image.c @@ -137,7 +137,7 @@ ev_image_save_tmp (EvImage *image, GError *error = NULL; gchar *filename = NULL; int fd; - + g_return_val_if_fail (EV_IS_IMAGE (image), NULL); g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); @@ -158,7 +158,7 @@ ev_image_save_tmp (EvImage *image, goto had_error; g_free (filename); - + return image->priv->tmp_uri; } diff --git a/libdocument/ev-image.h b/libdocument/ev-image.h index d0c4b80c..738b7fd5 100644 --- a/libdocument/ev-image.h +++ b/libdocument/ev-image.h @@ -42,7 +42,7 @@ typedef struct _EvImagePrivate EvImagePrivate; struct _EvImage { GObject base_instance; - + EvImagePrivate *priv; }; diff --git a/libdocument/ev-layer.h b/libdocument/ev-layer.h index 656d2994..69a693e7 100644 --- a/libdocument/ev-layer.h +++ b/libdocument/ev-layer.h @@ -41,7 +41,7 @@ typedef struct _EvLayerPrivate EvLayerPrivate; struct _EvLayer { GObject base_instance; - + EvLayerPrivate *priv; }; diff --git a/libdocument/ev-link-dest.c b/libdocument/ev-link-dest.c index f06bee12..6cf8e138 100644 --- a/libdocument/ev-link-dest.c +++ b/libdocument/ev-link-dest.c @@ -45,7 +45,7 @@ typedef enum { struct _EvLinkDest { GObject base_instance; - + EvLinkDestPrivate *priv; }; @@ -95,7 +95,7 @@ ev_link_dest_get_top (EvLinkDest *self, if (change_top) *change_top = (self->priv->change & EV_DEST_CHANGE_TOP); - + return self->priv->top; } @@ -416,7 +416,7 @@ ev_link_dest_new_xyz (gint page, change |= EV_DEST_CHANGE_TOP; if (change_zoom) change |= EV_DEST_CHANGE_ZOOM; - + return EV_LINK_DEST (g_object_new (EV_TYPE_LINK_DEST, "page", page, "type", EV_LINK_DEST_TYPE_XYZ, @@ -445,7 +445,7 @@ ev_link_dest_new_fith (gint page, if (change_top) change |= EV_DEST_CHANGE_TOP; - + return EV_LINK_DEST (g_object_new (EV_TYPE_LINK_DEST, "page", page, "type", EV_LINK_DEST_TYPE_FITH, @@ -480,7 +480,7 @@ ev_link_dest_new_fitr (gint page, gdouble top) { EvDestChange change = EV_DEST_CHANGE_TOP | EV_DEST_CHANGE_LEFT; - + return EV_LINK_DEST (g_object_new (EV_TYPE_LINK_DEST, "page", page, "type", EV_LINK_DEST_TYPE_FITR, diff --git a/libdocument/ev-link-dest.h b/libdocument/ev-link-dest.h index dd1f10a1..9ccc8a55 100644 --- a/libdocument/ev-link-dest.h +++ b/libdocument/ev-link-dest.h @@ -51,7 +51,7 @@ typedef enum { EV_LINK_DEST_TYPE_PAGE_LABEL, EV_LINK_DEST_TYPE_HLINK, EV_LINK_DEST_TYPE_UNKNOWN -} EvLinkDestType; +} EvLinkDestType; GType ev_link_dest_get_type (void) G_GNUC_CONST; diff --git a/libdocument/ev-link.c b/libdocument/ev-link.c index dab2e9f5..bb28ab30 100644 --- a/libdocument/ev-link.c +++ b/libdocument/ev-link.c @@ -50,7 +50,7 @@ const gchar * ev_link_get_title (EvLink *self) { g_return_val_if_fail (EV_IS_LINK (self), NULL); - + return self->priv->title; } @@ -58,7 +58,7 @@ EvLinkAction * ev_link_get_action (EvLink *self) { g_return_val_if_fail (EV_IS_LINK (self), NULL); - + return self->priv->action; } @@ -94,10 +94,10 @@ ev_link_set_property (GObject *object, GParamSpec *param_spec) { EvLink *self = EV_LINK (object); - + switch (prop_id) { case PROP_TITLE: - self->priv->title = g_value_dup_string (value); + self->priv->title = g_value_dup_string (value); break; case PROP_ACTION: self->priv->action = g_value_get_pointer (value); diff --git a/libdocument/ev-module.c b/libdocument/ev-module.c index 1a147eff..9512c1ff 100644 --- a/libdocument/ev-module.c +++ b/libdocument/ev-module.c @@ -2,7 +2,7 @@ * ev-module.c * This file is part of Atril * - * Copyright (C) 2005 - Paolo Maggi + * Copyright (C) 2005 - Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,10 +16,10 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* This is a modified version of ephy-module.c from Epiphany source code. * Here the original copyright assignment: * @@ -29,9 +29,9 @@ */ /* - * Modified by the gedit Team, 2005. See the AUTHORS file for a - * list of people on the gedit Team. - * See the ChangeLog files for a list of changes. + * Modified by the gedit Team, 2005. See the AUTHORS file for a + * list of people on the gedit Team. + * See the ChangeLog files for a list of changes. * * $Id: gedit-module.c 5367 2006-12-17 14:29:49Z pborelli $ */ @@ -103,7 +103,7 @@ ev_module_load (GTypeModule *gmodule) if (module->type == 0) { g_warning ("Invalid atril backend contained by module %s", module->path); - + return FALSE; } @@ -136,7 +136,7 @@ GObject * ev_module_new_object (EvModule *module) { g_return_val_if_fail (EV_IS_MODULE (module), NULL); - + if (module->type == 0) return NULL; diff --git a/libdocument/ev-module.h b/libdocument/ev-module.h index 629c251a..1804a1f7 100644 --- a/libdocument/ev-module.h +++ b/libdocument/ev-module.h @@ -2,7 +2,7 @@ * ev-module.h * This file is part of Atril * - * Copyright (C) 2005 - Paolo Maggi + * Copyright (C) 2005 - Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,10 +16,10 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ - + /* This is a modified version of gedit-module.h from Epiphany source code. * Here the original copyright assignment: * @@ -29,15 +29,15 @@ */ /* - * Modified by the gedit Team, 2005. See the AUTHORS file for a - * list of people on the gedit Team. - * See the ChangeLog files for a list of changes. + * Modified by the gedit Team, 2005. See the AUTHORS file for a + * list of people on the gedit Team. + * See the ChangeLog files for a list of changes. * * $Id: gedit-module.h 5263 2006-10-08 14:26:02Z pborelli $ */ /* Modified by Atril Team */ - + #if !defined (ATRIL_COMPILATION) #error "This is a private header." #endif diff --git a/libdocument/ev-page.c b/libdocument/ev-page.c index 80a0c5d9..ed6d0f87 100644 --- a/libdocument/ev-page.c +++ b/libdocument/ev-page.c @@ -32,7 +32,7 @@ static void ev_page_finalize (GObject *object) { EvPage *page = EV_PAGE (object); - + if (page->backend_destroy_func) { page->backend_destroy_func (page->backend_page); page->backend_destroy_func = NULL; diff --git a/libdocument/ev-page.h b/libdocument/ev-page.h index 8f7ab860..a165aa50 100644 --- a/libdocument/ev-page.h +++ b/libdocument/ev-page.h @@ -43,7 +43,7 @@ typedef GDestroyNotify EvBackendPageDestroyFunc; struct _EvPage { GObject base_instance; - + gint index; EvBackendPage backend_page; diff --git a/libdocument/ev-render-context.h b/libdocument/ev-render-context.h index 0344d97b..4366842d 100644 --- a/libdocument/ev-render-context.h +++ b/libdocument/ev-render-context.h @@ -46,7 +46,7 @@ struct _EvRenderContextClass struct _EvRenderContext { GObject parent; - + EvPage *page; gint rotation; gdouble scale; diff --git a/libdocument/ev-selection.c b/libdocument/ev-selection.c index 49e56eb4..c35c3b01 100644 --- a/libdocument/ev-selection.c +++ b/libdocument/ev-selection.c @@ -43,7 +43,7 @@ ev_selection_render_selection (EvSelection *selection, if (!iface->render_selection) return; - + iface->render_selection (selection, rc, surface, points, old_points, @@ -72,6 +72,6 @@ ev_selection_get_selection_region (EvSelection *selection, if (!iface->get_selection_region) return NULL; - + return iface->get_selection_region (selection, rc, style, points); } diff --git a/libmisc/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c index fae114d8..e19b509a 100644 --- a/libmisc/ev-page-action-widget.c +++ b/libmisc/ev-page-action-widget.c @@ -305,10 +305,10 @@ match_selected_cb (GtkEntryCompletion *completion, g_object_unref (link); gtk_tree_iter_free (iter); - + return TRUE; } - + static void display_completion_text (GtkCellLayout *cell_layout, @@ -331,7 +331,7 @@ display_completion_text (GtkCellLayout *cell_layout, if (link) g_object_unref (link); - + gtk_tree_iter_free (iter); } @@ -413,7 +413,7 @@ build_new_tree_cb (GtkTreeModel *model, g_object_unref (link); return FALSE; } - + type = ev_link_action_get_action_type (action); if (type == EV_LINK_ACTION_TYPE_GOTO_DEST) { @@ -424,9 +424,9 @@ build_new_tree_cb (GtkTreeModel *model, 0, iter, -1); } - + g_object_unref (link); - + return FALSE; } diff --git a/libmisc/ev-page-action-widget.h b/libmisc/ev-page-action-widget.h index 59e649c9..bd276044 100644 --- a/libmisc/ev-page-action-widget.h +++ b/libmisc/ev-page-action-widget.h @@ -19,7 +19,7 @@ */ #include <atril-view.h> - + #include <gtk/gtk.h> #define EV_TYPE_PAGE_ACTION_WIDGET (ev_page_action_widget_get_type ()) diff --git a/libmisc/ev-page-action.h b/libmisc/ev-page-action.h index 5196397e..3bae66ad 100644 --- a/libmisc/ev-page-action.h +++ b/libmisc/ev-page-action.h @@ -42,7 +42,7 @@ typedef struct _EvPageActionClass EvPageActionClass; struct _EvPageAction { GtkAction parent; - + /*< private >*/ EvPageActionPrivate *priv; }; diff --git a/libview/ev-job-scheduler.c b/libview/ev-job-scheduler.c index 2fea0224..99213d8e 100644 --- a/libview/ev-job-scheduler.c +++ b/libview/ev-job-scheduler.c @@ -56,12 +56,12 @@ ev_job_queue_push (EvSchedulerJob *job, EvJobPriority priority) { ev_debug_message (DEBUG_JOBS, "%s priority %d", EV_GET_TYPE_NAME (job->job), priority); - + g_mutex_lock (&job_queue_mutex); g_queue_push_tail (job_queue[priority], job); g_cond_broadcast (&job_queue_cond); - + g_mutex_unlock (&job_queue_mutex); } @@ -70,7 +70,7 @@ ev_job_queue_get_next_unlocked (void) { gint i; EvSchedulerJob *job = NULL; - + for (i = EV_JOB_PRIORITY_URGENT; i < EV_JOB_N_PRIORITIES; i++) { job = (EvSchedulerJob *) g_queue_pop_head (job_queue[i]); if (job) @@ -86,7 +86,7 @@ static gpointer ev_job_scheduler_init (gpointer data) { g_thread_new ("EvJobScheduler", ev_job_thread_proxy, NULL); - + return NULL; } @@ -94,12 +94,12 @@ static void ev_scheduler_job_list_add (EvSchedulerJob *job) { ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); - + G_LOCK (job_list); job_list = g_slist_prepend (job_list, job); job->job_link = job_list; - + G_UNLOCK (job_list); } @@ -107,11 +107,11 @@ static void ev_scheduler_job_list_remove (EvSchedulerJob *job) { ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); - + G_LOCK (job_list); job_list = g_slist_delete_link (job_list, job->job_link); - + G_UNLOCK (job_list); } @@ -131,7 +131,7 @@ ev_scheduler_job_destroy (EvSchedulerJob *job) ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); if (job->job->run_mode == EV_JOB_RUN_MAIN_LOOP) { - g_signal_handlers_disconnect_by_func (job->job, + g_signal_handlers_disconnect_by_func (job->job, G_CALLBACK (ev_scheduler_job_destroy), job); } else { @@ -139,7 +139,7 @@ ev_scheduler_job_destroy (EvSchedulerJob *job) G_CALLBACK (ev_scheduler_thread_job_cancelled), job); } - + ev_scheduler_job_list_remove (job); ev_scheduler_job_free (job); } @@ -149,7 +149,7 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job, GCancellable *cancellable) { GList *list; - + ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job)); g_mutex_lock (&job_queue_mutex); @@ -157,7 +157,7 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job, /* If the job is not still running, * remove it from the job queue and job list. * If the job is currently running, it will be - * destroyed as soon as it finishes. + * destroyed as soon as it finishes. */ list = g_queue_find (job_queue[job->priority], job); if (list) { @@ -213,7 +213,7 @@ ev_job_thread_proxy (gpointer data) continue; } g_mutex_unlock (&job_queue_mutex); - + ev_job_thread (job->job); ev_scheduler_job_destroy (job); } @@ -237,7 +237,7 @@ ev_job_scheduler_push_job (EvJob *job, s_job->priority = priority; ev_scheduler_job_list_add (s_job); - + switch (ev_job_get_run_mode (job)) { case EV_JOB_RUN_THREAD: g_signal_connect_swapped (job->cancellable, "cancelled", @@ -275,7 +275,7 @@ ev_job_scheduler_update_job (EvJob *job, return; ev_debug_message (DEBUG_JOBS, "%s pirority %d", EV_GET_TYPE_NAME (job), priority); - + G_LOCK (job_list); for (l = job_list; l; l = l->next) { @@ -286,14 +286,14 @@ ev_job_scheduler_update_job (EvJob *job, break; } } - + G_UNLOCK (job_list); if (need_resort) { GList *list; - + g_mutex_lock (&job_queue_mutex); - + list = g_queue_find (job_queue[s_job->priority], s_job); if (list) { ev_debug_message (DEBUG_JOBS, "Moving job %s from pirority %d to %d", @@ -302,7 +302,7 @@ ev_job_scheduler_update_job (EvJob *job, g_queue_push_tail (job_queue[priority], s_job); g_cond_broadcast (&job_queue_cond); } - + g_mutex_unlock (&job_queue_mutex); } } diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index 607bc2c2..134324e4 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -176,14 +176,14 @@ emit_finished (EvJob *job) ev_debug_message (DEBUG_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); job->idle_finished_id = 0; - + if (job->cancelled) { ev_debug_message (DEBUG_JOBS, "%s (%p) job was cancelled, do not emit finished", EV_GET_TYPE_NAME (job), job); } else { ev_profiler_stop (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); g_signal_emit (job, job_signals[FINISHED], 0); } - + return FALSE; } @@ -196,9 +196,9 @@ ev_job_emit_finished (EvJob *job) ev_debug_message (DEBUG_JOBS, "%s (%p) job was cancelled, returning", EV_GET_TYPE_NAME (job), job); return; } - + job->finished = TRUE; - + if (job->run_mode == EV_JOB_RUN_THREAD) { job->idle_finished_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, @@ -215,7 +215,7 @@ gboolean ev_job_run (EvJob *job) { EvJobClass *class = EV_JOB_GET_CLASS (job); - + return class-> run (job); } @@ -227,7 +227,7 @@ ev_job_cancel (EvJob *job) ev_debug_message (DEBUG_JOBS, "job %s (%p) cancelled", EV_GET_TYPE_NAME (job), job); ev_profiler_stop (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + /* This should never be called from a thread */ job->cancelled = TRUE; g_cancellable_cancel (job->cancellable); @@ -247,22 +247,22 @@ ev_job_failed (EvJob *job, { va_list args; gchar *message; - + if (job->failed || job->finished) return; ev_debug_message (DEBUG_JOBS, "job %s (%p) failed", EV_GET_TYPE_NAME (job), job); - + job->failed = TRUE; - + va_start (args, format); message = g_strdup_vprintf (format, args); va_end (args); - + job->error = g_error_new_literal (domain, code, message); g_free (message); - - ev_job_emit_finished (job); + + ev_job_emit_finished (job); } /** @@ -278,7 +278,7 @@ ev_job_failed_from_error (EvJob *job, { if (job->failed || job->finished) return; - + ev_debug_message (DEBUG_JOBS, "job %s (%p) failed", EV_GET_TYPE_NAME (job), job); job->failed = TRUE; @@ -294,7 +294,7 @@ ev_job_succeeded (EvJob *job) return; ev_debug_message (DEBUG_JOBS, "job %s (%p) succeeded", EV_GET_TYPE_NAME (job), job); - + job->failed = FALSE; ev_job_emit_finished (job); } @@ -337,7 +337,7 @@ ev_job_links_dispose (GObject *object) EvJobLinks *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_LINKS (object); if (job->model) { @@ -387,7 +387,7 @@ ev_job_links_run (EvJob *job) ev_debug_message (DEBUG_JOBS, NULL); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); job_links->model = ev_document_links_get_links_model (EV_DOCUMENT_LINKS (job->document)); ev_document_doc_mutex_unlock (); @@ -395,7 +395,7 @@ ev_job_links_run (EvJob *job) gtk_tree_model_foreach (job_links->model, (GtkTreeModelForeachFunc)fill_page_labels, job); ev_job_succeeded (job); - + return FALSE; } @@ -418,7 +418,7 @@ ev_job_links_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_LINKS, NULL); job->document = g_object_ref (document); - + return job; } @@ -435,7 +435,7 @@ ev_job_attachments_dispose (GObject *object) EvJobAttachments *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_ATTACHMENTS (object); if (job->attachments) { @@ -484,7 +484,7 @@ ev_job_attachments_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_ATTACHMENTS, NULL); job->document = g_object_ref (document); - + return job; } @@ -610,11 +610,11 @@ ev_job_render_run (EvJob *job) ev_debug_message (DEBUG_JOBS, "page: %d (%p)", job_render->page, job); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); ev_profiler_start (EV_PROFILE_JOBS, "Rendering page %d", job_render->page); - + ev_document_fc_mutex_lock (); ev_page = ev_document_get_page (job->document, job_render->page); @@ -622,7 +622,7 @@ ev_job_render_run (EvJob *job) if ( job->document->iswebdocument == TRUE ) { return TRUE; - + if (g_cancellable_is_cancelled (job->cancellable)) { ev_document_fc_mutex_unlock (); ev_document_doc_mutex_unlock (); @@ -630,7 +630,7 @@ ev_job_render_run (EvJob *job) return FALSE; } - + ev_document_fc_mutex_unlock (); ev_document_doc_mutex_unlock (); ev_job_succeeded (job); @@ -670,9 +670,9 @@ ev_job_render_run (EvJob *job) ev_document_fc_mutex_unlock (); ev_document_doc_mutex_unlock (); - + ev_job_succeeded (job); - + return FALSE; } @@ -697,7 +697,7 @@ ev_job_render_new (EvDocument *document, EvJobRender *job; ev_debug_message (DEBUG_JOBS, "page: %d", page); - + job = g_object_new (EV_TYPE_JOB_RENDER, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -830,7 +830,7 @@ ev_job_thumbnail_dispose (GObject *object) job = EV_JOB_THUMBNAIL (object); ev_debug_message (DEBUG_JOBS, "%d (%p)", job->page, job); - + if (job->thumbnail) { g_object_unref (job->thumbnail); job->thumbnail = NULL; @@ -941,7 +941,7 @@ ev_job_thumbnail_run (EvJob *job) if (job->document->iswebdocument == TRUE) { GtkWidget *webview; GtkWidget *offscreenwindow; - + webview = webkit_web_view_new (); offscreenwindow = gtk_offscreen_window_new (); @@ -957,7 +957,7 @@ ev_job_thumbnail_run (EvJob *job) g_object_ref (job_thumb)); webkit_web_view_load_uri (WEBKIT_WEB_VIEW (webview), (gchar*) rc->page->backend_page); } - else + else #endif /* ENABLE_EPUB */ { ev_document_doc_mutex_lock (); @@ -967,7 +967,7 @@ ev_job_thumbnail_run (EvJob *job) ev_job_succeeded (job); } g_object_unref (rc); - + return FALSE; } @@ -990,7 +990,7 @@ ev_job_thumbnail_new (EvDocument *document, EvJobThumbnail *job; ev_debug_message (DEBUG_JOBS, "%d", page); - + job = g_object_new (EV_TYPE_JOB_THUMBNAIL, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -1015,11 +1015,11 @@ ev_job_fonts_run (EvJob *job) EvDocumentFonts *fonts = EV_DOCUMENT_FONTS (job->document); ev_debug_message (DEBUG_JOBS, NULL); - + /* Do not block the main loop */ if (!ev_document_doc_mutex_trylock ()) return TRUE; - + if (!ev_document_fc_mutex_trylock ()) { ev_document_doc_mutex_unlock (); return TRUE; @@ -1040,7 +1040,7 @@ ev_job_fonts_run (EvJob *job) if (job_fonts->scan_completed) ev_job_succeeded (job); - + return !job_fonts->scan_completed; } @@ -1048,9 +1048,9 @@ static void ev_job_fonts_class_init (EvJobFontsClass *class) { EvJobClass *job_class = EV_JOB_CLASS (class); - + job_class->run = ev_job_fonts_run; - + job_fonts_signals[FONTS_UPDATED] = g_signal_new ("updated", EV_TYPE_JOB_FONTS, @@ -1068,7 +1068,7 @@ ev_job_fonts_new (EvDocument *document) EvJobFonts *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = g_object_new (EV_TYPE_JOB_FONTS, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -1089,7 +1089,7 @@ ev_job_load_dispose (GObject *object) EvJobLoad *job = EV_JOB_LOAD (object); ev_debug_message (DEBUG_JOBS, "%s", job->uri); - + if (job->uri) { g_free (job->uri); job->uri = NULL; @@ -1108,10 +1108,10 @@ ev_job_load_run (EvJob *job) { EvJobLoad *job_load = EV_JOB_LOAD (job); GError *error = NULL; - + ev_debug_message (DEBUG_JOBS, "%s", job_load->uri); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_fc_mutex_lock (); /* This job may already have a document even if the job didn't complete @@ -1124,7 +1124,7 @@ ev_job_load_run (EvJob *job) ev_document_security_set_password (EV_DOCUMENT_SECURITY (job->document), job_load->password); } - + job->failed = FALSE; job->finished = FALSE; g_clear_error (&job->error); @@ -1167,7 +1167,7 @@ ev_job_load_new (const gchar *uri) EvJobLoad *job; ev_debug_message (DEBUG_JOBS, "%s", uri); - + job = g_object_new (EV_TYPE_JOB_LOAD, NULL); job->uri = g_strdup (uri); @@ -1178,7 +1178,7 @@ void ev_job_load_set_uri (EvJobLoad *job, const gchar *uri) { ev_debug_message (DEBUG_JOBS, "%s", uri); - + if (job->uri) g_free (job->uri); job->uri = g_strdup (uri); @@ -1207,7 +1207,7 @@ ev_job_save_dispose (GObject *object) EvJobSave *job = EV_JOB_SAVE (object); ev_debug_message (DEBUG_JOBS, "%s", job->uri); - + if (job->uri) { g_free (job->uri); job->uri = NULL; @@ -1229,7 +1229,7 @@ ev_job_save_run (EvJob *job) gchar *tmp_filename = NULL; gchar *local_uri; GError *error = NULL; - + ev_debug_message (DEBUG_JOBS, "uri: %s, document_uri: %s", job_save->uri, job_save->document_uri); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); @@ -1257,7 +1257,7 @@ ev_job_save_run (EvJob *job) g_free (local_uri); ev_job_failed_from_error (job, error); g_error_free (error); - + return FALSE; } @@ -1268,11 +1268,11 @@ ev_job_save_run (EvJob *job) EvCompressionType ctype = EV_COMPRESSION_NONE; const gchar *ext; gchar *uri_comp; - + ext = g_strrstr (job_save->document_uri, ".gz"); if (ext && g_ascii_strcasecmp (ext, ".gz") == 0) ctype = EV_COMPRESSION_GZIP; - + ext = g_strrstr (job_save->document_uri, ".bz2"); if (ext && g_ascii_strcasecmp (ext, ".bz2") == 0) ctype = EV_COMPRESSION_BZIP2; @@ -1294,7 +1294,7 @@ ev_job_save_run (EvJob *job) g_free (local_uri); ev_job_failed_from_error (job, error); g_error_free (error); - + return FALSE; } @@ -1310,7 +1310,7 @@ ev_job_save_run (EvJob *job) } else { ev_job_succeeded (job); } - + return FALSE; } @@ -1376,7 +1376,7 @@ ev_job_find_dispose (GObject *object) if (job->results) { g_free(job->results); } - + (* G_OBJECT_CLASS (ev_job_find_parent_class)->dispose) (object); } @@ -1388,11 +1388,11 @@ ev_job_find_run (EvJob *job) EvPage *ev_page; GList *matches; ev_debug_message (DEBUG_JOBS, NULL); - + /* Do not block the main loop */ if (!ev_document_doc_mutex_trylock ()) return TRUE; - + #ifdef EV_ENABLE_DEBUG /* We use the #ifdef in this case because of the if */ if (job_find->current_page == job_find->start_page) @@ -1406,11 +1406,11 @@ ev_job_find_run (EvJob *job) job_find->case_sensitive); }else { matches = ev_document_find_find_text (find, ev_page, job_find->text, - job_find->case_sensitive); + job_find->case_sensitive); } - + g_object_unref (ev_page); - + ev_document_doc_mutex_unlock (); if (!job_find->has_results && !job->document->iswebdocument) { @@ -1425,7 +1425,7 @@ ev_job_find_run (EvJob *job) } g_signal_emit (job_find, job_find_signals[FIND_UPDATED], 0, job_find->current_page); - + job_find->current_page = (job_find->current_page + 1) % job_find->n_pages; if (job_find->current_page == job_find->start_page) { ev_job_succeeded (job); @@ -1441,10 +1441,10 @@ ev_job_find_class_init (EvJobFindClass *class) { EvJobClass *job_class = EV_JOB_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class); - + job_class->run = ev_job_find_run; gobject_class->dispose = ev_job_find_dispose; - + job_find_signals[FIND_UPDATED] = g_signal_new ("updated", EV_TYPE_JOB_FIND, @@ -1464,9 +1464,9 @@ ev_job_find_new (EvDocument *document, gboolean case_sensitive) { EvJobFind *job; - + ev_debug_message (DEBUG_JOBS, NULL); - + job = g_object_new (EV_TYPE_JOB_FIND, NULL); EV_JOB (job)->document = g_object_ref (document); @@ -1506,7 +1506,7 @@ ev_job_find_get_progress (EvJobFind *job) if (ev_job_is_finished (EV_JOB (job))) return 1.0; - + if (job->current_page > job->start_page) { pages_done = job->current_page - job->start_page + 1; } else if (job->current_page == job->start_page) { @@ -1549,7 +1549,7 @@ ev_job_layers_dispose (GObject *object) EvJobLayers *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_LAYERS (object); if (job->model) { @@ -1567,13 +1567,13 @@ ev_job_layers_run (EvJob *job) ev_debug_message (DEBUG_JOBS, NULL); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); job_layers->model = ev_document_layers_get_layers (EV_DOCUMENT_LAYERS (job->document)); ev_document_doc_mutex_unlock (); - + ev_job_succeeded (job); - + return FALSE; } @@ -1596,7 +1596,7 @@ ev_job_layers_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_LAYERS, NULL); job->document = g_object_ref (document); - + return job; } @@ -1614,7 +1614,7 @@ ev_job_export_dispose (GObject *object) EvJobExport *job; ev_debug_message (DEBUG_JOBS, NULL); - + job = EV_JOB_EXPORT (object); if (job->rc) { @@ -1635,27 +1635,27 @@ ev_job_export_run (EvJob *job) ev_debug_message (DEBUG_JOBS, NULL); ev_profiler_start (EV_PROFILE_JOBS, "%s (%p)", EV_GET_TYPE_NAME (job), job); - + ev_document_doc_mutex_lock (); - + ev_page = ev_document_get_page (job->document, job_export->page); if (job_export->rc) { job->failed = FALSE; job->finished = FALSE; g_clear_error (&job->error); - + ev_render_context_set_page (job_export->rc, ev_page); } else { job_export->rc = ev_render_context_new (ev_page, 0, 1.0); } g_object_unref (ev_page); - + ev_file_exporter_do_page (EV_FILE_EXPORTER (job->document), job_export->rc); - + ev_document_doc_mutex_unlock (); - + ev_job_succeeded (job); - + return FALSE; } @@ -1678,7 +1678,7 @@ ev_job_export_new (EvDocument *document) job = g_object_new (EV_TYPE_JOB_EXPORT, NULL); job->document = g_object_ref (document); - + return job; } diff --git a/libview/ev-jobs.h b/libview/ev-jobs.h index 35a378c5..284b2198 100644 --- a/libview/ev-jobs.h +++ b/libview/ev-jobs.h @@ -162,7 +162,7 @@ typedef enum { struct _EvJob { GObject parent; - + EvDocument *document; EvJobRunMode run_mode; @@ -170,7 +170,7 @@ struct _EvJob guint cancelled : 1; guint finished : 1; guint failed : 1; - + GError *error; GCancellable *cancellable; @@ -183,7 +183,7 @@ struct _EvJobClass GObjectClass parent_class; gboolean (*run) (EvJob *job); - + /* Signals */ void (* cancelled) (EvJob *job); void (* finished) (EvJob *job); diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c index 3b353c98..d6c75354 100644 --- a/libview/ev-pixbuf-cache.c +++ b/libview/ev-pixbuf-cache.c @@ -22,13 +22,13 @@ typedef struct _CacheJobInfo /* Device scale factor of target widget */ int device_scale; - /* Selection data. + /* Selection data. * Selection_points are the coordinates encapsulated in selection. * target_points is the target selection size. */ EvRectangle target_points; EvSelectionStyle selection_style; gboolean points_set; - + cairo_surface_t *selection; gdouble selection_scale; EvRectangle selection_points; @@ -227,7 +227,7 @@ ev_pixbuf_cache_new (GtkWidget *view, EvPixbufCache *pixbuf_cache; pixbuf_cache = (EvPixbufCache *) g_object_new (EV_TYPE_PIXBUF_CACHE, NULL); - /* This is a backlink, so we don't ref this */ + /* This is a backlink, so we don't ref this */ pixbuf_cache->view = view; pixbuf_cache->model = g_object_ref (model); pixbuf_cache->document = ev_document_model_get_document (model); @@ -685,7 +685,7 @@ add_job (EvPixbufCache *pixbuf_cache, GdkColor text, base; get_selection_colors (EV_VIEW (pixbuf_cache->view), &text, &base); - ev_job_render_set_selection_info (EV_JOB_RENDER (job_info->job), + ev_job_render_set_selection_info (EV_JOB_RENDER (job_info->job), &(job_info->target_points), job_info->selection_style, &text, &base); @@ -1153,7 +1153,7 @@ static void update_job_selection (CacheJobInfo *job_info, EvViewSelection *selection) { - job_info->points_set = TRUE; + job_info->points_set = TRUE; job_info->target_points = selection->rect; job_info->selection_style = selection->style; } @@ -1209,7 +1209,7 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache, if (((EvViewSelection *)list->data)->page == page) { selection = list->data; break; - } else if (((EvViewSelection *)list->data)->page > page) + } else if (((EvViewSelection *)list->data)->page > page) break; list = list->next; } @@ -1228,7 +1228,7 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache, if (((EvViewSelection *)list->data)->page == page) { selection = list->data; break; - } else if (((EvViewSelection *)list->data)->page > page) + } else if (((EvViewSelection *)list->data)->page > page) break; list = list->next; } @@ -1249,7 +1249,7 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache, if (((EvViewSelection *)list->data)->page == page) { selection = list->data; break; - } else if (((EvViewSelection *)list->data)->page > page) + } else if (((EvViewSelection *)list->data)->page > page) break; list = list->next; } @@ -1294,7 +1294,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache) selection->covered_region = cairo_region_reference (pixbuf_cache->prev_job[i].selection_region); retval = g_list_prepend (retval, selection); } - + page ++; } @@ -1308,7 +1308,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache) selection->covered_region = cairo_region_reference (pixbuf_cache->job_list[i].selection_region); retval = g_list_prepend (retval, selection); } - + page ++; } @@ -1324,7 +1324,7 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache) selection->covered_region = cairo_region_reference (pixbuf_cache->next_job[i].selection_region); retval = g_list_prepend (retval, selection); } - + page ++; } diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c index 9449dd37..be258b76 100644 --- a/libview/ev-print-operation.c +++ b/libview/ev-print-operation.c @@ -397,7 +397,7 @@ struct _EvPrintOperationExport { gboolean embed_page_setup; guint idle_id; - + /* Context */ EvFileExporterContext fc; gint n_pages_to_print; @@ -486,7 +486,7 @@ ev_print_queue_pop (EvDocument *document) queue = g_hash_table_lookup (print_queue, document); if (!queue || g_queue_is_empty (queue)) return NULL; - + op = g_queue_pop_tail (queue); g_object_unref (op); @@ -512,7 +512,7 @@ ev_print_operation_export_set_current_page (EvPrintOperation *op, EvPrintOperationExport *export = EV_PRINT_OPERATION_EXPORT (op); g_return_if_fail (current_page < export->n_pages); - + export->current_page = current_page; } @@ -619,7 +619,7 @@ clamp_ranges (EvPrintOperationExport *export) for (i = 0; i < export->n_ranges; i++) { gint n_pages; - + if ((export->ranges[i].start >= 0) && (export->ranges[i].start < export->n_pages) && (export->ranges[i].end >= 0) && @@ -639,7 +639,7 @@ clamp_ranges (EvPrintOperationExport *export) export->ranges[num_of_correct_ranges] = export->ranges[i]; num_of_correct_ranges++; } - + n_pages = export->ranges[i].end - export->ranges[i].start + 1; if (export->page_set == GTK_PAGE_SET_ALL) { n_pages_to_print += n_pages; @@ -648,13 +648,13 @@ clamp_ranges (EvPrintOperationExport *export) } else if (export->page_set == GTK_PAGE_SET_EVEN) { if (n_pages==1 && export->ranges[i].start % 2 == 0) null_flag = TRUE; - else + else n_pages_to_print += export->ranges[i].start % 2 == 0 ? n_pages / 2 : (n_pages / 2) + 1; } else if (export->page_set == GTK_PAGE_SET_ODD) { - if (n_pages==1 && export->ranges[i].start % 2 != 0) + if (n_pages==1 && export->ranges[i].start % 2 != 0) null_flag = TRUE; - else + else n_pages_to_print += export->ranges[i].start % 2 == 0 ? (n_pages / 2) + 1 : n_pages / 2; } @@ -775,7 +775,7 @@ ev_print_operation_export_run_next (EvPrintOperationExport *export) /* First pop the current job */ document = op->document; ev_print_queue_pop (document); - + next = ev_print_queue_peek (document); if (next) ev_print_operation_export_begin (EV_PRINT_OPERATION_EXPORT (next)); @@ -813,7 +813,7 @@ export_print_done (EvPrintOperationExport *export) GError *error = NULL; g_assert (export->temp_file != NULL); - + /* Some printers take into account some print settings, * and others don't. However we have exported the document * to a ps or pdf file according to such print settings. So, @@ -855,12 +855,12 @@ export_print_done (EvPrintOperationExport *export) data = g_key_file_to_data (key_file, &data_len, &error); if (data) { gint fd; - + fd = g_file_open_tmp ("print-settingsXXXXXX", &print_settings_file, &error); if (!error) g_file_set_contents (print_settings_file, data, data_len, &error); close (fd); - + g_free (data); } @@ -908,7 +908,7 @@ export_print_done (EvPrintOperationExport *export) } } else { GtkPrintJob *job; - + job = gtk_print_job_new (export->job_name, export->printer, settings, @@ -992,7 +992,7 @@ export_cancel (EvPrintOperationExport *export) g_object_unref (export->job_export); export->job_export = NULL; } - + if (export->fd != -1) { close (export->fd); export->fd = -1; @@ -1105,7 +1105,7 @@ export_print_page (EvPrintOperationExport *export) ev_job_scheduler_push_job (export->job_export, EV_JOB_PRIORITY_NONE); update_progress (export); - + return FALSE; } @@ -1116,7 +1116,7 @@ ev_print_operation_export_begin (EvPrintOperationExport *export) if (!export->temp_file) return; /* cancelled */ - + ev_document_doc_mutex_lock (); ev_file_exporter_begin (EV_FILE_EXPORTER (op->document), &export->fc); ev_document_doc_mutex_unlock (); @@ -1124,7 +1124,7 @@ ev_print_operation_export_begin (EvPrintOperationExport *export) export->idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, (GSourceFunc)export_print_page, export, - (GDestroyNotify)export_print_page_idle_finished); + (GDestroyNotify)export_print_page_idle_finished); } static void @@ -1145,7 +1145,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial gchar *filename; GError *error = NULL; EvPrintOperation *op = EV_PRINT_OPERATION (export); - + if (response != GTK_RESPONSE_OK && response != GTK_RESPONSE_APPLY) { gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -1155,7 +1155,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial } export->print_preview = (response == GTK_RESPONSE_APPLY); - + printer = gtk_print_unix_dialog_get_selected_printer (GTK_PRINT_UNIX_DIALOG (dialog)); ev_print_operation_export_set_printer (export, printer); @@ -1167,24 +1167,24 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial if (!gtk_printer_accepts_ps (export->printer)) { gtk_widget_destroy (GTK_WIDGET (dialog)); - + g_set_error_literal (&export->error, GTK_PRINT_ERROR, GTK_PRINT_ERROR_GENERAL, _("Printing is not supported on this printer.")); g_signal_emit (op, signals[DONE], 0, GTK_PRINT_OPERATION_RESULT_ERROR); - + return; } file_format = gtk_print_settings_get (print_settings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT); - + filename = g_strdup_printf ("atril_print.%s.XXXXXX", file_format != NULL ? file_format : ""); export->fd = g_file_open_tmp (filename, &export->temp_file, &error); g_free (filename); if (export->fd <= -1) { gtk_widget_destroy (GTK_WIDGET (dialog)); - + g_set_error_literal (&export->error, GTK_PRINT_ERROR, GTK_PRINT_ERROR_GENERAL, @@ -1198,19 +1198,19 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial export->current_page = gtk_print_unix_dialog_get_current_page (GTK_PRINT_UNIX_DIALOG (dialog)); export->page_set = gtk_print_settings_get_page_set (print_settings); print_pages = gtk_print_settings_get_print_pages (print_settings); - + switch (print_pages) { case GTK_PRINT_PAGES_CURRENT: export->ranges = &export->one_range; - + export->ranges[0].start = export->current_page; export->ranges[0].end = export->current_page; export->n_ranges = 1; - + break; case GTK_PRINT_PAGES_RANGES: { gint i; - + export->ranges = gtk_print_settings_get_page_ranges (print_settings, &export->n_ranges); for (i = 0; i < export->n_ranges; i++) if (export->ranges[i].end == -1 || export->ranges[i].end >= export->n_pages) @@ -1225,7 +1225,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial export->ranges[0].start = 0; export->ranges[0].end = export->n_pages - 1; export->n_ranges = 1; - + break; } @@ -1247,7 +1247,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial return; } else ev_print_operation_update_status (op, -1, -1, 0.0); - + width = gtk_page_setup_get_paper_width (page_setup, GTK_UNIT_POINTS); height = gtk_page_setup_get_paper_height (page_setup, GTK_UNIT_POINTS); scale = gtk_print_settings_get_scale (print_settings) * 0.01; @@ -1257,7 +1257,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial } export->pages_per_sheet = MAX (1, gtk_print_settings_get_number_up (print_settings)); - + export->copies = gtk_print_settings_get_n_copies (print_settings); export->collate = gtk_print_settings_get_collate (print_settings); export->reverse = gtk_print_settings_get_reverse (print_settings); @@ -1300,7 +1300,7 @@ ev_print_operation_export_print_dialog_response_cb (GtkDialog *dial ev_print_queue_push (op); g_signal_emit (op, signals[BEGIN_PRINT], 0); - + gtk_widget_destroy (GTK_WIDGET (dialog)); } @@ -1320,7 +1320,7 @@ ev_print_operation_export_run (EvPrintOperation *op, /* translators: Title of the print dialog */ dialog = gtk_print_unix_dialog_new (_("Print"), parent); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - + capabilities = GTK_PRINT_CAPABILITY_PREVIEW | ev_file_exporter_get_capabilities (EV_FILE_EXPORTER (op->document)); gtk_print_unix_dialog_set_manual_capabilities (GTK_PRINT_UNIX_DIALOG (dialog), @@ -1331,10 +1331,10 @@ ev_print_operation_export_run (EvPrintOperation *op, gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (dialog), export->current_page); - + gtk_print_unix_dialog_set_settings (GTK_PRINT_UNIX_DIALOG (dialog), export->print_settings); - + if (export->page_setup) gtk_print_unix_dialog_set_page_setup (GTK_PRINT_UNIX_DIALOG (dialog), export->page_setup); @@ -1400,7 +1400,7 @@ ev_print_operation_export_finalize (GObject *object) close (export->fd); export->fd = -1; } - + if (export->ranges) { if (export->ranges != &export->one_range) g_free (export->ranges); @@ -1469,7 +1469,7 @@ ev_print_operation_export_constructor (GType type, GObject *object; EvPrintOperationExport *export; EvPrintOperation *op; - + object = G_OBJECT_CLASS (ev_print_operation_export_parent_class)->constructor (type, n_construct_properties, construct_params); diff --git a/libview/ev-print-operation.h b/libview/ev-print-operation.h index 35f14021..fa493fc7 100644 --- a/libview/ev-print-operation.h +++ b/libview/ev-print-operation.h @@ -67,5 +67,5 @@ const gchar *ev_print_operation_get_status (EvPrintOperation *o gdouble ev_print_operation_get_progress (EvPrintOperation *op); G_END_DECLS - + #endif /* __EV_PRINT_OPERATION_H__ */ diff --git a/libview/ev-timeline.c b/libview/ev-timeline.c index 62c97286..1edb9b2c 100644 --- a/libview/ev-timeline.c +++ b/libview/ev-timeline.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-timeline.h b/libview/ev-timeline.h index b51e9b33..d4f6ba78 100644 --- a/libview/ev-timeline.h +++ b/libview/ev-timeline.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-transition-animation.c b/libview/ev-transition-animation.c index a8a2e117..c3c825fa 100644 --- a/libview/ev-transition-animation.c +++ b/libview/ev-transition-animation.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-transition-animation.h b/libview/ev-transition-animation.h index a0882734..8691fd66 100644 --- a/libview/ev-transition-animation.h +++ b/libview/ev-transition-animation.h @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h index dbb99914..f1059395 100644 --- a/libview/ev-view-private.h +++ b/libview/ev-view-private.h @@ -54,7 +54,7 @@ typedef struct { gboolean autoscrolling; guint last_y; guint start_y; - guint timeout_id; + guint timeout_id; } AutoScrollInfo; /* Information for handling selection */ @@ -147,7 +147,7 @@ struct _EvView { guint vscroll_policy : 1; gint scroll_x; - gint scroll_y; + gint scroll_y; /* Delta sum for emulating normal scrolling */ gdouble total_delta; @@ -156,7 +156,7 @@ struct _EvView { EvPoint pending_point; /* Current geometry */ - + gint start_page; gint end_page; gint current_page; @@ -182,7 +182,7 @@ struct _EvView { /* Information for middle clicking and dragging around. */ DragInfo drag_info; - + /* Autoscrolling */ AutoScrollInfo scroll_info; diff --git a/libview/ev-view.c b/libview/ev-view.c index e08db24f..7703c6ed 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -262,7 +262,7 @@ static EvRectangle *ev_view_find_get_result (EvView gint page, gint result); static void jump_to_find_result (EvView *view); -static void jump_to_find_page (EvView *view, +static void jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift); /*** Selection ***/ @@ -1447,7 +1447,7 @@ location_in_text (EvView *view, if (page == -1) return FALSE; - + region = ev_page_cache_get_text_mapping (view->page_cache, page); if (region) @@ -1479,11 +1479,11 @@ location_in_selected_text (EvView *view, } static gboolean -get_doc_point_from_offset (EvView *view, - gint page, - gint x_offset, - gint y_offset, - gint *x_new, +get_doc_point_from_offset (EvView *view, + gint page, + gint x_offset, + gint y_offset, + gint *x_new, gint *y_new) { gdouble width, height; @@ -1504,7 +1504,7 @@ get_doc_point_from_offset (EvView *view, x = width - x_offset; y = height - y_offset; } else if (view->rotation == 270) { - x = height - y_offset; + x = height - y_offset; y = x_offset; } else { g_assert_not_reached (); @@ -1512,7 +1512,7 @@ get_doc_point_from_offset (EvView *view, *x_new = x; *y_new = y; - + return TRUE; } @@ -1742,7 +1742,7 @@ goto_xyz_dest (EvView *view, EvLinkDest *dest) EvPoint doc_point; gint page; gdouble zoom, left, top; - gboolean change_zoom, change_left, change_top; + gboolean change_zoom, change_left, change_top; zoom = ev_link_dest_get_zoom (dest, &change_zoom); page = ev_link_dest_get_page (dest); @@ -1775,7 +1775,7 @@ goto_dest (EvView *view, EvLinkDest *dest) return; current_page = view->current_page; - + type = ev_link_dest_get_dest_type (dest); switch (type) { @@ -1816,7 +1816,7 @@ ev_view_goto_dest (EvView *view, EvLinkDest *dest) type = ev_link_dest_get_dest_type (dest); if (type == EV_LINK_DEST_TYPE_NAMED) { - EvLinkDest *dest2; + EvLinkDest *dest2; const gchar *named_dest; named_dest = ev_link_dest_get_named_dest (dest); @@ -1832,7 +1832,7 @@ ev_view_goto_dest (EvView *view, EvLinkDest *dest) goto_dest (view, dest); } - + void ev_view_handle_link (EvView *view, EvLink *link) { @@ -1848,9 +1848,9 @@ ev_view_handle_link (EvView *view, EvLink *link) switch (type) { case EV_LINK_ACTION_TYPE_GOTO_DEST: { EvLinkDest *dest; - + g_signal_emit (view, signals[SIGNAL_HANDLE_LINK], 0, link); - + dest = ev_link_action_get_dest (action); ev_view_goto_dest (view, dest); } @@ -1900,7 +1900,7 @@ static char * tip_from_action_named (EvLinkAction *action) { const gchar *name = ev_link_action_get_name (action); - + if (g_ascii_strcasecmp (name, "FirstPage") == 0) { return g_strdup (_("Go to first page")); } else if (g_ascii_strcasecmp (name, "PrevPage") == 0) { @@ -1914,7 +1914,7 @@ tip_from_action_named (EvLinkAction *action) } else if (g_ascii_strcasecmp (name, "Find") == 0) { return g_strdup (_("Find")); } - + return NULL; } @@ -1929,10 +1929,10 @@ tip_from_link (EvView *view, EvLink *link) action = ev_link_get_action (link); title = ev_link_get_title (link); - + if (!action) return title ? g_strdup (title) : NULL; - + type = ev_link_action_get_action_type (action); switch (type) { @@ -1968,7 +1968,7 @@ tip_from_link (EvView *view, EvLink *link) msg = g_strdup (title); break; } - + return msg; } @@ -2258,15 +2258,15 @@ ev_view_form_field_text_save (EvView *view, if (!view->document) return; - + field = g_object_get_data (G_OBJECT (widget), "form-field"); - + if (field->changed) { EvFormFieldText *field_text = EV_FORM_FIELD_TEXT (field); cairo_region_t *field_region; field_region = ev_view_form_field_get_region (view, field); - + ev_document_forms_form_field_text_set_text (EV_DOCUMENT_FORMS (view->document), field, field_text->text); field->changed = FALSE; @@ -2329,7 +2329,7 @@ ev_view_form_field_text_create_widget (EvView *view, gtk_entry_set_has_frame (GTK_ENTRY (text), FALSE); gtk_entry_set_max_length (GTK_ENTRY (text), field_text->max_len); gtk_entry_set_visibility (GTK_ENTRY (text), !field_text->is_password); - + if (txt) { gtk_entry_set_text (GTK_ENTRY (text), txt); g_free (txt); @@ -2347,10 +2347,10 @@ ev_view_form_field_text_create_widget (EvView *view, break; case EV_FORM_FIELD_TEXT_MULTILINE: { GtkTextBuffer *buffer; - + text = gtk_text_view_new (); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)); - + if (txt) { gtk_text_buffer_set_text (buffer, txt, -1); g_free (txt); @@ -2364,7 +2364,7 @@ ev_view_form_field_text_create_widget (EvView *view, field); } break; - } + } g_object_weak_ref (G_OBJECT (text), (GWeakNotify)ev_view_form_field_text_save, @@ -2381,7 +2381,7 @@ ev_view_form_field_choice_save (EvView *view, if (!view->document) return; - + field = g_object_get_data (G_OBJECT (widget), "form-field"); if (field->changed) { @@ -2413,10 +2413,10 @@ ev_view_form_field_choice_changed (GtkWidget *widget, EvFormField *field) { EvFormFieldChoice *field_choice = EV_FORM_FIELD_CHOICE (field); - + if (GTK_IS_COMBO_BOX (widget)) { gint item; - + item = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)); if (!field_choice->selected_items || GPOINTER_TO_INT (field_choice->selected_items->data) != item) { @@ -2442,7 +2442,7 @@ ev_view_form_field_choice_changed (GtkWidget *widget, GtkTreeSelection *selection = GTK_TREE_SELECTION (widget); GtkTreeModel *model; GList *items, *l; - + items = gtk_tree_selection_get_selected_rows (selection, &model); g_list_free (field_choice->selected_items); field_choice->selected_items = NULL; @@ -2451,7 +2451,7 @@ ev_view_form_field_choice_changed (GtkWidget *widget, GtkTreeIter iter; GtkTreePath *path = (GtkTreePath *)l->data; gint item; - + gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, 1, &item, -1); @@ -2493,7 +2493,7 @@ ev_view_form_field_choice_create_widget (EvView *view, field_choice->selected_items = g_list_prepend (field_choice->selected_items, GINT_TO_POINTER (i)); } - + if (item) { gtk_list_store_append (GTK_LIST_STORE (model), &iter); gtk_list_store_set (GTK_LIST_STORE (model), &iter, @@ -2541,7 +2541,7 @@ ev_view_form_field_choice_create_widget (EvView *view, view); } else if (field_choice->is_editable) { /* ComboBoxEntry */ gchar *text; - + choice = gtk_combo_box_new_with_model_and_entry (model); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (choice), 0); text = ev_document_forms_form_field_choice_get_text (EV_DOCUMENT_FORMS (view->document), field); @@ -2570,7 +2570,7 @@ ev_view_form_field_choice_create_widget (EvView *view, NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (choice), selected_item); gtk_combo_box_popup (GTK_COMBO_BOX (choice)); - + g_signal_connect (choice, "changed", G_CALLBACK (ev_view_form_field_choice_changed), field); @@ -3736,7 +3736,7 @@ ev_view_size_allocate (GtkWidget *widget, ev_view_size_request (widget, &req); view->internal_size_request = FALSE; } - + view_set_adjustment_values (view, GTK_ORIENTATION_HORIZONTAL); view_set_adjustment_values (view, GTK_ORIENTATION_VERTICAL); @@ -4171,9 +4171,9 @@ get_link_area (EvView *view, x += view->scroll_x; y += view->scroll_y; - + find_page_at_location (view, x, y, &page, &x_offset, &y_offset); - + link_mapping = ev_page_cache_get_link_mapping (view->page_cache, page); ev_view_get_area_from_mapping (view, page, link_mapping, @@ -4457,7 +4457,7 @@ ev_view_button_press_event (GtkWidget *widget, ev_annotation_window_ungrab_focus (window); view->window_child_focus = NULL; } - + view->pressed_button = event->button; view->selection_info.in_drag = FALSE; @@ -4532,7 +4532,7 @@ ev_view_button_press_event (GtkWidget *widget, ev_view_pend_cursor_blink (view); } } - } + } return TRUE; case 2: /* use root coordinates as reference point because @@ -4550,7 +4550,7 @@ ev_view_button_press_event (GtkWidget *widget, ev_view_set_focused_element_at_location (view, event->x, event->y); return ev_view_do_popup_menu (view, event->x, event->y); } - + return FALSE; } @@ -4599,7 +4599,7 @@ ev_view_drag_data_get (GtkWidget *widget, pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (view->document), view->image_dnd_info.image); ev_document_doc_mutex_unlock (); - + gtk_selection_data_set_pixbuf (selection_data, pixbuf); g_object_unref (pixbuf); } @@ -4614,7 +4614,7 @@ ev_view_drag_data_get (GtkWidget *widget, pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (view->document), view->image_dnd_info.image); ev_document_doc_mutex_unlock (); - + tmp_uri = ev_image_save_tmp (view->image_dnd_info.image, pixbuf); g_object_unref (pixbuf); @@ -4636,10 +4636,10 @@ ev_view_drag_motion (GtkWidget *widget, gdk_drag_status (context, 0, time); else gdk_drag_status (context, gdk_drag_context_get_suggested_action (context), time); - + return TRUE; } - + static gboolean selection_update_idle_cb (EvView *view) { @@ -4653,7 +4653,7 @@ selection_update_idle_cb (EvView *view) static gboolean selection_scroll_timeout_cb (EvView *view) -{ +{ gint x, y, shift = 0; GtkWidget *widget = GTK_WIDGET (view); GtkAllocation allocation; @@ -4696,16 +4696,16 @@ ev_view_drag_update_momentum (EvView *view) int i; if (!view->drag_info.in_drag) return FALSE; - + for (i = DRAG_HISTORY - 1; i > 0; i--) { view->drag_info.buffer[i].x = view->drag_info.buffer[i-1].x; view->drag_info.buffer[i].y = view->drag_info.buffer[i-1].y; } /* Momentum is a moving average of 10ms granularity over - * the last 100ms with each 10ms stored in buffer. + * the last 100ms with each 10ms stored in buffer. */ - + view->drag_info.momentum.x = (view->drag_info.buffer[DRAG_HISTORY - 1].x - view->drag_info.buffer[0].x); view->drag_info.momentum.y = (view->drag_info.buffer[DRAG_HISTORY - 1].y - view->drag_info.buffer[0].y); @@ -4835,7 +4835,7 @@ ev_view_motion_notify_event (GtkWidget *widget, return TRUE; } } - + switch (view->pressed_button) { case 1: /* For the Atril 0.4.x release, we limit selection to un-rotated @@ -4844,22 +4844,22 @@ ev_view_motion_notify_event (GtkWidget *widget, if (view->rotation != 0) return FALSE; - /* Schedule timeout to scroll during selection and additionally + /* Schedule timeout to scroll during selection and additionally * scroll once to allow arbitrary speed. */ if (!view->selection_scroll_id) view->selection_scroll_id = g_timeout_add (SCROLL_TIME, (GSourceFunc)selection_scroll_timeout_cb, view); - else + else selection_scroll_timeout_cb (view); view->motion.x = x + view->scroll_x; view->motion.y = y + view->scroll_y; - /* Queue an idle to handle the motion. We do this because - * handling any selection events in the motion could be slower - * than new motion events reach us. We always put it in the - * idle to make sure we catch up and don't visibly lag the + /* Queue an idle to handle the motion. We do this because + * handling any selection events in the motion could be slower + * than new motion events reach us. We always put it in the + * idle to make sure we catch up and don't visibly lag the * mouse. */ if (!view->selection_update_id) view->selection_update_id = g_idle_add ((GSourceFunc)selection_update_idle_cb, view); @@ -4922,7 +4922,7 @@ ev_view_motion_notify_event (GtkWidget *widget, break; default: ev_view_handle_cursor_over_xy (view, x, y); - } + } return FALSE; } @@ -5603,7 +5603,7 @@ ev_view_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event) EvView *view = EV_VIEW (widget); ev_view_handle_cursor_over_xy (view, event->x, event->y); - + return FALSE; } @@ -6608,7 +6608,7 @@ on_adjustment_value_changed (GtkAdjustment *adjustment, ev_view_window_child_move (view, child, child->x + dx, child->y + dy); } - + if (view->pending_resize) { gtk_widget_queue_draw (widget); } else { @@ -6720,7 +6720,7 @@ ev_view_autoscroll_cb (EvView *view) view->scroll_info.timeout_id = 0; return FALSE; } - + /* Replace 100 with your speed of choice: The lower the faster. * Replace 3 with another speed of choice: The higher, the faster it accelerated * based on the distance of the starting point from the mouse @@ -6730,13 +6730,13 @@ ev_view_autoscroll_cb (EvView *view) speed = -pow ((((gdouble)view->scroll_info.start_y - view->scroll_info.last_y) / 100), 3); else speed = pow ((((gdouble)view->scroll_info.last_y - view->scroll_info.start_y) / 100), 3); - + value = gtk_adjustment_get_value (view->vadjustment); value = CLAMP (value + speed, 0, gtk_adjustment_get_upper (view->vadjustment) - gtk_adjustment_get_page_size (view->vadjustment)); gtk_adjustment_set_value (view->vadjustment, value); - + return TRUE; } @@ -6745,12 +6745,12 @@ void ev_view_autoscroll_start (EvView *view) { gint x, y; - + g_return_if_fail (EV_IS_VIEW (view)); if (view->scroll_info.autoscrolling) return; - + view->scroll_info.autoscrolling = TRUE; view->scroll_info.timeout_id = g_timeout_add (20, (GSourceFunc)ev_view_autoscroll_cb, @@ -6764,7 +6764,7 @@ void ev_view_autoscroll_stop (EvView *view) { gint x, y; - + g_return_if_fail (EV_IS_VIEW (view)); if (!view->scroll_info.autoscrolling) @@ -7417,7 +7417,7 @@ jump_to_find_result (EvView *view) * @shift: Shift from current page * * Jumps to the first page that has occurences of searched word. - * Uses a direction where to look and a shift from current page. + * Uses a direction where to look and a shift from current page. * */ static void @@ -7429,16 +7429,16 @@ jump_to_find_page (EvView *view, EvViewFindDirection direction, gint shift) for (i = 0; i < n_pages; i++) { int page; - + if (direction == EV_VIEW_FIND_NEXT) page = view->current_page + i; else - page = view->current_page - i; + page = view->current_page - i; page += shift; - + if (page >= n_pages) { page = page - n_pages; - } else if (page < 0) + } else if (page < 0) page = page + n_pages; if (ev_view_find_get_n_results (view, page) > 0) { @@ -7459,7 +7459,7 @@ ev_view_find_changed (EvView *view, GList **results, gint page) { g_return_if_fail (view->current_page >= 0); view->find_pages = results; - + if (view->jump_to_find_result == TRUE) { jump_to_find_page (view, EV_VIEW_FIND_NEXT, 0); jump_to_find_result (view); @@ -7602,13 +7602,13 @@ get_selection_page_range (EvView *view, for (i = start_page; i <= end_page; i++) { GdkRectangle page_area; GtkBorder border; - + ev_view_get_page_extents (view, i, &page_area, &border); page_area.x -= border.left; page_area.y -= border.top; page_area.width += border.left + border.right; page_area.height += border.top + border.bottom; - if (gdk_rectangle_point_in (&page_area, start) || + if (gdk_rectangle_point_in (&page_area, start) || gdk_rectangle_point_in (&page_area, stop)) { if (first == -1) first = i; @@ -7930,7 +7930,7 @@ get_selected_text (EvView *view) } ev_document_doc_mutex_unlock (); - + normalized_text = g_utf8_normalize (text->str, text->len, G_NORMALIZE_NFKC); g_string_free (text, TRUE); return normalized_text; @@ -7975,7 +7975,7 @@ ev_view_primary_get_cb (GtkClipboard *clipboard, } else if (EV_IS_SELECTION (ev_view->document) && ev_view->selection_info.selections) { gchar *text; - + text = get_selected_text (ev_view); if (text) { gtk_selection_data_set_text (selection_data, text, -1); @@ -8011,7 +8011,7 @@ ev_view_update_primary_selection (EvView *ev_view) gtk_target_list_add_text_targets (target_list, 0); targets = gtk_target_table_new_from_list (target_list, &n_targets); gtk_target_list_unref (target_list); - + if (!gtk_clipboard_set_with_owner (clipboard, targets, n_targets, ev_view_primary_get_cb, @@ -8040,9 +8040,9 @@ ev_view_copy_link_address (EvView *view, EvLinkAction *action) { clear_link_selected (view); - + ev_view_clipboard_copy (view, ev_link_action_get_uri (action)); - + view->link_selected = g_object_ref (action); ev_view_update_primary_selection (view); } @@ -8115,11 +8115,11 @@ ev_view_previous_page (EvView *view) return TRUE; } - + /** * ev_view_disconnect_handlers * @view: #EvView instance - * + * * Disconnect all signal handlers from the model, to ensure error free operation of the webview, * we have an equivalent function for the webview. */ diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c index 782e4ea4..2fc06791 100644 --- a/libview/ev-web-view.c +++ b/libview/ev-web-view.c @@ -64,7 +64,7 @@ struct _EvWebView gchar *hlink; }; -struct _EvWebViewClass +struct _EvWebViewClass { WebKitWebViewClass base_class; }; @@ -90,7 +90,7 @@ static void web_view_update_range_and_current_page (EvWebView *webview) { g_return_if_fail(EV_IS_WEB_VIEW(webview)); - + if (ev_document_get_n_pages (webview->document) <= 0) return; @@ -114,7 +114,7 @@ ev_web_view_dispose (GObject *object) g_object_unref(webview->model); webview->model = NULL; } - + if (webview->hlink) { g_free(webview->hlink); webview->hlink = NULL; @@ -150,7 +150,7 @@ ev_web_view_init (EvWebView *webview) webview->search->on_result = -1 ; webview->search->results = NULL; webview->search->search_jump = TRUE ; - + webview->fullscreen = FALSE; webview->inverted_stylesheet = FALSE; webview->hlink = NULL; @@ -169,7 +169,7 @@ ev_web_view_change_page (EvWebView *webview, gint new_page) { g_return_if_fail(EV_IS_WEB_VIEW(webview)); - + EvDocumentClass *klass = EV_DOCUMENT_GET_CLASS(webview->document); webview->current_page = new_page; @@ -225,7 +225,7 @@ ev_web_view_document_changed_cb (EvDocumentModel *model, EvWebView *webview) { g_return_if_fail(EV_IS_WEB_VIEW(webview)); - + EvDocument *document = ev_document_model_get_document (model); if (document != webview->document) { @@ -240,11 +240,11 @@ ev_web_view_document_changed_cb (EvDocumentModel *model, } webview->inverted_stylesheet = FALSE; gint current_page = ev_document_model_get_page(model); - + ev_web_view_change_page (webview, current_page); - + } -} +} static void ev_web_view_inverted_colors_changed_cb (EvDocumentModel *model, @@ -255,12 +255,12 @@ ev_web_view_inverted_colors_changed_cb (EvDocumentModel *model, if (!document || !document->iswebdocument) return; - + if (ev_document_model_get_inverted_colors(model) == TRUE) { if (document == NULL) { ev_document_model_set_inverted_colors(model,FALSE); return; - } + } if (webview->inverted_stylesheet == FALSE) { ev_document_check_add_night_sheet(document); webview->inverted_stylesheet = TRUE; @@ -334,7 +334,7 @@ ev_web_view_next_page (EvWebView *webview) int page, n_pages; g_return_val_if_fail (EV_IS_WEB_VIEW (webview), FALSE); - + if (!webview->document) return FALSE; @@ -383,13 +383,13 @@ ev_web_view_previous_page (EvWebView *webview) EvPage *webpage = ev_document_get_page(webview->document,page); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webpage->backend_page); return TRUE; - } else { + } else { return FALSE; } } - -void -ev_web_view_handle_link(EvWebView *webview,EvLink *link) + +void +ev_web_view_handle_link(EvWebView *webview,EvLink *link) { EvLinkAction *action = NULL; EvLinkDest *dest = NULL; @@ -400,12 +400,12 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link) return; dest = ev_link_action_get_dest(action); - + if (dest == NULL) return; dest_type = ev_link_dest_get_dest_type(dest); - + switch(dest_type) { case EV_LINK_DEST_TYPE_PAGE: { ev_document_model_set_page(webview->model,ev_link_dest_get_page(dest)); @@ -426,7 +426,7 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link) ev_document_model_set_page(webview->model,ev_link_dest_get_page(dest)); webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),uri); break; - + default:return; } } @@ -492,7 +492,7 @@ ev_web_view_find_get_n_results (EvWebView *webview, gint page) * @shift: Shift from current page * * Jumps to the first page that has occurences of searched word. - * Uses a direction where to look and a shift from current page. + * Uses a direction where to look and a shift from current page. **/ static void jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint shift) @@ -507,12 +507,12 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh if (direction == EV_WEB_VIEW_FIND_NEXT) page = webview->current_page + i; else - page = webview->current_page - i; + page = webview->current_page - i; page += shift; if (page >= n_pages) { page = page - n_pages; - } else if (page < 0) + } else if (page < 0) page = page + n_pages; if (page == webview->current_page && ev_web_view_find_get_n_results(webview,page) > 0) { @@ -525,7 +525,7 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh webview->findoptions |= WEBKIT_FIND_OPTIONS_WRAP_AROUND; else webview->findoptions &= ~WEBKIT_FIND_OPTIONS_WRAP_AROUND; - + webview->findoptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS; } @@ -550,7 +550,7 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh void ev_web_view_find_changed (EvWebView *webview, guint *results, gchar *text,gboolean case_sensitive) { - webview->search->results = results; + webview->search->results = results; webview->search->on_result = 0; webview->search->search_string = g_strdup(text); webview->search->case_sensitive = case_sensitive; @@ -563,7 +563,7 @@ ev_web_view_find_changed (EvWebView *webview, guint *results, gchar *text,gboole } jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 0); } -} +} void ev_web_view_find_next (EvWebView *webview) @@ -576,7 +576,7 @@ ev_web_view_find_next (EvWebView *webview) if (webview->search->on_result >= n_results) { webview->search->on_result = 0; jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 1); - } + } else { webkit_find_controller_search_next(webview->findcontroller); } @@ -614,7 +614,7 @@ ev_web_view_find_cancel (EvWebView *webview) webkit_find_controller_search_finish (webview->findcontroller); } -void +void ev_web_view_set_handler(EvWebView *webview,gboolean visible) { if (visible) { @@ -630,7 +630,7 @@ ev_web_view_set_handler(EvWebView *webview,gboolean visible) else { g_signal_handlers_disconnect_by_func(webview, jump_to_find_results, - NULL); + NULL); g_signal_handlers_disconnect_by_func(webview, results_counted_cb, NULL); @@ -704,7 +704,7 @@ ev_web_view_zoom_reset(EvWebView *webview) /** * ev_web_view_disconnect_handlers * @webview : #EvWebView instance - * + * * This function call will disconnect all model signal handlers from the webview, to ensure smooth operation of the Atril-view. * Equivalent to function ev_view_disconnect_handlers in ev-view.c */ diff --git a/libview/ev-web-view.h b/libview/ev-web-view.h index 90892d37..16b82ba8 100644 --- a/libview/ev-web-view.h +++ b/libview/ev-web-view.h @@ -54,7 +54,7 @@ void ev_web_view_reload (EvWebView *webview); void ev_web_view_reload_page (EvWebView *webview, gint page); - + /* Navigation */ gboolean ev_web_view_next_page (EvWebView *webview); gboolean ev_web_view_previous_page (EvWebView *webview); @@ -68,7 +68,7 @@ void ev_web_view_find_previous (EvWebView *webview); void ev_web_view_find_changed (EvWebView *webview, guint *results, - gchar *text, + gchar *text, gboolean case_sensitive); void ev_web_view_find_search_changed (EvWebView *webview); diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c index a33929a3..d710afe5 100644 --- a/previewer/ev-previewer-window.c +++ b/previewer/ev-previewer-window.c @@ -1,4 +1,4 @@ -/* ev-previewer-window.c: +/* ev-previewer-window.c: * this file is part of atril, a mate document viewer * * Copyright (C) 2009 Carlos Garcia Campos <[email protected]> @@ -235,7 +235,7 @@ ev_previewer_window_enumerate_finished (EvPreviewerWindow *window) GTK_PRINT_ERROR_GENERAL, _("The selected printer '%s' could not be found"), gtk_print_settings_get_printer (window->print_settings)); - + ev_previewer_window_error_dialog_run (window, error); g_error_free (error); } diff --git a/previewer/ev-previewer-window.h b/previewer/ev-previewer-window.h index 7d1e686b..5c5d9d5e 100644 --- a/previewer/ev-previewer-window.h +++ b/previewer/ev-previewer-window.h @@ -1,4 +1,4 @@ -/* ev-previewer-window.h: +/* ev-previewer-window.h: * this file is part of atril, a mate document viewer * * Copyright (C) 2009 Carlos Garcia Campos <[email protected]> diff --git a/previewer/ev-previewer.c b/previewer/ev-previewer.c index 53cb2e22..e96db773 100644 --- a/previewer/ev-previewer.c +++ b/previewer/ev-previewer.c @@ -1,4 +1,4 @@ -/* ev-previewer.c: +/* ev-previewer.c: * this file is part of atril, a mate document viewer * * Copyright (C) 2009 Carlos Garcia Campos <[email protected]> @@ -103,13 +103,13 @@ main (gint argc, gchar **argv) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif - + context = g_option_context_new (_("MATE Document Previewer")); g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); - + if (!g_option_context_parse (context, &argc, &argv, &error)) { g_warning ("Error parsing command line arguments: %s", error->message); g_error_free (error); @@ -121,12 +121,12 @@ main (gint argc, gchar **argv) if (!filenames) { g_warning ("File argument is required"); - + return 1; } filename = filenames[0]; - + if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { g_warning ("Filename \"%s\" does not exist or is not a regular file", filename); @@ -152,7 +152,7 @@ main (gint argc, gchar **argv) gtk_widget_show (window); ev_previewer_load_document (filename, model); - + gtk_main (); if (unlink_temp_file) @@ -163,6 +163,6 @@ main (gint argc, gchar **argv) ev_shutdown (); ev_stock_icons_shutdown (); g_object_unref (model); - + return 0; } diff --git a/properties/ev-properties-main.c b/properties/ev-properties-main.c index 9235c86a..1fee3037 100644 --- a/properties/ev-properties-main.c +++ b/properties/ev-properties-main.c @@ -102,7 +102,7 @@ ev_properties_get_pages (CajaPropertyPageProvider *provider, /* okay, make the page */ uri = caja_file_info_get_uri (file); mime_type = caja_file_info_get_mime_type (file); - + document = ev_backends_manager_get_document (mime_type); if (!document) goto end; @@ -112,7 +112,7 @@ ev_properties_get_pages (CajaPropertyPageProvider *provider, g_error_free (error); goto end; } - + label = gtk_label_new (_("Document")); page = ev_properties_view_new (uri); ev_properties_view_set_info (EV_PROPERTIES_VIEW (page), @@ -127,7 +127,7 @@ ev_properties_get_pages (CajaPropertyPageProvider *provider, end: g_free (uri); g_free (mime_type); - + return pages; } diff --git a/properties/ev-properties-view.c b/properties/ev-properties-view.c index 2209c8ba..709b7c27 100644 --- a/properties/ev-properties-view.c +++ b/properties/ev-properties-view.c @@ -92,12 +92,12 @@ static void ev_properties_view_dispose (GObject *object) { EvPropertiesView *properties = EV_PROPERTIES_VIEW (object); - + if (properties->uri) { g_free (properties->uri); properties->uri = NULL; } - + G_OBJECT_CLASS (ev_properties_view_parent_class)->dispose (object); } @@ -118,34 +118,34 @@ make_valid_utf8 (const gchar *name) GString *string; const gchar *remainder, *invalid; gint remaining_bytes, valid_bytes; - + string = NULL; remainder = name; remaining_bytes = strlen (name); - - while (remaining_bytes != 0) + + while (remaining_bytes != 0) { - if (g_utf8_validate (remainder, remaining_bytes, &invalid)) + if (g_utf8_validate (remainder, remaining_bytes, &invalid)) break; valid_bytes = invalid - remainder; - - if (string == NULL) + + if (string == NULL) string = g_string_sized_new (remaining_bytes); g_string_append_len (string, remainder, valid_bytes); g_string_append_c (string, '?'); - + remaining_bytes -= valid_bytes + 1; remainder = invalid + 1; } - + if (string == NULL) return g_strdup (name); - + g_string_append (string, remainder); g_assert (g_utf8_validate (string->str, -1, NULL)); - + return g_string_free (string, FALSE); } @@ -222,7 +222,7 @@ get_default_user_units (void) #ifdef HAVE__NL_MEASUREMENT_MEASUREMENT gchar *imperial = NULL; - + imperial = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT); if (imperial && imperial[0] == 2) return GTK_UNIT_INCH; /* imperial */ @@ -234,9 +234,9 @@ get_default_user_units (void) return GTK_UNIT_MM; if (strcmp (e, "default:inch") == 0) return GTK_UNIT_INCH; - + g_warning ("Whoever translated default:mm did so wrongly.\n"); - + return GTK_UNIT_MM; } @@ -272,7 +272,7 @@ ev_regular_paper_size (const EvDocumentInfo *info) } paper_sizes = gtk_paper_size_get_paper_sizes (FALSE); - + for (l = paper_sizes; l && l->data; l = g_list_next (l)) { GtkPaperSize *size = (GtkPaperSize *) l->data; gdouble paper_width; @@ -310,7 +310,7 @@ ev_regular_paper_size (const EvDocumentInfo *info) g_free (exact_size); return str; } - + return exact_size; } diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c index 94a2b8d9..a0abdd4b 100644 --- a/shell/eggfindbar.c +++ b/shell/eggfindbar.c @@ -1,18 +1,18 @@ /* Copyright (C) 2004 Red Hat, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with the Mate Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ @@ -83,7 +83,7 @@ egg_find_bar_class_init (EggFindBarClass *klass) GObjectClass *object_class; GtkWidgetClass *widget_class; GtkBindingSet *binding_set; - + egg_find_bar_parent_class = g_type_class_peek_parent (klass); object_class = (GObjectClass *)klass; @@ -96,7 +96,7 @@ egg_find_bar_class_init (EggFindBarClass *klass) widget_class->show = egg_find_bar_show; widget_class->hide = egg_find_bar_hide; - + widget_class->grab_focus = egg_find_bar_grab_focus; find_bar_signals[NEXT] = @@ -257,7 +257,7 @@ entry_changed_callback (GtkEntry *entry, text = g_strdup (gtk_entry_get_text (entry)); egg_find_bar_set_search_string (find_bar, text); - + g_free (text); } @@ -293,8 +293,8 @@ egg_find_bar_init (EggFindBar *find_bar) /* Data */ priv = EGG_FIND_BAR_GET_PRIVATE (find_bar); - - find_bar->priv = priv; + + find_bar->priv = priv; priv->search_string = NULL; gtk_toolbar_set_style (GTK_TOOLBAR (find_bar), GTK_TOOLBAR_BOTH_HORIZ); @@ -302,7 +302,7 @@ egg_find_bar_init (EggFindBar *find_bar) /* Find: |_____| */ item = gtk_tool_item_new (); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); - + label = gtk_label_new_with_mnemonic (_("Find:")); gtk_widget_set_halign (label, GTK_ALIGN_START); gtk_widget_set_hexpand (label, TRUE); @@ -535,11 +535,11 @@ egg_find_bar_set_search_string (EggFindBar *find_bar, priv = (EggFindBarPrivate *)find_bar->priv; g_object_freeze_notify (G_OBJECT (find_bar)); - + if (priv->search_string != search_string) { char *old; - + old = priv->search_string; if (search_string && *search_string == '\0') @@ -556,16 +556,16 @@ egg_find_bar_set_search_string (EggFindBar *find_bar, strcmp (old, search_string) != 0)) { gboolean not_empty; - + priv->search_string = g_strdup (search_string); g_free (old); - + gtk_entry_set_text (GTK_ENTRY (priv->find_entry), priv->search_string ? priv->search_string : ""); - - not_empty = (search_string == NULL) ? FALSE : TRUE; + + not_empty = (search_string == NULL) ? FALSE : TRUE; gtk_widget_set_sensitive (GTK_WIDGET (find_bar->priv->next_button), not_empty); gtk_widget_set_sensitive (GTK_WIDGET (find_bar->priv->previous_button), not_empty); @@ -675,7 +675,7 @@ egg_find_bar_set_status_text (EggFindBar *find_bar, g_return_if_fail (EGG_IS_FIND_BAR (find_bar)); priv = (EggFindBarPrivate *)find_bar->priv; - + gtk_label_set_text (GTK_LABEL (priv->status_label), text); g_object_set (priv->status_separator, "visible", text != NULL && *text != '\0', NULL); g_object_set (priv->status_item, "visible", text != NULL && *text !='\0', NULL); diff --git a/shell/eggfindbar.h b/shell/eggfindbar.h index 5ad01804..df7157e1 100644 --- a/shell/eggfindbar.h +++ b/shell/eggfindbar.h @@ -12,7 +12,7 @@ * * You should have received a copy of the GNU Library General Public * License along with the Mate Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c index f836722b..14e72bf2 100644 --- a/shell/ev-daemon.c +++ b/shell/ev-daemon.c @@ -386,7 +386,7 @@ ev_daemon_application_dbus_register (GApplication *gapplication, g_object_unref (skeleton); return FALSE; } - + application->daemon = skeleton; g_signal_connect (skeleton, "handle-register-document", diff --git a/shell/ev-file-monitor.c b/shell/ev-file-monitor.c index 5107119e..fcb711d4 100644 --- a/shell/ev-file-monitor.c +++ b/shell/ev-file-monitor.c @@ -43,7 +43,7 @@ static void ev_file_monitor_changed_cb (GFileMonitor *monitor, GFile *other_file, GFileMonitorEvent event_type, EvFileMonitor *ev_monitor); - + #define EV_FILE_MONITOR_GET_PRIVATE(object) \ (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_FILE_MONITOR, EvFileMonitorPrivate)) @@ -63,7 +63,7 @@ ev_file_monitor_finalize (GObject *object) EvFileMonitor *ev_monitor = EV_FILE_MONITOR (object); ev_file_monitor_timeout_stop (ev_monitor); - + if (ev_monitor->priv->monitor) { g_signal_handlers_disconnect_by_func (ev_monitor->priv->monitor, ev_file_monitor_changed_cb, @@ -99,7 +99,7 @@ static gboolean timeout_cb (EvFileMonitor *ev_monitor) { g_signal_emit (ev_monitor, signals[CHANGED], 0); - + ev_monitor->priv->timeout_id = 0; return FALSE; } @@ -108,7 +108,7 @@ static void ev_file_monitor_timeout_start (EvFileMonitor *ev_monitor) { ev_file_monitor_timeout_stop (ev_monitor); - + ev_monitor->priv->timeout_id = g_timeout_add_seconds (5, (GSourceFunc)timeout_cb, ev_monitor); } @@ -149,7 +149,7 @@ ev_file_monitor_new (const gchar *uri) EvFileMonitor *ev_monitor; GFile *file; GError *error = NULL; - + ev_monitor = EV_FILE_MONITOR (g_object_new (EV_TYPE_FILE_MONITOR, NULL)); file = g_file_new_for_uri (uri); diff --git a/shell/ev-history.c b/shell/ev-history.c index 51ecb3fa..73d3c863 100644 --- a/shell/ev-history.c +++ b/shell/ev-history.c @@ -77,7 +77,7 @@ ev_history_class_init (EvHistoryClass *class) object_class->finalize = ev_history_finalize; - signals[HISTORY_CHANGED] = + signals[HISTORY_CHANGED] = g_signal_new ("changed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, @@ -110,13 +110,13 @@ ev_history_add_link (EvHistory *history, EvLink *link) g_object_ref (link); history->priv->links = g_list_append (history->priv->links, link); - + if (g_list_length (history->priv->links) > HISTORY_LENGTH) { g_object_unref (G_OBJECT (history->priv->links->data)); - history->priv->links = g_list_delete_link (history->priv->links, + history->priv->links = g_list_delete_link (history->priv->links, history->priv->links); } - + g_signal_emit (history, signals[HISTORY_CHANGED], 0); } diff --git a/shell/ev-history.h b/shell/ev-history.h index d8bb53f5..27096c3f 100644 --- a/shell/ev-history.h +++ b/shell/ev-history.h @@ -40,7 +40,7 @@ typedef struct _EvHistoryClass EvHistoryClass; struct _EvHistory { GObject parent; - + /*< private >*/ EvHistoryPrivate *priv; }; @@ -48,7 +48,7 @@ struct _EvHistory struct _EvHistoryClass { GObjectClass parent_class; - + void (*changed) (EvHistory *history); }; diff --git a/shell/ev-keyring.c b/shell/ev-keyring.c index 3a9cd4c1..c4670d63 100644 --- a/shell/ev-keyring.c +++ b/shell/ev-keyring.c @@ -85,7 +85,7 @@ ev_keyring_save_password (const gchar *uri, unescaped_uri = g_uri_unescape_string (uri, NULL); name = g_strdup_printf (_("Password for document %s"), unescaped_uri); g_free (unescaped_uri); - + retval = secret_password_store_sync (EV_DOCUMENT_PASSWORD_SCHEMA, keyring, name, password, NULL, NULL, "type", "document_password", diff --git a/shell/ev-media-player-keys.c b/shell/ev-media-player-keys.c index e7d950c1..a3388f98 100644 --- a/shell/ev-media-player-keys.c +++ b/shell/ev-media-player-keys.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * Copyright (C) 2007 Jan Arne Petersen <[email protected]> * Copyright (C) 2008 Bastien Nocera <[email protected]> * Copyright Ā© 2010 Christian Persch @@ -206,7 +206,7 @@ ev_media_player_keys_focused (EvMediaPlayerKeys *keys) { if (keys->proxy == NULL) return; - + ev_media_player_keys_grab_keys (keys); } diff --git a/shell/ev-media-player-keys.h b/shell/ev-media-player-keys.h index 8e2d62be..f18f192a 100644 --- a/shell/ev-media-player-keys.h +++ b/shell/ev-media-player-keys.h @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* +/* * Copyright (C) 2007 Jan Arne Petersen <[email protected]> * Copyright (C) 2008 Bastien Nocera <[email protected]> * diff --git a/shell/ev-message-area.c b/shell/ev-message-area.c index 8764411e..f6561f22 100644 --- a/shell/ev-message-area.c +++ b/shell/ev-message-area.c @@ -33,7 +33,7 @@ struct _EvMessageAreaPrivate { GtkWidget *image; GtkWidget *label; GtkWidget *secondary_label; - + guint message_type : 3; }; @@ -305,7 +305,7 @@ ev_message_area_set_image_from_stock (EvMessageArea *area, { g_return_if_fail (EV_IS_MESSAGE_AREA (area)); g_return_if_fail (icon_name != NULL); - + gtk_image_set_from_icon_name (GTK_IMAGE (area->priv->image), icon_name, GTK_ICON_SIZE_DIALOG); diff --git a/shell/ev-navigation-action-widget.c b/shell/ev-navigation-action-widget.c index 430d4e33..758cc820 100644 --- a/shell/ev-navigation-action-widget.c +++ b/shell/ev-navigation-action-widget.c @@ -27,7 +27,7 @@ static void ev_navigation_action_widget_init (EvNavigationActionWidget static void ev_navigation_action_widget_class_init (EvNavigationActionWidgetClass *action_widget); static void ev_navigation_action_widget_toggled (GtkToggleToolButton *toggle); static gboolean ev_navigation_action_widget_button_press_event (GtkWidget *widget, - GdkEventButton *event, + GdkEventButton *event, gpointer data); G_DEFINE_TYPE (EvNavigationActionWidget, ev_navigation_action_widget, GTK_TYPE_TOGGLE_TOOL_BUTTON) @@ -44,14 +44,14 @@ static void ev_navigation_action_widget_init (EvNavigationActionWidget *action_widget) { GtkWidget *toggle_button; - + /* It's rather dirty hack but we need a child to connect to * button press event */ - + toggle_button = gtk_bin_get_child (GTK_BIN (action_widget)); - - g_signal_connect (toggle_button, "button-press-event", + + g_signal_connect (toggle_button, "button-press-event", G_CALLBACK (ev_navigation_action_widget_button_press_event), action_widget); return; @@ -81,7 +81,7 @@ menu_deactivate_cb (GtkMenuShell *menu_shell, gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (widget), FALSE); return TRUE; } - + static void menu_detacher (GtkWidget *widget, GtkMenu *menu) @@ -97,13 +97,13 @@ ev_navigation_action_widget_set_menu(EvNavigationActionWidget *button, GtkWidget if (button->menu == GTK_MENU (menu)) return; - + if (button->menu && gtk_widget_get_visible (GTK_WIDGET (button->menu))) gtk_menu_shell_deactivate (GTK_MENU_SHELL (button->menu)); if (button->menu) { - g_signal_handlers_disconnect_by_func (button->menu, - menu_deactivate_cb, + g_signal_handlers_disconnect_by_func (button->menu, + menu_deactivate_cb, button); gtk_menu_detach (button->menu); } diff --git a/shell/ev-navigation-action-widget.h b/shell/ev-navigation-action-widget.h index 4241cd31..20702c6f 100644 --- a/shell/ev-navigation-action-widget.h +++ b/shell/ev-navigation-action-widget.h @@ -36,7 +36,7 @@ struct _EvNavigationActionWidget struct _EvNavigationActionWidgetClass { GtkToggleToolButtonClass parent_class; - + void (*show_menu) (EvNavigationActionWidget *widget); }; diff --git a/shell/ev-navigation-action.c b/shell/ev-navigation-action.c index b34c3789..45e744ee 100644 --- a/shell/ev-navigation-action.c +++ b/shell/ev-navigation-action.c @@ -54,7 +54,7 @@ ev_navigation_action_history_changed (EvHistory *history, gpointer data) { EvNavigationAction *action = EV_NAVIGATION_ACTION (data); - + gtk_action_set_sensitive (GTK_ACTION (action), ev_history_get_n_links (history) > 0); } @@ -67,7 +67,7 @@ ev_navigation_action_set_history (EvNavigationAction *action, g_object_add_weak_pointer (G_OBJECT (action->priv->history), (gpointer) &action->priv->history); - + g_signal_connect_object (history, "changed", G_CALLBACK (ev_navigation_action_history_changed), action, 0); @@ -81,12 +81,12 @@ activate_menu_item_cb (GtkWidget *widget, EvNavigationAction *action) g_return_if_fail (EV_IS_HISTORY (action->priv->history)); index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "index")); - + if (action->priv->history) { EvLink *link; link = ev_history_get_link_nth (action->priv->history, index); - + g_signal_emit (action, widget_signals[WIDGET_ACTIVATE_LINK], 0, link); } } @@ -197,7 +197,7 @@ create_menu_item (GtkAction *action) gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), menu); gtk_widget_show (menu_item); - + return menu_item; } diff --git a/shell/ev-navigation-action.h b/shell/ev-navigation-action.h index 8089e4f4..55a3c40d 100644 --- a/shell/ev-navigation-action.h +++ b/shell/ev-navigation-action.h @@ -42,7 +42,7 @@ typedef struct _EvNavigationActionClass EvNavigationActionClass; struct _EvNavigationAction { GtkAction parent; - + /*< private >*/ EvNavigationActionPrivate *priv; }; diff --git a/shell/ev-open-recent-action.c b/shell/ev-open-recent-action.c index 47da1d53..d7815d2a 100644 --- a/shell/ev-open-recent-action.c +++ b/shell/ev-open-recent-action.c @@ -95,7 +95,7 @@ ev_open_recent_action_class_init (EvOpenRecentActionClass *class) G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (EvOpenRecentActionClass, item_activated), NULL, NULL, - g_cclosure_marshal_VOID__STRING, + g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); } diff --git a/shell/ev-password-view.c b/shell/ev-password-view.c index 0bf8ea90..7f1b98b0 100644 --- a/shell/ev-password-view.c +++ b/shell/ev-password-view.c @@ -140,7 +140,7 @@ ev_password_view_init (EvPasswordView *password_view) _("This document is locked and can only be read by entering the correct password.")); gtk_label_set_markup (GTK_LABEL (label), markup); g_free (markup); - + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); @@ -189,15 +189,15 @@ ev_password_dialog_got_response (GtkDialog *dialog, EvPasswordView *password_view) { gtk_widget_set_sensitive (GTK_WIDGET (password_view), TRUE); - + if (response_id == GTK_RESPONSE_OK) { g_free (password_view->priv->password); password_view->priv->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (password_view->priv->password_entry))); - + g_signal_emit (password_view, password_view_signals[UNLOCK], 0); } - + gtk_widget_destroy (GTK_WIDGET (dialog)); } @@ -207,7 +207,7 @@ ev_password_dialog_remember_button_toggled (GtkToggleButton *button, { if (gtk_toggle_button_get_active (button)) { gpointer data; - + data = g_object_get_data (G_OBJECT (button), "password-save"); password_view->priv->password_save = GPOINTER_TO_INT (data); } @@ -243,7 +243,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) gchar *text, *markup, *file_name; gtk_widget_set_sensitive (GTK_WIDGET (password_view), FALSE); - + dialog = GTK_DIALOG (gtk_dialog_new ()); content_area = gtk_dialog_get_content_area (dialog); action_area = gtk_dialog_get_action_area (dialog); @@ -267,7 +267,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - + /* Build contents */ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); @@ -341,7 +341,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) gtk_grid_attach (GTK_GRID (grid), password_view->priv->password_entry, 1, 0, 1, 1); gtk_widget_set_hexpand (password_view->priv->password_entry, TRUE); gtk_widget_show (password_view->priv->password_entry); - + gtk_label_set_mnemonic_widget (GTK_LABEL (label), password_view->priv->password_entry); @@ -394,7 +394,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) g_signal_connect (dialog, "response", G_CALLBACK (ev_password_dialog_got_response), password_view); - + gtk_widget_show (GTK_WIDGET (dialog)); } diff --git a/shell/ev-password-view.h b/shell/ev-password-view.h index 05a4a445..326e8c73 100644 --- a/shell/ev-password-view.h +++ b/shell/ev-password-view.h @@ -35,7 +35,7 @@ typedef struct _EvPasswordViewPrivate EvPasswordViewPrivate; struct _EvPasswordView { GtkViewport parent_instance; - + EvPasswordViewPrivate *priv; }; diff --git a/shell/ev-progress-message-area.c b/shell/ev-progress-message-area.c index 6ac9f245..88a7e333 100644 --- a/shell/ev-progress-message-area.c +++ b/shell/ev-progress-message-area.c @@ -80,13 +80,13 @@ ev_progress_message_area_init (EvProgressMessageArea *area) { GtkWidget *contents; GtkWidget *vbox; - + area->priv = EV_PROGRESS_MESSAGE_AREA_GET_PRIVATE (area); contents = _ev_message_area_get_main_box (EV_MESSAGE_AREA (area)); - + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - + area->priv->label = gtk_label_new (NULL); gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE); gtk_label_set_ellipsize (GTK_LABEL (area->priv->label), @@ -191,7 +191,7 @@ ev_progress_message_area_set_fraction (EvProgressMessageArea *area, gdouble fraction) { g_return_if_fail (EV_IS_PROGRESS_MESSAGE_AREA (area)); - + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (area->priv->progress_bar), fraction); g_object_notify (G_OBJECT (area), "fraction"); diff --git a/shell/ev-properties-dialog.c b/shell/ev-properties-dialog.c index 4ad1220b..cbb7b0f7 100644 --- a/shell/ev-properties-dialog.c +++ b/shell/ev-properties-dialog.c @@ -66,7 +66,7 @@ ev_properties_dialog_init (EvPropertiesDialog *properties) gtk_dialog_add_button (GTK_DIALOG (properties), "gtk-close", GTK_RESPONSE_CANCEL); - gtk_dialog_set_default_response (GTK_DIALOG (properties), + gtk_dialog_set_default_response (GTK_DIALOG (properties), GTK_RESPONSE_CANCEL); properties->notebook = gtk_notebook_new (); diff --git a/shell/ev-properties-fonts.c b/shell/ev-properties-fonts.c index d62ed6eb..5ee22b8a 100644 --- a/shell/ev-properties-fonts.c +++ b/shell/ev-properties-fonts.c @@ -55,12 +55,12 @@ ev_properties_fonts_dispose (GObject *object) EvPropertiesFonts *properties = EV_PROPERTIES_FONTS (object); if (properties->fonts_job) { - g_signal_handlers_disconnect_by_func (properties->fonts_job, - job_fonts_finished_cb, + g_signal_handlers_disconnect_by_func (properties->fonts_job, + job_fonts_finished_cb, properties); ev_job_cancel (properties->fonts_job); - g_object_unref (properties->fonts_job); + g_object_unref (properties->fonts_job); properties->fonts_job = NULL; } @@ -86,7 +86,7 @@ font_cell_data_func (GtkTreeViewColumn *col, GtkCellRenderer *renderer, gtk_tree_model_get (model, iter, EV_DOCUMENT_FONTS_COLUMN_NAME, &name, EV_DOCUMENT_FONTS_COLUMN_DETAILS, &details, - -1); + -1); if (details) { markup = g_strdup_printf ("<b><big>%s</big></b>\n<small>%s</small>", @@ -96,7 +96,7 @@ font_cell_data_func (GtkTreeViewColumn *col, GtkCellRenderer *renderer, } g_object_set (renderer, "markup", markup, NULL); - + g_free (markup); g_free (details); g_free (name); @@ -112,14 +112,14 @@ ev_properties_fonts_init (EvPropertiesFonts *properties) gtk_orientable_set_orientation (GTK_ORIENTABLE (properties), GTK_ORIENTATION_VERTICAL); gtk_container_set_border_width (GTK_CONTAINER (properties), 12); gtk_box_set_spacing (GTK_BOX (properties), 6); - + swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow), GTK_SHADOW_IN); - + properties->fonts_treeview = gtk_tree_view_new (); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (properties->fonts_treeview), FALSE); @@ -141,7 +141,7 @@ ev_properties_fonts_init (EvPropertiesFonts *properties) gtk_container_add (GTK_CONTAINER (swindow), properties->fonts_treeview); gtk_widget_show (properties->fonts_treeview); - gtk_box_pack_start (GTK_BOX (properties), swindow, + gtk_box_pack_start (GTK_BOX (properties), swindow, TRUE, TRUE, 0); gtk_widget_show (swindow); diff --git a/shell/ev-sidebar-attachments.c b/shell/ev-sidebar-attachments.c index a7c60f3f..c485c3fc 100644 --- a/shell/ev-sidebar-attachments.c +++ b/shell/ev-sidebar-attachments.c @@ -73,8 +73,8 @@ static void ev_sidebar_attachments_page_iface_init (EvSidebarPageInterface *ifac G_DEFINE_TYPE_EXTENDED (EvSidebarAttachments, ev_sidebar_attachments, GTK_TYPE_BOX, - 0, - G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, + 0, + G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, ev_sidebar_attachments_page_iface_init)) #define EV_SIDEBAR_ATTACHMENTS_GET_PRIVATE(object) \ @@ -92,7 +92,7 @@ ev_sidebar_attachments_icon_cache_add (EvSidebarAttachments *ev_attachbar, g_hash_table_insert (ev_attachbar->priv->icon_cache, (gpointer)g_strdup (mime_type), (gpointer)pixbuf); - + } static GdkPixbuf * @@ -115,12 +115,12 @@ icon_theme_get_pixbuf_from_mime_type (GtkIconTheme *icon_theme, g_string_free (icon_name, TRUE); if (pixbuf) return pixbuf; - + icon_name = g_string_new ("mate-mime-"); g_string_append_len (icon_name, mime_type, separator - mime_type); pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name->str, 48, 0, NULL); g_string_free (icon_name, TRUE); - + return pixbuf; } @@ -129,7 +129,7 @@ ev_sidebar_attachments_icon_cache_get (EvSidebarAttachments *ev_attachbar, const gchar *mime_type) { GdkPixbuf *pixbuf = NULL; - + g_assert (mime_type != NULL); pixbuf = g_hash_table_lookup (ev_attachbar->priv->icon_cache, @@ -162,7 +162,7 @@ icon_cache_update_icon (gchar *key, ev_sidebar_attachments_icon_cache_add (ev_attachbar, key, pixbuf); - + return FALSE; } @@ -197,7 +197,7 @@ ev_sidebar_attachments_get_attachment_at_pos (EvSidebarAttachments *ev_attachbar gtk_icon_view_select_path (GTK_ICON_VIEW (ev_attachbar->priv->icon_view), path); - + gtk_tree_path_free (path); return attachment; @@ -214,7 +214,7 @@ ev_sidebar_attachments_popup_menu_show (EvSidebarAttachments *ev_attachbar, GList *attach_list = NULL; icon_view = GTK_ICON_VIEW (ev_attachbar->priv->icon_view); - + path = gtk_icon_view_get_path_at_pos (icon_view, x, y); if (!path) return FALSE; @@ -225,7 +225,7 @@ ev_sidebar_attachments_popup_menu_show (EvSidebarAttachments *ev_attachbar, } gtk_tree_path_free (path); - + selected = gtk_icon_view_get_selected_items (icon_view); if (!selected) return FALSE; @@ -277,7 +277,7 @@ ev_sidebar_attachments_button_press (EvSidebarAttachments *ev_attachbar, if (!gtk_widget_has_focus (icon_view)) { gtk_widget_grab_focus (icon_view); } - + if (event->button == 2) return FALSE; @@ -286,29 +286,29 @@ ev_sidebar_attachments_button_press (EvSidebarAttachments *ev_attachbar, if (event->type == GDK_2BUTTON_PRESS) { GError *error = NULL; EvAttachment *attachment; - + attachment = ev_sidebar_attachments_get_attachment_at_pos (ev_attachbar, event->x, event->y); if (!attachment) return FALSE; - + ev_attachment_open (attachment, gtk_widget_get_screen (GTK_WIDGET (ev_attachbar)), event->time, &error); - + if (error) { g_warning ("%s", error->message); g_error_free (error); } - + g_object_unref (attachment); - + return TRUE; } break; - case 3: + case 3: return ev_sidebar_attachments_popup_menu_show (ev_attachbar, event->x, event->y); } @@ -323,7 +323,7 @@ ev_sidebar_attachments_update_icons (EvSidebarAttachments *ev_attachbar, gboolean valid; ev_sidebar_attachments_icon_cache_refresh (ev_attachbar); - + valid = gtk_tree_model_get_iter_first ( GTK_TREE_MODEL (ev_attachbar->priv->model), &iter); @@ -364,7 +364,7 @@ ev_sidebar_attachments_screen_changed (GtkWidget *widget, if (!ev_attachbar->priv->icon_theme) return; - + screen = gtk_widget_get_screen (widget); if (screen == old_screen) return; @@ -405,7 +405,7 @@ ev_sidebar_attachments_drag_data_get (GtkWidget *widget, return; uris = g_ptr_array_new (); - + for (l = selected; l && l->data; l = g_list_next (l)) { EvAttachment *attachment; GtkTreePath *path; @@ -413,7 +413,7 @@ ev_sidebar_attachments_drag_data_get (GtkWidget *widget, GFile *file; gchar *template; GError *error = NULL; - + path = (GtkTreePath *) l->data; gtk_tree_model_get_iter (GTK_TREE_MODEL (ev_attachbar->priv->model), @@ -426,14 +426,14 @@ ev_sidebar_attachments_drag_data_get (GtkWidget *widget, template = g_strdup_printf ("%s.XXXXXX", ev_attachment_get_name (attachment)); file = ev_mkstemp_file (template, &error); g_free (template); - + if (file != NULL && ev_attachment_save (attachment, file, &error)) { gchar *uri; uri = g_file_get_uri (file); g_ptr_array_add (uris, uri); } - + if (error) { g_warning ("%s", error->message); g_error_free (error); @@ -459,7 +459,7 @@ ev_sidebar_attachments_get_property (GObject *object, GParamSpec *pspec) { EvSidebarAttachments *ev_sidebar_attachments; - + ev_sidebar_attachments = EV_SIDEBAR_ATTACHMENTS (object); switch (prop_id) { @@ -479,7 +479,7 @@ ev_sidebar_attachments_dispose (GObject *object) if (ev_attachbar->priv->icon_theme) { g_signal_handlers_disconnect_by_func ( - ev_attachbar->priv->icon_theme, + ev_attachbar->priv->icon_theme, G_CALLBACK (ev_sidebar_attachments_update_icons), ev_attachbar); ev_attachbar->priv->icon_theme = NULL; @@ -534,7 +534,7 @@ static void ev_sidebar_attachments_init (EvSidebarAttachments *ev_attachbar) { GtkWidget *swindow; - + ev_attachbar->priv = EV_SIDEBAR_ATTACHMENTS_GET_PRIVATE (ev_attachbar); gtk_orientable_set_orientation (GTK_ORIENTABLE (ev_attachbar), GTK_ORIENTATION_VERTICAL); @@ -546,8 +546,8 @@ ev_sidebar_attachments_init (EvSidebarAttachments *ev_attachbar) GTK_SHADOW_IN); /* Data Model */ ev_attachbar->priv->model = gtk_list_store_new (N_COLS, - GDK_TYPE_PIXBUF, - G_TYPE_STRING, + GDK_TYPE_PIXBUF, + G_TYPE_STRING, G_TYPE_STRING, EV_TYPE_ATTACHMENT); @@ -593,7 +593,7 @@ ev_sidebar_attachments_init (EvSidebarAttachments *ev_attachbar) g_signal_connect (ev_attachbar->priv->icon_view, "drag-data-get", G_CALLBACK (ev_sidebar_attachments_drag_data_get), - (gpointer) ev_attachbar); + (gpointer) ev_attachbar); } GtkWidget * @@ -611,7 +611,7 @@ job_finished_callback (EvJobAttachments *job, EvSidebarAttachments *ev_attachbar) { GList *l; - + for (l = job->attachments; l && l->data; l = g_list_next (l)) { EvAttachment *attachment; GtkTreeIter iter; @@ -628,7 +628,7 @@ job_finished_callback (EvJobAttachments *job, gtk_list_store_set (ev_attachbar->priv->model, &iter, COLUMN_NAME, ev_attachment_get_name (attachment), COLUMN_ICON, pixbuf, - COLUMN_ATTACHMENT, attachment, + COLUMN_ATTACHMENT, attachment, -1); } @@ -660,7 +660,7 @@ ev_sidebar_attachments_document_changed_cb (EvDocumentModel *model, G_CALLBACK (ev_sidebar_attachments_update_icons), (gpointer) ev_attachbar); } - + gtk_list_store_clear (ev_attachbar->priv->model); job = ev_job_attachments_new (document); diff --git a/shell/ev-sidebar-layers.c b/shell/ev-sidebar-layers.c index 6a723abb..28aad795 100644 --- a/shell/ev-sidebar-layers.c +++ b/shell/ev-sidebar-layers.c @@ -55,8 +55,8 @@ static guint signals[N_SIGNALS] = { 0 }; G_DEFINE_TYPE_EXTENDED (EvSidebarLayers, ev_sidebar_layers, GTK_TYPE_BOX, - 0, - G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, + 0, + G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, ev_sidebar_layers_page_iface_init)) #define EV_SIDEBAR_LAYERS_GET_PRIVATE(object) \ @@ -71,7 +71,7 @@ ev_sidebar_layers_dispose (GObject *object) g_signal_handlers_disconnect_by_func (sidebar->priv->job, job_finished_callback, sidebar); - ev_job_cancel (sidebar->priv->job); + ev_job_cancel (sidebar->priv->job); g_object_unref (sidebar->priv->job); sidebar->priv->job = NULL; } @@ -91,7 +91,7 @@ ev_sidebar_layers_get_property (GObject *object, GParamSpec *pspec) { EvSidebarLayers *ev_sidebar_layers; - + ev_sidebar_layers = EV_SIDEBAR_LAYERS (object); switch (prop_id) { @@ -188,18 +188,18 @@ ev_sidebar_layers_visibility_changed (GtkCellRendererToggle *cell, EvLayer *layer; model = gtk_tree_view_get_model (ev_layers->priv->tree_view); - + path = gtk_tree_path_new_from_string (path_str); gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get (model, &iter, EV_DOCUMENT_LAYERS_COLUMN_VISIBLE, &visible, - EV_DOCUMENT_LAYERS_COLUMN_LAYER, &layer, + EV_DOCUMENT_LAYERS_COLUMN_LAYER, &layer, -1); - + visible = !visible; if (visible) { gint rb_group; - + ev_document_layers_show_layer (EV_DOCUMENT_LAYERS (ev_layers->priv->document), layer); @@ -213,7 +213,7 @@ ev_sidebar_layers_visibility_changed (GtkCellRendererToggle *cell, ev_document_layers_hide_layer (EV_DOCUMENT_LAYERS (ev_layers->priv->document), layer); } - + gtk_tree_store_set (GTK_TREE_STORE (model), &iter, EV_DOCUMENT_LAYERS_COLUMN_VISIBLE, visible, -1); @@ -223,7 +223,7 @@ ev_sidebar_layers_visibility_changed (GtkCellRendererToggle *cell, (GtkTreeModelForeachFunc)update_kids, &iter); } - + gtk_tree_path_free (path); g_signal_emit (ev_layers, signals[LAYERS_VISIBILITY_CHANGED], 0); @@ -235,7 +235,7 @@ ev_sidebar_layers_create_tree_view (EvSidebarLayers *ev_layers) GtkTreeView *tree_view; GtkTreeViewColumn *column; GtkCellRenderer *renderer; - + tree_view = GTK_TREE_VIEW (gtk_tree_view_new ()); gtk_tree_view_set_headers_visible (tree_view, FALSE); gtk_tree_selection_set_mode (gtk_tree_view_get_selection (tree_view), @@ -267,7 +267,7 @@ ev_sidebar_layers_create_tree_view (EvSidebarLayers *ev_layers) "sensitive", EV_DOCUMENT_LAYERS_COLUMN_ENABLED, NULL); g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL); - + gtk_tree_view_append_column (tree_view, column); return tree_view; @@ -278,7 +278,7 @@ ev_sidebar_layers_init (EvSidebarLayers *ev_layers) { GtkWidget *swindow; GtkTreeModel *model; - + ev_layers->priv = EV_SIDEBAR_LAYERS_GET_PRIVATE (ev_layers); gtk_orientable_set_orientation (GTK_ORIENTABLE (ev_layers), GTK_ORIENTATION_VERTICAL); @@ -384,7 +384,7 @@ job_finished_callback (EvJobLayers *job, priv = sidebar_layers->priv; gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), job->model); - + g_object_unref (job); priv->job = NULL; } diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c index a4473504..90a23269 100644 --- a/shell/ev-sidebar-links.c +++ b/shell/ev-sidebar-links.c @@ -80,11 +80,11 @@ static const gchar* ev_sidebar_links_get_label (EvSidebarPage *sidebar_page); static guint signals[N_SIGNALS] = { 0 }; -G_DEFINE_TYPE_EXTENDED (EvSidebarLinks, - ev_sidebar_links, +G_DEFINE_TYPE_EXTENDED (EvSidebarLinks, + ev_sidebar_links, GTK_TYPE_BOX, - 0, - G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, + 0, + G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, ev_sidebar_links_page_iface_init)) @@ -117,7 +117,7 @@ ev_sidebar_links_get_property (GObject *object, GParamSpec *pspec) { EvSidebarLinks *ev_sidebar_links; - + ev_sidebar_links = EV_SIDEBAR_LINKS (object); switch (prop_id) @@ -142,7 +142,7 @@ ev_sidebar_links_dispose (GObject *object) if (sidebar->priv->job) { g_signal_handlers_disconnect_by_func (sidebar->priv->job, job_finished_callback, sidebar); - ev_job_cancel (sidebar->priv->job); + ev_job_cancel (sidebar->priv->job); g_object_unref (sidebar->priv->job); sidebar->priv->job = NULL; } @@ -228,7 +228,7 @@ selection_changed_callback (GtkTreeSelection *selection, gtk_tree_model_get (model, &iter, EV_DOCUMENT_LINKS_COLUMN_LINK, &link, -1); - + if (link == NULL) return; @@ -298,7 +298,7 @@ print_section_cb (GtkWidget *menuitem, EvSidebarLinks *sidebar) g_object_unref (link); return; } - + first_page++; g_object_unref (link); @@ -317,7 +317,7 @@ print_section_cb (GtkWidget *menuitem, EvSidebarLinks *sidebar) if (last_page == -1) last_page = ev_document_get_n_pages (sidebar->priv->document); - + window = gtk_widget_get_toplevel (GTK_WIDGET (sidebar)); if (EV_IS_WINDOW (window)) { ev_window_print_range (EV_WINDOW (window), first_page, last_page); @@ -401,7 +401,7 @@ ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links) loading_model = create_loading_model (); priv->tree_view = gtk_tree_view_new_with_model (loading_model); g_object_unref (loading_model); - + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE); @@ -423,7 +423,7 @@ ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links) "markup", EV_DOCUMENT_LINKS_COLUMN_MARKUP, NULL); - + renderer = gtk_cell_renderer_text_new (); gtk_tree_view_column_pack_end (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE); gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer, @@ -486,15 +486,15 @@ update_page_callback_foreach (GtkTreeModel *model, dest_page = ev_document_links_get_link_page (document_links, link); g_object_unref (link); - + current_page = ev_document_model_get_page (sidebar_links->priv->doc_model); - + if (dest_page == current_page) { gtk_tree_view_expand_to_path (GTK_TREE_VIEW (sidebar_links->priv->tree_view), path); gtk_tree_view_set_cursor (GTK_TREE_VIEW (sidebar_links->priv->tree_view), path, NULL, FALSE); - + return TRUE; } } @@ -513,7 +513,7 @@ ev_sidebar_links_set_current_page (EvSidebarLinks *sidebar_links, /* Widget is not currently visible */ if (!gtk_widget_get_mapped (GTK_WIDGET (sidebar_links))) return; - + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar_links->priv->tree_view)); if (gtk_tree_selection_get_selected (selection, &model, &iter)) { @@ -528,11 +528,11 @@ ev_sidebar_links_set_current_page (EvSidebarLinks *sidebar_links, dest_page = ev_document_links_get_link_page (document_links, link); g_object_unref (link); - + if (dest_page == current_page) return; } - } + } /* We go through the tree linearly looking for the first page that * matches. This is pretty inefficient. We can do something neat with @@ -545,7 +545,7 @@ ev_sidebar_links_set_current_page (EvSidebarLinks *sidebar_links, gtk_tree_model_foreach (model, update_page_callback_foreach, sidebar_links); - + g_signal_handler_unblock (selection, sidebar_links->priv->selection_id); g_signal_handler_unblock (sidebar_links->priv->tree_view, sidebar_links->priv->row_activated_id); } @@ -558,7 +558,7 @@ update_page_callback (EvSidebarLinks *sidebar_links, ev_sidebar_links_set_current_page (sidebar_links, new_page); } -static void +static void row_activated_callback (GtkTreeView *treeview, GtkTreePath *arg1, GtkTreeViewColumn *arg2, @@ -584,7 +584,7 @@ expand_open_links (GtkTreeView *tree_view, GtkTreeModel *model, GtkTreeIter *par -1); if (expand) { GtkTreePath *path; - + path = gtk_tree_model_get_path (model, &iter); gtk_tree_view_expand_row (tree_view, path, FALSE); gtk_tree_path_free (path); @@ -621,7 +621,7 @@ job_finished_callback (EvJobLinks *job, ev_sidebar_links_set_links_model (sidebar_links, job->model); gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), job->model); - + g_object_unref (job); priv->job = NULL; @@ -629,7 +629,7 @@ job_finished_callback (EvJobLinks *job, selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - + if (priv->selection_id <= 0) { priv->selection_id = g_signal_connect (selection, "changed", diff --git a/shell/ev-sidebar-links.h b/shell/ev-sidebar-links.h index 495a6f07..eb4ae8ff 100644 --- a/shell/ev-sidebar-links.h +++ b/shell/ev-sidebar-links.h @@ -1,6 +1,6 @@ /* ev-sidebar-links.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/shell/ev-sidebar-page.c b/shell/ev-sidebar-page.c index fdb8d4af..0b216bd8 100644 --- a/shell/ev-sidebar-page.c +++ b/shell/ev-sidebar-page.c @@ -28,7 +28,7 @@ G_DEFINE_INTERFACE (EvSidebarPage, ev_sidebar_page, 0) -gboolean +gboolean ev_sidebar_page_support_document (EvSidebarPage *sidebar_page, EvDocument *document) { @@ -40,8 +40,8 @@ ev_sidebar_page_support_document (EvSidebarPage *sidebar_page, iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page); g_return_val_if_fail (iface->support_document, FALSE); - - return iface->support_document (sidebar_page, document); + + return iface->support_document (sidebar_page, document); } void @@ -70,7 +70,7 @@ ev_sidebar_page_get_label (EvSidebarPage *sidebar_page) iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page); g_assert (iface->get_label); - + return iface->get_label (sidebar_page); } @@ -79,7 +79,7 @@ static void ev_sidebar_page_default_init (EvSidebarPageInterface *iface) { static gboolean initialized = FALSE; - + if (!initialized) { g_object_interface_install_property (iface, g_param_spec_object ("main-widget", diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 3d17d692..905b95aa 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -99,11 +99,11 @@ static void thumbnail_job_completed_callback (EvJobThumbnail EvSidebarThumbnails *sidebar_thumbnails); static void adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails); -G_DEFINE_TYPE_EXTENDED (EvSidebarThumbnails, - ev_sidebar_thumbnails, +G_DEFINE_TYPE_EXTENDED (EvSidebarThumbnails, + ev_sidebar_thumbnails, GTK_TYPE_BOX, - 0, - G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, + 0, + G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, ev_sidebar_thumbnails_page_iface_init)) #define EV_SIDEBAR_THUMBNAILS_GET_PRIVATE(object) \ @@ -252,12 +252,12 @@ static void ev_sidebar_thumbnails_dispose (GObject *object) { EvSidebarThumbnails *sidebar_thumbnails = EV_SIDEBAR_THUMBNAILS (object); - + if (sidebar_thumbnails->priv->loading_icons) { g_hash_table_destroy (sidebar_thumbnails->priv->loading_icons); sidebar_thumbnails->priv->loading_icons = NULL; } - + if (sidebar_thumbnails->priv->list_store) { ev_sidebar_thumbnails_clear_model (sidebar_thumbnails); g_object_unref (sidebar_thumbnails->priv->list_store); @@ -296,7 +296,7 @@ ev_sidebar_thumbnails_map (GtkWidget *widget) sidebar = EV_SIDEBAR_THUMBNAILS (widget); GTK_WIDGET_CLASS (ev_sidebar_thumbnails_parent_class)->map (widget); - + adjustment_changed_cb (sidebar); } @@ -367,7 +367,7 @@ ev_sidebar_thumbnails_get_loading_icon (EvSidebarThumbnails *sidebar_thumbnails, } else { g_free (key); } - + return icon; } @@ -512,12 +512,12 @@ update_visible_range (EvSidebarThumbnails *sidebar_thumbnails, /* Clear the areas we no longer display */ if (old_start_page >= 0 && old_start_page < start_page) cancel_running_jobs (sidebar_thumbnails, old_start_page, MIN (start_page - 1, old_end_page)); - + if (old_end_page > 0 && old_end_page > end_page) cancel_running_jobs (sidebar_thumbnails, MAX (end_page + 1, old_start_page), old_end_page); add_range (sidebar_thumbnails, start_page, end_page); - + priv->start_page = start_page; priv->end_page = end_page; } @@ -543,7 +543,7 @@ adjustment_changed_cb (EvSidebarThumbnails *sidebar_thumbnails) return; value = gtk_adjustment_get_value (priv->vadjustment); - + if (priv->tree_view) { if (! gtk_widget_get_realized (priv->tree_view)) return; @@ -607,7 +607,7 @@ ev_sidebar_thumbnails_fill_model (EvSidebarThumbnails *sidebar_thumbnails) prev_width = width; prev_height = height; - + gtk_list_store_append (priv->list_store, &iter); gtk_list_store_set (priv->list_store, &iter, COLUMN_PAGE_STRING, page_string, @@ -775,7 +775,7 @@ ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails) GUINT_TO_POINTER (signal_id)); priv->swindow = gtk_scrolled_window_new (NULL, NULL); - + /* We actually don't want GTK_POLICY_AUTOMATIC for horizontal scrollbar here * it's just a workaround for bug #449462 (GTK2 only) */ @@ -999,29 +999,29 @@ ev_sidebar_thumbnails_set_model (EvSidebarPage *sidebar_page, } static gboolean -ev_sidebar_thumbnails_clear_job (GtkTreeModel *model, +ev_sidebar_thumbnails_clear_job (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { EvJob *job; - + gtk_tree_model_get (model, iter, COLUMN_JOB, &job, -1); - + if (job != NULL) { ev_job_cancel (job); g_signal_handlers_disconnect_by_func (job, thumbnail_job_completed_callback, data); g_object_unref (job); } - - return FALSE; + + return FALSE; } -static void +static void ev_sidebar_thumbnails_clear_model (EvSidebarThumbnails *sidebar_thumbnails) { EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv; - + gtk_tree_model_foreach (GTK_TREE_MODEL (priv->list_store), ev_sidebar_thumbnails_clear_job, sidebar_thumbnails); gtk_list_store_clear (priv->list_store); } diff --git a/shell/ev-sidebar-thumbnails.h b/shell/ev-sidebar-thumbnails.h index b93d47eb..ed10ac39 100644 --- a/shell/ev-sidebar-thumbnails.h +++ b/shell/ev-sidebar-thumbnails.h @@ -1,6 +1,6 @@ /* ev-sidebar-thumbnails.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c index eb1b59ee..f5c6b83d 100644 --- a/shell/ev-sidebar.c +++ b/shell/ev-sidebar.c @@ -88,7 +88,7 @@ ev_sidebar_select_page (EvSidebar *ev_sidebar, GtkTreeIter *iter) int index; gtk_tree_model_get (ev_sidebar->priv->page_model, iter, - PAGE_COLUMN_TITLE, &title, + PAGE_COLUMN_TITLE, &title, PAGE_COLUMN_NOTEBOOK_INDEX, &index, -1); @@ -106,14 +106,14 @@ ev_sidebar_set_page (EvSidebar *ev_sidebar, gboolean valid; valid = gtk_tree_model_get_iter_first (ev_sidebar->priv->page_model, &iter); - + while (valid) { GtkWidget *widget; gtk_tree_model_get (ev_sidebar->priv->page_model, &iter, PAGE_COLUMN_MAIN_WIDGET, &widget, -1); - + if (widget == main_widget) { ev_sidebar_select_page (ev_sidebar, &iter); valid = FALSE; @@ -137,7 +137,7 @@ ev_sidebar_set_property (GObject *object, switch (prop_id) { case PROP_CURRENT_PAGE: - ev_sidebar_set_page (sidebar, g_value_get_object (value)); + ev_sidebar_set_page (sidebar, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -178,7 +178,7 @@ ev_sidebar_class_init (EvSidebarClass *ev_sidebar_class) g_object_class = G_OBJECT_CLASS (ev_sidebar_class); g_type_class_add_private (g_object_class, sizeof (EvSidebarPrivate)); - + g_object_class->dispose = ev_sidebar_dispose; g_object_class->get_property = ev_sidebar_get_property; g_object_class->set_property = ev_sidebar_set_property; @@ -210,9 +210,9 @@ ev_sidebar_select_button_press_cb (GtkWidget *widget, gtk_widget_get_preferred_size (ev_sidebar->priv->menu, &requisition, NULL); gtk_widget_set_size_request (ev_sidebar->priv->menu, MAX (width, requisition.width), -1); - + gtk_widget_grab_focus (widget); - + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); gtk_menu_popup_at_widget (GTK_MENU (ev_sidebar->priv->menu), widget, @@ -232,7 +232,7 @@ ev_sidebar_select_button_key_press_cb (GtkWidget *widget, gpointer user_data) { EvSidebar *ev_sidebar = EV_SIDEBAR (user_data); - + if (event->keyval == GDK_KEY_space || event->keyval == GDK_KEY_KP_Space || event->keyval == GDK_KEY_Return || @@ -265,7 +265,7 @@ ev_sidebar_menu_deactivate_cb (GtkWidget *widget, GtkWidget *menu_button; menu_button = GTK_WIDGET (user_data); - + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (menu_button), FALSE); } @@ -274,7 +274,7 @@ ev_sidebar_menu_detach_cb (GtkWidget *widget, GtkMenu *menu) { EvSidebar *ev_sidebar = EV_SIDEBAR (widget); - + ev_sidebar->priv->menu = NULL; } @@ -289,12 +289,12 @@ ev_sidebar_menu_item_activate_cb (GtkWidget *widget, menu_item = gtk_menu_get_active (GTK_MENU (ev_sidebar->priv->menu)); valid = gtk_tree_model_get_iter_first (ev_sidebar->priv->page_model, &iter); - + while (valid) { gtk_tree_model_get (ev_sidebar->priv->page_model, &iter, PAGE_COLUMN_MENU_ITEM, &item, -1); - + if (item == menu_item) { ev_sidebar_select_page (ev_sidebar, &iter); valid = FALSE; @@ -366,15 +366,15 @@ ev_sidebar_init (EvSidebar *ev_sidebar) g_signal_connect (close_button, "clicked", G_CALLBACK (ev_sidebar_close_clicked_cb), ev_sidebar); - + image = gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_MENU); gtk_container_add (GTK_CONTAINER (close_button), image); gtk_widget_show (image); - + gtk_box_pack_end (GTK_BOX (hbox), close_button, FALSE, FALSE, 0); gtk_widget_show (close_button); - + ev_sidebar->priv->menu = gtk_menu_new (); g_signal_connect (ev_sidebar->priv->menu, "deactivate", G_CALLBACK (ev_sidebar_menu_deactivate_cb), @@ -416,7 +416,7 @@ ev_sidebar_add_page (EvSidebar *ev_sidebar, gchar *label_title; const gchar *title; int index; - + g_return_if_fail (EV_IS_SIDEBAR (ev_sidebar)); g_return_if_fail (EV_IS_SIDEBAR_PAGE (main_widget)); g_return_if_fail (GTK_IS_WIDGET (main_widget)); @@ -424,10 +424,10 @@ ev_sidebar_add_page (EvSidebar *ev_sidebar, ev_sidebar_page_set_model (EV_SIDEBAR_PAGE (main_widget), ev_sidebar->priv->model); title = ev_sidebar_page_get_label (EV_SIDEBAR_PAGE (main_widget)); - + index = gtk_notebook_append_page (GTK_NOTEBOOK (ev_sidebar->priv->notebook), main_widget, NULL); - + menu_item = gtk_image_menu_item_new_with_label (title); g_signal_connect (menu_item, "activate", G_CALLBACK (ev_sidebar_menu_item_activate_cb), diff --git a/shell/ev-sidebar.h b/shell/ev-sidebar.h index 9fc5b39a..11d16632 100644 --- a/shell/ev-sidebar.h +++ b/shell/ev-sidebar.h @@ -1,6 +1,6 @@ /* ev-sidebar.h * this file is part of atril, a mate document viewer - * + * * Copyright (C) 2004 Red Hat, Inc. * * Author: diff --git a/shell/ev-utils.c b/shell/ev-utils.c index ebfca1ec..7c7aa845 100644 --- a/shell/ev-utils.c +++ b/shell/ev-utils.c @@ -26,14 +26,14 @@ #include <string.h> #include <glib/gi18n.h> -void +void file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser) { GSList *pixbuf_formats = NULL; GSList *iter; GtkFileFilter *filter; int i; - + filter = gtk_file_filter_new(); gtk_file_filter_set_name (filter, _("By extension")); g_object_set_data (G_OBJECT(filter), "pixbuf-format", NULL); @@ -87,7 +87,7 @@ get_gdk_pixbuf_format_by_extension (gchar *uri) for (iter = pixbuf_formats; iter; iter = iter->next) { gchar **extension_list; GdkPixbufFormat *format = iter->data; - + if (gdk_pixbuf_format_is_disabled (format) || !gdk_pixbuf_format_is_writable (format)) continue; diff --git a/shell/ev-window-title.c b/shell/ev-window-title.c index 7b8c45e8..f200f849 100644 --- a/shell/ev-window-title.c +++ b/shell/ev-window-title.c @@ -74,7 +74,7 @@ get_filename_from_uri (const char *uri) { char *filename; char *basename; - + filename = g_uri_unescape_string (uri, NULL); basename = g_path_get_basename (filename); g_free(filename); @@ -92,7 +92,7 @@ ev_window_title_sanitize_title (EvWindowTitle *window_title, char **title) { backend = ev_backends_manager_get_document_module_name (window_title->document); for (i = 0; i < G_N_ELEMENTS (bad_extensions); i++) { - if (g_ascii_strcasecmp (bad_extensions[i].backend, backend) == 0 && + if (g_ascii_strcasecmp (bad_extensions[i].backend, backend) == 0 && g_str_has_suffix (*title, bad_extensions[i].text)) { char *new_title; char *filename = get_filename_from_uri (window_title->uri); @@ -109,7 +109,7 @@ ev_window_title_sanitize_title (EvWindowTitle *window_title, char **title) { g_str_has_prefix (*title, bad_prefixes[i].text)) { char *new_title; int len = strlen(bad_prefixes[i].text); - + new_title = g_strdup_printf ("%s", (*title) + len); g_free (*title); *title = new_title; diff --git a/shell/ev-window.c b/shell/ev-window.c index 24e84536..b5ecc8a3 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -204,7 +204,7 @@ struct _EvWindowPrivate { gboolean in_reload; EvFileMonitor *monitor; guint setup_document_idle; - + EvDocument *document; EvHistory *history; EvWindowPageMode page_mode; @@ -354,16 +354,16 @@ static void ev_view_popup_cmd_remove_annotation (GtkAction *actio EvWindow *window); static void ev_attachment_popup_cmd_open_attachment (GtkAction *action, EvWindow *window); -static void ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, +static void ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, EvWindow *window); static void ev_window_cmd_view_fit_page (GtkAction *action, EvWindow *ev_window); static void ev_window_cmd_view_fit_width (GtkAction *action, EvWindow *ev_window); -static void ev_window_cmd_view_expand_window (GtkAction *action, +static void ev_window_cmd_view_expand_window (GtkAction *action, EvWindow *ev_window); -static void view_handle_link_cb (EvView *view, - EvLink *link, +static void view_handle_link_cb (EvView *view, + EvLink *link, EvWindow *window); static void ev_window_update_find_status_message (EvWindow *ev_window); static void ev_window_cmd_edit_find (GtkAction *action, @@ -493,7 +493,7 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window) ev_window_set_action_sensitive (ev_window, "EditRotateRight", has_pages && !(document->iswebdocument)); /* View menu */ - /*If it has pages it is a document, so our check for a webdocument won't lead to a crash. We need to switch these view modes off since more than one + /*If it has pages it is a document, so our check for a webdocument won't lead to a crash. We need to switch these view modes off since more than one *webview is hard to manage, and would lead to unexpected behaviour in case the number of webviews gets too large. */ ev_window_set_action_sensitive (ev_window, "ViewContinuous", has_pages && !(document->iswebdocument)); @@ -526,7 +526,7 @@ ev_window_update_actions (EvWindow *ev_window) EvWebView *webview = NULL; #endif EvView *view = NULL; - + int n_pages = 0, page = -1; gboolean has_pages = FALSE; gboolean presentation_mode; @@ -548,7 +548,7 @@ ev_window_update_actions (EvWindow *ev_window) { view = EV_VIEW (ev_window->priv->view); } - + can_find_in_page = (ev_window->priv->find_job && ev_job_find_has_results (EV_JOB_FIND (ev_window->priv->find_job))); if (view) { @@ -575,7 +575,7 @@ ev_window_update_actions (EvWindow *ev_window) has_pages && can_find_in_page); presentation_mode = EV_WINDOW_IS_PRESENTATION (ev_window); - + if (ev_window->priv->document && ev_window->priv->document->iswebdocument == FALSE ) { ev_window_set_action_sensitive (ev_window, "ViewZoomIn", has_pages && @@ -650,7 +650,7 @@ static void set_widget_visibility (GtkWidget *widget, gboolean visible) { g_assert (GTK_IS_WIDGET (widget)); - + if (visible) gtk_widget_show (widget); else @@ -669,18 +669,18 @@ update_chrome_visibility (EvWindow *window) fullscreen_mode = fullscreen || presentation; menubar = (priv->chrome & EV_CHROME_MENUBAR) != 0 && !fullscreen_mode; - toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 || + toolbar = ((priv->chrome & EV_CHROME_TOOLBAR) != 0 || (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && !fullscreen_mode; - fullscreen_toolbar = ((priv->chrome & EV_CHROME_FULLSCREEN_TOOLBAR) != 0 || + fullscreen_toolbar = ((priv->chrome & EV_CHROME_FULLSCREEN_TOOLBAR) != 0 || (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && fullscreen; findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0; sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && priv->document && !presentation; - set_widget_visibility (priv->menubar, menubar); + set_widget_visibility (priv->menubar, menubar); set_widget_visibility (priv->toolbar, toolbar); set_widget_visibility (priv->find_bar, findbar); set_widget_visibility (priv->sidebar, sidebar); - + ev_window_set_action_sensitive (window, "EditToolbar", toolbar); if (priv->fullscreen_toolbar != NULL) { @@ -692,7 +692,7 @@ static void update_chrome_flag (EvWindow *window, EvChrome flag, gboolean active) { EvWindowPrivate *priv = window->priv; - + if (active) { priv->chrome |= flag; } else { @@ -728,21 +728,21 @@ update_sizing_buttons (EvWindow *window) g_signal_handlers_unblock_by_func (action, G_CALLBACK (ev_window_cmd_view_fit_page), window); - action = gtk_action_group_get_action (action_group, "ViewFitWidth"); + action = gtk_action_group_get_action (action_group, "ViewFitWidth"); g_signal_handlers_block_by_func (action, G_CALLBACK (ev_window_cmd_view_fit_width), window); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fit_width); g_signal_handlers_unblock_by_func (action, G_CALLBACK (ev_window_cmd_view_fit_width), window); - action = gtk_action_group_get_action (window->priv->action_group, - ZOOM_CONTROL_ACTION); + action = gtk_action_group_get_action (window->priv->action_group, + ZOOM_CONTROL_ACTION); if (fit_page) { - ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), + ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), EPHY_ZOOM_FIT_PAGE); } else if (fit_width) { if (!window->priv->document || (window->priv->document && !window->priv->document->iswebdocument)) { - ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), + ephy_zoom_action_set_zoom_level (EPHY_ZOOM_ACTION (action), EPHY_ZOOM_FIT_WIDTH); } } @@ -779,7 +779,7 @@ ev_window_is_empty (const EvWindow *ev_window) { g_return_val_if_fail (EV_IS_WINDOW (ev_window), FALSE); - return (ev_window->priv->document == NULL) && + return (ev_window->priv->document == NULL) && (ev_window->priv->load_job == NULL); } @@ -830,14 +830,14 @@ ev_window_error_message (EvWindow *window, va_start (args, format); msg = g_strdup_vprintf (format, args); va_end (args); - + area = ev_message_area_new (GTK_MESSAGE_ERROR, msg, "gtk-close", GTK_RESPONSE_CLOSE, NULL); g_free (msg); - + if (error) ev_message_area_set_secondary_text (EV_MESSAGE_AREA (area), error->message); g_signal_connect (area, "response", @@ -869,7 +869,7 @@ ev_window_warning_message (EvWindow *window, GTK_RESPONSE_CLOSE, NULL); g_free (msg); - + g_signal_connect (area, "response", G_CALLBACK (ev_window_message_area_response_cb), window); @@ -918,14 +918,14 @@ ev_window_find_page_title (GtkTreeModel *tree_model, PageTitleData *data) { gchar *page_string; - + gtk_tree_model_get (tree_model, iter, - EV_DOCUMENT_LINKS_COLUMN_PAGE_LABEL, &page_string, + EV_DOCUMENT_LINKS_COLUMN_PAGE_LABEL, &page_string, -1); - + if (!page_string) return FALSE; - + if (!strcmp (page_string, data->page_label)) { gtk_tree_model_get (tree_model, iter, EV_DOCUMENT_LINKS_COLUMN_MARKUP, &data->page_title, @@ -933,7 +933,7 @@ ev_window_find_page_title (GtkTreeModel *tree_model, g_free (page_string); return TRUE; } - + g_free (page_string); return FALSE; } @@ -976,13 +976,13 @@ ev_window_add_history (EvWindow *window, gint page, EvLink *link) EvLink *real_link; EvLinkAction *action; EvLinkDest *dest; - + if (window->priv->history == NULL) return; if (!EV_IS_DOCUMENT_LINKS (window->priv->document)) return; - + if (link) { action = g_object_ref (ev_link_get_action (link)); dest = ev_link_action_get_dest (action); @@ -1005,7 +1005,7 @@ ev_window_add_history (EvWindow *window, gint page, EvLink *link) } real_link = ev_link_new (link_title, action); - + ev_history_add_link (window->priv->history, real_link); g_free (link_title); @@ -1017,7 +1017,7 @@ static void view_handle_link_cb (EvView *view, EvLink *link, EvWindow *window) { int current_page = ev_document_model_get_page (window->priv->model); - + ev_window_add_history (window, 0, link); ev_window_add_history (window, current_page, NULL); } @@ -1530,7 +1530,7 @@ ev_window_clear_thumbnail_job (EvWindow *ev_window) if (ev_window->priv->thumbnail_job != NULL) { if (!ev_job_is_finished (ev_window->priv->thumbnail_job)) ev_job_cancel (ev_window->priv->thumbnail_job); - + g_signal_handlers_disconnect_by_func (ev_window->priv->thumbnail_job, ev_window_set_icon_from_thumbnail, ev_window); @@ -1659,9 +1659,9 @@ ev_window_setup_document (EvWindow *ev_window) ev_window->priv->setup_document_idle = 0; ev_window_refresh_window_thumbnail (ev_window); - + ev_window_set_page_mode (ev_window, PAGE_MODE_DOCUMENT); - + ev_window_title_set_document (ev_window->priv->title, document); ev_window_title_set_uri (ev_window->priv->title, ev_window->priv->uri); @@ -1686,13 +1686,13 @@ ev_window_setup_document (EvWindow *ev_window) ev_window->priv->history = ev_history_new (); action = gtk_action_group_get_action (ev_window->priv->action_group, NAVIGATION_ACTION); ev_navigation_action_set_history (EV_NAVIGATION_ACTION (action), ev_window->priv->history); - + if (ev_window->priv->properties) { ev_properties_dialog_set_document (EV_PROPERTIES_DIALOG (ev_window->priv->properties), ev_window->priv->uri, ev_window->priv->document); } - + info = ev_document_get_info (document); update_document_mode (ev_window, info->mode); @@ -1744,18 +1744,18 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document) } #if ENABLE_EPUB - if (document->iswebdocument == TRUE && + if (document->iswebdocument == TRUE && ev_window->priv->view != NULL) { /*We have encountered a web document, replace the atril view with a web view, if the web view is not already loaded.*/ gtk_container_remove (GTK_CONTAINER(ev_window->priv->scrolled_window), ev_window->priv->view); ev_view_disconnect_handlers(EV_VIEW(ev_window->priv->view)); - g_object_unref(ev_window->priv->view); + g_object_unref(ev_window->priv->view); ev_window->priv->view = NULL; gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window), ev_window->priv->webview); - gtk_widget_show(ev_window->priv->webview); + gtk_widget_show(ev_window->priv->webview); } else if(ev_window->priv->webview != NULL && document->iswebdocument == FALSE) { /*Since the document is not a webdocument might as well get rid of the webview now*/ @@ -1801,7 +1801,7 @@ static void ev_window_password_view_unlock (EvWindow *ev_window) { const gchar *password; - + g_assert (ev_window->priv->load_job); password = ev_password_view_get_password (EV_PASSWORD_VIEW (ev_window->priv->password_view)); @@ -1815,7 +1815,7 @@ ev_window_clear_load_job (EvWindow *ev_window) if (ev_window->priv->load_job != NULL) { if (!ev_job_is_finished (ev_window->priv->load_job)) ev_job_cancel (ev_window->priv->load_job); - + g_signal_handlers_disconnect_by_func (ev_window->priv->load_job, ev_window_load_job_cb, ev_window); g_object_unref (ev_window->priv->load_job); ev_window->priv->load_job = NULL; @@ -1828,7 +1828,7 @@ ev_window_clear_reload_job (EvWindow *ev_window) if (ev_window->priv->reload_job != NULL) { if (!ev_job_is_finished (ev_window->priv->reload_job)) ev_job_cancel (ev_window->priv->reload_job); - + g_signal_handlers_disconnect_by_func (ev_window->priv->reload_job, ev_window_reload_job_cb, ev_window); g_object_unref (ev_window->priv->reload_job); ev_window->priv->reload_job = NULL; @@ -1883,7 +1883,7 @@ ev_window_load_job_cb (EvJob *job, ev_window_hide_loading_message (ev_window); /* Success! */ - if (!ev_job_is_failed (job)) { + if (!ev_job_is_failed (job)) { ev_document_model_set_document (ev_window->priv->model, document); #ifdef ENABLE_DBUS @@ -1931,16 +1931,16 @@ ev_window_load_job_cb (EvJob *job, g_signal_connect_swapped (ev_window->priv->monitor, "changed", G_CALLBACK (ev_window_document_changed), ev_window); - + ev_window_clear_load_job (ev_window); return; } if (g_error_matches (job->error, EV_DOCUMENT_ERROR, EV_DOCUMENT_ERROR_ENCRYPTED)) { gchar *password; - + setup_view_from_metadata (ev_window); - + /* First look whether password is in keyring */ password = ev_keyring_lookup_password (ev_window->priv->uri); if (password) { @@ -1972,10 +1972,10 @@ ev_window_load_job_cb (EvJob *job, ev_job_load_set_password (job_load, NULL); ev_password_view_ask_password (EV_PASSWORD_VIEW (ev_window->priv->password_view)); } else { - ev_window_error_message (ev_window, job->error, + ev_window_error_message (ev_window, job->error, "%s", _("Unable to open document")); ev_window_clear_load_job (ev_window); - } + } } static void @@ -2012,7 +2012,7 @@ ev_window_reload_job_cb (EvJob *job, find_bar_search_changed_cb (EGG_FIND_BAR (ev_window->priv->find_bar), NULL, ev_window); } - + ev_window_clear_reload_job (ev_window); ev_window->priv->in_reload = FALSE; } @@ -2044,7 +2044,7 @@ ev_window_close_dialogs (EvWindow *ev_window) if (ev_window->priv->print_dialog) gtk_widget_destroy (ev_window->priv->print_dialog); ev_window->priv->print_dialog = NULL; - + if (ev_window->priv->properties) gtk_widget_destroy (ev_window->priv->properties); ev_window->priv->properties = NULL; @@ -2097,13 +2097,13 @@ ev_window_progress_response_cb (EvProgressMessageArea *area, ev_window_set_message_area (ev_window, NULL); } -static gboolean +static gboolean show_loading_progress (EvWindow *ev_window) { GtkWidget *area; gchar *text; gchar *display_name; - + if (ev_window->priv->message_area) return FALSE; @@ -2137,10 +2137,10 @@ ev_window_load_remote_failed (EvWindow *ev_window, GError *error) { if ( !ev_window->priv->view ) return; - + ev_window_hide_loading_message (ev_window); ev_window->priv->in_reload = FALSE; - ev_window_error_message (ev_window, error, + ev_window_error_message (ev_window, error, "%s", _("Unable to open document")); g_free (ev_window->priv->local_uri); ev_window->priv->local_uri = NULL; @@ -2162,7 +2162,7 @@ set_uri_mtime (GFile *source, g_error_free (error); } else { GTimeVal mtime; - + g_file_info_get_modification_time (info, &mtime); ev_window->priv->uri_mtime = mtime.tv_sec; g_object_unref (info); @@ -2229,13 +2229,13 @@ window_open_file_copy_ready_cb (GFile *source, g_free (ev_window->priv->uri); ev_window->priv->uri = NULL; g_object_unref (source); - + ev_window_hide_loading_message (ev_window); } else { ev_window_load_remote_failed (ev_window, error); g_object_unref (source); } - + g_error_free (error); } @@ -2246,7 +2246,7 @@ window_open_file_copy_progress_cb (goffset n_bytes, { gchar *status; gdouble fraction; - + if (!ev_window->priv->message_area) return; @@ -2256,7 +2256,7 @@ window_open_file_copy_progress_cb (goffset n_bytes, fraction = n_bytes / (gdouble)total_bytes; status = g_strdup_printf (_("Downloading document (%d%%)"), (gint)(fraction * 100)); - + ev_progress_message_area_set_status (EV_PROGRESS_MESSAGE_AREA (ev_window->priv->message_area), status); ev_progress_message_area_set_fraction (EV_PROGRESS_MESSAGE_AREA (ev_window->priv->message_area), @@ -2270,7 +2270,7 @@ ev_window_load_file_remote (EvWindow *ev_window, GFile *source_file) { GFile *target_file; - + if (!ev_window->priv->local_uri) { char *base_name, *template; GFile *tmp_file; @@ -2300,14 +2300,14 @@ ev_window_load_file_remote (EvWindow *ev_window, } ev_window_reset_progress_cancellable (ev_window); - + target_file = g_file_new_for_uri (ev_window->priv->local_uri); g_file_copy_async (source_file, target_file, G_FILE_COPY_OVERWRITE, G_PRIORITY_DEFAULT, ev_window->priv->progress_cancellable, (GFileProgressCallback)window_open_file_copy_progress_cb, - ev_window, + ev_window, (GAsyncReadyCallback)window_open_file_copy_ready_cb, ev_window); g_object_unref (target_file); @@ -2326,7 +2326,7 @@ ev_window_open_uri (EvWindow *ev_window, GFile *source_file; ev_window->priv->in_reload = FALSE; - + if (ev_window->priv->uri && g_ascii_strcasecmp (ev_window->priv->uri, uri) == 0) { ev_window_reload_document (ev_window, dest); @@ -2337,7 +2337,7 @@ ev_window_open_uri (EvWindow *ev_window, g_object_unref (ev_window->priv->monitor); ev_window->priv->monitor = NULL; } - + ev_window_close_dialogs (ev_window); ev_window_clear_load_job (ev_window); ev_window_clear_local_uri (ev_window); @@ -2471,7 +2471,7 @@ static void ev_window_reload_local (EvWindow *ev_window) { const gchar *uri; - + uri = ev_window->priv->local_uri ? ev_window->priv->local_uri : ev_window->priv->uri; ev_window->priv->reload_job = ev_job_load_new (uri); g_signal_connect (ev_window->priv->reload_job, "finished", @@ -2480,15 +2480,15 @@ ev_window_reload_local (EvWindow *ev_window) ev_job_scheduler_push_job (ev_window->priv->reload_job, EV_JOB_PRIORITY_NONE); } -static gboolean +static gboolean show_reloading_progress (EvWindow *ev_window) { GtkWidget *area; gchar *text; - + if (ev_window->priv->message_area) return FALSE; - + text = g_strdup_printf (_("Reloading document from %s"), ev_window->priv->uri); area = ev_progress_message_area_new ("gtk-refresh", @@ -2514,9 +2514,9 @@ reload_remote_copy_ready_cb (GFile *remote, EvWindow *ev_window) { GError *error = NULL; - + ev_window_clear_progress_idle (ev_window); - + g_file_copy_finish (remote, async_result, &error); if (error) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -2526,7 +2526,7 @@ reload_remote_copy_ready_cb (GFile *remote, } else { ev_window_reload_local (ev_window); } - + g_object_unref (remote); } @@ -2537,7 +2537,7 @@ reload_remote_copy_progress_cb (goffset n_bytes, { gchar *status; gdouble fraction; - + if (!ev_window->priv->message_area) return; @@ -2547,7 +2547,7 @@ reload_remote_copy_progress_cb (goffset n_bytes, fraction = n_bytes / (gdouble)total_bytes; status = g_strdup_printf (_("Downloading document (%d%%)"), (gint)(fraction * 100)); - + ev_progress_message_area_set_status (EV_PROGRESS_MESSAGE_AREA (ev_window->priv->message_area), status); ev_progress_message_area_set_fraction (EV_PROGRESS_MESSAGE_AREA (ev_window->priv->message_area), @@ -2573,23 +2573,23 @@ query_remote_uri_mtime_cb (GFile *remote, return; } - + g_file_info_get_modification_time (info, &mtime); if (ev_window->priv->uri_mtime != mtime.tv_sec) { GFile *target_file; - + /* Remote file has changed */ ev_window->priv->uri_mtime = mtime.tv_sec; ev_window_reset_progress_cancellable (ev_window); - + target_file = g_file_new_for_uri (ev_window->priv->local_uri); g_file_copy_async (remote, target_file, G_FILE_COPY_OVERWRITE, G_PRIORITY_DEFAULT, ev_window->priv->progress_cancellable, (GFileProgressCallback)reload_remote_copy_progress_cb, - ev_window, + ev_window, (GAsyncReadyCallback)reload_remote_copy_ready_cb, ev_window); g_object_unref (target_file); @@ -2599,7 +2599,7 @@ query_remote_uri_mtime_cb (GFile *remote, g_object_unref (remote); ev_window_reload_local (ev_window); } - + g_object_unref (info); } @@ -2607,7 +2607,7 @@ static void ev_window_reload_remote (EvWindow *ev_window) { GFile *remote; - + remote = g_file_new_for_uri (ev_window->priv->uri); /* Reload the remote uri only if it has changed */ g_file_query_info_async (remote, @@ -2786,9 +2786,9 @@ ev_window_cmd_recent_file_activate (GtkAction *action, info = g_object_get_data (G_OBJECT (action), "gtk-recent-info"); g_assert (info != NULL); - + uri = gtk_recent_info_get_uri (info); - + ev_application_open_uri_at_dest (EV_APP, uri, gtk_window_get_screen (GTK_WINDOW (window)), NULL, 0, NULL, gtk_get_current_event_time ()); @@ -2818,7 +2818,7 @@ compare_recent_items (GtkRecentInfo *a, GtkRecentInfo *b) has_ev_a = gtk_recent_info_has_application (a, atril); has_ev_b = gtk_recent_info_has_application (b, atril); - + if (has_ev_a && has_ev_b) { time_t time_a, time_b; @@ -2838,7 +2838,7 @@ compare_recent_items (GtkRecentInfo *a, GtkRecentInfo *b) /* * Doubles underscore to avoid spurious menu accels. */ -static gchar * +static gchar * ev_window_get_recent_file_label (gint index, const gchar *filename) { GString *str; @@ -2846,22 +2846,22 @@ ev_window_get_recent_file_label (gint index, const gchar *filename) const gchar *p; const gchar *end; gboolean is_rtl; - + is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL); g_return_val_if_fail (filename != NULL, NULL); - + length = strlen (filename); str = g_string_sized_new (length + 10); g_string_printf (str, "%s_%d. ", is_rtl ? "\xE2\x80\x8F" : "", index); p = filename; end = filename + length; - + while (p != end) { const gchar *next; next = g_utf8_next_char (p); - + switch (*p) { case '_': g_string_append (str, "__"); @@ -2870,10 +2870,10 @@ ev_window_get_recent_file_label (gint index, const gchar *filename) g_string_append_len (str, p, next - p); break; } - + p = next; } - + return g_string_free (str, FALSE); } @@ -2961,7 +2961,7 @@ ev_window_setup_recent (EvWindow *ev_window) "gtk-recent-info", gtk_recent_info_ref (info), (GDestroyNotify) gtk_recent_info_unref); - + g_signal_connect (action, "activate", G_CALLBACK (ev_window_cmd_recent_file_activate), (gpointer) ev_window); @@ -2985,12 +2985,12 @@ ev_window_setup_recent (EvWindow *ev_window) if (++n_items == 5) break; } - + g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL); g_list_free (items); } -static gboolean +static gboolean show_saving_progress (GFile *dst) { EvWindow *ev_window; @@ -3001,7 +3001,7 @@ show_saving_progress (GFile *dst) ev_window = EV_WINDOW (g_object_get_data (G_OBJECT (dst), "ev-window")); ev_window->priv->progress_idle = 0; - + if (ev_window->priv->message_area) return FALSE; @@ -3048,7 +3048,7 @@ window_save_file_copy_ready_cb (GFile *src, ev_window = EV_WINDOW (g_object_get_data (G_OBJECT (dst), "ev-window")); ev_window_clear_progress_idle (ev_window); - + if (g_file_copy_finish (src, async_result, &error)) { ev_tmp_file_unlink (src); return; @@ -3056,7 +3056,7 @@ window_save_file_copy_ready_cb (GFile *src, if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { gchar *name; - + name = g_file_get_basename (dst); ev_window_error_message (ev_window, error, _("The file could not be saved as ā%sā."), @@ -3078,7 +3078,7 @@ window_save_file_copy_progress_cb (goffset n_bytes, gdouble fraction; ev_window = EV_WINDOW (g_object_get_data (G_OBJECT (dst), "ev-window")); - + if (!ev_window->priv->message_area) return; @@ -3104,7 +3104,7 @@ window_save_file_copy_progress_cb (goffset n_bytes, default: g_assert_not_reached (); } - + ev_progress_message_area_set_status (EV_PROGRESS_MESSAGE_AREA (ev_window->priv->message_area), status); ev_progress_message_area_set_fraction (EV_PROGRESS_MESSAGE_AREA (ev_window->priv->message_area), @@ -3144,7 +3144,7 @@ ev_window_clear_save_job (EvWindow *ev_window) if (ev_window->priv->save_job != NULL) { if (!ev_job_is_finished (ev_window->priv->save_job)) ev_job_cancel (ev_window->priv->save_job); - + g_signal_handlers_disconnect_by_func (ev_window->priv->save_job, ev_window_save_job_cb, ev_window); @@ -3185,7 +3185,7 @@ file_save_dialog_response_cb (GtkWidget *fc, uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (fc)); - /* FIXME: remote copy should be done here rather than in the save job, + /* FIXME: remote copy should be done here rather than in the save job, * so that we can track progress and cancel the operation */ @@ -3514,7 +3514,7 @@ static void ev_window_print_cancel (EvWindow *ev_window) { EvPrintOperation *op; - + if (!ev_window->priv->print_queue) return; @@ -3528,7 +3528,7 @@ ev_window_print_update_pending_jobs_message (EvWindow *ev_window, gint n_jobs) { gchar *text = NULL; - + if (!EV_IS_PROGRESS_MESSAGE_AREA (ev_window->priv->message_area) || !ev_window->priv->print_queue) return; @@ -3537,7 +3537,7 @@ ev_window_print_update_pending_jobs_message (EvWindow *ev_window, ev_window_set_message_area (ev_window, NULL); return; } - + if (n_jobs > 1) { text = g_strdup_printf (ngettext ("%d pending job in queue", "%d pending jobs in queue", @@ -3553,7 +3553,7 @@ static gboolean destroy_window (GtkWidget *window) { gtk_widget_destroy (window); - + return FALSE; } @@ -3586,7 +3586,7 @@ ev_window_print_operation_done (EvPrintOperation *op, ev_print_operation_get_error (op, &error); - + /* The message area is already used by * the printing progress, so it's better to * use a popup dialog in this case @@ -3602,7 +3602,7 @@ ev_window_print_operation_done (EvPrintOperation *op, G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (dialog); - + g_error_free (error); } break; @@ -3645,7 +3645,7 @@ ev_window_print_operation_status_changed (EvPrintOperation *op, status = ev_print_operation_get_status (op); fraction = ev_print_operation_get_progress (op); - + if (!ev_window->priv->message_area) { GtkWidget *area; const gchar *job_name; @@ -3881,8 +3881,8 @@ print_jobs_confirmation_dialog_response (GtkDialog *dialog, gint response, EvWindow *ev_window) { - gtk_widget_destroy (GTK_WIDGET (dialog)); - + gtk_widget_destroy (GTK_WIDGET (dialog)); + switch (response) { case GTK_RESPONSE_YES: if (!ev_window->priv->print_queue || @@ -4006,11 +4006,11 @@ static void ev_window_cmd_focus_page_selector (GtkAction *act, EvWindow *window) { GtkAction *action; - + update_chrome_flag (window, EV_CHROME_RAISE_TOOLBAR, TRUE); ev_window_set_action_sensitive (window, "ViewToolbar", FALSE); update_chrome_visibility (window); - + action = gtk_action_group_get_action (window->priv->action_group, PAGE_SELECTOR_ACTION); ev_page_action_grab_focus (EV_PAGE_ACTION (action)); @@ -4022,7 +4022,7 @@ ev_window_cmd_scroll_forward (GtkAction *action, EvWindow *window) /* If the webview is occupying the window */ if (window->priv->document && window->priv->document->iswebdocument == TRUE) return; - + g_signal_emit_by_name (window->priv->view, "scroll", GTK_SCROLL_PAGE_FORWARD, GTK_ORIENTATION_VERTICAL); } @@ -4032,7 +4032,7 @@ ev_window_cmd_scroll_backward (GtkAction *action, EvWindow *window) /* If the webview is occupying the window */ if (window->priv->document && window->priv->document->iswebdocument == TRUE) return; - + g_signal_emit_by_name (window->priv->view, "scroll", GTK_SCROLL_PAGE_BACKWARD, GTK_ORIENTATION_VERTICAL); } @@ -4172,7 +4172,7 @@ ev_window_cmd_edit_find_previous (GtkAction *action, EvWindow *ev_window) gtk_widget_grab_focus (ev_window->priv->find_bar); if (ev_window->priv->document->iswebdocument == FALSE) { ev_view_find_previous (EV_VIEW (ev_window->priv->view)); - } + } #if ENABLE_EPUB else { ev_web_view_find_previous(EV_WEB_VIEW(ev_window->priv->webview)); @@ -4184,10 +4184,10 @@ static void ev_window_cmd_edit_copy (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); -#if ENABLE_EPUB +#if ENABLE_EPUB if (ev_window->priv->document->iswebdocument) { ev_web_view_copy(EV_WEB_VIEW(ev_window->priv->webview)); - } else + } else #endif { ev_view_copy (EV_VIEW (ev_window->priv->view)); @@ -4231,7 +4231,7 @@ fullscreen_toolbar_setup_item_properties (GtkUIManager *ui_manager) item = gtk_ui_manager_get_widget (ui_manager, "/FullscreenToolbar/StartPresentation"); g_object_set (item, "is-important", TRUE, NULL); - + item = gtk_ui_manager_get_widget (ui_manager, "/FullscreenToolbar/LeaveFullscreen"); g_object_set (item, "is-important", TRUE, NULL); } @@ -4243,7 +4243,7 @@ ev_window_run_fullscreen (EvWindow *window) if (ev_document_model_get_fullscreen (window->priv->model)) return; - + if (!window->priv->fullscreen_toolbar) { window->priv->fullscreen_toolbar = gtk_ui_manager_get_widget (window->priv->ui_manager, @@ -4405,7 +4405,7 @@ ev_window_run_presentation (EvWindow *window) if (EV_WINDOW_IS_PRESENTATION (window)) return; - + if (window->priv->document->iswebdocument) { ev_window_warning_message(window,_("Presentation mode is not supported for ePub documents")); return; @@ -4480,10 +4480,10 @@ ev_window_stop_presentation (EvWindow *window, update_chrome_visibility (window); if (unfullscreen_window) gtk_window_unfullscreen (GTK_WINDOW (window)); - + if (window->priv->view) { gtk_widget_grab_focus (window->priv->view); - } + } #if ENABLE_EPUB else { gtk_widget_grab_focus (window->priv->webview); @@ -4600,7 +4600,7 @@ ev_window_state_event (GtkWidget *widget, if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) { if (ev_document_model_get_fullscreen (window->priv->model) || EV_WINDOW_IS_PRESENTATION (window)) return FALSE; - + ev_window_run_fullscreen (window); } else { if (ev_document_model_get_fullscreen (window->priv->model)) @@ -4860,7 +4860,7 @@ ev_window_cmd_go_next_page (GtkAction *action, EvWindow *ev_window) #if ENABLE_EPUB if ( ev_window->priv->document->iswebdocument == TRUE ) { ev_web_view_next_page(EV_WEB_VIEW(ev_window->priv->webview)); - } else + } else #endif { ev_view_next_page (EV_VIEW (ev_window->priv->view)); @@ -4888,12 +4888,12 @@ static void ev_window_cmd_go_forward (GtkAction *action, EvWindow *ev_window) { int n_pages, current_page; - + g_return_if_fail (EV_IS_WINDOW (ev_window)); n_pages = ev_document_get_n_pages (ev_window->priv->document); current_page = ev_document_model_get_page (ev_window->priv->model); - + if (current_page + 10 < n_pages) { ev_document_model_set_page (ev_window->priv->model, current_page + 10); } @@ -4903,11 +4903,11 @@ static void ev_window_cmd_go_backward (GtkAction *action, EvWindow *ev_window) { int current_page; - + g_return_if_fail (EV_IS_WINDOW (ev_window)); current_page = ev_document_model_get_page (ev_window->priv->model); - + if (current_page - 10 >= 0) { ev_document_model_set_page (ev_window->priv->model, current_page - 10); } @@ -5037,7 +5037,7 @@ ev_window_cmd_help_contents (GtkAction *action, EvWindow *ev_window) &error); if (error) { - ev_window_error_message (ev_window, error, + ev_window_error_message (ev_window, error, "%s", _("There was an error displaying help")); g_error_free (error); } @@ -5062,7 +5062,7 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window) if (window->priv->document && !window->priv->document->iswebdocument && window->priv->view) ev_view_autoscroll_stop (EV_VIEW (window->priv->view)); - + widget = gtk_window_get_focus (GTK_WINDOW (window)); if (widget && gtk_widget_get_ancestor (widget, EGG_TYPE_FIND_BAR)) { update_chrome_flag (window, EV_CHROME_FINDBAR, FALSE); @@ -5386,7 +5386,7 @@ static void ev_window_view_toolbar_cb (GtkAction *action, EvWindow *ev_window) { gboolean active; - + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); update_chrome_flag (ev_window, EV_CHROME_TOOLBAR, active); update_chrome_visibility (ev_window); @@ -5399,7 +5399,7 @@ ev_window_view_sidebar_cb (GtkAction *action, EvWindow *ev_window) { if (EV_WINDOW_IS_PRESENTATION (ev_window)) return; - + update_chrome_flag (ev_window, EV_CHROME_SIDEBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); update_chrome_visibility (ev_window); @@ -5448,13 +5448,13 @@ view_menu_link_popup (EvWindow *ev_window, GtkAction *action; if ( ev_window->priv->document->iswebdocument == TRUE ) return ; - + if (ev_window->priv->link) g_object_unref (ev_window->priv->link); - + if (link) ev_window->priv->link = g_object_ref (link); - else + else ev_window->priv->link = NULL; if (ev_window->priv->link) { @@ -5476,7 +5476,7 @@ view_menu_link_popup (EvWindow *ev_window, } } } - + action = gtk_action_group_get_action (ev_window->priv->view_popup_action_group, "OpenLink"); gtk_action_set_visible (action, show_external); @@ -5504,14 +5504,14 @@ view_menu_image_popup (EvWindow *ev_window, if (ev_window->priv->document->iswebdocument == TRUE ) return ; if (ev_window->priv->image) g_object_unref (ev_window->priv->image); - + if (image) ev_window->priv->image = g_object_ref (image); - else + else ev_window->priv->image = NULL; show_image = (ev_window->priv->image != NULL); - + action = gtk_action_group_get_action (ev_window->priv->view_popup_action_group, "SaveImageAs"); gtk_action_set_visible (action, show_image); @@ -5621,9 +5621,9 @@ attachment_bar_menu_popup_cb (EvSidebarAttachments *attachbar, (GFunc) g_object_unref, NULL); g_list_free (ev_window->priv->attach_list); } - + ev_window->priv->attach_list = attach_list; - + popup = ev_window->priv->attachment_popup; gtk_menu_popup_at_pointer (GTK_MENU (popup), @@ -5638,7 +5638,7 @@ ev_window_update_find_status_message (EvWindow *ev_window) if (!ev_window->priv->find_job) return; - + if (ev_job_is_finished (ev_window->priv->find_job)) { EvJobFind *job_find = EV_JOB_FIND (ev_window->priv->find_job); @@ -5664,7 +5664,7 @@ ev_window_update_find_status_message (EvWindow *ev_window) message = g_strdup_printf (_("%3d%% remaining to search"), (gint) ((1.0 - percent) * 100)); } - + egg_find_bar_set_status_text (EGG_FIND_BAR (ev_window->priv->find_bar), message); g_free (message); } @@ -5687,7 +5687,7 @@ ev_window_find_job_updated_cb (EvJobFind *job, ev_web_view_find_changed(EV_WEB_VIEW(ev_window->priv->webview), job->results,job->text, job->case_sensitive); } - else + else #endif { ev_view_find_changed (EV_VIEW (ev_window->priv->view), @@ -5722,7 +5722,7 @@ find_bar_previous_cb (EggFindBar *find_bar, #if ENABLE_EPUB if (ev_window->priv->document->iswebdocument == TRUE ) { ev_web_view_find_previous(EV_WEB_VIEW(ev_window->priv->webview)); - }else + }else #endif { ev_view_find_previous (EV_VIEW (ev_window->priv->view)); @@ -5736,7 +5736,7 @@ find_bar_next_cb (EggFindBar *find_bar, #if ENABLE_EPUB if (ev_window->priv->document->iswebdocument == TRUE ) { ev_web_view_find_next(EV_WEB_VIEW(ev_window->priv->webview)); - } else + } else #endif { ev_view_find_next (EV_VIEW (ev_window->priv->view)); @@ -5748,10 +5748,10 @@ find_bar_close_cb (EggFindBar *find_bar, EvWindow *ev_window) { #if ENABLE_EPUB - if (ev_window->priv->document->iswebdocument == TRUE ) { + if (ev_window->priv->document->iswebdocument == TRUE ) { ev_web_view_find_cancel(EV_WEB_VIEW(ev_window->priv->webview)); } - else + else #endif { ev_view_find_cancel (EV_VIEW (ev_window->priv->view)); @@ -5769,7 +5769,7 @@ ev_window_search_start (EvWindow *ev_window) if (!ev_window->priv->document || !EV_IS_DOCUMENT_FIND (ev_window->priv->document)) return; - + search_string = egg_find_bar_get_search_string (find_bar); ev_window_clear_find_job (ev_window); @@ -5780,7 +5780,7 @@ ev_window_search_start (EvWindow *ev_window) ev_document_get_n_pages (ev_window->priv->document), search_string, egg_find_bar_get_case_sensitive (find_bar)); - + g_signal_connect (ev_window->priv->find_job, "finished", G_CALLBACK (ev_window_find_job_finished_cb), ev_window); @@ -5865,8 +5865,8 @@ zoom_control_changed_cb (EphyZoomAction *action, new_height = (gint)(doc_height * scale); /* - * If the sidebar, menu bar, or tool bars are open, - * we must account for their sizes in calculating + * If the sidebar, menu bar, or tool bars are open, + * we must account for their sizes in calculating * the new expanded window size. */ @@ -6101,7 +6101,7 @@ ev_window_dispose (GObject *object) g_object_unref (priv->monitor); priv->monitor = NULL; } - + if (priv->title) { ev_window_title_free (priv->title); priv->title = NULL; @@ -6169,9 +6169,9 @@ ev_window_dispose (GObject *object) g_object_unref (priv->document); priv->document = NULL; } - + if (priv->view) { - g_object_unref (priv->view); + g_object_unref (priv->view); priv->view = NULL; } @@ -6199,7 +6199,7 @@ ev_window_dispose (GObject *object) if (priv->find_job) { ev_window_clear_find_job (window); } - + if (priv->local_uri) { ev_window_clear_local_uri (window); priv->local_uri = NULL; @@ -6210,7 +6210,7 @@ ev_window_dispose (GObject *object) g_object_unref (priv->progress_cancellable); priv->progress_cancellable = NULL; } - + ev_window_close_dialogs (window); if (priv->link) { @@ -6253,7 +6253,7 @@ ev_window_dispose (GObject *object) g_free (priv->search_string); priv->search_string = NULL; } - + if (priv->dest) { g_object_unref (priv->dest); priv->dest = NULL; @@ -6314,7 +6314,7 @@ ev_window_key_press_event (GtkWidget *widget, /* Handle focus widget key events */ if (gtk_window_propagate_key_event (window, event)) return TRUE; - + /* Handle mnemonics and accelerators */ if (gtk_window_activate_key (window, event)) return TRUE; @@ -6608,7 +6608,7 @@ navigation_action_activate_link_cb (EvNavigationAction *action, EvLink *link, Ev gtk_widget_grab_focus (window->priv->webview); return; } -#endif +#endif ev_view_handle_link (EV_VIEW (window->priv->view), link); gtk_widget_grab_focus (window->priv->view); } @@ -6823,10 +6823,10 @@ sidebar_page_main_widget_update_cb (GObject *ev_sidebar_page, EvWindow *ev_window) { GtkWidget *widget; - + g_object_get (ev_sidebar_page, "main_widget", &widget, NULL); - if (widget != NULL) { + if (widget != NULL) { g_signal_connect_object (widget, "focus_in_event", G_CALLBACK (view_actions_focus_in_cb), ev_window, 0); @@ -6900,7 +6900,7 @@ launch_action (EvWindow *window, EvLinkAction *action) dir = g_path_get_dirname (window->priv->uri); base_file = g_file_new_for_uri (dir); g_free (dir); - + file = g_file_resolve_relative_path (base_file, filename); g_object_unref (base_file); } @@ -6928,7 +6928,7 @@ launch_action (EvWindow *window, EvLinkAction *action) _("Unable to launch external application.")); g_error_free (error); } - + g_object_unref (app_info); g_object_unref (file); /* FIXMEchpe: unref launch context? */ @@ -6996,7 +6996,7 @@ open_remote_link (EvWindow *window, EvLinkAction *action) gchar *dir; dir = g_path_get_dirname (window->priv->uri); - + uri = g_build_filename (dir, ev_link_action_get_filename (action), NULL); g_free (dir); @@ -7005,7 +7005,7 @@ open_remote_link (EvWindow *window, EvLinkAction *action) gtk_window_get_screen (GTK_WINDOW (window)), ev_link_action_get_dest (action), 0, - NULL, + NULL, gtk_get_current_event_time ()); g_free (uri); @@ -7046,7 +7046,7 @@ view_external_link_cb (EvWindow *window, EvLinkAction *action) switch (ev_link_action_get_action_type (action)) { case EV_LINK_ACTION_TYPE_GOTO_DEST: { EvLinkDest *dest; - + dest = ev_link_action_get_dest (action); if (!dest) return; @@ -7147,7 +7147,7 @@ image_save_dialog_response_cb (GtkWidget *fc, gchar *file_format; GdkPixbufFormat *format; GtkFileFilter *filter; - + if (response_id != GTK_RESPONSE_OK) { gtk_widget_destroy (fc); return; @@ -7159,7 +7159,7 @@ image_save_dialog_response_cb (GtkWidget *fc, uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (fc)); filter = gtk_file_chooser_get_filter (GTK_FILE_CHOOSER (fc)); format = g_object_get_data (G_OBJECT (filter), "pixbuf-format"); - + if (format == NULL) { format = get_gdk_pixbuf_format_by_extension (uri); } @@ -7174,7 +7174,7 @@ image_save_dialog_response_cb (GtkWidget *fc, } if (format == NULL) { - ev_window_error_message (ev_window, NULL, + ev_window_error_message (ev_window, NULL, "%s", _("Couldn't find appropriate format to save image")); g_free (uri); @@ -7204,10 +7204,10 @@ image_save_dialog_response_cb (GtkWidget *fc, gdk_pixbuf_save (pixbuf, filename, file_format, &error, NULL); g_free (file_format); g_object_unref (pixbuf); - + has_error: if (error) { - ev_window_error_message (ev_window, error, + ev_window_error_message (ev_window, error, "%s", _("The image could not be saved.")); g_error_free (error); g_free (filename); @@ -7219,14 +7219,14 @@ image_save_dialog_response_cb (GtkWidget *fc, if (!is_native) { GFile *source_file; - + source_file = g_file_new_for_path (filename); - + ev_window_save_remote (ev_window, EV_SAVE_IMAGE, source_file, target_file); g_object_unref (source_file); } - + g_free (filename); g_object_unref (target_file); gtk_widget_destroy (fc); @@ -7252,12 +7252,12 @@ ev_view_popup_cmd_save_image_as (GtkAction *action, EvWindow *window) gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); - + file_chooser_dialog_add_writable_pixbuf_formats (GTK_FILE_CHOOSER (fc)); ev_window_file_chooser_restore_folder (window, GTK_FILE_CHOOSER (fc), NULL, G_USER_DIRECTORY_PICTURES); - + g_signal_connect (fc, "response", G_CALLBACK (image_save_dialog_response_cb), window); @@ -7273,14 +7273,14 @@ ev_view_popup_cmd_copy_image (GtkAction *action, EvWindow *window) if (!window->priv->image) return; - + clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD); ev_document_doc_mutex_lock (); pixbuf = ev_document_images_get_image (EV_DOCUMENT_IMAGES (window->priv->document), window->priv->image); ev_document_doc_mutex_unlock (); - + gtk_clipboard_set_image (clipboard, pixbuf); g_object_unref (pixbuf); } @@ -7290,7 +7290,7 @@ ev_view_popup_cmd_annot_properties (GtkAction *action, EvWindow *window) { if (window->priv->document->iswebdocument == TRUE ) return; - + const gchar *author; GdkRGBA rgba; gdouble opacity; @@ -7362,7 +7362,7 @@ ev_attachment_popup_cmd_open_attachment (GtkAction *action, EvWindow *window) { GList *l; GdkScreen *screen; - + if (!window->priv->attach_list) return; @@ -7371,13 +7371,13 @@ ev_attachment_popup_cmd_open_attachment (GtkAction *action, EvWindow *window) for (l = window->priv->attach_list; l && l->data; l = g_list_next (l)) { EvAttachment *attachment; GError *error = NULL; - + attachment = (EvAttachment *) l->data; - + ev_attachment_open (attachment, screen, gtk_get_current_event_time (), &error); if (error) { - ev_window_error_message (window, error, + ev_window_error_message (window, error, "%s", _("Unable to open attachment")); g_error_free (error); } @@ -7395,7 +7395,7 @@ attachment_save_dialog_response_cb (GtkWidget *fc, GtkFileChooserAction fc_action; gboolean is_dir; gboolean is_native; - + if (response_id != GTK_RESPONSE_OK) { gtk_widget_destroy (fc); return; @@ -7409,12 +7409,12 @@ attachment_save_dialog_response_cb (GtkWidget *fc, g_object_get (G_OBJECT (fc), "action", &fc_action, NULL); is_dir = (fc_action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); is_native = g_file_is_native (target_file); - + for (l = ev_window->priv->attach_list; l && l->data; l = g_list_next (l)) { EvAttachment *attachment; GFile *save_to = NULL; GError *error = NULL; - + attachment = (EvAttachment *) l->data; if (is_native) { @@ -7431,9 +7431,9 @@ attachment_save_dialog_response_cb (GtkWidget *fc, if (save_to) ev_attachment_save (attachment, save_to, &error); - + if (error) { - ev_window_error_message (ev_window, error, + ev_window_error_message (ev_window, error, "%s", _("The attachment could not be saved.")); g_error_free (error); g_object_unref (save_to); @@ -7477,7 +7477,7 @@ ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, EvWindow *window) if (g_list_length (window->priv->attach_list) == 1) attachment = (EvAttachment *) window->priv->attach_list->data; - + fc = gtk_file_chooser_dialog_new ( _("Save Attachment"), GTK_WINDOW (window), @@ -7511,9 +7511,9 @@ ev_window_media_player_key_pressed (EvWindow *window, const gchar *key, gpointer user_data) { - if (!gtk_window_is_active (GTK_WINDOW (window))) + if (!gtk_window_is_active (GTK_WINDOW (window))) return; - + /* Note how Previous/Next only go to the * next/previous page despite their icon telling you * they should go to the beginning/end. @@ -7872,12 +7872,12 @@ ev_window_init (EvWindow *ev_window) "notify::position", G_CALLBACK (ev_window_sidebar_position_change_cb), ev_window); - + gtk_paned_set_position (GTK_PANED (ev_window->priv->hpaned), SIDEBAR_DEFAULT_SIZE); gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), ev_window->priv->hpaned, TRUE, TRUE, 0); gtk_widget_show (ev_window->priv->hpaned); - + ev_window->priv->sidebar = ev_sidebar_new (); ev_sidebar_set_model (EV_SIDEBAR (ev_window->priv->sidebar), ev_window->priv->model); @@ -8051,7 +8051,7 @@ ev_window_init (EvWindow *ev_window) /* We own a ref on these widgets, as we can swap them in and out */ g_object_ref (ev_window->priv->view); g_object_ref (ev_window->priv->password_view); - + gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window), ev_window->priv->view); diff --git a/shell/main.c b/shell/main.c index 6e21f9f2..582ffe2f 100644 --- a/shell/main.c +++ b/shell/main.c @@ -90,7 +90,7 @@ launch_previewer (void) * the first path given */ cmd_str = g_string_new ("atril-previewer"); - + if (print_settings) { gchar *quoted; @@ -104,14 +104,14 @@ launch_previewer (void) if (file_arguments) { gchar *quoted; - + quoted = g_shell_quote (file_arguments[0]); g_string_append_printf (cmd_str, " %s", quoted); g_free (quoted); } cmd = g_string_free (cmd_str, FALSE); - + if (!error) { GAppInfo *app; @@ -255,9 +255,9 @@ main (int argc, char *argv[]) if (preview_mode) { gboolean retval; - + retval = launch_previewer (); - + return retval ? 0 : 1; } diff --git a/thumbnailer/atril-thumbnailer.c b/thumbnailer/atril-thumbnailer.c index a6875386..708e4800 100644 --- a/thumbnailer/atril-thumbnailer.c +++ b/thumbnailer/atril-thumbnailer.c @@ -164,7 +164,7 @@ atril_thumbnail_pngenc_get (EvDocument *document, const char *thumbnail, int siz EvPage *page; page = ev_document_get_page (document, 0); - + ev_document_get_page_size (document, 0, &width, &height); rc = ev_render_context_new (page, 0, size / width); @@ -172,7 +172,7 @@ atril_thumbnail_pngenc_get (EvDocument *document, const char *thumbnail, int siz rc, FALSE); g_object_unref (rc); g_object_unref (page); - + if (pixbuf != NULL) { if (gdk_pixbuf_save (pixbuf, thumbnail, "png", NULL, NULL)) { g_object_unref (pixbuf); @@ -181,7 +181,7 @@ atril_thumbnail_pngenc_get (EvDocument *document, const char *thumbnail, int siz g_object_unref (pixbuf); } - + return FALSE; } @@ -193,9 +193,9 @@ atril_thumbnail_pngenc_get_async (struct AsyncData *data) data->output, data->size); ev_document_doc_mutex_unlock (); - + g_idle_add ((GSourceFunc)gtk_main_quit, NULL); - + return NULL; } @@ -239,7 +239,7 @@ main (int argc, char *argv[]) return -1; } - + g_option_context_free (context); if (size < 1) { @@ -275,7 +275,7 @@ main (int argc, char *argv[]) struct AsyncData data; gtk_init (&argc, &argv); - + data.document = document; data.output = output; data.size = size; @@ -283,7 +283,7 @@ main (int argc, char *argv[]) g_thread_new ("EvThumbnailerAsyncRenderer", (GThreadFunc) atril_thumbnail_pngenc_get_async, &data); - + gtk_main (); g_object_unref (document); |