Update copyright in all files
[geeqie.git] / src / dupe.h
1 /*
2  * Copyright (C) 2004 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef DUPE_H
23 #define DUPE_H
24
25 #include "similar.h"
26
27 /* match methods */
28 typedef enum
29 {
30         DUPE_MATCH_NONE = 0,
31         DUPE_MATCH_NAME = 1 << 0,
32         DUPE_MATCH_SIZE = 1 << 1,
33         DUPE_MATCH_DATE = 1 << 2,
34         DUPE_MATCH_DIM  = 1 << 3,       /* image dimensions */
35         DUPE_MATCH_SUM  = 1 << 4,       /* MD5sum */
36         DUPE_MATCH_PATH = 1 << 5,
37         DUPE_MATCH_SIM_HIGH = 1 << 6,   /* similarity */
38         DUPE_MATCH_SIM_MED  = 1 << 7,
39         DUPE_MATCH_SIM_LOW  = 1 << 8,
40         DUPE_MATCH_SIM_CUSTOM = 1 << 9,
41         DUPE_MATCH_NAME_CI = 1 << 10    /* same as name, but case insensitive */
42 } DupeMatchType;
43
44 typedef struct _DupeItem DupeItem;
45 struct _DupeItem
46 {
47         CollectionData *collection;     /* NULL if from DupeWindow->files */
48         CollectInfo *info;
49
50         FileData *fd;
51
52         gchar *md5sum;
53         gint width;
54         gint height;
55
56         ImageSimilarityData *simd;
57
58         /* thumb */
59         GdkPixbuf *pixbuf;
60
61         GList *group;                   /* List of match data */
62         gdouble group_rank;
63
64         gint second;
65 };
66
67 typedef struct _DupeMatch DupeMatch;
68 struct _DupeMatch
69 {
70         DupeItem *di;
71         gdouble rank;
72 };
73
74 typedef struct _DupeWindow DupeWindow;
75 struct _DupeWindow
76 {
77         GList *list;                    /* dropped files (DupeItem) */
78         GList *dupes;                   /* list of dupes (DupeItem, grouping the DupeMatches) */
79         DupeMatchType match_mask;       /* mask of things to check for match */
80
81         GtkWidget *window;
82         GtkWidget *table;
83         GtkWidget *listview;
84         GtkWidget *combo;
85         GtkWidget *status_label;
86         GtkWidget *extra_label;
87         GtkWidget *button_thumbs;
88
89         gboolean show_thumbs;
90
91         guint idle_id; /* event source id */
92         GList *working;
93         gint setup_done;
94         gint setup_count;
95         gint setup_n;                   /* these are merely for speed optimization */
96         GList *setup_point;             /* ditto */
97         DupeMatchType setup_mask;       /* ditto */
98         guint64 setup_time;
99         guint64 setup_time_count;
100
101         DupeItem *click_item;           /* for popup menu */
102
103         ThumbLoader *thumb_loader;
104         DupeItem *thumb_item;
105
106         ImageLoader *img_loader;
107
108         /* second set comparison stuff */
109
110         gboolean second_set;            /* second set enabled ? */
111         GList *second_list;             /* second set dropped files */
112         gboolean second_drop;           /* drop is on second set */
113
114         GtkWidget *second_vbox;         /* box of second widgets */
115         GtkWidget *second_listview;
116         GtkWidget *second_status_label;
117
118         gboolean color_frozen;
119 };
120
121
122 DupeWindow *dupe_window_new(DupeMatchType match_mask);
123
124 void dupe_window_clear(DupeWindow *dw);
125 void dupe_window_close(DupeWindow *dw);
126
127 void dupe_window_add_collection(DupeWindow *dw, CollectionData *collection);
128 void dupe_window_add_files(DupeWindow *dw, GList *list, gboolean recurse);
129
130 /* cell max with/height hack utility */
131 void cell_renderer_height_override(GtkCellRenderer *renderer);
132
133
134 #endif
135 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */