Sync to GQview 1.5.9 release.
[geeqie.git] / src / dupe.h
1 /*
2  * GQview
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 } DupeMatchType;
33
34 typedef struct _DupeItem DupeItem;
35 struct _DupeItem
36 {
37         CollectionData *collection;     /* NULL if from DupeWindow->files */
38         CollectInfo *info;
39
40         gchar *path;
41         const gchar *name;              /* we store the pointer into path for the name,
42                                          * so that we only need to calculate this once,
43                                          * which significantly speeds up comparing names */
44         gint64 size;
45         time_t date;
46
47         long checksum;
48         gchar *md5sum;
49         gint width;
50         gint height;
51
52         ImageSimilarityData *simd;
53
54         /* thumb */
55         GdkPixbuf *pixbuf;
56
57         GList *group;                   /* List of match data */
58         gdouble group_rank;
59
60         gint second;
61 };
62
63 typedef struct _DupeMatch DupeMatch;
64 struct _DupeMatch
65 {
66         DupeItem *di;
67         gdouble rank;
68 };
69
70 typedef struct _DupeWindow DupeWindow;
71 struct _DupeWindow
72 {
73         GList *list;                    /* dropped files (DupeItem) */
74         GList *dupes;                   /* list of dupes (DupeItem, grouping the DupeMatches) */
75         DupeMatchType match_mask;       /* mask of things to check for match */
76
77         GtkWidget *window;
78         GtkWidget *table;
79         GtkWidget *listview;
80         GtkWidget *combo;
81         GtkWidget *status_label;
82         GtkWidget *extra_label;
83         GtkWidget *button_thumbs;
84
85         gint show_thumbs;
86
87         gint idle_id;
88         GList *working;
89         gint setup_done;
90         gint setup_count;
91         gint setup_n;                   /* these are merely for speed optimization */
92         GList *setup_point;             /* ditto */
93         DupeMatchType setup_mask;       /* ditto */
94         guint64 setup_time;
95         guint64 setup_time_count;
96
97         DupeItem *click_item;           /* for popup menu */
98
99         ThumbLoader *thumb_loader;
100         DupeItem *thumb_item;
101
102         ImageLoader *img_loader;
103
104         /* second set comparison stuff */
105
106         gint second_set;                /* second set enabled ? */
107         GList *second_list;             /* second set dropped files */
108         gint second_drop;               /* drop is on second set */
109
110         GtkWidget *second_vbox;         /* box of second widgets */
111         GtkWidget *second_listview;
112         GtkWidget *second_status_label;
113
114         gint color_frozen;
115 };
116
117
118 DupeWindow *dupe_window_new(DupeMatchType match_mask);
119
120 void dupe_window_clear(DupeWindow *dw);
121 void dupe_window_close(DupeWindow *dw);
122
123 void dupe_window_add_collection(DupeWindow *dw, CollectionData *collection);
124 void dupe_window_add_files(DupeWindow *dw, GList *list, gint recurse);
125
126 void dupe_maint_removed(const gchar *path);
127 void dupe_maint_renamed(const gchar *source, const gchar *dest);
128
129
130 /* cell max with/height hack utility */
131 void cell_renderer_height_override(GtkCellRenderer *renderer);
132
133
134 #endif
135
136