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:
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h5
-rw-r--r--source/blender/windowmanager/WM_types.h5
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c5
-rw-r--r--source/blender/windowmanager/intern/wm_window.c51
4 files changed, 65 insertions, 1 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 99e6e26d6a9..5a059b72e27 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -206,5 +206,10 @@ void WM_jobs_start(struct wmJob *);
void WM_jobs_stop(struct wmWindowManager *wm, void *owner);
void WM_jobs_stop_all(struct wmWindowManager *wm);
+ /* clipboard */
+char *WM_clipboard_text_get(int selection);
+void WM_clipboard_text_set(char *buf, int selection);
+
+
#endif /* WM_API_H */
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 9dc2d5cf0b2..d3cb60d90fe 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -156,6 +156,7 @@ typedef struct wmNotifier {
#define NC_GROUP (9<<24)
#define NC_IMAGE (10<<24)
#define NC_BRUSH (11<<24)
+#define NC_TEXT (12<<24)
/* data type, 256 entries is enough, it can overlap */
#define NOTE_DATA 0x00FF0000
@@ -205,6 +206,10 @@ typedef struct wmNotifier {
#define ND_LIGHTING_DRAW (45<<16)
#define ND_SKY (46<<16)
+ /* NC_TEXT Text */
+#define ND_CURSOR (50<<16)
+#define ND_DISPLAY (51<<16)
+
/* subtype, 256 entries too */
#define NOTE_SUBTYPE 0x0000FF00
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 5247cb8abc1..8c06be7a37e 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -151,12 +151,15 @@ void wm_event_do_notifiers(bContext *C)
}
if(note->window==win) {
if(note->category==NC_SCREEN) {
- if(note->data==ND_SCREENBROWSE)
+ if(note->data==ND_SCREENBROWSE) {
ED_screen_set(C, note->reference); // XXX hrms, think this over!
+ printf("screen set %p\n", note->reference);
+ }
}
else if(note->category==NC_SCENE) {
if(note->data==ND_SCENEBROWSE) {
ED_screen_set_scene(C, note->reference); // XXX hrms, think this over!
+ printf("scene set %p\n", note->reference);
}
else if(note->data==ND_FRAME)
do_anim= 1;
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 43871ba5a7f..a57fff58948 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -661,6 +661,57 @@ void WM_event_remove_window_timer(wmWindow *win, wmTimer *timer)
}
}
+/* ******************* clipboard **************** */
+
+char *WM_clipboard_text_get(int selection)
+{
+ char *p, *p2, *buf, *newbuf;
+
+ buf= (char*)GHOST_getClipboard(selection);
+ if(!buf)
+ return NULL;
+
+ /* always convert from \r\n to \n */
+ newbuf= MEM_callocN(strlen(buf)+1, "WM_clipboard_text_get");
+
+ for(p= buf, p2= newbuf; *p; p++) {
+ if(*p != '\r')
+ *(p2++)= *p;
+ }
+ *p2= '\0';
+
+ free(buf); /* ghost uses regular malloc */
+
+ return newbuf;
+}
+
+void WM_clipboard_text_set(char *buf, int selection)
+{
+ /* do conversion from \n to \r\n on Windows */
+ char *p, *p2, *newbuf;
+ int newlen= 0;
+
+ for(p= buf; *p; p++) {
+ if(*p == '\n')
+ newlen += 2;
+ else
+ newlen++;
+ }
+
+ newbuf= MEM_callocN(newlen+1, "WM_clipboard_text_set");
+
+ for(p= buf, p2= newbuf; *p; p++, p2++) {
+ if(*p == '\n') {
+ *(p2++)= '\r'; *p2= '\n';
+ }
+ else *p2= *p;
+ }
+ *p2= '\0';
+
+ GHOST_putClipboard((GHOST_TInt8*)newbuf, selection);
+ MEM_freeN(newbuf);
+}
+
/* ************************************ */
void wm_window_get_position(wmWindow *win, int *posx_r, int *posy_r)