1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software Foundation,
14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 */
16
17 /** \file
18 * \ingroup spfile
19 */
20
21 #include "BLI_listbase.h"
22 #include "BLI_rect.h"
23
24 #include "BLO_readfile.h"
25
26 #include "BKE_context.h"
27
28 #include "ED_fileselect.h"
29 #include "ED_screen.h"
30
31 #include "WM_types.h"
32
33 #include "file_intern.h"
34
file_tile_boundbox(const ARegion * region,FileLayout * layout,const int file,rcti * r_bounds)35 void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds)
36 {
37 int xmin, ymax;
38
39 ED_fileselect_layout_tilepos(layout, file, &xmin, &ymax);
40 ymax = (int)region->v2d.tot.ymax - ymax; /* real, view space ymax */
41 BLI_rcti_init(r_bounds,
42 xmin,
43 xmin + layout->tile_w + layout->tile_border_x,
44 ymax - layout->tile_h - layout->tile_border_y,
45 ymax);
46 }
47