Commit of cursor framework. Cursors now defined in source/blender/src/cursors.c and
source/blender/include/BIF_cursors.h. Allows large cursors on Win32 and X11. See cursors.c for documentatioin on how to use.
This commit is contained in:
1
Makefile
1
Makefile
@@ -58,3 +58,4 @@ release:
|
||||
@echo "====> $(MAKE) $@ in $(SOURCEDIR)/$@" ;\
|
||||
$(MAKE) -C $@ $@ || exit 1;
|
||||
|
||||
|
||||
|
||||
@@ -300,6 +300,23 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle
|
||||
GHOST_TUns8 mask[16][2],
|
||||
int hotX,
|
||||
int hotY);
|
||||
/**
|
||||
* Set the shape of the cursor to a custom cursor of specified size.
|
||||
* @param windowhandle The handle to the window
|
||||
* @param bitmap The bitmap data for the cursor.
|
||||
* @param mask The mask data for the cursor.
|
||||
* @parm sizex, sizey The size of the cursor
|
||||
* @param hotX The X coordinate of the cursor hotspot.
|
||||
* @param hotY The Y coordinate of the cursor hotspot.
|
||||
* @param fg_color, bg_color Colors of the cursor
|
||||
* @return Indication of success.
|
||||
*/
|
||||
extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
|
||||
GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask,
|
||||
int sizex, int sizey,
|
||||
int hotX, int hotY,
|
||||
int fg_color, int bg_color );
|
||||
|
||||
/**
|
||||
* Returns the visibility state of the cursor.
|
||||
|
||||
@@ -230,6 +230,12 @@ public:
|
||||
GHOST_TUns8 mask[16][2],
|
||||
int hotX,
|
||||
int hotY) = 0;
|
||||
|
||||
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask,
|
||||
int sizex, int sizey,
|
||||
int hotX, int hotY,
|
||||
int fg_color, int bg_color) = 0;
|
||||
|
||||
/**
|
||||
* Returns the visibility state of the cursor.
|
||||
|
||||
@@ -289,6 +289,24 @@ GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
|
||||
return window->setCustomCursorShape(bitmap, mask, hotX, hotY);
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
|
||||
GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask,
|
||||
int sizex,
|
||||
int sizey,
|
||||
int hotX,
|
||||
int hotY,
|
||||
int fg_color,
|
||||
int bg_color)
|
||||
{
|
||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
||||
|
||||
return window->setCustomCursorShape(bitmap, mask, sizex, sizey,
|
||||
hotX, hotY, fg_color, bg_color);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
|
||||
{
|
||||
GHOST_IWindow* window = (GHOST_IWindow*) windowhandle;
|
||||
|
||||
@@ -107,9 +107,18 @@ GHOST_TSuccess GHOST_Window::setCursorShape(GHOST_TStandardCursor cursorShape)
|
||||
}
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY)
|
||||
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2],
|
||||
int hotX, int hotY)
|
||||
{
|
||||
if (setWindowCustomCursorShape(bitmap, mask, hotX, hotY)) {
|
||||
return setCustomCursorShape( (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask,
|
||||
16, 16, hotX, hotY, 0, 1 );
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
int sizex, int sizey, int hotX, int hotY,
|
||||
int fg_color, int bg_color )
|
||||
{
|
||||
if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey,hotX, hotY, fg_color, bg_color)) {
|
||||
m_cursorShape = GHOST_kStandardCursorCustom;
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
@@ -149,6 +149,12 @@ public:
|
||||
GHOST_TUns8 mask[16][2],
|
||||
int hotX,
|
||||
int hotY);
|
||||
|
||||
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask,
|
||||
int sizex, int sizey,
|
||||
int hotX, int hotY,
|
||||
int fg_color, int bg_color);
|
||||
|
||||
/**
|
||||
* Returns the visibility state of the cursor.
|
||||
@@ -226,8 +232,11 @@ protected:
|
||||
* Sets the cursor shape on the window using
|
||||
* native window system calls.
|
||||
*/
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY) = 0;
|
||||
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2],
|
||||
int hotX, int hotY) = 0;
|
||||
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
int szx, int szy, int hotX, int hotY, int fg, int bg) = 0;
|
||||
/** The the of drawing context installed in this window. */
|
||||
GHOST_TDrawingContextType m_drawingContextType;
|
||||
|
||||
|
||||
@@ -602,6 +602,15 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCursorShape(GHOST_TStandardCursor sh
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
/** Reverse the bits in a GHOST_TUns8 */
|
||||
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
|
||||
{
|
||||
ch= ((ch>>1)&0x55) | ((ch<<1)&0xAA);
|
||||
ch= ((ch>>2)&0x33) | ((ch<<2)&0xCC);
|
||||
ch= ((ch>>4)&0x0F) | ((ch<<4)&0xF0);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/** Reverse the bits in a GHOST_TUns16 */
|
||||
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
||||
{
|
||||
@@ -612,7 +621,8 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
||||
return shrt;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY)
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color)
|
||||
{
|
||||
int y;
|
||||
|
||||
@@ -625,8 +635,8 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap
|
||||
if (!m_customCursor) return GHOST_kFailure;
|
||||
|
||||
for (y=0; y<16; y++) {
|
||||
m_customCursor->data[y] = uns16ReverseBits((bitmap[y][0]<<0) | (bitmap[y][1]<<8));
|
||||
m_customCursor->mask[y] = uns16ReverseBits((mask[y][0]<<0) | (mask[y][1]<<8));
|
||||
m_customCursor->data[y] = uns16ReverseBits((bitmap[2*y]<<0) | (bitmap[2*y+1]<<8));
|
||||
m_customCursor->mask[y] = uns16ReverseBits((mask[2*y]<<0) | (mask[2*y+1]<<8));
|
||||
}
|
||||
|
||||
m_customCursor->hotSpot.h = hotX;
|
||||
@@ -638,3 +648,9 @@ GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_WindowCarbon::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
|
||||
GHOST_TUns8 mask[16][2], int hotX, int hotY)
|
||||
{
|
||||
setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*) mask, 16, 16, hotX, hotY, 0, 1);
|
||||
}
|
||||
|
||||
@@ -243,6 +243,9 @@ protected:
|
||||
* Sets the cursor shape on the window using
|
||||
* native window system calls.
|
||||
*/
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
|
||||
int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
|
||||
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
|
||||
|
||||
/**
|
||||
|
||||
@@ -560,6 +560,15 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCursorShape(GHOST_TStandardCursor cur
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
/** Reverse the bits in a GHOST_TUns8 */
|
||||
static GHOST_TUns8 uns8ReverseBits(GHOST_TUns8 ch)
|
||||
{
|
||||
ch= ((ch>>1)&0x55) | ((ch<<1)&0xAA);
|
||||
ch= ((ch>>2)&0x33) | ((ch<<2)&0xCC);
|
||||
ch= ((ch>>4)&0x0F) | ((ch<<4)&0xF0);
|
||||
return ch;
|
||||
}
|
||||
|
||||
/** Reverse the bits in a GHOST_TUns16 */
|
||||
static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
||||
{
|
||||
@@ -569,13 +578,26 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
|
||||
shrt= ((shrt>>8)&0x00FF) | ((shrt<<8)&0xFF00);
|
||||
return shrt;
|
||||
}
|
||||
GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
|
||||
GHOST_TUns8 mask[16][2], int hotX, int hotY)
|
||||
{
|
||||
setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask,
|
||||
16, 16, hotX, hotY, 0, 1);
|
||||
|
||||
GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY)
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask, int sixeX, int sizeY, int hotX, int hotY,
|
||||
int fg_color, int bg_color)
|
||||
{
|
||||
GHOST_TUns32 andData[32];
|
||||
GHOST_TUns32 xorData[32];
|
||||
int y;
|
||||
|
||||
GHOST_TUns32 fullBitRow, fullMaskRow;
|
||||
int x, y, cols;
|
||||
|
||||
cols=sizeX/8; /* Num of whole bytes per row (width of bm/mask) */
|
||||
if (sizeX%8) cols++;
|
||||
|
||||
if (m_customCursor) {
|
||||
DestroyCursor(m_customCursor);
|
||||
m_customCursor = NULL;
|
||||
@@ -584,10 +606,15 @@ GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[
|
||||
memset(&andData, 0xFF, sizeof(andData));
|
||||
memset(&xorData, 0, sizeof(xorData));
|
||||
|
||||
for (y=0; y<16; y++) {
|
||||
GHOST_TUns32 fullBitRow = uns16ReverseBits((bitmap[y][0]<<8) | (bitmap[y][1]<<0));
|
||||
GHOST_TUns32 fullMaskRow = uns16ReverseBits((mask[y][0]<<8) | (mask[y][1]<<0));
|
||||
|
||||
for (y=0; y<sizeY; y++) {
|
||||
fullBitRow=0;
|
||||
fullMaskRow=0;
|
||||
for (x=cols-1; x>=0; x--){
|
||||
fullBitRow<<=8;
|
||||
fullMaskRow<<=8;
|
||||
fullBitRow |= uns8ReverseBits(bitmap[cols*y + x]);
|
||||
fullMaskRow |= uns8ReverseBits( mask[cols*y + x]);
|
||||
}
|
||||
xorData[y]= fullBitRow & fullMaskRow;
|
||||
andData[y]= ~fullMaskRow;
|
||||
}
|
||||
|
||||
@@ -249,6 +249,17 @@ protected:
|
||||
*/
|
||||
virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
|
||||
|
||||
virtual setWindowCustomCursorShape(
|
||||
GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask,
|
||||
int sizex,
|
||||
int sizey,
|
||||
int hotX,
|
||||
int hotY,
|
||||
int fg_color,
|
||||
int bg_color
|
||||
);
|
||||
|
||||
/** Window handle. */
|
||||
HWND m_hWnd;
|
||||
/** Device context handle. */
|
||||
|
||||
@@ -684,6 +684,24 @@ setWindowCustomCursorShape(
|
||||
int hotX,
|
||||
int hotY
|
||||
){
|
||||
|
||||
setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask,
|
||||
16, 16, hotX, hotY, 0, 1);
|
||||
|
||||
}
|
||||
|
||||
GHOST_TSuccess
|
||||
GHOST_WindowX11::
|
||||
setWindowCustomCursorShape(
|
||||
GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask,
|
||||
int sizex,
|
||||
int sizey,
|
||||
int hotX,
|
||||
int hotY,
|
||||
int fg_color,
|
||||
int bg_color
|
||||
){
|
||||
Pixmap bitmap_pix, mask_pix;
|
||||
XColor fg, bg;
|
||||
|
||||
@@ -696,8 +714,8 @@ setWindowCustomCursorShape(
|
||||
XFreeCursor(m_display, m_custom_cursor);
|
||||
}
|
||||
|
||||
bitmap_pix = XCreateBitmapFromData(m_display, m_window, (char*) bitmap, 16, 16);
|
||||
mask_pix = XCreateBitmapFromData(m_display, m_window, (char*) mask, 16, 16);
|
||||
bitmap_pix = XCreateBitmapFromData(m_display, m_window, (char*) bitmap, sizex, sizey);
|
||||
mask_pix = XCreateBitmapFromData(m_display, m_window, (char*) mask, sizex, sizey);
|
||||
|
||||
m_custom_cursor = XCreatePixmapCursor(m_display, bitmap_pix, mask_pix, &fg, &bg, hotX, hotY);
|
||||
XDefineCursor(m_display, m_window, m_custom_cursor);
|
||||
|
||||
@@ -236,6 +236,22 @@ protected:
|
||||
int hotX,
|
||||
int hotY
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets the cursor shape on the window using
|
||||
* native window system calls (Arbitrary size/color).
|
||||
*/
|
||||
GHOST_TSuccess
|
||||
setWindowCustomCursorShape(
|
||||
GHOST_TUns8 *bitmap,
|
||||
GHOST_TUns8 *mask,
|
||||
int sizex,
|
||||
int sizey,
|
||||
int hotX,
|
||||
int hotY,
|
||||
int fg_color,
|
||||
int bg_color
|
||||
);
|
||||
|
||||
private :
|
||||
|
||||
|
||||
@@ -308,12 +308,12 @@ ifeq ($(OS),linux)
|
||||
BINTARGETS += blenderplayer
|
||||
endif
|
||||
ifeq ($(CPU),i386)
|
||||
BINTARGETS = plugin
|
||||
# BINTARGETS = plugin
|
||||
# BINTARGETS += ptest
|
||||
BINTARGETS += xplink
|
||||
# BINTARGETS += xplink
|
||||
BINTARGETS += blenderdynamic
|
||||
BINTARGETS += blenderplayer
|
||||
BINTARGETS += blenderstatic
|
||||
# BINTARGETS += blenderplayer
|
||||
# BINTARGETS += blenderstatic
|
||||
endif
|
||||
ifeq ($(CPU),powerpc)
|
||||
BINTARGETS = blenderdynamic
|
||||
|
||||
96
source/blender/include/BIF_cursors.h
Normal file
96
source/blender/include/BIF_cursors.h
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __BLI_CURSORS_DOT_H__
|
||||
#define __BLI_CURSORS_DOT_H__
|
||||
|
||||
void InitCursorData(void);
|
||||
short GetBlenderCursor(void);
|
||||
void SetBlenderCursor(short cursornum);
|
||||
|
||||
//typedef struct BCursor_s BCursor;
|
||||
typedef struct BCursor {
|
||||
|
||||
char *small_bm;
|
||||
char *small_mask;
|
||||
|
||||
char small_sizex;
|
||||
char small_sizey;
|
||||
char small_hotx;
|
||||
char small_hoty;
|
||||
|
||||
char *big_bm;
|
||||
char *big_mask;
|
||||
|
||||
char big_sizex;
|
||||
char big_sizey;
|
||||
char big_hotx;
|
||||
char big_hoty;
|
||||
|
||||
char fg_color;
|
||||
char bg_color;
|
||||
|
||||
} BCursor;
|
||||
|
||||
#define LASTCURSOR -2
|
||||
#define SYSCURSOR -1
|
||||
enum {
|
||||
BC_NW_ARROWCURSOR=0,
|
||||
BC_NS_ARROWCURSOR,
|
||||
BC_EW_ARROWCURSOR,
|
||||
BC_WAITCURSOR,
|
||||
BC_CROSSCURSOR,
|
||||
BC_EDITCROSSCURSOR,
|
||||
BC_BOXSELCURSOR,
|
||||
BC_KNIFECURSOR,
|
||||
|
||||
/* --- ALWAYS LAST ----- */
|
||||
BC_NUMCURSORS,
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
BC_BLACK=0,
|
||||
BC_WHITE,
|
||||
BC_RED,
|
||||
BC_BLUE,
|
||||
BC_GREEN,
|
||||
BC_YELLOW
|
||||
};
|
||||
|
||||
#define SMALL_CURSOR 0
|
||||
#define BIG_CURSOR 1
|
||||
|
||||
#endif
|
||||
|
||||
@@ -140,7 +140,8 @@ typedef struct UserDef {
|
||||
short menuthreshold1, menuthreshold2;
|
||||
char fontname[256]; // FILE_MAXDIR+FILE length
|
||||
struct ListBase themes;
|
||||
short undosteps, pad0;
|
||||
short undosteps;
|
||||
short curssize;
|
||||
short tb_leftmouse, tb_rightmouse;
|
||||
struct SolidLight light[3];
|
||||
} UserDef;
|
||||
|
||||
518
source/blender/src/cursors.c
Normal file
518
source/blender/src/cursors.c
Normal file
@@ -0,0 +1,518 @@
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version. The Blender
|
||||
* Foundation also sells licenses for use in proprietary software under
|
||||
* the Blender License. See http://www.blender.org/BL/ for information
|
||||
* about this.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include "BLI_winstuff.h"
|
||||
#endif
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BIF_cursors.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_graphics.h"
|
||||
#include "BIF_screen.h"
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
#include "winlay.h"
|
||||
|
||||
|
||||
/* ******************************************************************
|
||||
Cursor Description:
|
||||
|
||||
Each bit represents a pixel, so 1 byte = 8 pixels,
|
||||
the bytes go Left to Right. Top to bottom
|
||||
the bits in a byte go right to left
|
||||
(ie; 0x01, 0x80 represents a line of 16 pix with the first and last pix set.)
|
||||
|
||||
A 0 in the bitmap = bg_color, a 1 fg_color
|
||||
a 0 in the mask = transparent pix.
|
||||
|
||||
Until 32x32 cursors are supported on all platforms, the size of the
|
||||
small cursors MUST be 16x16.
|
||||
|
||||
Large cursors have a MAXSIZE of 32x32.
|
||||
|
||||
Other than that, the specified size of the cursors is just a guideline,
|
||||
However, the char array that defines the BM and MASK must be byte aligned.
|
||||
ie a 17x17 cursor needs 3 bytes (cols) * 17 bytes (rows)
|
||||
(3 bytes = 17 bits rounded up to nearest whole byte). Pad extra bits
|
||||
in mask with 0's.
|
||||
|
||||
Setting big_bm=NULL disables the large version of the cursor.
|
||||
|
||||
******************************************************************* */
|
||||
|
||||
/* Because defining a cursor mixes declarations and executable code
|
||||
each cursor needs it's own scoping block or it would be split up
|
||||
over several hundred lines of code. To enforce/document this better
|
||||
I define 2 pretty braindead macros so it's obvious what the extra "[]"
|
||||
are for */
|
||||
|
||||
#define BEGIN_CURSOR_BLOCK {
|
||||
#define END_CURSOR_BLOCK }
|
||||
|
||||
/* Cursor Globals */
|
||||
static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs */
|
||||
static short CurrentCursor=-1, LastCursor=-1;
|
||||
|
||||
void SetBlenderCursor(short curs){
|
||||
Window *win;
|
||||
|
||||
if ((curs<LASTCURSOR)||(curs>=BC_NUMCURSORS)) return;
|
||||
|
||||
win=winlay_get_active_window();
|
||||
|
||||
if (win==NULL) return; /* Can't set custom cursor before Window init */
|
||||
if (win->ghostwin==NULL) return;
|
||||
|
||||
LastCursor=CurrentCursor;
|
||||
CurrentCursor=curs;
|
||||
|
||||
if (curs==LASTCURSOR) curs=LastCursor;
|
||||
|
||||
if (curs==SYSCURSOR) { /* System default Cursor */
|
||||
set_cursor(CURSOR_STD);
|
||||
}
|
||||
else if ( (U.curssize==0) || (BlenderCursor[curs]->big_bm == NULL) ) {
|
||||
printf("setting small cursor\n");
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
BlenderCursor[curs]->small_bm, BlenderCursor[curs]->small_mask,
|
||||
BlenderCursor[curs]->small_sizex,BlenderCursor[curs]->small_sizey,
|
||||
BlenderCursor[curs]->small_hotx,BlenderCursor[curs]->small_hoty,
|
||||
BlenderCursor[curs]->fg_color, BlenderCursor[curs]->bg_color
|
||||
);
|
||||
}
|
||||
else {
|
||||
printf("setting big cursor\n");
|
||||
GHOST_SetCustomCursorShapeEx(win->ghostwin,
|
||||
BlenderCursor[curs]->big_bm, BlenderCursor[curs]->big_mask,
|
||||
BlenderCursor[curs]->big_sizex,BlenderCursor[curs]->big_sizey,
|
||||
BlenderCursor[curs]->big_hotx,BlenderCursor[curs]->big_hoty,
|
||||
BlenderCursor[curs]->fg_color, BlenderCursor[curs]->bg_color
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
short GetCurrentCursor(void){
|
||||
return(CurrentCursor);
|
||||
}
|
||||
|
||||
|
||||
void InitCursorData(void){
|
||||
|
||||
/********************** NW_ARROW Cursor **************************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char nw_sbm[]={
|
||||
0x03, 0x00, 0x05, 0x00, 0x09, 0x00, 0x11, 0x00,
|
||||
0x21, 0x00, 0x41, 0x00, 0x81, 0x00, 0x01, 0x01,
|
||||
0x01, 0x02, 0xc1, 0x03, 0x49, 0x00, 0x8d, 0x00,
|
||||
0x8b, 0x00, 0x10, 0x01, 0x90, 0x01, 0x60, 0x00,
|
||||
};
|
||||
|
||||
static char nw_smsk[]={
|
||||
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00,
|
||||
0x3f, 0x00, 0x7f, 0x00, 0xff, 0x00, 0xff, 0x01,
|
||||
0xff, 0x03, 0xff, 0x03, 0x7f, 0x00, 0xff, 0x00,
|
||||
0xfb, 0x00, 0xf0, 0x01, 0xf0, 0x01, 0x60, 0x00,
|
||||
};
|
||||
|
||||
static BCursor NWArrowCursor = {
|
||||
/*small*/
|
||||
nw_sbm, nw_smsk,
|
||||
16, 16,
|
||||
6, 7,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
32,32,
|
||||
15, 15,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_NW_ARROWCURSOR]=&NWArrowCursor;
|
||||
END_CURSOR_BLOCK
|
||||
|
||||
///********************** NS_ARROW Cursor *************************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char ns_sbm[]={
|
||||
0x40, 0x01, 0x20, 0x02, 0x10, 0x04, 0x08, 0x08,
|
||||
0x04, 0x10, 0x3c, 0x1e, 0x20, 0x02, 0x20, 0x02,
|
||||
0x20, 0x02, 0x20, 0x02, 0x3c, 0x1e, 0x04, 0x10,
|
||||
0x08, 0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x01
|
||||
};
|
||||
|
||||
static char ns_smsk[]={
|
||||
0xc0, 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f,
|
||||
0xfc, 0x1f, 0xfc, 0x1f, 0xe0, 0x03, 0xe0, 0x03,
|
||||
0xe0, 0x03, 0xe0, 0x03, 0xfc, 0x1f, 0xfc, 0x1f,
|
||||
0xf8, 0x0f, 0xf0, 0x07, 0xe0, 0x03, 0xc0, 0x01
|
||||
};
|
||||
|
||||
static BCursor NSArrowCursor = {
|
||||
/*small*/
|
||||
ns_sbm, ns_smsk,
|
||||
16, 16,
|
||||
6, 7,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
32,32,
|
||||
15, 15,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_NS_ARROWCURSOR]=&NSArrowCursor;
|
||||
|
||||
END_CURSOR_BLOCK
|
||||
/********************** EW_ARROW Cursor *************************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char ew_sbm[]={
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x38, 0x1c,
|
||||
0x2c, 0x34, 0xe6, 0x67, 0x03, 0xc0, 0x01, 0x80,
|
||||
0x03, 0xc0, 0xe6, 0x67, 0x2c, 0x34, 0x38, 0x1c,
|
||||
0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static char ew_smsk[]={
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x38, 0x1c,
|
||||
0x3c, 0x3c, 0xfe, 0x7f, 0xff, 0xff, 0x3f, 0xfc,
|
||||
0xff, 0xff, 0xfe, 0x7f, 0x3c, 0x3c, 0x38, 0x1c,
|
||||
0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static BCursor EWArrowCursor = {
|
||||
/*small*/
|
||||
ew_sbm, ew_smsk,
|
||||
16, 16,
|
||||
7, 6,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
32,32,
|
||||
15, 15,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_EW_ARROWCURSOR]=&EWArrowCursor;
|
||||
END_CURSOR_BLOCK
|
||||
|
||||
/********************** Wait Cursor *****************************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char wait_sbm[]={
|
||||
0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x84, 0x21,
|
||||
0xc8, 0x13, 0xd0, 0x0b, 0xa0, 0x04, 0x20, 0x05,
|
||||
0xa0, 0x04, 0x10, 0x09, 0x88, 0x11, 0xc4, 0x23,
|
||||
0xe2, 0x47, 0xfa, 0x5f, 0x02, 0x40, 0xfe, 0x7f,
|
||||
};
|
||||
|
||||
static char wait_smsk[]={
|
||||
0xfe, 0x7f, 0xfe, 0x7f, 0x06, 0x60, 0x8c, 0x31,
|
||||
0xd8, 0x1b, 0xf0, 0x0f, 0xe0, 0x06, 0x60, 0x07,
|
||||
0xe0, 0x06, 0x30, 0x0d, 0x98, 0x19, 0xcc, 0x33,
|
||||
0xe6, 0x67, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
|
||||
};
|
||||
|
||||
static char wait_lbm[]={
|
||||
0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
|
||||
0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x18,
|
||||
0x18, 0xc0, 0x03, 0x0c, 0x30, 0x20, 0x07, 0x06,
|
||||
0x60, 0xf0, 0x0f, 0x03, 0xc0, 0xd0, 0x8d, 0x01,
|
||||
0x80, 0x79, 0xcf, 0x00, 0x00, 0xf3, 0x67, 0x00,
|
||||
0x00, 0x66, 0x37, 0x00, 0x00, 0x8c, 0x33, 0x00,
|
||||
0x00, 0x0c, 0x32, 0x00, 0x00, 0xcc, 0x33, 0x00,
|
||||
0x00, 0x8c, 0x30, 0x00, 0x00, 0x46, 0x61, 0x00,
|
||||
0x00, 0x03, 0xc3, 0x00, 0x80, 0x01, 0x83, 0x01,
|
||||
0xc0, 0xc0, 0x03, 0x03, 0x60, 0xa0, 0x05, 0x06,
|
||||
0x30, 0xf0, 0x0f, 0x0c, 0x18, 0xf8, 0x1d, 0x18,
|
||||
0x0c, 0x5c, 0x3f, 0x30, 0x0c, 0xff, 0x5f, 0x30,
|
||||
0x0c, 0xf7, 0xfe, 0x31, 0xcc, 0xfb, 0x9f, 0x33,
|
||||
0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x30,
|
||||
0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
|
||||
};
|
||||
|
||||
static char wait_lmsk[]={
|
||||
0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
|
||||
0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
|
||||
0x3c, 0x00, 0x00, 0x3c, 0x3c, 0x00, 0x00, 0x1e,
|
||||
0x78, 0xc0, 0x03, 0x0f, 0xf0, 0xa0, 0x87, 0x07,
|
||||
0xe0, 0xf1, 0xcf, 0x03, 0xc0, 0xf3, 0xef, 0x01,
|
||||
0x80, 0xff, 0xff, 0x00, 0x00, 0xff, 0x7f, 0x00,
|
||||
0x00, 0xfe, 0x3f, 0x00, 0x00, 0xfc, 0x3f, 0x00,
|
||||
0x00, 0x3c, 0x3f, 0x00, 0x00, 0xfc, 0x3f, 0x00,
|
||||
0x00, 0xbc, 0x3c, 0x00, 0x00, 0xde, 0x79, 0x00,
|
||||
0x00, 0x0f, 0xf3, 0x00, 0x80, 0x07, 0xe3, 0x01,
|
||||
0xc0, 0xc3, 0xc3, 0x03, 0xe0, 0xe1, 0x87, 0x07,
|
||||
0xf0, 0xf0, 0x0f, 0x0f, 0x78, 0xf8, 0x1f, 0x1e,
|
||||
0x3c, 0x7c, 0x3f, 0x3c, 0x3c, 0xff, 0x7f, 0x3c,
|
||||
0xbc, 0xff, 0xff, 0x3d, 0xfc, 0xfb, 0xbf, 0x3f,
|
||||
0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
|
||||
0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x3f,
|
||||
};
|
||||
|
||||
static BCursor WaitCursor = {
|
||||
/*small*/
|
||||
wait_sbm, wait_smsk,
|
||||
16, 16,
|
||||
7, 7,
|
||||
/*big*/
|
||||
wait_lbm, wait_lmsk,
|
||||
32,32,
|
||||
15, 15,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_WAITCURSOR]=&WaitCursor;
|
||||
END_CURSOR_BLOCK
|
||||
|
||||
/********************** Cross Cursor ***************************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char cross_sbm[]={
|
||||
0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
|
||||
0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x7e, 0x7e,
|
||||
0x7e, 0x7e, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
|
||||
0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static char cross_smsk[]={
|
||||
0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
|
||||
0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0x7f, 0xfe,
|
||||
0x7f, 0xfe, 0xc0, 0x03, 0x80, 0x01, 0x80, 0x01,
|
||||
0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
|
||||
};
|
||||
static char cross_lbm[]={
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00,
|
||||
0x00, 0xc0, 0x03, 0x00, 0x00, 0x40, 0x02, 0x00,
|
||||
0x00, 0x78, 0x1e, 0x00, 0xfc, 0x1f, 0xf8, 0x3f,
|
||||
0xfc, 0x1f, 0xf8, 0x3f, 0x00, 0x78, 0x1e, 0x00,
|
||||
0x00, 0x40, 0x02, 0x00, 0x00, 0xc0, 0x03, 0x00,
|
||||
0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static char cross_lmsk[]={
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00,
|
||||
0x00, 0xe0, 0x07, 0x00, 0x00, 0x70, 0x0e, 0x00,
|
||||
0x00, 0x78, 0x1e, 0x00, 0xff, 0x1f, 0xf8, 0xff,
|
||||
0xff, 0x1f, 0xf8, 0xff, 0x00, 0x78, 0x1e, 0x00,
|
||||
0x00, 0x70, 0x0e, 0x00, 0x00, 0xe0, 0x07, 0x00,
|
||||
0x00, 0xc0, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
|
||||
};
|
||||
|
||||
static BCursor CrossCursor = {
|
||||
/*small*/
|
||||
cross_sbm, cross_smsk,
|
||||
16, 16,
|
||||
7, 7,
|
||||
/*big*/
|
||||
cross_lbm, cross_lmsk,
|
||||
32,32,
|
||||
15, 15,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_CROSSCURSOR]=&CrossCursor;
|
||||
END_CURSOR_BLOCK
|
||||
|
||||
/********************** EditCross Cursor ***********************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char editcross_sbm[]={
|
||||
0x0e, 0x00, 0x11, 0x00, 0x1d, 0x00, 0x19, 0x03,
|
||||
0x1d, 0x03, 0x11, 0x03, 0x0e, 0x03, 0x00, 0x03,
|
||||
0xf8, 0x7c, 0xf8, 0x7c, 0x00, 0x03, 0x00, 0x03,
|
||||
0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static char editcross_smsk[]={
|
||||
0x0e, 0x00, 0x1f, 0x00, 0x1f, 0x03, 0x1f, 0x03,
|
||||
0x1f, 0x03, 0x1f, 0x03, 0x0e, 0x03, 0x80, 0x07,
|
||||
0xfc, 0xfc, 0xfc, 0xfc, 0x80, 0x07, 0x00, 0x03,
|
||||
0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03,
|
||||
};
|
||||
|
||||
static BCursor EditCrossCursor = {
|
||||
/*small*/
|
||||
editcross_sbm, editcross_smsk,
|
||||
16, 16,
|
||||
9, 8,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
32,32,
|
||||
15, 15,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_EDITCROSSCURSOR]=&EditCrossCursor;
|
||||
END_CURSOR_BLOCK
|
||||
|
||||
/********************** Box Select *************************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char box_sbm[32]={
|
||||
0x7f, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x06,
|
||||
0x41, 0x06, 0x41, 0x06, 0x7f, 0x06, 0x00, 0x06,
|
||||
0xe0, 0x79, 0xe0, 0x79, 0x00, 0x06, 0x00, 0x06,
|
||||
0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00,
|
||||
};
|
||||
|
||||
static char box_smsk[32]={
|
||||
0x7f, 0x00, 0x7f, 0x00, 0x63, 0x06, 0x63, 0x06,
|
||||
0x63, 0x06, 0x7f, 0x06, 0x7f, 0x06, 0x00, 0x0f,
|
||||
0xf0, 0xf9, 0xf0, 0xf9, 0x00, 0x0f, 0x00, 0x06,
|
||||
0x00, 0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0x06,
|
||||
|
||||
};
|
||||
|
||||
static BCursor BoxSelCursor = {
|
||||
/*small*/
|
||||
box_sbm, box_smsk,
|
||||
16, 16,
|
||||
9, 8,
|
||||
/*big*/
|
||||
NULL, NULL,
|
||||
32,32,
|
||||
15, 15,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_BOXSELCURSOR]=&BoxSelCursor;
|
||||
|
||||
END_CURSOR_BLOCK
|
||||
/********************** Knife Cursor ***********************/
|
||||
BEGIN_CURSOR_BLOCK
|
||||
static char knife_sbm[]={
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c,
|
||||
0x00, 0x5a, 0x00, 0x34, 0x00, 0x2a, 0x00, 0x17,
|
||||
0x80, 0x06, 0x40, 0x03, 0xa0, 0x03, 0xd0, 0x01,
|
||||
0x68, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static char knife_smsk[]={
|
||||
0x00, 0x60, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0xfe,
|
||||
0x00, 0xfe, 0x00, 0x7e, 0x00, 0x7f, 0x80, 0x3f,
|
||||
0xc0, 0x0e, 0x60, 0x07, 0xb0, 0x07, 0xd8, 0x03,
|
||||
0xec, 0x01, 0x7e, 0x00, 0x1f, 0x00, 0x07, 0x00
|
||||
};
|
||||
|
||||
static char knife_lbm[]={
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c,
|
||||
0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7f,
|
||||
0x00, 0x00, 0x80, 0xbf, 0x00, 0x00, 0xc0, 0x5f,
|
||||
0x00, 0x00, 0xc0, 0x6f, 0x00, 0x00, 0xc0, 0x37,
|
||||
0x00, 0x00, 0xa8, 0x1b, 0x00, 0x00, 0x54, 0x0d,
|
||||
0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x54, 0x00,
|
||||
0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x53, 0x00,
|
||||
0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00,
|
||||
0x00, 0xd0, 0x0f, 0x00, 0x00, 0xe8, 0x07, 0x00,
|
||||
0x00, 0xf4, 0x07, 0x00, 0x00, 0xfa, 0x00, 0x00,
|
||||
0x00, 0x3d, 0x00, 0x00, 0x80, 0x0e, 0x00, 0x00,
|
||||
0xc0, 0x03, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
|
||||
0x30, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
};
|
||||
|
||||
static char knife_lmsk[]={
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18,
|
||||
0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x7e,
|
||||
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x80, 0xff,
|
||||
0x00, 0x00, 0xc0, 0xbf, 0x00, 0x00, 0xe0, 0xdf,
|
||||
0x00, 0x00, 0xe0, 0xef, 0x00, 0x00, 0xf8, 0x77,
|
||||
0x00, 0x00, 0xfc, 0x3b, 0x00, 0x00, 0xfe, 0x1d,
|
||||
0x00, 0x00, 0xfe, 0x0f, 0x00, 0x00, 0xfe, 0x01,
|
||||
0x00, 0x00, 0xff, 0x01, 0x00, 0xc0, 0xff, 0x00,
|
||||
0x00, 0xe0, 0x7f, 0x00, 0x00, 0xf0, 0x1f, 0x00,
|
||||
0x00, 0xd8, 0x1f, 0x00, 0x00, 0xec, 0x0f, 0x00,
|
||||
0x00, 0xf6, 0x0f, 0x00, 0x00, 0xfb, 0x06, 0x00,
|
||||
0x80, 0xbd, 0x01, 0x00, 0xc0, 0x6e, 0x00, 0x00,
|
||||
0xe0, 0x1b, 0x00, 0x00, 0xf0, 0x06, 0x00, 0x00,
|
||||
0xb8, 0x01, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
|
||||
0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
};
|
||||
|
||||
static BCursor KnifeCursor = {
|
||||
/*small*/
|
||||
knife_sbm, knife_smsk,
|
||||
16, 16,
|
||||
0, 15,
|
||||
/*big*/
|
||||
knife_lbm, knife_lmsk,
|
||||
32,32,
|
||||
0, 31,
|
||||
/*color*/
|
||||
BC_BLACK, BC_WHITE
|
||||
};
|
||||
|
||||
BlenderCursor[BC_KNIFECURSOR]=&KnifeCursor;
|
||||
|
||||
END_CURSOR_BLOCK
|
||||
/********************** Put the cursors in the array ***********************/
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include "BLI_editVert.h"
|
||||
#include "BLI_rand.h"
|
||||
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_key.h"
|
||||
#include "BKE_object.h"
|
||||
@@ -87,6 +88,7 @@
|
||||
#include "BIF_mywindow.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_glutil.h"
|
||||
#include "BIF_cursors.h"
|
||||
|
||||
#include "BSE_view.h"
|
||||
#include "BSE_edit.h"
|
||||
@@ -4981,7 +4983,7 @@ void addedgevlak_mesh(void)
|
||||
|
||||
CalcNormFloat(evl->v1->co, evl->v2->co, evl->v3->co, evl->n);
|
||||
|
||||
inp= evl->n[0]*G.vd->viewmat[0][2] + evl->n[1]*G.vd->viewmat[1][2] + evl->n[2]*G.vd->viewmat[2][2];
|
||||
inp= evl->n[0]*G.vd->viewmat[0][2] + evl->n[1]*G.vd->viewmat[1][2] + evl->n[2]*G.vd->viewmat[2][2];
|
||||
|
||||
if(inp < 0.0) flipvlak(evl);
|
||||
}
|
||||
@@ -7407,24 +7409,10 @@ CutCurve *get_mouse_trail(int *len, char mode){
|
||||
void KnifeSubdivide(char mode){
|
||||
|
||||
int oldcursor, len=0;
|
||||
short isect=0;
|
||||
short isect=0, aligned=0;
|
||||
CutCurve *curve;
|
||||
EditEdge *eed;
|
||||
Window *win;
|
||||
/* Remove this from here when cursor support finished */
|
||||
unsigned char bitmap[16][2]={
|
||||
{0x00, 0x00 } , {0x00, 0x00 } , {0x00, 0x10 } , {0x00, 0x2c } ,
|
||||
{0x00, 0x5a } , {0x00, 0x34 } , {0x00, 0x2a } , {0x00, 0x17 } ,
|
||||
{0x80, 0x06 } , {0x40, 0x03 } , {0xa0, 0x03 } , {0xd0, 0x01 } ,
|
||||
{0x68, 0x00 } , {0x1c, 0x00 } , {0x06, 0x00 } , {0x00, 0x00 }
|
||||
};
|
||||
|
||||
unsigned char mask[16][2]={
|
||||
{0x00, 0x60 } , {0x00, 0xf0 } , {0x00, 0xfc } , {0x00, 0xfe } ,
|
||||
{0x00, 0xfe } , {0x00, 0x7e } , {0x00, 0x7f } , {0x80, 0x3f } ,
|
||||
{0xc0, 0x0e } , {0x60, 0x07 } , {0xb0, 0x07 } , {0xd8, 0x03 } ,
|
||||
{0xec, 0x01 } , {0x7e, 0x00 } , {0x1f, 0x00 } , {0x07, 0x00 }
|
||||
};
|
||||
|
||||
if (G.obedit==0) return;
|
||||
|
||||
@@ -7440,10 +7428,10 @@ void KnifeSubdivide(char mode){
|
||||
|
||||
/* Set a knife cursor here */
|
||||
oldcursor=get_cursor();
|
||||
//set_cursor(CURSOR_PENCIL);
|
||||
|
||||
win=winlay_get_active_window();
|
||||
window_set_custom_cursor(win, mask, bitmap, 0, 15);
|
||||
//GHOST_SetCustomCursorShape(win->ghostwin, mask, bitmap, 0, 15);
|
||||
|
||||
SetBlenderCursor(BC_KNIFECURSOR);
|
||||
|
||||
curve=get_mouse_trail(&len, TRAIL_MIXED);
|
||||
|
||||
|
||||
@@ -167,31 +167,6 @@ static int convert_key(GHOST_TKey key) {
|
||||
|
||||
/***/
|
||||
|
||||
struct _Window {
|
||||
GHOST_WindowHandle ghostwin;
|
||||
|
||||
/* Handler and private data for handler */
|
||||
WindowHandlerFP handler;
|
||||
void *user_data;
|
||||
|
||||
/* Window state */
|
||||
int size[2], position[2];
|
||||
int active, visible;
|
||||
|
||||
/* Last known mouse/button/qualifier state */
|
||||
int lmouse[2];
|
||||
int lqual; /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY) */
|
||||
int lmbut; /* (L_MOUSE, M_MOUSE, R_MOUSE) */
|
||||
int commandqual;
|
||||
|
||||
/* Tracks the faked mouse button, if non-zero it is
|
||||
* the event number of the last faked button.
|
||||
*/
|
||||
int faked_mbut;
|
||||
|
||||
GHOST_TimerTaskHandle timer;
|
||||
int timer_event;
|
||||
};
|
||||
|
||||
static Window *window_new(GHOST_WindowHandle ghostwin)
|
||||
{
|
||||
|
||||
@@ -2070,19 +2070,30 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
|
||||
|
||||
uiDefBut(block, LABEL,0,"Mousewheel:",
|
||||
(xpos+edgespace+(4*midspace)+(5*medprefbut)),y3label,medprefbut,buth,
|
||||
(xpos+edgespace+(4*midspace)+(5*medprefbut)),y3label,smallprefbut+15,buth,
|
||||
0, 0, 0, 0, 0, "");
|
||||
uiDefButS(block, TOG|BIT|2, 0, "Invert Wheel Zoom",
|
||||
(xpos+edgespace+(5*midspace)+(5*medprefbut)),y1,medprefbut,buth,
|
||||
(xpos+edgespace+(5*midspace)+(5*medprefbut)),y1,smallprefbut+15,buth,
|
||||
&(U.uiflag), 0, 0, 0, 0,
|
||||
"Swaps mouse wheel zoom direction");
|
||||
|
||||
|
||||
uiDefButI(block, NUM, 0, "Scroll Lines:",
|
||||
(xpos+edgespace+(5*midspace)+(5*medprefbut)),y2,medprefbut,buth,
|
||||
(xpos+edgespace+(5*midspace)+(5*medprefbut)),y2,smallprefbut+15,buth,
|
||||
&U.wheellinescroll, 0.0, 32.0, 0, 0,
|
||||
"The number of lines scrolled at a time with the mouse wheel");
|
||||
|
||||
|
||||
#ifndef __APPLE__
|
||||
uiDefBut(block, LABEL,0,"Cursor:",
|
||||
(xpos+edgespace+(5*midspace)+(5*medprefbut)+smallprefbut+15),y3label,smallprefbut,buth,
|
||||
0, 0, 0, 0, 0, "");
|
||||
uiDefButS(block, TOG|BIT|0, 0, "Large",
|
||||
(xpos+edgespace+(6*midspace)+(5*medprefbut)+smallprefbut+15),y2,smallprefbut,buth,
|
||||
&(U.curssize), 0, 0, 0, 0,
|
||||
"Use Large cursors when available.");
|
||||
#else
|
||||
U.curssize=0; /*Small Cursor always for OSX for now */
|
||||
#endif
|
||||
|
||||
} else if (U.userpref == 1) { /* edit methods */
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_space.h"
|
||||
#include "BIF_toolbox.h"
|
||||
#include "BIF_cursors.h"
|
||||
|
||||
#include "BSE_drawview.h"
|
||||
#include "BSE_headerbuttons.h"
|
||||
@@ -490,6 +491,7 @@ void BIF_init(void)
|
||||
|
||||
initscreen(); /* for (visuele) speed, this first, then setscreen */
|
||||
initbuttons();
|
||||
InitCursorData();
|
||||
|
||||
init_draw_rects(); /* drawobject.c */
|
||||
BIF_read_homefile();
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
*/
|
||||
|
||||
/* Abstract window operations */
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
|
||||
typedef struct _Window Window;
|
||||
typedef void (*WindowHandlerFP) (Window *win, void *user_data, short evt, short val, char ascii);
|
||||
@@ -79,3 +81,29 @@ void winlay_process_events (int wait_for_event);
|
||||
|
||||
void winlay_get_screensize (int *width_r, int *height_r);
|
||||
|
||||
|
||||
struct _Window {
|
||||
GHOST_WindowHandle ghostwin;
|
||||
|
||||
/* Handler and private data for handler */
|
||||
WindowHandlerFP handler;
|
||||
void *user_data;
|
||||
|
||||
/* Window state */
|
||||
int size[2], position[2];
|
||||
int active, visible;
|
||||
|
||||
/* Last known mouse/button/qualifier state */
|
||||
int lmouse[2];
|
||||
int lqual; /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY) */
|
||||
int lmbut; /* (L_MOUSE, M_MOUSE, R_MOUSE) */
|
||||
int commandqual;
|
||||
|
||||
/* Tracks the faked mouse button, if non-zero it is
|
||||
* the event number of the last faked button.
|
||||
*/
|
||||
int faked_mbut;
|
||||
|
||||
GHOST_TimerTaskHandle timer;
|
||||
int timer_event;
|
||||
};
|
||||
|
||||
@@ -120,11 +120,11 @@ ifeq ($(OS),linux)
|
||||
CC = gcc
|
||||
CCC = g++
|
||||
# CFLAGS += -pipe
|
||||
CFLAGS += -pipe -fPIC
|
||||
CCFLAGS += -pipe -fPIC
|
||||
CFLAGS += -pipe -fPIC -ggdb -march=athlon-xp -ffast-math -msse -mmmx
|
||||
CCFLAGS += -pipe -fPIC -ggdb -march=athlon-xp -ffast-math -msse -mmmx
|
||||
# CCFLAGS += -pipe
|
||||
REL_CFLAGS += -O2
|
||||
REL_CCFLAGS += -O2
|
||||
REL_CFLAGS += -O3
|
||||
REL_CCFLAGS += -O3
|
||||
NAN_DEPEND = true
|
||||
ifeq ($(CPU),alpha)
|
||||
CFLAGS += -mieee
|
||||
|
||||
Reference in New Issue
Block a user