Mercurial > hg > forks > geeqie
changeset 2414:f62b9c25d89f
Refactor pan-types.h into discrete header files for each pan-view code module
author | Omari Stephens <xsdg@google.com> |
---|---|
date | Fri, 23 Dec 2016 22:23:02 +0000 |
parents | 8e9d5cf1edcb |
children | be26469cf616 |
files | src/pan-calendar.c src/pan-calendar.h src/pan-folder.c src/pan-folder.h src/pan-grid.c src/pan-grid.h src/pan-item.c src/pan-item.h src/pan-timeline.c src/pan-timeline.h src/pan-types.h src/pan-util.c src/pan-util.h src/pan-view.c src/pan-view.h |
diffstat | 15 files changed, 313 insertions(+), 136 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pan-calendar.c Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-calendar.c Fri Dec 23 22:23:02 2016 +0000 @@ -19,12 +19,14 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "main.h" -#include "pan-types.h" +#include "pan-calendar.h" #include <glib/gprintf.h> #include <math.h> +#include "pan-util.h" +#include "pan-view.h" +#include "pixbuf_util.h" #define PAN_CAL_POPUP_COLOR 220, 220, 220 #define PAN_CAL_POPUP_ALPHA 255
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pan-calendar.h Fri Dec 23 22:23:02 2016 +0000 @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2006 John Ellis + * Copyright (C) 2008 - 2016 The Geeqie Team + * + * Author: John Ellis + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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. + */ + +#ifndef PAN_CALENDAR_H +#define PAN_CALENDAR_H + +//#include "main.h" +#include "pan-item.h" +#include "pan-types.h" + +void pan_calendar_update(PanWindow *pw, PanItem *pi_day); +void pan_calendar_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); + +#endif
--- a/src/pan-folder.c Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-folder.c Fri Dec 23 22:23:02 2016 +0000 @@ -19,11 +19,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "main.h" -#include "pan-types.h" +#include "pan-folder.h" #include <math.h> +#include "pan-item.h" +#include "pan-util.h" static void pan_flower_size(PanWindow *pw, gint *width, gint *height) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pan-folder.h Fri Dec 23 22:23:02 2016 +0000 @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2006 John Ellis + * Copyright (C) 2008 - 2016 The Geeqie Team + * + * Author: John Ellis + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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. + */ + +#ifndef PAN_FOLDER_H +#define PAN_FOLDER_H + +#include "main.h" +#include "pan-types.h" + +void pan_flower_compute(PanWindow *pw, FileData *dir_fd, + gint *width, gint *height, + gint *scroll_x, gint *scroll_y); +void pan_folder_tree_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); + +#endif
--- a/src/pan-grid.c Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-grid.c Fri Dec 23 22:23:02 2016 +0000 @@ -19,11 +19,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "main.h" -#include "pan-types.h" +#include "pan-grid.h" #include <math.h> +#include "pan-item.h" +#include "pan-util.h" void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pan-grid.h Fri Dec 23 22:23:02 2016 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2006 John Ellis + * Copyright (C) 2008 - 2016 The Geeqie Team + * + * Author: John Ellis + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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. + */ + +#ifndef PAN_GRID_H +#define PAN_GRID_H + +#include "main.h" +#include "pan-types.h" + +void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); + +#endif
--- a/src/pan-item.c Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-item.c Fri Dec 23 22:23:02 2016 +0000 @@ -19,9 +19,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "main.h" -#include "pan-types.h" +#include "pan-item.h" +#include "image.h" +#include "pixbuf_util.h" +#include "ui_misc.h" /* *-----------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pan-item.h Fri Dec 23 22:23:02 2016 +0000 @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2006 John Ellis + * Copyright (C) 2008 - 2016 The Geeqie Team + * + * Author: John Ellis + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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. + */ + +#ifndef PAN_ITEM_H +#define PAN_ITEM_H + +#include "main.h" +#include "pan-types.h" +#include "pixbuf-renderer.h" + +void pan_item_free(PanItem *pi); + +void pan_item_set_key(PanItem *pi, const gchar *key); +void pan_item_added(PanWindow *pw, PanItem *pi); +void pan_item_remove(PanWindow *pw, PanItem *pi); + +// Determine sizes +void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border); +void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h); + +// Find items +PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key); +GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path, + gboolean ignore_case, gboolean partial); +GList *pan_item_find_by_fd(PanWindow *pw, PanItemType type, FileData *fd, + gboolean ignore_case, gboolean partial); +PanItem *pan_item_find_by_coord(PanWindow *pw, PanItemType type, + gint x, gint y, const gchar *key); + +// Item box type +PanItem *pan_item_box_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height, + gint border_size, + guint8 base_r, guint8 base_g, guint8 base_b, guint8 base_a, + guint8 bord_r, guint8 bord_g, guint8 bord_b, guint8 bord_a); +void pan_item_box_shadow(PanItem *pi, gint offset, gint fade); +gint pan_item_box_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, + gint x, gint y, gint width, gint height); + +// Item triangle type +PanItem *pan_item_tri_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height, + gint x1, gint y1, gint x2, gint y2, gint x3, gint y3, + guint8 r, guint8 g, guint8 b, guint8 a); +void pan_item_tri_border(PanItem *pi, gint borders, + guint8 r, guint8 g, guint8 b, guint8 a); +gint pan_item_tri_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, + gint x, gint y, gint width, gint height); + +// Item text type +PanItem *pan_item_text_new(PanWindow *pw, gint x, gint y, const gchar *text, + PanTextAttrType attr, PanBorderType border, + guint8 r, guint8 g, guint8 b, guint8 a); +gint pan_item_text_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, + gint x, gint y, gint width, gint height); + +// Item thumbnail type +PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y); +gint pan_item_thumb_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, + gint x, gint y, gint width, gint height); + +// Item image type +PanItem *pan_item_image_new(PanWindow *pw, FileData *fd, gint x, gint y, gint w, gint h); +gint pan_item_image_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, + gint x, gint y, gint width, gint height); + +// Alignment +typedef struct _PanTextAlignment PanTextAlignment; +struct _PanTextAlignment { + PanWindow *pw; + + GList *column1; + GList *column2; + + gint x; + gint y; + gchar *key; +}; + +PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gchar *key); +void pan_text_alignment_free(PanTextAlignment *ta); + +PanItem *pan_text_alignment_add(PanTextAlignment *ta, const gchar *label, const gchar *text); +void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box); + +#endif
--- a/src/pan-timeline.c Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-timeline.c Fri Dec 23 22:23:02 2016 +0000 @@ -19,9 +19,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "main.h" -#include "pan-types.h" +#include "pan-timeline.h" +#include "pan-item.h" +#include "pan-util.h" +#include "pan-view.h" void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pan-timeline.h Fri Dec 23 22:23:02 2016 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2006 John Ellis + * Copyright (C) 2008 - 2016 The Geeqie Team + * + * Author: John Ellis + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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. + */ + +#ifndef PAN_TIMELINE_H +#define PAN_TIMELINE_H + +#include "main.h" +#include "pan-types.h" + +void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); + +#endif
--- a/src/pan-types.h Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-types.h Fri Dec 23 22:23:02 2016 +0000 @@ -22,15 +22,8 @@ #ifndef PAN_TYPES_H #define PAN_TYPES_H -#include "cache.h" #include "cache-loader.h" #include "filedata.h" -#include "image.h" -#include "image-load.h" -#include "pixbuf_util.h" -#include "pixbuf-renderer.h" -#include "ui_misc.h" - /* thumbnail sizes and spacing */ @@ -250,119 +243,5 @@ CacheData *cd; }; - -/* pan-view.c */ - -GList *pan_layout_intersect(PanWindow *pw, gint x, gint y, gint width, gint height); -void pan_layout_resize(PanWindow *pw); - -void pan_cache_sync_date(PanWindow *pw, GList *list); - -GList *pan_cache_sort(GList *list, SortType method, gboolean ascend); -/* pan-item.c */ - -void pan_item_free(PanItem *pi); - -void pan_item_set_key(PanItem *pi, const gchar *key); -void pan_item_added(PanWindow *pw, PanItem *pi); -void pan_item_remove(PanWindow *pw, PanItem *pi); - -void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border); -void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h); - - -PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key); -GList *pan_item_find_by_path(PanWindow *pw, PanItemType type, const gchar *path, - gboolean ignore_case, gboolean partial); -GList *pan_item_find_by_fd(PanWindow *pw, PanItemType type, FileData *fd, - gboolean ignore_case, gboolean partial); -PanItem *pan_item_find_by_coord(PanWindow *pw, PanItemType type, - gint x, gint y, const gchar *key); - - -PanItem *pan_item_box_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height, - gint border_size, - guint8 base_r, guint8 base_g, guint8 base_b, guint8 base_a, - guint8 bord_r, guint8 bord_g, guint8 bord_b, guint8 bord_a); -void pan_item_box_shadow(PanItem *pi, gint offset, gint fade); -gint pan_item_box_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, - gint x, gint y, gint width, gint height); - -PanItem *pan_item_tri_new(PanWindow *pw, FileData *fd, gint x, gint y, gint width, gint height, - gint x1, gint y1, gint x2, gint y2, gint x3, gint y3, - guint8 r, guint8 g, guint8 b, guint8 a); -void pan_item_tri_border(PanItem *pi, gint borders, - guint8 r, guint8 g, guint8 b, guint8 a); -gint pan_item_tri_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, - gint x, gint y, gint width, gint height); - -PanItem *pan_item_text_new(PanWindow *pw, gint x, gint y, const gchar *text, - PanTextAttrType attr, PanBorderType border, - guint8 r, guint8 g, guint8 b, guint8 a); -gint pan_item_text_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, - gint x, gint y, gint width, gint height); - -PanItem *pan_item_thumb_new(PanWindow *pw, FileData *fd, gint x, gint y); -gint pan_item_thumb_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, - gint x, gint y, gint width, gint height); - -PanItem *pan_item_image_new(PanWindow *pw, FileData *fd, gint x, gint y, gint w, gint h); -gint pan_item_image_draw(PanWindow *pw, PanItem *pi, GdkPixbuf *pixbuf, PixbufRenderer *pr, - gint x, gint y, gint width, gint height); - - -typedef struct _PanTextAlignment PanTextAlignment; -struct _PanTextAlignment { - PanWindow *pw; - - GList *column1; - GList *column2; - - gint x; - gint y; - gchar *key; -}; - -PanTextAlignment *pan_text_alignment_new(PanWindow *pw, gint x, gint y, const gchar *key); -void pan_text_alignment_free(PanTextAlignment *ta); - -PanItem *pan_text_alignment_add(PanTextAlignment *ta, const gchar *label, const gchar *text); -void pan_text_alignment_calc(PanTextAlignment *ta, PanItem *box); - - -/* utils in pan-util.c */ - -typedef enum { - PAN_DATE_LENGTH_EXACT, - PAN_DATE_LENGTH_HOUR, - PAN_DATE_LENGTH_DAY, - PAN_DATE_LENGTH_WEEK, - PAN_DATE_LENGTH_MONTH, - PAN_DATE_LENGTH_YEAR -} PanDateLengthType; - -gboolean pan_date_compare(time_t a, time_t b, PanDateLengthType length); -gint pan_date_value(time_t d, PanDateLengthType length); -gchar *pan_date_value_string(time_t d, PanDateLengthType length); -time_t pan_date_to_time(gint year, gint month, gint day); - -gboolean pan_is_link_loop(const gchar *s); -gboolean pan_is_ignored(const gchar *s, gboolean ignore_symlinks); -GList *pan_list_tree(FileData *dir_fd, SortType sort, gboolean ascend, - gboolean ignore_symlinks); - - -/* the different view types */ - -void pan_calendar_update(PanWindow *pw, PanItem *pi_day); -void pan_calendar_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); -void pan_flower_compute(PanWindow *pw, FileData *dir_fd, - gint *width, gint *height, - gint *scroll_x, gint *scroll_y); -void pan_folder_tree_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); -void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); -void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height); - - #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
--- a/src/pan-util.c Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-util.c Fri Dec 23 22:23:02 2016 +0000 @@ -19,8 +19,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "main.h" -#include "pan-types.h" +#include "pan-util.h" #include "ui_fileops.h"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pan-util.h Fri Dec 23 22:23:02 2016 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2006 John Ellis + * Copyright (C) 2008 - 2016 The Geeqie Team + * + * Author: John Ellis + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * 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. + */ + +#ifndef PAN_UTIL_H +#define PAN_UTIL_H + +#include "main.h" +#include "pan-types.h" + +typedef enum { + PAN_DATE_LENGTH_EXACT, + PAN_DATE_LENGTH_HOUR, + PAN_DATE_LENGTH_DAY, + PAN_DATE_LENGTH_WEEK, + PAN_DATE_LENGTH_MONTH, + PAN_DATE_LENGTH_YEAR +} PanDateLengthType; + +gboolean pan_date_compare(time_t a, time_t b, PanDateLengthType length); +gint pan_date_value(time_t d, PanDateLengthType length); +gchar *pan_date_value_string(time_t d, PanDateLengthType length); +time_t pan_date_to_time(gint year, gint month, gint day); + +gboolean pan_is_link_loop(const gchar *s); +gboolean pan_is_ignored(const gchar *s, gboolean ignore_symlinks); +GList *pan_list_tree(FileData *dir_fd, SortType sort, gboolean ascend, + gboolean ignore_symlinks); + +#endif
--- a/src/pan-view.c Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-view.c Fri Dec 23 22:23:02 2016 +0000 @@ -19,23 +19,31 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "main.h" #include "pan-view.h" #include "bar_exif.h" #include "dnd.h" #include "editors.h" #include "exif.h" -#include "metadata.h" #include "fullscreen.h" #include "history_list.h" +#include "image.h" #include "img-view.h" #include "menu.h" +#include "metadata.h" #include "misc.h" -#include "pan-types.h" +#include "pan-calendar.h" +#include "pan-folder.h" +#include "pan-grid.h" +#include "pan-item.h" +#include "pan-timeline.h" +#include "pan-util.h" +#include "pixbuf-renderer.h" +#include "pixbuf_util.h" #include "thumb.h" #include "ui_fileops.h" #include "ui_menu.h" +#include "ui_misc.h" #include "ui_tabcomp.h" #include "ui_utildlg.h" #include "uri_utils.h"
--- a/src/pan-view.h Fri Dec 23 21:36:24 2016 +0000 +++ b/src/pan-view.h Fri Dec 23 22:23:02 2016 +0000 @@ -22,9 +22,18 @@ #ifndef PAN_VIEW_H #define PAN_VIEW_H +#include "main.h" +#include "pan-types.h" void pan_window_new(FileData *dir_fd); +GList *pan_layout_intersect(PanWindow *pw, gint x, gint y, gint width, gint height); +void pan_layout_resize(PanWindow *pw); + +void pan_cache_sync_date(PanWindow *pw, GList *list); + +GList *pan_cache_sort(GList *list, SortType method, gboolean ascend); + #endif /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */