Cleaning up legacy cursors and adding merge guard comments on changed code

Liny 2014-05-19 16:54:18 -07:00
parent 03488b7c94
commit 97a45e7597
11 changed files with 86 additions and 37 deletions

View File

@ -68,7 +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_TOOLPAY"] = UI_CURSOR_TOOLPAY; // <FS:LO> Legacy cursor setting from main program
cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN;
cursor_string_table["UI_CURSOR_TOOLPATHFINDING"] = UI_CURSOR_TOOLPATHFINDING;
cursor_string_table["UI_CURSOR_TOOLPATHFINDINGPATHSTART"] = UI_CURSOR_TOOLPATHFINDING_PATH_START;

View File

@ -64,7 +64,7 @@ enum ECursorType {
UI_CURSOR_PIPETTE,
UI_CURSOR_TOOLSIT,
UI_CURSOR_TOOLBUY,
UI_CURSOR_TOOLPAY,
UI_CURSOR_TOOLPAY, // <FS:LO> Legacy cursor setting from main program
UI_CURSOR_TOOLOPEN,
UI_CURSOR_TOOLPATHFINDING,
UI_CURSOR_TOOLPATHFINDING_PATH_START,

View File

@ -398,7 +398,9 @@ LLWindow* LLWindowManager::createWindow(
BOOL disable_vsync,
BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
//U32 fsaa_samples)
U32 fsaa_samples,
BOOL useLegacyCursors) // <FS:LO> Legacy cursor setting from main program
{
LLWindow* new_window;
@ -411,15 +413,18 @@ 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);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
#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);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
#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);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
#endif
}
else

View File

@ -279,7 +279,9 @@ public:
BOOL disable_vsync = TRUE,
BOOL use_gl = TRUE,
BOOL ignore_pixel_depth = FALSE,
U32 fsaa_samples = 0);
//U32 fsaa_samples = 0);
U32 fsaa_samples = 0,
BOOL useLegacyCursors = FALSE); // <FS:LO> Legacy cursor setting from main program
static BOOL destroyWindow(LLWindow* window);
static BOOL isWindowValid(LLWindow *window);
};

View File

@ -37,7 +37,6 @@
#include "llstring.h"
#include "lldir.h"
#include "indra_constants.h"
#include "../newview/llviewercontrol.h"
#include <OpenGL/OpenGL.h>
#include <CoreServices/CoreServices.h>
@ -118,8 +117,10 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
: LLWindow(NULL, fullscreen, flags)
/*U32 fsaa_samples,) // <FS:LO> Legacy cursor setting from main program
: LLWindow(NULL, fullscreen, flags)*/
U32 fsaa_samples, BOOL useLegacyCursors)
: LLWindow(NULL, fullscreen, flags), mUseLegacyCursors(useLegacyCursors)
{
// *HACK: During window construction we get lots of OS events for window
// reshape, activate, etc. that the viewer isn't ready to handle.
@ -190,7 +191,8 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
}
//start with arrow cursor
initCursors();
//initCursors();
initCursors(mUseLegacyCursors); // <FS:LO> Legacy cursor setting from main program
setCursor( UI_CURSOR_ARROW );
allowLanguageTextInput(NULL, FALSE);
@ -1321,7 +1323,6 @@ void LLWindowMacOSX::setupFailure(const std::string& text, const std::string& ca
// it is handled at a very low-level
const char* cursorIDToName(int id)
{
BOOL use_legacy_cursors = gSavedSettings.getBOOL("UseLegacyCursors");
switch (id)
{
case UI_CURSOR_ARROW: return "UI_CURSOR_ARROW";
@ -1357,16 +1358,21 @@ 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";
/* <FS:LO> Legacy cursor setting from main program
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 (mUseLegacyCursors) return "UI_CURSOR_TOOLSIT_LEGACY"; else return "UI_CURSOR_TOOLSIT";
case UI_CURSOR_TOOLBUY: if (mUseLegacyCursors) return "UI_CURSOR_TOOLBUY_LEGACY"; else return "UI_CURSOR_TOOLBUY";
case UI_CURSOR_TOOLOPEN: if (mUseLegacyCursors) return "UI_CURSOR_TOOLOPEN_LEGACY"; else return "UI_CURSOR_TOOLOPEN";
case UI_CURSOR_TOOLPAY: if (mUseLegacyCursors) return "UI_CURSOR_TOOLPAY_LEGACY"; else return "UI_CURSOR_TOOLBUY";
// </FS:LO>
case UI_CURSOR_TOOLPATHFINDING: return "UI_CURSOR_PATHFINDING";
case UI_CURSOR_TOOLPATHFINDING_PATH_START: return "UI_CURSOR_PATHFINDING_START";
case UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD: return "UI_CURSOR_PATHFINDING_START_ADD";
case UI_CURSOR_TOOLPATHFINDING_PATH_END: return "UI_CURSOR_PATHFINDING_END";
case UI_CURSOR_TOOLPATHFINDING_PATH_END_ADD: return "UI_CURSOR_PATHFINDING_END_ADD";
case UI_CURSOR_TOOLNO: return "UI_CURSOR_NO";
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_TOOLPAY_LEGACY"; else return "UI_CURSOR_TOOLBUY";
}
llerrs << "cursorIDToName: unknown cursor id" << id << llendl;
@ -1497,7 +1503,9 @@ ECursorType LLWindowMacOSX::getCursor() const
return mCurrentCursor;
}
void LLWindowMacOSX::initCursors()
// <FS:LO> Legacy cursor setting from main program
//void LLWindowMacOSX::initCursors()
void LLWindowMacOSX::initCursors(BOOL useLegacyCursors)
{
initPixmapCursor(UI_CURSOR_NO, 8, 8);
initPixmapCursor(UI_CURSOR_WORKING, 1, 1);
@ -1520,7 +1528,11 @@ void LLWindowMacOSX::initCursors()
initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1);
if (gSavedSettings.getBOOL("UseLegacyCursors"))
/* <FS:LO> Legacy cursor setting from main program
initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15);*/
if (useLegacyCursors)
{
initPixmapCursor(UI_CURSOR_TOOLSIT, 0, 0);
initPixmapCursor(UI_CURSOR_TOOLBUY, 0, 0);
@ -1534,6 +1546,7 @@ void LLWindowMacOSX::initCursors()
initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLPAY, 20, 15);
}
// </FS:LO>
initPixmapCursor(UI_CURSOR_TOOLPATHFINDING, 16, 16);
initPixmapCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START, 16, 16);
initPixmapCursor(UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD, 16, 16);

View File

@ -136,10 +136,12 @@ 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);
U32 fsaa_samples, BOOL useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
~LLWindowMacOSX();
void initCursors();
//void initCursors();
void initCursors(BOOL useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
BOOL isValid();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
@ -216,6 +218,8 @@ protected:
friend class LLWindowManager;
private
BOOL mUseLegacyCursors; // <FS:LO> Legacy cursor setting from main program
};

View File

@ -39,7 +39,6 @@
#include "llstring.h"
#include "lldir.h"
#include "llfindlocale.h"
#include "../newview/llviewercontrol.h"
#if LL_GTK
extern "C" {
@ -193,10 +192,14 @@ 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)
// <FS:LO> Legacy cursor setting from main program
//BOOL ignore_pixel_depth, U32 fsaa_samples,)
BOOL ignore_pixel_depth, U32 fsaa_samples, BOOL useLegacyCursors)
: LLWindow(callbacks, fullscreen, flags),
Lock_Display(NULL),
Unlock_Display(NULL), mGamma(1.0f)
//Unlock_Display(NULL), mGamma(1.0f)
Unlock_Display(NULL), mGamma(1.0f),
mUseLegacyCursors(useLegacyCursors) // </FS:LO>
{
// Initialize the keyboard
gKeyboard = new LLKeyboardSDL();
@ -239,7 +242,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
gGLManager.initGL();
//start with arrow cursor
initCursors();
initCursors(useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
setCursor( UI_CURSOR_ARROW );
}
@ -803,7 +806,7 @@ BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL
gGLManager.initGL();
//start with arrow cursor
initCursors();
initCursors(mUseLegacyCursors;); // <FS:LO> Legacy cursor setting from main program
setCursor( UI_CURSOR_ARROW );
}
}
@ -2116,7 +2119,7 @@ void LLWindowSDL::updateCursor()
}
}
void LLWindowSDL::initCursors()
void LLWindowSDL::initCursors(useLegacyCursors) // <FS:LO> Legacy cursor setting from main program
{
int i;
// Blank the cursor pointer array for those we may miss.
@ -2161,6 +2164,10 @@ 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);
/* <FS:LO> Legacy cursor setting from main program
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 (gSavedSettings.getBOOL("UseLegacyCursors")) {
mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit-legacy.BMP",0,0);
mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy-legacy.BMP",0,0);
@ -2174,6 +2181,7 @@ void LLWindowSDL::initCursors()
mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLPAY] = makeSDLCursorFromBMP("toolbuy.BMP",20,15);
}
// </FS:LO>
mSDLCursors[UI_CURSOR_TOOLPATHFINDING] = makeSDLCursorFromBMP("lltoolpathfinding.BMP", 16, 16);
mSDLCursors[UI_CURSOR_TOOLPATHFINDING_PATH_START] = makeSDLCursorFromBMP("lltoolpathfindingpathstart.BMP", 16, 16);
mSDLCursors[UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD] = makeSDLCursorFromBMP("lltoolpathfindingpathstartadd.BMP", 16, 16);

View File

@ -151,13 +151,15 @@ 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 ignore_pixel_depth, U32 fsaa_samples, BOOL useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
~LLWindowSDL();
/*virtual*/ BOOL isValid();
/*virtual*/ LLSD getNativeKeyData();
void initCursors();
//void initCursors();
void initCursors(BOOL useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
void quitCursors();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
@ -214,6 +216,8 @@ private:
U32 mKeyScanCode;
U32 mKeyVirtualKey;
SDLMod mKeyModifiers;
BOOL mUseLegacyCursors; // <FS:LO> Legacy cursor setting from main program
};

View File

@ -42,7 +42,6 @@
#include "llstring.h"
#include "lldir.h"
#include "llglslshader.h"
#include "../newview/llviewercontrol.h"
// System includes
#include <commdlg.h>
@ -363,7 +362,9 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
//U32 fsaa_samples)
U32 fsaa_samples,
BOOL useLegacyCursors) // <FS:LO> Legacy cursor setting from main program
: LLWindow(callbacks, fullscreen, flags)
{
@ -638,7 +639,8 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
}
//start with arrow cursor
initCursors();
//initCursors();
initCursors(useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
setCursor( UI_CURSOR_ARROW );
// Initialize (boot strap) the Language text input management,
@ -1665,8 +1667,8 @@ HCURSOR LLWindowWin32::loadColorCursor(LPCTSTR name)
LR_DEFAULTCOLOR);
}
void LLWindowWin32::initCursors()
//void LLWindowWin32::initCursors()
void LLWindowWin32::initCursors(BOOL useLegacyCursors) // <FS:LO> Legacy cursor setting from main program
{
mCursor[ UI_CURSOR_ARROW ] = LoadCursor(NULL, IDC_ARROW);
mCursor[ UI_CURSOR_WAIT ] = LoadCursor(NULL, IDC_WAIT);
@ -1700,7 +1702,11 @@ 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"));
if (gSavedSettings.getBOOL("UseLegacyCursors"))
/*<FS:LO> Legacy cursor setting from main program
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 (useLegacyCursors)
{
mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT-LEGACY"));
mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY-LEGACY"));
@ -1714,6 +1720,7 @@ void LLWindowWin32::initCursors()
mCursor[ UI_CURSOR_TOOLOPEN ] = LoadCursor(module, TEXT("TOOLOPEN"));
mCursor[ UI_CURSOR_TOOLPAY ] = LoadCursor(module, TEXT("TOOLBUY"));
}
// </FS:LO>
mCursor[ UI_CURSOR_TOOLPATHFINDING ] = LoadCursor(module, TEXT("TOOLPATHFINDING"));
mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_START_ADD ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHSTARTADD"));
mCursor[ UI_CURSOR_TOOLPATHFINDING_PATH_START ] = LoadCursor(module, TEXT("TOOLPATHFINDINGPATHSTART"));

View File

@ -123,10 +123,12 @@ 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 ignore_pixel_depth, U32 fsaa_samples, BOOL useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
~LLWindowWin32();
void initCursors();
//void initCursors();
void initCursors(BOOL useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
void initInputDevices();
HCURSOR loadColorCursor(LPCTSTR name);
BOOL isValid();

View File

@ -1705,6 +1705,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
resetSnapshotLoc();
BOOL useLegacyCursors = gSavedSettings.getBOOL("UseLegacyCursors"); // <FS:LO> Legacy cursor setting from main program
/*
LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
@ -1722,7 +1724,9 @@ LLViewerWindow::LLViewerWindow(const Params& p)
gSavedSettings.getBOOL("DisableVerticalSync"),
!gHeadlessClient,
p.ignore_pixel_depth,
gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
//gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples"), //don't use window level anti-aliasing if FBOs are enabled
useLegacyCursors); // <FS:LO> Legacy cursor setting from main program
if (!LLViewerShaderMgr::sInitialized)
{ //immediately initialize shaders