f75efaac611c0d9e5d6b03f7ed11fff8c6e7436c
[geeqie.git] / src / dupe.h
1 /*
2  * Geeqie
3  * (C) 2004 John Ellis
4  * Copyright (C) 2008 - 2012 The Geeqie Team
5  *
6  * Author: John Ellis
7  *
8  * This software is released under the GNU General Public License (GNU GPL).
9  * Please read the included file COPYING for more information.
10  * This software comes with no warranty of any kind, use at your own risk!
11  */
12
13
14 #ifndef DUPE_H
15 #define DUPE_H
16
17 #include "similar.h"
18
19 /* match methods */
20 typedef enum
21 {
22         DUPE_MATCH_NONE = 0,
23         DUPE_MATCH_NAME = 1 << 0,
24         DUPE_MATCH_SIZE = 1 << 1,
25         DUPE_MATCH_DATE = 1 << 2,
26         DUPE_MATCH_DIM  = 1 << 3,       /* image dimensions */
27         DUPE_MATCH_SUM  = 1 << 4,       /* MD5sum */
28         DUPE_MATCH_PATH = 1 << 5,
29         DUPE_MATCH_SIM_HIGH = 1 << 6,   /* similarity */
30         DUPE_MATCH_SIM_MED  = 1 << 7,
31         DUPE_MATCH_SIM_LOW  = 1 << 8,
32         DUPE_MATCH_SIM_CUSTOM = 1 << 9,
33         DUPE_MATCH_NAME_CI = 1 << 10    /* same as name, but case insensitive */
34 } DupeMatchType;
35
36 typedef struct _DupeItem DupeItem;
37 struct _DupeItem
38 {
39         CollectionData *collection;     /* NULL if from DupeWindow->files */
40         CollectInfo *info;
41
42         FileData *fd;
43
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         gboolean show_thumbs;
82
83         guint idle_id; /* event source 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         gboolean second_set;            /* second set enabled ? */
103         GList *second_list;             /* second set dropped files */
104         gboolean 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         gboolean 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, gboolean recurse);
121
122 /* cell max with/height hack utility */
123 void cell_renderer_height_override(GtkCellRenderer *renderer);
124
125
126 #endif
127 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */