Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Weikert <elubie@gmx.net>2009-01-18 21:24:11 +0300
committerAndrea Weikert <elubie@gmx.net>2009-01-18 21:24:11 +0300
commit2c5bf52214cd9a1c17f84de31fd1a4deee327afc (patch)
tree0a5cc47d92aa59b37f664f5a5b8aa9626a6fb8eb /source/blender/editors/space_file/file_ops.c
parent332517957de480414048d86e0b01499932214020 (diff)
2.5 filebrowser
* slightly improved drawing code * temporarily added creation of thumbnails within thread in the background until thread job manager is available in WM. * fixed missing icons in thumbnail view
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 49014a69b68..2754947b9a5 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -73,9 +73,9 @@ static void set_active_file_thumbs(SpaceFile *sfile, FileSelectParams* params, s
View2D* v2d = &ar->v2d;
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
- offsetx = (x - (v2d->cur.xmin+sfile->tile_border_x))/(sfile->tile_w + sfile->tile_border_x);
- offsety = (-y+sfile->tile_border_y)/(sfile->tile_h + sfile->tile_border_y);
- columns = (v2d->cur.xmax - v2d->cur.xmin) / (sfile->tile_w+ sfile->tile_border_x);
+ offsetx = (x - (v2d->cur.xmin+sfile->tile_border_x))/(sfile->tile_w + 2*sfile->tile_border_x);
+ offsety = (v2d->tot.ymax - sfile->tile_border_y - y)/(sfile->tile_h + 2*sfile->tile_border_y);
+ columns = (v2d->cur.xmax - v2d->cur.xmin) / (sfile->tile_w+ 2*sfile->tile_border_x);
active_file = offsetx + columns*offsety;
if (active_file >= 0 && active_file < numfiles )
@@ -251,4 +251,34 @@ void ED_FILE_OT_select_bookmark(wmOperatorType *ot)
/* api callbacks */
ot->invoke= bookmark_select_invoke;
ot->poll= ED_operator_file_active;
+}
+
+
+static int loadimages_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ ScrArea *sa= CTX_wm_area(C);
+ ARegion *ar= CTX_wm_region(C);
+ SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
+ if (sfile->files) {
+ filelist_loadimage_timer(sfile->files);
+ if (filelist_changed(sfile->files)) {
+ ED_area_tag_redraw(sa);
+ }
+ }
+
+
+ return OPERATOR_FINISHED;
+}
+
+void ED_FILE_OT_loadimages(wmOperatorType *ot)
+{
+
+ /* identifiers */
+ ot->name= "Load Images";
+ ot->idname= "ED_FILE_OT_loadimages";
+
+ /* api callbacks */
+ ot->invoke= loadimages_invoke;
+
+ ot->poll= ED_operator_file_active;
} \ No newline at end of file