Fix #314: Remote commands for thumbnail maintenance
[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 enum
45 {
46         DUPE_SELECT_NONE,
47         DUPE_SELECT_GROUP1,
48         DUPE_SELECT_GROUP2
49 } DupeSelectType;
50
51 typedef struct _DupeItem DupeItem;
52 struct _DupeItem
53 {
54         CollectionData *collection;     /* NULL if from DupeWindow->files */
55         CollectInfo *info;
56
57         FileData *fd;
58
59         gchar *md5sum;
60         gint width;
61         gint height;
62
63         ImageSimilarityData *simd;
64
65         /* thumb */
66         GdkPixbuf *pixbuf;
67
68         GList *group;                   /* List of match data */
69         gdouble group_rank;
70
71         gint second;
72 };
73
74 typedef struct _DupeMatch DupeMatch;
75 struct _DupeMatch
76 {
77         DupeItem *di;
78         gdouble rank;
79 };
80
81 typedef struct _DupeWindow DupeWindow;
82 struct _DupeWindow
83 {
84         GList *list;                    /* dropped files (DupeItem) */
85         GList *dupes;                   /* list of dupes (DupeItem, grouping the DupeMatches) */
86         DupeMatchType match_mask;       /* mask of things to check for match */
87
88         GtkWidget *window;
89         GtkWidget *table;
90         GtkWidget *listview;
91         GtkWidget *combo;
92         GtkWidget *status_label;
93         GtkWidget *extra_label;
94         GtkWidget *button_thumbs;
95         GtkWidget *button_rotation_invariant;
96         GtkWidget *custom_threshold;
97
98         gboolean show_thumbs;
99
100         guint idle_id; /* event source id */
101         GList *working;
102         gint setup_done;
103         gint setup_count;
104         gint setup_n;                   /* these are merely for speed optimization */
105         GList *setup_point;             /* ditto */
106         DupeMatchType setup_mask;       /* ditto */
107         guint64 setup_time;
108         guint64 setup_time_count;
109
110         DupeItem *click_item;           /* for popup menu */
111
112         ThumbLoader *thumb_loader;
113         DupeItem *thumb_item;
114
115         ImageLoader *img_loader;
116
117         /* second set comparison stuff */
118
119         gboolean second_set;            /* second set enabled ? */
120         GList *second_list;             /* second set dropped files */
121         gboolean second_drop;           /* drop is on second set */
122
123         GtkWidget *second_vbox;         /* box of second widgets */
124         GtkWidget *second_listview;
125         GtkWidget *second_status_label;
126
127         gboolean color_frozen;
128 };
129
130
131 DupeWindow *dupe_window_new(void);
132
133 void dupe_window_clear(DupeWindow *dw);
134 void dupe_window_close(DupeWindow *dw);
135
136 void dupe_window_add_collection(DupeWindow *dw, CollectionData *collection);
137 void dupe_window_add_files(DupeWindow *dw, GList *list, gboolean recurse);
138
139 /* cell max with/height hack utility */
140 void cell_renderer_height_override(GtkCellRenderer *renderer);
141
142
143 #endif
144 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */