2 * Copyright (C) 2006 John Ellis
3 * Copyright (C) 2008 - 2016 The Geeqie Team
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.
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.
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.
27 #include "pan-types.h"
29 #include "pan-view-filter.h"
32 void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height)
41 list = pan_list_tree(dir_fd, SORT_NAME, TRUE, TRUE, pw->ignore_symlinks);
42 pan_filter_fd_list(&list, pw->filter_ui->filter_elements, pw->filter_ui->filter_classes);
44 grid_size = static_cast<gint>(sqrt(static_cast<gdouble>(g_list_length(list))));
45 if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE)
47 grid_size = grid_size * (512 + PAN_THUMB_GAP) * pw->image_size / 100;
51 grid_size = grid_size * (PAN_THUMB_SIZE + PAN_THUMB_GAP);
56 *width = PAN_BOX_BORDER * 2;
57 *height = PAN_BOX_BORDER * 2;
67 fd = static_cast<FileData *>(work->data);
70 if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE)
72 pi = pan_item_image_new(pw, fd, x, y, 10, 10);
74 x += pi->width + PAN_THUMB_GAP;
75 if (y + pi->height + PAN_THUMB_GAP > next_y) next_y = y + pi->height + PAN_THUMB_GAP;
84 pi = pan_item_thumb_new(pw, fd, x, y);
86 x += PAN_THUMB_SIZE + PAN_THUMB_GAP;
90 y += PAN_THUMB_SIZE + PAN_THUMB_GAP;
93 pan_item_size_coordinates(pi, PAN_THUMB_GAP, width, height);
98 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */