diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-09-08 20:15:42 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-09-08 20:15:42 +0400 |
commit | d9ffc99e66d659ac887d801b9cc071b4c3f9b8ab (patch) | |
tree | d88e83b5a9edab115081641d26c811b6aa22296a /source/blender/editors/space_file/filesel.c | |
parent | 551ebaa3dd758bc1975548c28766bfa3159d3846 (diff) | |
parent | b1490e39dd1017e51984d8a34d226e869bbb25df (diff) |
Merge branch 'master' into soc-2014-viewport_fxsoc-2014-viewport_fx
I have resolved some differences, for instance selection code which was more or less a stub, to be
the same as master. This will have to be fixed later.
Conflicts:
CMakeLists.txt
intern/ghost/CMakeLists.txt
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_Window.cpp
intern/ghost/intern/GHOST_WindowWin32.cpp
intern/ghost/intern/GHOST_WindowX11.cpp
source/blender/blenlib/BLI_math_matrix.h
source/blender/blenlib/intern/math_matrix.c
source/blender/gpu/CMakeLists.txt
source/blender/gpu/GPU_select.h
source/blender/gpu/intern/gpu_buffers.c
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/gpu/intern/gpu_select.c
source/blender/gpu/shaders/gpu_shader_simple_vert.glsl
source/blender/nodes/CMakeLists.txt
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 81ab276ccc0..afe3f29e9bc 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -281,14 +281,28 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar) { int numfiles; + /* Values in pixels. + * + * - *_item: size of each (row|col), (including padding) + * - *_view: (x|y) size of the view. + * - *_over: extra pixels, to take into account, when the fit isnt exact + * (needed since you may see the end of the previous column and the beginning of the next). + * + * Could be more clever and take scrolling into account, + * but for now don't bother. + */ if (layout->flag & FILE_LAYOUT_HOR) { - int width = (int)(BLI_rctf_size_x(&ar->v2d.cur) - 2 * layout->tile_border_x); - numfiles = (int)((float)width / (float)layout->tile_w + 0.5f); + const int x_item = layout->tile_w + (2 * layout->tile_border_x); + const int x_view = (int)(BLI_rctf_size_x(&ar->v2d.cur)); + const int x_over = x_item - (x_view % x_item); + numfiles = (int)((float)(x_view + x_over) / (float)(x_item)); return numfiles * layout->rows; } else { - int height = (int)(BLI_rctf_size_y(&ar->v2d.cur) - 2 * layout->tile_border_y); - numfiles = (int)((float)height / (float)layout->tile_h + 0.5f); + const int y_item = layout->tile_h + (2 * layout->tile_border_y); + const int y_view = (int)(BLI_rctf_size_y(&ar->v2d.cur)); + const int y_over = y_item - (y_view % y_item); + numfiles = (int)((float)(y_view + y_over) / (float)(y_item)); return numfiles * layout->columns; } } |