Mercurial > geeqie
annotate src/pan-grid.c @ 1260:51dec1b35246
Add -Wformat and -Wformat-security gcc options when --enable-debug-flags is set, move default optimization to -O2 by default (-O0 is only useful for specific debugging purposes).
author | zas_ |
---|---|
date | Mon, 26 Jan 2009 08:36:23 +0000 |
parents | 1646720364cf |
children | 8b89e3ff286b |
rev | line source |
---|---|
105 | 1 /* |
196 | 2 * Geeqie |
105 | 3 * (C) 2006 John Ellis |
475 | 4 * Copyright (C) 2008 The Geeqie Team |
105 | 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 | |
281 | 14 #include "main.h" |
105 | 15 #include "pan-types.h" |
16 | |
17 #include <math.h> | |
18 | |
19 | |
783 | 20 void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height) |
105 | 21 { |
22 GList *list; | |
23 GList *work; | |
24 gint x, y; | |
25 gint grid_size; | |
26 gint next_y; | |
27 | |
783 | 28 list = pan_list_tree(dir_fd, SORT_NAME, TRUE, pw->ignore_symlinks); |
105 | 29 |
1000
4fe8f9656107
For the sake of consistency, use glib basic types everywhere.
zas_
parents:
783
diff
changeset
|
30 grid_size = (gint)sqrt((gdouble)g_list_length(list)); |
105 | 31 if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE) |
32 { | |
33 grid_size = grid_size * (512 + PAN_THUMB_GAP) * pw->image_size / 100; | |
34 } | |
35 else | |
36 { | |
37 grid_size = grid_size * (PAN_THUMB_SIZE + PAN_THUMB_GAP); | |
38 } | |
39 | |
40 next_y = 0; | |
41 | |
42 *width = PAN_BOX_BORDER * 2; | |
43 *height = PAN_BOX_BORDER * 2; | |
44 | |
45 x = PAN_THUMB_GAP; | |
46 y = PAN_THUMB_GAP; | |
47 work = list; | |
48 while (work) | |
49 { | |
50 FileData *fd; | |
51 PanItem *pi; | |
52 | |
53 fd = work->data; | |
54 work = work->next; | |
55 | |
56 if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE) | |
57 { | |
58 pi = pan_item_image_new(pw, fd, x, y, 10, 10); | |
59 | |
60 x += pi->width + PAN_THUMB_GAP; | |
61 if (y + pi->height + PAN_THUMB_GAP > next_y) next_y = y + pi->height + PAN_THUMB_GAP; | |
62 if (x > grid_size) | |
63 { | |
64 x = PAN_THUMB_GAP; | |
65 y = next_y; | |
66 } | |
67 } | |
68 else | |
69 { | |
70 pi = pan_item_thumb_new(pw, fd, x, y); | |
71 | |
72 x += PAN_THUMB_SIZE + PAN_THUMB_GAP; | |
73 if (x > grid_size) | |
74 { | |
75 x = PAN_THUMB_GAP; | |
76 y += PAN_THUMB_SIZE + PAN_THUMB_GAP; | |
77 } | |
78 } | |
79 pan_item_size_coordinates(pi, PAN_THUMB_GAP, width, height); | |
80 } | |
81 | |
82 g_list_free(list); | |
83 } | |
1055
1646720364cf
Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents:
1000
diff
changeset
|
84 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |