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:
authorTon Roosendaal <ton@blender.org>2010-12-17 22:05:34 +0300
committerTon Roosendaal <ton@blender.org>2010-12-17 22:05:34 +0300
commita0ce28d7312adc31194e2ba34974dc5de754fced (patch)
treefc801b5d536e8d37207d04c068b7e1e456f470df /source/blender/windowmanager/intern/wm_window.c
parentfd90685a48f6fae30e6731bc4a805930e776f117 (diff)
Drag & drop feature:
You now can drop a .blend inside blender window to open it. Implementation notes: - Added call to extract icon type for files. Code re-used from space_file - External files that get dropped set icon types too. Drop box polls can check for this. - Also enabled setting op-context for drop operators, this was needed to prevent filewindow to open.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r--source/blender/windowmanager/intern/wm_window.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index c962ee8c118..723286b09ce 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -60,6 +60,7 @@
#include "wm_event_system.h"
#include "ED_screen.h"
+#include "ED_fileselect.h"
#include "PIL_time.h"
@@ -413,6 +414,11 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm)
keymap= WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
WM_event_add_keymap_handler(&win->modalhandlers, keymap);
+ /* add drop boxes */
+ {
+ ListBase *lb= WM_dropboxmap_find("Window", 0, 0);
+ WM_event_add_dropbox_handler(&win->handlers, lb);
+ }
wm_window_title(wm, win);
}
}
@@ -820,15 +826,17 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
/* printf("Drop detected\n"); */
/* add drag data to wm for paths: */
- /* need icon type, some dropboxes check for that... see filesel code for this */
if(ddd->dataType == GHOST_kDragnDropTypeFilenames) {
GHOST_TStringArray *stra= ddd->data;
- int a;
+ int a, icon;
for(a=0; a<stra->count; a++) {
printf("drop file %s\n", stra->strings[a]);
- WM_event_start_drag(C, 0, WM_DRAG_PATH, stra->strings[a], 0.0);
+ /* try to get icon type from extension */
+ icon= ED_file_extension_icon((char *)stra->strings[a]);
+
+ WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0);
/* void poin should point to string, it makes a copy */
break; // only one drop element supported now
}