diff --git a/source/blender/include/BIF_cursors.h b/source/blender/include/BIF_cursors.h index b3a285d5b86..fe3ff6e2506 100644 --- a/source/blender/include/BIF_cursors.h +++ b/source/blender/include/BIF_cursors.h @@ -77,6 +77,11 @@ enum { BC_VLOOPCURSOR, BC_TEXTEDITCURSOR, BC_PAINTBRUSHCURSOR, + BC_HANDCURSOR, + BC_NSEW_SCROLLCURSOR, + BC_NS_SCROLLCURSOR, + BC_EW_SCROLLCURSOR, + BC_EYEDROPPER_CURSOR, /* --- ALWAYS LAST ----- */ BC_NUMCURSORS, }; diff --git a/source/blender/src/cursors.c b/source/blender/src/cursors.c index 4d8897cbfcd..ea10d2e9b3e 100644 --- a/source/blender/src/cursors.c +++ b/source/blender/src/cursors.c @@ -71,7 +71,14 @@ in mask with 0's. Setting big_bm=NULL disables the large version of the cursor. -******************************************************************* */ +******************************************************************* + +There is a nice Python GUI utility that can be used for drawing cursors in +this format in the Blender source distribution, in +blender/source/tools/MakeCursor.py . Start it with $ python MakeCursor.py +It will copy its output to the console when you press 'Do it'. + +*/ /* Because defining a cursor mixes declarations and executable code each cursor needs it's own scoping block or it would be split up @@ -574,7 +581,7 @@ static char vloop_lmsk[]={ END_CURSOR_BLOCK - /********************** EditCross Cursor ***********************/ + /********************** TextEdit Cursor ***********************/ BEGIN_CURSOR_BLOCK static char textedit_sbm[]={ 0xe0, 0x03, 0x10, 0x04, 0x60, 0x03, 0x40, 0x01, @@ -607,7 +614,7 @@ BEGIN_CURSOR_BLOCK END_CURSOR_BLOCK - /********************** EditCross Cursor ***********************/ + /********************** Paintbrush Cursor ***********************/ BEGIN_CURSOR_BLOCK static char paintbrush_sbm[]={ @@ -645,8 +652,188 @@ BEGIN_CURSOR_BLOCK BlenderCursor[BC_PAINTBRUSHCURSOR]=&PaintBrushCursor; END_CURSOR_BLOCK - /********************** Put the cursors in the array ***********************/ + +/********************** Hand Cursor ***********************/ +BEGIN_CURSOR_BLOCK + +static char hand_sbm[]={ + 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x80, 0x0d, + 0x98, 0x6d, 0x98, 0x6d, 0xb0, 0x6d, 0xb0, 0x6d, + 0xe0, 0x6f, 0xe6, 0x7f, 0xee, 0x7f, 0xfc, 0x3f, + 0xf8, 0x3f, 0xf0, 0x1f, 0xc0, 0x1f, 0xc0, 0x1f, +}; + +static char hand_smsk[]={ + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x0f, 0xd8, 0x7f, + 0xfc, 0xff, 0xfc, 0xff, 0xf8, 0xff, 0xf8, 0xff, + 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, + 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x3f, 0xe0, 0x3f, +}; + + +static BCursor HandCursor = { + /*small*/ + hand_sbm, hand_smsk, + 16, 16, + 8, 8, + /*big*/ + NULL, NULL, + 32,32, + 15, 15, + /*color*/ + BC_BLACK, BC_WHITE +}; + +BlenderCursor[BC_HANDCURSOR]=&HandCursor; + +END_CURSOR_BLOCK + +/********************** NSEW Scroll Cursor ***********************/ +BEGIN_CURSOR_BLOCK + +static char nsewscroll_sbm[]={ + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0e, 0x70, + 0x0e, 0x70, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0x03, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00, +}; + +static char nsewscroll_smsk[]={ + 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, + 0xc0, 0x03, 0x0c, 0x30, 0x1e, 0x78, 0x1f, 0xf8, + 0x1f, 0xf8, 0x1e, 0x78, 0x0c, 0x30, 0xc0, 0x03, + 0xe0, 0x07, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, +}; + + +static BCursor NSEWScrollCursor = { + /*small*/ + nsewscroll_sbm, nsewscroll_smsk, + 16, 16, + 8, 8, + /*big*/ + NULL, NULL, + 32,32, + 15, 15, + /*color*/ + BC_BLACK, BC_WHITE +}; + +BlenderCursor[BC_NSEW_SCROLLCURSOR]=&NSEWScrollCursor; + +END_CURSOR_BLOCK + + +/********************** NS Scroll Cursor ***********************/ +BEGIN_CURSOR_BLOCK + +static char nsscroll_sbm[]={ + 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0x03, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00, +}; + +static char nsscroll_smsk[]={ + 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, + 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, + 0xe0, 0x07, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, +}; + + +static BCursor NSScrollCursor = { + /*small*/ + nsscroll_sbm, nsscroll_smsk, + 16, 16, + 8, 8, + /*big*/ + NULL, NULL, + 32,32, + 15, 15, + /*color*/ + BC_BLACK, BC_WHITE +}; + +BlenderCursor[BC_NS_SCROLLCURSOR]=&NSScrollCursor; + +END_CURSOR_BLOCK + + +/********************** EW Scroll Cursor ***********************/ +BEGIN_CURSOR_BLOCK + +static char ewscroll_sbm[]={ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0c, 0x30, 0x0e, 0x70, + 0x0e, 0x70, 0x0c, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +static char ewscroll_smsk[]={ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x30, 0x1e, 0x78, 0x1f, 0xf8, + 0x1f, 0xf8, 0x1e, 0x78, 0x0c, 0x30, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + + +static BCursor EWScrollCursor = { + /*small*/ + ewscroll_sbm, ewscroll_smsk, + 16, 16, + 8, 8, + /*big*/ + NULL, NULL, + 32,32, + 15, 15, + /*color*/ + BC_BLACK, BC_WHITE +}; + +BlenderCursor[BC_EW_SCROLLCURSOR]=&EWScrollCursor; + +END_CURSOR_BLOCK + +/********************** Eyedropper Cursor ***********************/ +BEGIN_CURSOR_BLOCK + +static char eyedropper_sbm[]={ + 0x00, 0x30, 0x00, 0x48, 0x00, 0x85, 0x80, 0x82, + 0x40, 0x40, 0x80, 0x20, 0x40, 0x11, 0xa0, 0x23, + 0xd0, 0x15, 0xe8, 0x0a, 0x74, 0x01, 0xb4, 0x00, + 0x4a, 0x00, 0x35, 0x00, 0x08, 0x00, 0x04, 0x00, +}; + +static char eyedropper_smsk[]={ + 0x00, 0x30, 0x00, 0x78, 0x00, 0xfd, 0x80, 0xff, + 0xc0, 0x7f, 0x80, 0x3f, 0xc0, 0x1f, 0xe0, 0x3f, + 0xf0, 0x1f, 0xf8, 0x0b, 0xfc, 0x01, 0xfc, 0x00, + 0x7e, 0x00, 0x3f, 0x00, 0x0c, 0x00, 0x04, 0x00, +}; + + +static BCursor EyedropperCursor = { + /*small*/ + eyedropper_sbm, eyedropper_smsk, + 16, 16, + 1, 15, + /*big*/ + NULL, NULL, + 32,32, + 15, 15, + /*color*/ + BC_BLACK, BC_WHITE +}; + +BlenderCursor[BC_EYEDROPPER_CURSOR]=&EyedropperCursor; + +END_CURSOR_BLOCK + +/********************** Put the cursors in the array ***********************/ + + } diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 3982de571c2..10f0a5271cb 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -79,7 +79,9 @@ #include "BDR_drawmesh.h" #include "BDR_imagepaint.h" +#include "BIF_cursors.h" #include "BIF_gl.h" +#include "BIF_graphics.h" #include "BIF_mywindow.h" #include "BIF_drawimage.h" #include "BIF_resources.h" @@ -104,6 +106,7 @@ #include "mydevice.h" #include "blendef.h" #include "butspace.h" // event codes +#include "winlay.h" #include "interface.h" /* bad.... but preview code needs UI info. Will solve... (ton) */ @@ -1695,10 +1698,17 @@ static void image_zoom_set_factor(float zoomfac) void image_viewmove(int mode) { short mval[2], mvalo[2], zoom0; + int oldcursor; + Window *win; getmouseco_sc(mvalo); zoom0= G.sima->zoom; + oldcursor=get_cursor(); + win=winlay_get_active_window(); + + SetBlenderCursor(BC_NSEW_SCROLLCURSOR); + while(get_mbut()&(L_MOUSE|M_MOUSE)) { getmouseco_sc(mval); @@ -1724,6 +1734,7 @@ void image_viewmove(int mode) } else BIF_wait_for_statechange(); } + window_set_cursor(win, oldcursor); if(image_preview_active(curarea, NULL, NULL)) { /* recalculates new preview rect */ diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index 54fcda9181c..ead44dcf8ba 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -68,7 +68,9 @@ #include "BKE_key.h" #include "BKE_utildefines.h" +#include "BIF_cursors.h" #include "BIF_gl.h" +#include "BIF_graphics.h" #include "BIF_resources.h" #include "BIF_screen.h" #include "BIF_interface.h" @@ -89,6 +91,7 @@ #include "mydevice.h" #include "blendef.h" #include "butspace.h" // shouldnt be... +#include "winlay.h" /* local define... also used in editipo ... */ #define ISPOIN(a, b, c) ( (a->b) && (a->c) ) @@ -689,7 +692,7 @@ void test_view2d(View2D *v2d, int winx, int winy) } } -#define IPOBUTX 65 +#define IPOBUTX 70 static int calc_ipobuttonswidth(ScrArea *sa) { SpaceIpo *sipo= sa->spacedata.first; @@ -2357,6 +2360,8 @@ int view2dmove(unsigned short event) float facx=0.0, facy=0.0, dx, dy, left=1.0, right=1.0; short mval[2], mvalo[2], leftret=1, mousebut; short is_wheel= (event==WHEELUPMOUSE) || (event==WHEELDOWNMOUSE); + int oldcursor, cursor; + Window *win; /* when wheel is used, we only draw it once */ @@ -2431,16 +2436,31 @@ int view2dmove(unsigned short event) facx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(float)(curarea->winx); facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(curarea->winy); } - + + cursor = BC_NSEW_SCROLLCURSOR; + /* no x move in outliner */ - if(curarea->spacetype==SPACE_OOPS && G.v2d->scroll) facx= 0.0; + if(curarea->spacetype==SPACE_OOPS && G.v2d->scroll) { + facx= 0.0; + cursor = BC_NS_SCROLLCURSOR; + } /* no y move in audio & time */ - if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) facy= 0.0; + if ELEM(curarea->spacetype, SPACE_SOUND, SPACE_TIME) { + facy= 0.0; + cursor = BC_EW_SCROLLCURSOR; + } + + /* store the old cursor to temporarily change it */ + oldcursor=get_cursor(); + win=winlay_get_active_window(); + if(get_mbut() & mousebut && leftret) return 0; if(facx==0.0 && facy==0.0) return 1; + if (!is_wheel) SetBlenderCursor(cursor); + while( (get_mbut()&(L_MOUSE|M_MOUSE)) || is_wheel) { /* If the mousewheel is used with shift key @@ -2449,6 +2469,7 @@ int view2dmove(unsigned short event) * and right. */ if (is_wheel) { + if(event==WHEELDOWNMOUSE) { facx= -facx; facy= -facy; } @@ -2478,6 +2499,8 @@ int view2dmove(unsigned short event) } } else { + + getmouseco_areawin(mval); dx= facx*(mvalo[0]-mval[0]); dy= facy*(mvalo[1]-mval[1]); @@ -2509,6 +2532,7 @@ int view2dmove(unsigned short event) if ( is_wheel ) return 1; } + window_set_cursor(win, oldcursor); return 1; } diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c index 373af6c3b01..22f31bc7e4f 100644 --- a/source/blender/src/drawseq.c +++ b/source/blender/src/drawseq.c @@ -56,8 +56,10 @@ #include "BKE_plugin_types.h" #include "BKE_scene.h" #include "BKE_utildefines.h" - + +#include "BIF_cursors.h" #include "BIF_gl.h" +#include "BIF_graphics.h" #include "BIF_mywindow.h" #include "BIF_screen.h" #include "BIF_drawseq.h" @@ -80,6 +82,7 @@ #include "blendef.h" /* CFRA */ #include "mydevice.h" /* REDRAWSEQ */ #include "interface.h" +#include "winlay.h" #define SEQ_LEFTHANDLE 1 #define SEQ_RIGHTHANDLE 2 @@ -918,6 +921,8 @@ void seq_viewmove(SpaceSeq *sseq) ScrArea *sa; short mval[2], mvalo[2]; short rectx, recty, xmin, xmax, ymin, ymax, pad; + int oldcursor; + Window *win; sa = sseq->area; rectx= (G.scene->r.size*G.scene->r.xsch)/100; @@ -931,6 +936,11 @@ void seq_viewmove(SpaceSeq *sseq) getmouseco_sc(mvalo); + oldcursor=get_cursor(); + win=winlay_get_active_window(); + + SetBlenderCursor(BC_NSEW_SCROLLCURSOR); + while(get_mbut()&(L_MOUSE|M_MOUSE)) { getmouseco_sc(mval); @@ -952,6 +962,7 @@ void seq_viewmove(SpaceSeq *sseq) } else BIF_wait_for_statechange(); } + window_set_cursor(win, oldcursor); } #define SEQ_BUT_PLUGIN 1 diff --git a/source/blender/src/interface.c b/source/blender/src/interface.c index 169f349e6ed..ce333f89835 100644 --- a/source/blender/src/interface.c +++ b/source/blender/src/interface.c @@ -3090,7 +3090,7 @@ static void do_palette_sample_cb(void *bt1, void *col1) /* frontbuf */ while (get_mbut() & L_MOUSE) BIF_wait_for_statechange(); - SetBlenderCursor(BC_CROSSCURSOR); + SetBlenderCursor(BC_EYEDROPPER_CURSOR); /* loop and wait for a mouse click */ capturing = TRUE;