Added support for legacy cursors

master
kadah 2011-01-15 20:07:08 -08:00
parent 674454ca30
commit 80e2a367a3
27 changed files with 112 additions and 37 deletions

View File

@ -68,6 +68,7 @@ ECursorType getCursorFromString(const std::string& cursor_string)
cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE;
cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT;
cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY;
cursor_string_table["UI_CURSOR_TOOLPAY"] = UI_CURSOR_TOOLPAY;
cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN;
}

View File

@ -64,6 +64,7 @@ enum ECursorType {
UI_CURSOR_PIPETTE,
UI_CURSOR_TOOLSIT,
UI_CURSOR_TOOLBUY,
UI_CURSOR_TOOLPAY,
UI_CURSOR_TOOLOPEN,
UI_CURSOR_COUNT // Number of elements in this enum (NOT a cursor)
};

View File

@ -338,7 +338,8 @@ LLWindow* LLWindowManager::createWindow(
BOOL disable_vsync,
BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
U32 fsaa_samples,
BOOL use_legacy_cursors)
{
LLWindow* new_window;
@ -351,15 +352,15 @@ LLWindow* LLWindowManager::createWindow(
#elif LL_SDL
new_window = new LLWindowSDL(callbacks,
title, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, use_legacy_cursors);
#elif LL_WINDOWS
new_window = new LLWindowWin32(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, use_legacy_cursors);
#elif LL_DARWIN
new_window = new LLWindowMacOSX(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, use_legacy_cursors);
#endif
}
else

View File

@ -258,7 +258,8 @@ public:
BOOL disable_vsync = TRUE,
BOOL use_gl = TRUE,
BOOL ignore_pixel_depth = FALSE,
U32 fsaa_samples = 0);
U32 fsaa_samples = 0,
BOOL use_legacy_cursors = TRUE);
static BOOL destroyWindow(LLWindow* window);
static BOOL isWindowValid(LLWindow *window);
};

View File

@ -217,7 +217,8 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
U32 fsaa_samples,
BOOL use_legacy_cursors)
: LLWindow(NULL, fullscreen, flags)
{
// *HACK: During window construction we get lots of OS events for window
@ -319,7 +320,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
}
//start with arrow cursor
initCursors();
initCursors(use_legacy_cursors);
setCursor( UI_CURSOR_ARROW );
}
@ -2739,7 +2740,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
return result;
}
const char* cursorIDToName(int id)
const char* cursorIDToName(int id, BOOL use_legacy_cursors)
{
switch (id)
{
@ -2776,9 +2777,10 @@ const char* cursorIDToName(int id)
case UI_CURSOR_TOOLPAUSE: return "UI_CURSOR_TOOLPAUSE";
case UI_CURSOR_TOOLMEDIAOPEN: return "UI_CURSOR_TOOLMEDIAOPEN";
case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE";
case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT";
case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY";
case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN";
case UI_CURSOR_TOOLSIT: if (use_legacy_cursors) return "UI_CURSOR_TOOLSIT_LEGACY"; else return "UI_CURSOR_TOOLSIT";
case UI_CURSOR_TOOLBUY: if (use_legacy_cursors) return "UI_CURSOR_TOOLBUY_LEGACY"; else return "UI_CURSOR_TOOLBUY";
case UI_CURSOR_TOOLOPEN: if (use_legacy_cursors) return "UI_CURSOR_TOOLOPEN_LEGACY"; else return "UI_CURSOR_TOOLOPEN";
case UI_CURSOR_TOOLPAY: if (use_legacy_cursors) return "UI_CURSOR_TOOLBUY_LEGACY"; else return "UI_CURSOR_TOOLPAY";
}
llerrs << "cursorIDToName: unknown cursor id" << id << llendl;
@ -2789,14 +2791,14 @@ const char* cursorIDToName(int id)
static CursorRef gCursors[UI_CURSOR_COUNT];
static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY)
static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY, BOOL use_legacy_cursors = TRUE)
{
// cursors are in <Application Bundle>/Contents/Resources/cursors_mac/UI_CURSOR_FOO.tif
std::string fullpath = gDirUtilp->getAppRODataDir();
fullpath += gDirUtilp->getDirDelimiter();
fullpath += "cursors_mac";
fullpath += gDirUtilp->getDirDelimiter();
fullpath += cursorIDToName(cursorid);
fullpath += cursorIDToName(cursorid, use_legacy_cursors);
fullpath += ".tif";
gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY);
@ -2883,6 +2885,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
case UI_CURSOR_TOOLMEDIAOPEN:
case UI_CURSOR_TOOLSIT:
case UI_CURSOR_TOOLBUY:
case UI_CURSOR_TOOLPAY:
case UI_CURSOR_TOOLOPEN:
result = setImageCursor(gCursors[cursor]);
break;
@ -2902,7 +2905,8 @@ ECursorType LLWindowMacOSX::getCursor() const
return mCurrentCursor;
}
void LLWindowMacOSX::initCursors()
void LLWindowMacOSX::initCursors(BOOL use_legacy_cursors)
{
{
initPixmapCursor(UI_CURSOR_NO, 8, 8);
initPixmapCursor(UI_CURSOR_WORKING, 1, 1);
@ -2925,9 +2929,10 @@ void LLWindowMacOSX::initCursors()
initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_TOOLPAY, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10);
initPixmapCursor(UI_CURSOR_SIZENESW, 10, 10);

View File

@ -123,10 +123,11 @@ protected:
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples);
U32 fsaa_samples,
BOOL use_legacy_cursors);
~LLWindowMacOSX();
void initCursors();
void initCursors(BOOL use_legacy_cursors = TRUE);
BOOL isValid();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);

View File

@ -187,7 +187,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples)
BOOL ignore_pixel_depth, U32 fsaa_samples, BOOL use_legacy_cursors)
: LLWindow(callbacks, fullscreen, flags),
Lock_Display(NULL),
Unlock_Display(NULL), mGamma(1.0f)
@ -233,7 +233,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
gGLManager.initGL();
//start with arrow cursor
initCursors();
initCursors(use_legacy_cursors);
setCursor( UI_CURSOR_ARROW );
}
@ -2023,7 +2023,7 @@ void LLWindowSDL::setCursor(ECursorType cursor)
}
}
void LLWindowSDL::initCursors()
void LLWindowSDL::initCursors(BOOL use_legacy_cursors)
{
int i;
// Blank the cursor pointer array for those we may miss.
@ -2068,9 +2068,19 @@ void LLWindowSDL::initCursors()
mSDLCursors[UI_CURSOR_TOOLPAUSE] = makeSDLCursorFromBMP("toolpause.BMP",0,0);
mSDLCursors[UI_CURSOR_TOOLMEDIAOPEN] = makeSDLCursorFromBMP("toolmediaopen.BMP",0,0);
mSDLCursors[UI_CURSOR_PIPETTE] = makeSDLCursorFromBMP("lltoolpipette.BMP",2,28);
mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",20,15);
if (use_legacy_cursors) {
mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit-legacy.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy-legacy.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen-legacy.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLPAY] = makeSDLCursorFromBMP("toolpay-legacy.BMP",20,15);
}
else
{
mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLPAY] = makeSDLCursorFromBMP("toolbuy.BMP",20,15);
}
if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) {
llinfos << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << llendl;

View File

@ -146,13 +146,14 @@ protected:
LLWindowSDL(LLWindowCallbacks* callbacks,
const std::string& title, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples);
BOOL ignore_pixel_depth, U32 fsaa_samples, BOOL use_legacy_cursors);
BOOL ignore_pixel_depth, U32 fsaa_samples, BOOL use_legacy_cursors);
~LLWindowSDL();
/*virtual*/ BOOL isValid();
/*virtual*/ LLSD getNativeKeyData();
void initCursors();
void initCursors(BOOL use_legacy_cursors = TRUE);
void quitCursors();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);

View File

@ -363,7 +363,8 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
U32 fsaa_samples,
BOOL use_legacy_cursors)
: LLWindow(callbacks, fullscreen, flags)
{
mFSAASamples = fsaa_samples;
@ -612,7 +613,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
}
//start with arrow cursor
initCursors();
initCursors(use_legacy_cursors);
setCursor( UI_CURSOR_ARROW );
// Initialize (boot strap) the Language text input management,
@ -1504,7 +1505,7 @@ HCURSOR LLWindowWin32::loadColorCursor(LPCTSTR name)
}
void LLWindowWin32::initCursors()
void LLWindowWin32::initCursors(BOOL use_legacy_cursors)
{
mCursor[ UI_CURSOR_ARROW ] = LoadCursor(NULL, IDC_ARROW);
mCursor[ UI_CURSOR_WAIT ] = LoadCursor(NULL, IDC_WAIT);
@ -1538,9 +1539,20 @@ void LLWindowWin32::initCursors()
mCursor[ UI_CURSOR_TOOLZOOMIN ] = LoadCursor(module, TEXT("TOOLZOOMIN"));
mCursor[ UI_CURSOR_TOOLPICKOBJECT3 ] = LoadCursor(module, TEXT("TOOLPICKOBJECT3"));
mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE"));
mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT"));
mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY"));
mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN"));
if (use_legacy_cursors)
{
mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT-LEGACY"));
mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY-LEGACY"));
mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN-LEGACY"));
mCursor[ UI_CURSOR_TOOLPAY ] = LoadCursor(module, TEXT("TOOLPAY-LEGACY"));
}
else
{
mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT"));
mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY"));
mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN"));
mCursor[ UI_CURSOR_TOOLPAY ] = LoadCursor(module, TEXT("TOOLBUY"));
}
// Color cursors
mCursor[ UI_CURSOR_TOOLPLAY ] = loadColorCursor(TEXT("TOOLPLAY"));

View File

@ -118,10 +118,10 @@ protected:
LLWindowWin32(LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples);
BOOL ignore_pixel_depth, U32 fsaa_samples, BOOL use_legacy_cursors);
~LLWindowWin32();
void initCursors();
void initCursors(BOOL use_legacy_cursors = TRUE);
void initInputDevices();
HCURSOR loadColorCursor(LPCTSTR name);
BOOL isValid();

View File

@ -12842,5 +12842,16 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>UseLegacyCursors</key>
<map>
<key>Comment</key>
<string>Use 1.x style cursors instead</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -450,7 +450,7 @@ ECursorType cursor_from_object(LLViewerObject* object)
if ((object && object->flagTakesMoney())
|| (parent && parent->flagTakesMoney()))
{
cursor = UI_CURSOR_TOOLBUY;
cursor = UI_CURSOR_TOOLPAY;
}
break;
case CLICK_ACTION_ZOOM:

View File

@ -1358,7 +1358,8 @@ LLViewerWindow::LLViewerWindow(
gSavedSettings.getBOOL("DisableVerticalSync"),
!gNoRender,
ignore_pixel_depth,
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples"), //don't use window level anti-aliasing if FBOs are enabled
gSavedSettings.getBOOL("UseLegacyCursors"));
if (!LLAppViewer::instance()->restoreErrorTrap())
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -135,6 +135,11 @@ TOOLBUY CURSOR "toolbuy.cur"
TOOLOPEN CURSOR "toolopen.cur"
TOOLSIT CURSOR "toolsit.cur"
TOOLBUY-LEGACY CURSOR "toolbuy-legacy.cur"
TOOLPAY-LEGACY CURSOR "toolpay-legacy.cur"
TOOLOPEN-LEGACY CURSOR "toolopen-legacy.cur"
TOOLSIT-LEGACY CURSOR "toolsit-legacy.cur"
/////////////////////////////////////////////////////////////////////////////
//
// Version

View File

@ -78,5 +78,30 @@
width="200">
(Requires restart)
</text>
<check_box
control_name="UseLegacyCursors"
follows="left|top"
height="16"
initial_value="true"
label="Use Legacy Cursors"
layout="topleft"
left="30"
top_pad="20"
name="use _legacy_cursors"
width="200" />
<text
font="SansSerifSmall"
type="string"
text_color="White_50"
length="1"
follows="left|top"
height="18"
layout="topleft"
left_pad="30"
name="theme_textbox2"
width="200">
(Requires restart)
</text>
</panel>