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>2008-01-01 21:29:19 +0300
committerTon Roosendaal <ton@blender.org>2008-01-01 21:29:19 +0300
commit372ee054c0deb4ca07e1a70c7b905d24043723be (patch)
tree115102f61c68e194331eac39e677d2c4b41c1837 /source/blender/windowmanager/intern/wm_cursors.c
parent58bf29e3898292ad9b46b7c0a591c856dde6eacb (diff)
Some notes for those who try to follow this :)
- first work on getting area/screen handling back - added structure for where to put stuff, is still under review, wait a bit for docs? Campbell is working on removing every bad level include from sources, so we can safely rebuild the src/ directory.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_cursors.c')
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c83
1 files changed, 66 insertions, 17 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 8c86070ca61..e4299b8949b 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -28,6 +28,7 @@
*/
#include <stdio.h>
+#include <string.h>
#include "GHOST_C-api.h"
@@ -100,32 +101,80 @@ void WM_set_cursor(bContext *C, int curs)
}
GHOST_SetCursorVisibility(win->ghostwin, 1);
-
+
+ LastCursor=CurrentCursor;
+ CurrentCursor=curs;
+
+ /* previous cursor? */
+ if (curs==LASTCURSOR) curs=LastCursor;
+
/* detect if we use system cursor or Blender cursor */
if(curs>=BC_GHOST_CURSORS) {
GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
- return;
}
-
- if ((curs<LASTCURSOR)||(curs>=BC_NUMCURSORS)) return;
-
-
- LastCursor=CurrentCursor;
- CurrentCursor=curs;
-
- if (curs==LASTCURSOR) curs=LastCursor;
-
- if (curs==SYSCURSOR) { /* System default Cursor */
- GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
+ else {
+ if ((curs<LASTCURSOR)||(curs>=BC_NUMCURSORS)) return;
+
+ if (curs==SYSCURSOR) { /* System default Cursor */
+ GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
+ }
+ else if ( (U.curssize==0) || (BlenderCursor[curs]->big_bm == NULL) ) {
+ window_set_custom_cursor_ex(win, BlenderCursor[curs], 0);
+ }
+ else {
+ window_set_custom_cursor_ex(win, BlenderCursor[curs], 1);
+ }
}
- else if ( (U.curssize==0) || (BlenderCursor[curs]->big_bm == NULL) ) {
- window_set_custom_cursor_ex(win, BlenderCursor[curs], 0);
+}
+
+void WM_waitcursor(bContext *C, int val)
+{
+ if(C->window) {
+ if(val) {
+ WM_set_cursor(C, CURSOR_WAIT);
+ } else {
+ WM_set_cursor(C, LASTCURSOR);
+ }
}
- else {
- window_set_custom_cursor_ex(win, BlenderCursor[curs], 1);
+}
+
+void WM_timecursor(bContext *C, int nr)
+{
+ /* 10 8x8 digits */
+ static char number_bitmaps[10][8]= {
+ {0, 56, 68, 68, 68, 68, 68, 56},
+ {0, 24, 16, 16, 16, 16, 16, 56},
+ {0, 60, 66, 32, 16, 8, 4, 126},
+ {0, 124, 32, 16, 56, 64, 66, 60},
+ {0, 32, 48, 40, 36, 126, 32, 32},
+ {0, 124, 4, 60, 64, 64, 68, 56},
+ {0, 56, 4, 4, 60, 68, 68, 56},
+ {0, 124, 64, 32, 16, 8, 8, 8},
+ {0, 60, 66, 66, 60, 66, 66, 60},
+ {0, 56, 68, 68, 120, 64, 68, 56}
+ };
+ unsigned char mask[16][2];
+ unsigned char bitmap[16][2];
+ int i, idx;
+
+ memset(&bitmap, 0x00, sizeof(bitmap));
+ memset(&mask, 0xFF, sizeof(mask));
+
+ /* print number bottom right justified */
+ for (idx= 3; nr && idx>=0; idx--) {
+ char *digit= number_bitmaps[nr%10];
+ int x = idx%2;
+ int y = idx/2;
+
+ for (i=0; i<8; i++)
+ bitmap[i + y*8][x]= digit[i];
+ nr/= 10;
}
+
+ window_set_custom_cursor(C->window, mask, bitmap, 7, 7);
}
+
/* ******************************************************************
Custom Cursor Description: