5d95800914fac4dc31ab905c943590c845c18d93
[geeqie.git] / src / dupe.h
1 /*
2  * Geeqie
3  * (C) 2004 John Ellis
4  *
5  * Author: John Ellis
6  *
7  * This software is released under the GNU General Public License (GNU GPL).
8  * Please read the included file COPYING for more information.
9  * This software comes with no warranty of any kind, use at your own risk!
10  */
11
12
13 #ifndef DUPE_H
14 #define DUPE_H
15
16 #include "similar.h"
17
18 /* match methods */
19 typedef enum
20 {
21         DUPE_MATCH_NONE = 0,
22         DUPE_MATCH_NAME = 1 << 0,
23         DUPE_MATCH_SIZE = 1 << 1,
24         DUPE_MATCH_DATE = 1 << 2,
25         DUPE_MATCH_DIM  = 1 << 3,       /* image dimensions */
26         DUPE_MATCH_SUM  = 1 << 4,       /* simple checksum */
27         DUPE_MATCH_PATH = 1 << 5,
28         DUPE_MATCH_SIM_HIGH = 1 << 6,   /* similarity */
29         DUPE_MATCH_SIM_MED  = 1 << 7,
30         DUPE_MATCH_SIM_LOW  = 1 << 8,
31         DUPE_MATCH_SIM_CUSTOM = 1 << 9,
32         DUPE_MATCH_NAME_CI = 1 << 10    /* same as name, but case insensitive */
33 } DupeMatchType;
34
35 typedef struct _DupeItem DupeItem;
36 struct _DupeItem
37 {
38         CollectionData *collection;     /* NULL if from DupeWindow->files */
39         CollectInfo *info;
40
41         FileData *fd;
42
43         long checksum;
44         gchar *md5sum;
45         gint width;
46         gint height;
47
48         ImageSimilarityData *simd;
49
50         /* thumb */
51         GdkPixbuf *pixbuf;
52
53         GList *group;                   /* List of match data */
54         gdouble group_rank;
55
56         gint second;
57 };
58
59 typedef struct _DupeMatch DupeMatch;
60 struct _DupeMatch
61 {
62         DupeItem *di;
63         gdouble rank;
64 };
65
66 typedef struct _DupeWindow DupeWindow;
67 struct _DupeWindow
68 {
69         GList *list;                    /* dropped files (DupeItem) */
70         GList *dupes;                   /* list of dupes (DupeItem, grouping the DupeMatches) */
71         DupeMatchType match_mask;       /* mask of things to check for match */
72
73         GtkWidget *window;
74         GtkWidget *table;
75         GtkWidget *listview;
76         GtkWidget *combo;
77         GtkWidget *status_label;
78         GtkWidget *extra_label;
79         GtkWidget *button_thumbs;
80
81         gint show_thumbs;
82
83         gint idle_id;
84         GList *working;
85         gint setup_done;
86         gint setup_count;
87         gint setup_n;                   /* these are merely for speed optimization */
88         GList *setup_point;             /* ditto */
89         DupeMatchType setup_mask;       /* ditto */
90         guint64 setup_time;
91         guint64 setup_time_count;
92
93         DupeItem *click_item;           /* for popup menu */
94
95         ThumbLoader *thumb_loader;
96         DupeItem *thumb_item;
97
98         ImageLoader *img_loader;
99
100         /* second set comparison stuff */
101
102         gint second_set;                /* second set enabled ? */
103         GList *second_list;             /* second set dropped files */
104         gint second_drop;               /* drop is on second set */
105
106         GtkWidget *second_vbox;         /* box of second widgets */
107         GtkWidget *second_listview;
108         GtkWidget *second_status_label;
109
110         gint color_frozen;
111 };
112
113
114 DupeWindow *dupe_window_new(DupeMatchType match_mask);
115
116 void dupe_window_clear(DupeWindow *dw);
117 void dupe_window_close(DupeWindow *dw);
118
119 void dupe_window_add_collection(DupeWindow *dw, CollectionData *collection);
120 void dupe_window_add_files(DupeWindow *dw, GList *list, gint recurse);
121
122 void dupe_maint_removed(FileData *fd);
123 void dupe_maint_renamed(FileData *fd);
124
125
126 /* cell max with/height hack utility */
127 void cell_renderer_height_override(GtkCellRenderer *renderer);
128
129
130 #endif