summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-05-08 07:43:08 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-05-08 07:43:08 +0000
commita4000c3744e42fcbb638e742f3b63fa31a0dee15 (patch)
tree7f472c30e65bbfa04ee9bc06631a1af305cc31fb /indra/llwindow
parent6c4cadbb04d633ad7b762058bdeba6e1f650dafd (diff)
merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/CMakeLists.txt6
-rw-r--r--indra/llwindow/lldxhardware.cpp1
-rw-r--r--indra/llwindow/llkeyboard.cpp2
-rw-r--r--indra/llwindow/llkeyboardmacosx.cpp2
-rw-r--r--indra/llwindow/llkeyboardsdl.cpp2
-rw-r--r--indra/llwindow/llkeyboardwin32.cpp10
-rw-r--r--indra/llwindow/llpreeditor.h2
-rw-r--r--indra/llwindow/llwindow.cpp233
-rw-r--r--indra/llwindow/llwindow.h83
-rw-r--r--indra/llwindow/llwindowcallbacks.cpp201
-rw-r--r--indra/llwindow/llwindowcallbacks.h85
-rw-r--r--indra/llwindow/llwindowheadless.cpp6
-rw-r--r--indra/llwindow/llwindowheadless.h9
-rw-r--r--indra/llwindow/llwindowmacosx.cpp27
-rw-r--r--indra/llwindow/llwindowmacosx.h6
-rw-r--r--indra/llwindow/llwindowsdl.cpp16
-rw-r--r--indra/llwindow/llwindowsdl.h5
-rw-r--r--indra/llwindow/llwindowwin32.cpp121
-rw-r--r--indra/llwindow/llwindowwin32.h4
19 files changed, 459 insertions, 362 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index e1f7406287..f5d06b7258 100644
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -37,7 +37,7 @@ set(llwindow_SOURCE_FILES
llwindowheadless.cpp
)
-set(llwindows_HEADER_FILES
+set(llwindow_HEADER_FILES
CMakeLists.txt
llkeyboard.h
@@ -47,10 +47,12 @@ set(llwindows_HEADER_FILES
set(viewer_SOURCE_FILES
llwindow.cpp
llmousehandler.cpp
+ llwindowcallbacks.cpp
)
set(viewer_HEADER_FILES
llwindow.h
+ llwindowcallbacks.h
llpreeditor.h
llmousehandler.h
)
@@ -143,7 +145,7 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN)
${llwindow_SOURCE_FILES}
${server_SOURCE_FILES}
)
- # *TODO: This should probably have target_link_libraries
+ target_link_libraries (llwindowheadless ${llwindow_LINK_LIBRARIES})
endif (SERVER AND NOT WINDOWS AND NOT DARWIN)
if (llwindow_HEADER_FILES)
diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp
index beab131856..d33a0a6eea 100644
--- a/indra/llwindow/lldxhardware.cpp
+++ b/indra/llwindow/lldxhardware.cpp
@@ -47,6 +47,7 @@
#include "llstring.h"
#include "llstl.h"
+#include "lltimer.h"
void (*gWriteDebug)(const char* msg) = NULL;
LLDXHardware gDXHardware;
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp
index 02b4ed17c2..f0f618aef1 100644
--- a/indra/llwindow/llkeyboard.cpp
+++ b/indra/llwindow/llkeyboard.cpp
@@ -34,7 +34,7 @@
#include "indra_constants.h"
#include "llkeyboard.h"
-#include "llwindow.h"
+#include "llwindowcallbacks.h"
//
diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp
index ec82032161..f53773c393 100644
--- a/indra/llwindow/llkeyboardmacosx.cpp
+++ b/indra/llwindow/llkeyboardmacosx.cpp
@@ -34,7 +34,7 @@
#include "linden_common.h"
#include "llkeyboardmacosx.h"
-#include "llwindow.h"
+#include "llwindowcallbacks.h"
#include <Carbon/Carbon.h>
diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp
index 8a6b6d6298..8a0b1de98c 100644
--- a/indra/llwindow/llkeyboardsdl.cpp
+++ b/indra/llwindow/llkeyboardsdl.cpp
@@ -34,7 +34,7 @@
#include "linden_common.h"
#include "llkeyboardsdl.h"
-#include "llwindow.h"
+#include "llwindowcallbacks.h"
#include "SDL/SDL.h"
LLKeyboardSDL::LLKeyboardSDL()
diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp
index a06f19149c..ea11e0537e 100644
--- a/indra/llwindow/llkeyboardwin32.cpp
+++ b/indra/llwindow/llkeyboardwin32.cpp
@@ -34,14 +34,16 @@
#include "linden_common.h"
-#include "llkeyboardwin32.h"
-
-#include "llwindow.h"
-
#define WIN32_LEAN_AND_MEAN
#include <winsock2.h>
#include <windows.h>
+#include "llkeyboardwin32.h"
+
+#include "llwindowcallbacks.h"
+
+
+
LLKeyboardWin32::LLKeyboardWin32()
{
// Set up key mapping for windows - eventually can read this from a file?
diff --git a/indra/llwindow/llpreeditor.h b/indra/llwindow/llpreeditor.h
index 370f76cb85..dd63a98606 100644
--- a/indra/llwindow/llpreeditor.h
+++ b/indra/llwindow/llpreeditor.h
@@ -94,7 +94,7 @@ public:
// Get the contents of this preeditor as a LLWString. If there is an active preedit,
// the returned LLWString contains it.
- virtual const LLWString & getWText() const = 0;
+ virtual LLWString getWText() const = 0;
// Handle a UTF-32 char on this preeditor, i.e., add the character
// to the contents.
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 7e412a14de..1c6c9e6e9d 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -46,14 +46,12 @@
#include "llerror.h"
#include "llkeyboard.h"
#include "linked_lists.h"
+#include "llwindowcallbacks.h"
-//static instance for default callbacks
-LLWindowCallbacks LLWindow::sDefaultCallbacks;
//
-// LLWindowCallbacks
+// Globals
//
-
LLSplashScreen *gSplashScreenp = NULL;
BOOL gDebugClicks = FALSE;
BOOL gDebugWindowProc = FALSE;
@@ -67,158 +65,6 @@ const std::string gURLProtocolWhitelist[] = { "file:", "http:", "https:" };
// Important - these lists should match - protocol to handler
const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };
-BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated)
-{
- return FALSE;
-}
-
-
-BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level)
-{
-}
-
-BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask)
-{
- return FALSE;
-}
-
-
-BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleMouseLeave(LLWindow *window)
-{
- return;
-}
-
-BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window)
-{
- //allow the window to close
- return TRUE;
-}
-
-void LLWindowCallbacks::handleQuit(LLWindow *window)
-{
- if(LLWindowManager::destroyWindow(window) == FALSE)
- {
- llerrs << "LLWindowCallbacks::handleQuit() : Couldn't destroy window" << llendl;
- }
-}
-
-BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
-}
-
-void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
-{
-}
-
-void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
-{
-}
-
-void LLWindowCallbacks::handleFocus(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleFocusLost(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item)
-{
-}
-
-BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y,
- const S32 width, const S32 height)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handleWindowBlock(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleWindowUnblock(LLWindow *window)
-{
-}
-
-void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data)
-{
-}
-
-BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window)
-{
- return FALSE;
-}
-
-BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
-{
- return FALSE;
-}
-
-void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg)
-{
-
-}
-
-void LLWindowCallbacks::handlePauseWatchdog(LLWindow *window)
-{
-
-}
-
-void LLWindowCallbacks::handleResumeWatchdog(LLWindow *window)
-{
-
-}
-
S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
{
@@ -257,8 +103,8 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
// LLWindow
//
-LLWindow::LLWindow(BOOL fullscreen, U32 flags)
- : mCallbacks(&sDefaultCallbacks),
+LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
+ : mCallbacks(callbacks),
mPostQuit(TRUE),
mFullscreen(fullscreen),
mFullscreenWidth(0),
@@ -275,9 +121,23 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags)
mHideCursorPermanent(FALSE),
mFlags(flags),
mHighSurrogate(0)
+{ }
+
+LLWindow::~LLWindow()
+{ }
+
+//virtual
+BOOL LLWindow::isValid()
{
+ return TRUE;
}
-
+
+//virtual
+BOOL LLWindow::canDelete()
+{
+ return TRUE;
+}
+
// virtual
void LLWindow::incBusyCount()
{
@@ -293,13 +153,28 @@ void LLWindow::decBusyCount()
}
}
-void LLWindow::setCallbacks(LLWindowCallbacks *callbacks)
+//virtual
+void LLWindow::resetBusyCount()
{
- mCallbacks = callbacks;
- if (gKeyboard)
- {
- gKeyboard->setCallbacks(callbacks);
- }
+ mBusyCount = 0;
+}
+
+//virtual
+S32 LLWindow::getBusyCount() const
+{
+ return mBusyCount;
+}
+
+//virtual
+ECursorType LLWindow::getCursor() const
+{
+ return mCurrentCursor;
+}
+
+//virtual
+BOOL LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b)
+{
+ return FALSE;
}
void *LLWindow::getMediaWindow()
@@ -462,23 +337,7 @@ void LLSplashScreen::hide()
static std::set<LLWindow*> sWindowList;
LLWindow* LLWindowManager::createWindow(
- const std::string& title,
- const std::string& name,
- LLCoordScreen upper_left,
- LLCoordScreen size,
- U32 flags,
- BOOL fullscreen,
- BOOL clearBg,
- BOOL disable_vsync,
- BOOL use_gl,
- BOOL ignore_pixel_depth)
-{
- return createWindow(
- title, name, upper_left.mX, upper_left.mY, size.mX, size.mY, flags,
- fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
-}
-
-LLWindow* LLWindowManager::createWindow(
+ LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
BOOL fullscreen,
BOOL clearBg,
@@ -492,26 +351,26 @@ LLWindow* LLWindowManager::createWindow(
if (use_gl)
{
#if LL_MESA_HEADLESS
- new_window = new LLWindowMesaHeadless(
+ new_window = new LLWindowMesaHeadless(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
#elif LL_SDL
- new_window = new LLWindowSDL(
+ new_window = new LLWindowSDL(callbacks,
title, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_WINDOWS
- new_window = new LLWindowWin32(
+ new_window = new LLWindowWin32(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_DARWIN
- new_window = new LLWindowMacOSX(
+ new_window = new LLWindowMacOSX(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#endif
}
else
{
- new_window = new LLWindowHeadless(
+ new_window = new LLWindowHeadless(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
}
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 8361771b66..8602225108 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -39,52 +39,8 @@
#include "llcursortypes.h"
class LLSplashScreen;
-
-class LLWindow;
-
class LLPreeditor;
-
-class LLWindowCallbacks
-{
-public:
- virtual ~LLWindowCallbacks() {}
- virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
- virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask);
- virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
- virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask);
-
- virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual void handleMouseLeave(LLWindow *window);
- // return TRUE to allow window to close, which will then cause handleQuit to be called
- virtual BOOL handleCloseRequest(LLWindow *window);
- // window is about to be destroyed, clean up your business
- virtual void handleQuit(LLWindow *window);
- virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual BOOL handleActivate(LLWindow *window, BOOL activated);
- virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
- virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
- virtual void handleScrollWheel(LLWindow *window, S32 clicks);
- virtual void handleResize(LLWindow *window, S32 width, S32 height);
- virtual void handleFocus(LLWindow *window);
- virtual void handleFocusLost(LLWindow *window);
- virtual void handleMenuSelect(LLWindow *window, S32 menu_item);
- virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
- virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button
- virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while
- virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while
- virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
- virtual BOOL handleTimerEvent(LLWindow *window);
- virtual BOOL handleDeviceChange(LLWindow *window);
-
- virtual void handlePingWatchdog(LLWindow *window, const char * msg);
- virtual void handlePauseWatchdog(LLWindow *window);
- virtual void handleResumeWatchdog(LLWindow *window);
-
-};
+class LLWindowCallbacks;
// Refer to llwindow_test in test/common/llwindow for usage example
@@ -134,12 +90,12 @@ public:
// arrow/hour if busycount > 0.
virtual void incBusyCount();
virtual void decBusyCount();
- virtual void resetBusyCount() { mBusyCount = 0; }
- virtual S32 getBusyCount() const { return mBusyCount; }
+ virtual void resetBusyCount();
+ virtual S32 getBusyCount() const;
// Sets cursor, may set to arrow+hourglass
virtual void setCursor(ECursorType cursor) = 0;
- virtual ECursorType getCursor() const { return mCurrentCursor; }
+ virtual ECursorType getCursor() const;
virtual void captureMouse() = 0;
virtual void releaseMouse() = 0;
@@ -183,13 +139,12 @@ public:
virtual F32 getPixelAspectRatio() = 0;
virtual void setNativeAspectRatio(F32 aspect) = 0;
- void setCallbacks(LLWindowCallbacks *callbacks);
-
virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode)
virtual void afterDialog() {}; // undo whatever was done in beforeDialog()
-// opens system default color picker
- virtual BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b) { return FALSE; };
+ // opens system default color picker, modally
+ // Returns TRUE if valid color selected
+ virtual BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
// return a platform-specific window reference (HWND on Windows, WindowRef on the Mac, Gtk window on Linux)
virtual void *getPlatformWindow() = 0;
@@ -207,12 +162,12 @@ public:
static std::vector<std::string> getDynamicFallbackFontList();
protected:
- LLWindow(BOOL fullscreen, U32 flags);
- virtual ~LLWindow() {}
- virtual BOOL isValid() {return TRUE;}
- virtual BOOL canDelete() {return TRUE;}
-protected:
- static LLWindowCallbacks sDefaultCallbacks;
+ LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags);
+ virtual ~LLWindow();
+ // Defaults to true
+ virtual BOOL isValid();
+ // Defaults to true
+ virtual BOOL canDelete();
protected:
LLWindowCallbacks* mCallbacks;
@@ -294,18 +249,8 @@ const S32 OSBTN_CANCEL = 3;
class LLWindowManager
{
public:
- static LLWindow* createWindow(
- const std::string& title,
- const std::string& name,
- LLCoordScreen upper_left = LLCoordScreen(10, 10),
- LLCoordScreen size = LLCoordScreen(320, 240),
- U32 flags = 0,
- BOOL fullscreen = FALSE,
- BOOL clearBg = FALSE,
- BOOL disable_vsync = TRUE,
- BOOL use_gl = TRUE,
- BOOL ignore_pixel_depth = FALSE);
static LLWindow *createWindow(
+ LLWindowCallbacks* callbacks,
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
U32 flags = 0,
BOOL fullscreen = FALSE,
diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp
new file mode 100644
index 0000000000..72f9997149
--- /dev/null
+++ b/indra/llwindow/llwindowcallbacks.cpp
@@ -0,0 +1,201 @@
+/**
+ * @file llwindowcallbacks.cpp
+ * @brief OS event callback class
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llwindowcallbacks.h"
+
+#include "llcoord.h"
+
+//
+// LLWindowCallbacks
+//
+
+BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated)
+{
+ return FALSE;
+}
+
+
+BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level)
+{
+}
+
+BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask)
+{
+ return FALSE;
+}
+
+
+BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleMouseLeave(LLWindow *window)
+{
+ return;
+}
+
+BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window)
+{
+ //allow the window to close
+ return TRUE;
+}
+
+void LLWindowCallbacks::handleQuit(LLWindow *window)
+{
+}
+
+BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+}
+
+void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
+{
+}
+
+void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
+{
+}
+
+void LLWindowCallbacks::handleFocus(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleFocusLost(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item)
+{
+}
+
+BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y,
+ const S32 width, const S32 height)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handleWindowBlock(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleWindowUnblock(LLWindow *window)
+{
+}
+
+void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data)
+{
+}
+
+BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window)
+{
+ return FALSE;
+}
+
+BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
+{
+ return FALSE;
+}
+
+void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg)
+{
+
+}
+
+void LLWindowCallbacks::handlePauseWatchdog(LLWindow *window)
+{
+
+}
+
+void LLWindowCallbacks::handleResumeWatchdog(LLWindow *window)
+{
+
+}
+
+std::string LLWindowCallbacks::translateString(const char* tag)
+{
+ return std::string();
+}
+
+//virtual
+std::string LLWindowCallbacks::translateString(const char* tag,
+ const std::map<std::string, std::string>& args)
+{
+ return std::string();
+}
diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h
new file mode 100644
index 0000000000..abc66c42a2
--- /dev/null
+++ b/indra/llwindow/llwindowcallbacks.h
@@ -0,0 +1,85 @@
+/**
+ * @file llwindowcallbacks.h
+ * @brief OS event callback class
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#ifndef LLWINDOWCALLBACKS_H
+#define LLWINDOWCALLBACKS_H
+
+class LLCoordGL;
+class LLWindow;
+
+class LLWindowCallbacks
+{
+public:
+ virtual ~LLWindowCallbacks() {}
+ virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
+ virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask);
+ virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
+ virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask);
+
+ virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual void handleMouseLeave(LLWindow *window);
+ // return TRUE to allow window to close, which will then cause handleQuit to be called
+ virtual BOOL handleCloseRequest(LLWindow *window);
+ // window is about to be destroyed, clean up your business
+ virtual void handleQuit(LLWindow *window);
+ virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual BOOL handleActivate(LLWindow *window, BOOL activated);
+ virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
+ virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual void handleScrollWheel(LLWindow *window, S32 clicks);
+ virtual void handleResize(LLWindow *window, S32 width, S32 height);
+ virtual void handleFocus(LLWindow *window);
+ virtual void handleFocusLost(LLWindow *window);
+ virtual void handleMenuSelect(LLWindow *window, S32 menu_item);
+ virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
+ virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button
+ virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while
+ virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while
+ virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
+ virtual BOOL handleTimerEvent(LLWindow *window);
+ virtual BOOL handleDeviceChange(LLWindow *window);
+
+ virtual void handlePingWatchdog(LLWindow *window, const char * msg);
+ virtual void handlePauseWatchdog(LLWindow *window);
+ virtual void handleResumeWatchdog(LLWindow *window);
+
+ // Look up a localized string, usually for an error message
+ virtual std::string translateString(const char* tag);
+ virtual std::string translateString(const char* tag,
+ const std::map<std::string, std::string>& args);
+};
+
+
+#endif
diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp
index 3742846440..b4e9009321 100644
--- a/indra/llwindow/llwindowheadless.cpp
+++ b/indra/llwindow/llwindowheadless.cpp
@@ -38,10 +38,10 @@
//
// LLWindowHeadless
//
-LLWindowHeadless::LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
- U32 flags, BOOL fullscreen, BOOL clearBg,
+LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
+ U32 flags, BOOL fullscreen, BOOL clear_background,
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
- : LLWindow(fullscreen, flags)
+ : LLWindow(callbacks, fullscreen, flags)
{
}
diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h
index 4353d157b5..3cffd2bbf6 100644
--- a/indra/llwindow/llwindowheadless.h
+++ b/indra/llwindow/llwindowheadless.h
@@ -94,9 +94,12 @@ public:
/*virtual*/ void *getPlatformWindow() { return 0; };
/*virtual*/ void bringToFront() {};
- LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
- U32 flags, BOOL fullscreen, BOOL clearBg,
- BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
+ LLWindowHeadless(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name,
+ S32 x, S32 y,
+ S32 width, S32 height,
+ U32 flags, BOOL fullscreen, BOOL clear_background,
+ BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
virtual ~LLWindowHeadless();
private:
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 65a40dcef4..82dc5e4a13 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -32,19 +32,21 @@
#include "linden_common.h"
-#include <Carbon/Carbon.h>
-#include <OpenGL/OpenGL.h>
-
#include "llwindowmacosx.h"
+
#include "llkeyboardmacosx.h"
+#include "llwindowcallbacks.h"
+#include "llwindowmacosx-objc.h"
+#include "llpreeditor.h"
+
#include "llerror.h"
#include "llgl.h"
#include "llstring.h"
#include "lldir.h"
#include "indra_constants.h"
-#include "llwindowmacosx-objc.h"
-#include "llpreeditor.h"
+#include <Carbon/Carbon.h>
+#include <OpenGL/OpenGL.h>
extern BOOL gDebugWindowProc;
@@ -214,19 +216,27 @@ static LLWindowMacOSX *gWindowImplementation = NULL;
-LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
+LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
- : LLWindow(fullscreen, flags)
+ : LLWindow(NULL, fullscreen, flags)
{
+ // *HACK: During window construction we get lots of OS events for window
+ // reshape, activate, etc. that the viewer isn't ready to handle.
+ // Route them to a dummy callback structure until the end of constructor.
+ LLWindowCallbacks null_callbacks;
+ mCallbacks = &null_callbacks;
+
// Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm).
setupCocoa();
// Initialize the keyboard
gKeyboard = new LLKeyboardMacOSX();
+ gKeyboard->setCallbacks(callbacks);
// Ignore use_gl for now, only used for drones on PC
mWindow = NULL;
@@ -315,6 +325,7 @@ LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name
setCursor( UI_CURSOR_ARROW );
}
+ mCallbacks = callbacks;
stop_glerror();
}
@@ -3202,7 +3213,7 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url)
}
-BOOL LLWindowMacOSX::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
+BOOL LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b)
{
BOOL retval = FALSE;
OSErr error = noErr;
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 3886782732..17074080eb 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -35,6 +35,8 @@
#include "llwindow.h"
+#include "lltimer.h"
+
#include <Carbon/Carbon.h>
#include <AGL/agl.h>
@@ -103,7 +105,7 @@ public:
/*virtual*/ void beforeDialog();
/*virtual*/ void afterDialog();
- /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
+ /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
/*virtual*/ void *getPlatformWindow();
/*virtual*/ void *getMediaWindow();
@@ -116,7 +118,7 @@ public:
static std::vector<std::string> getDynamicFallbackFontList();
protected:
- LLWindowMacOSX(
+ LLWindowMacOSX(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,
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 24bd70d57f..3c203d9f5c 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -36,15 +36,16 @@
#include "linden_common.h"
#include "llwindowsdl.h"
+
+#include "llwindowcallbacks.h"
#include "llkeyboardsdl.h"
+
#include "llerror.h"
#include "llgl.h"
#include "llstring.h"
#include "lldir.h"
#include "llfindlocale.h"
-#include "indra_constants.h"
-
#if LL_GTK
extern "C" {
# include "gtk/gtk.h"
@@ -187,16 +188,19 @@ Display* LLWindowSDL::get_SDL_Display(void)
#endif // LL_X11
-LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width,
+LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
+ const std::string& title, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples)
- : LLWindow(fullscreen, flags), Lock_Display(NULL),
+ : LLWindow(callbacks, fullscreen, flags),
+ Lock_Display(NULL),
Unlock_Display(NULL), mGamma(1.0f)
{
// Initialize the keyboard
gKeyboard = new LLKeyboardSDL();
+ gKeyboard->setCallbacks(callbacks);
// Note that we can't set up key-repeat until after SDL has init'd video
// Ignore use_gl for now, only used for drones on PC
@@ -2229,7 +2233,7 @@ static void color_changed_callback(GtkWidget *widget,
gtk_color_selection_get_current_color(colorsel, colorp);
}
-BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
+BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
{
BOOL rtn = FALSE;
@@ -2306,7 +2310,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ
return 0;
}
-BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
+BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
{
return (FALSE);
}
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 632d8fc1fa..1e4dffd7a6 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -36,6 +36,7 @@
// Simple Directmedia Layer (http://libsdl.org/) implementation of LLWindow class
#include "llwindow.h"
+#include "lltimer.h"
#include "SDL/SDL.h"
#include "SDL/SDL_endian.h"
@@ -118,7 +119,7 @@ public:
/*virtual*/ void beforeDialog();
/*virtual*/ void afterDialog();
- /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
+ /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
/*virtual*/ void *getPlatformWindow();
/*virtual*/ void bringToFront();
@@ -147,7 +148,7 @@ public:
#endif // LL_X11
protected:
- LLWindowSDL(
+ 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);
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 6280868dfb..b60740c7e4 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -36,6 +36,17 @@
#include "llwindowwin32.h"
+// LLWindow library includes
+#include "llkeyboardwin32.h"
+#include "llpreeditor.h"
+#include "llwindowcallbacks.h"
+
+// Linden library includes
+#include "llerror.h"
+#include "llgl.h"
+#include "llstring.h"
+
+// System includes
#include <commdlg.h>
#include <WinUser.h>
#include <mapi.h>
@@ -49,16 +60,6 @@
#include <dinput.h>
#include <Dbt.h.>
-#include "llkeyboardwin32.h"
-#include "llerror.h"
-#include "llgl.h"
-#include "llstring.h"
-#include "lldir.h"
-
-#include "indra_constants.h"
-
-#include "llpreeditor.h"
-
// culled from winuser.h
#ifndef WM_MOUSEWHEEL /* Added to be compatible with later SDK's */
const S32 WM_MOUSEWHEEL = 0x020A;
@@ -358,13 +359,14 @@ LLWinImm::~LLWinImm()
}
-LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
+LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
+ const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples)
- : LLWindow(fullscreen, flags)
+ : LLWindow(callbacks, fullscreen, flags)
{
mFSAASamples = fsaa_samples;
mIconResource = gIconResource;
@@ -378,6 +380,7 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
// Initialize the keyboard
gKeyboard = new LLKeyboardWin32();
+ gKeyboard->setCallbacks(callbacks);
// Initialize (boot strap) the Language text input management,
// based on the system's (user's) default settings.
@@ -481,7 +484,8 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
if (!RegisterClass(&wc))
{
- OSMessageBox("RegisterClass failed", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBRegClassFailed"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return;
}
sIsClassRegistered = TRUE;
@@ -572,8 +576,11 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
mFullscreenBits = -1;
mFullscreenRefresh = -1;
- std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
- OSMessageBox(error, "Error", OSMB_OK);
+ std::map<std::string,std::string> args;
+ args["[WIDTH]"] = llformat("%d", width);
+ args["[HEIGHT]"] = llformat ("%d", height);
+ OSMessageBox(mCallbacks->translateString("MBFullScreenErr", args),
+ mCallbacks->translateString("MBError"), OSMB_OK);
}
}
@@ -712,7 +719,9 @@ void LLWindowWin32::close()
// This causes WM_DESTROY to be sent *immediately*
if (!DestroyWindow(mWindowHandle))
{
- OSMessageBox("DestroyWindow(mWindowHandle) failed", "Shutdown Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"),
+ mCallbacks->translateString("MBShutdownErr"),
+ OSMB_OK);
}
mWindowHandle = NULL;
@@ -1015,14 +1024,16 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
if (!(mhDC = GetDC(mWindowHandle)))
{
close();
- OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBDevContextErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd)))
{
close();
- OSMessageBox("Can't find suitable pixel format", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
@@ -1031,57 +1042,48 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
&pfd))
{
close();
- OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (pfd.cColorBits < 32)
{
close();
- OSMessageBox(
- "Second Life requires True Color (32-bit) to run in a window.\n"
- "Please go to Control Panels -> Display -> Settings and\n"
- "set the screen to 32-bit color.\n"
- "Alternately, if you choose to run fullscreen, Second Life\n"
- "will automatically adjust the screen each time it runs.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (pfd.cAlphaBits < 8)
{
close();
- OSMessageBox(
- "Second Life is unable to run because it can't get an 8 bit alpha\n"
- "channel. Usually this is due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "Also be sure your monitor is set to True Color (32-bit) in\n"
- "Control Panels -> Display -> Settings.\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBAlpha"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!SetPixelFormat(mhDC, pixel_format, &pfd))
{
close();
- OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!(mhRC = wglCreateContext(mhDC)))
{
close();
- OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!wglMakeCurrent(mhDC, mhRC))
{
close();
- OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextActErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
@@ -1243,14 +1245,15 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
if (!(mhDC = GetDC(mWindowHandle)))
{
close();
- OSMessageBox("Can't make GL device context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!SetPixelFormat(mhDC, pixel_format, &pfd))
{
close();
- OSMessageBox("Can't set pixel format", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"),
+ mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
@@ -1287,7 +1290,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
&pfd))
{
close();
- OSMessageBox("Can't get pixel format description", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
@@ -1300,57 +1303,35 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32)
{
close();
- OSMessageBox(
- "Second Life requires True Color (32-bit) to run in a window.\n"
- "Please go to Control Panels -> Display -> Settings and\n"
- "set the screen to 32-bit color.\n"
- "Alternately, if you choose to run fullscreen, Second Life\n"
- "will automatically adjust the screen each time it runs.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (pfd.cAlphaBits < 8)
{
close();
- OSMessageBox(
- "Second Life is unable to run because it can't get an 8 bit alpha\n"
- "channel. Usually this is due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "Also be sure your monitor is set to True Color (32-bit) in\n"
- "Control Panels -> Display -> Settings.\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBAlpha"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!(mhRC = wglCreateContext(mhDC)))
{
close();
- OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!wglMakeCurrent(mhDC, mhRC))
{
close();
- OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
if (!gGLManager.initGL())
{
close();
- OSMessageBox(
- "Second Life is unable to run because your video card drivers\n"
- "did not install properly, are out of date, or are for unsupported\n"
- "hardware. Please make sure you have the latest video card drivers\n"
- "and even if you do have the latest, try reinstalling them.\n\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
+ OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
return FALSE;
}
@@ -3030,7 +3011,7 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url )
}
-BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b )
+BOOL LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b )
{
BOOL retval = FALSE;
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 237f834318..e14324c9f1 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -100,7 +100,7 @@ public:
/*virtual*/ F32 getPixelAspectRatio();
/*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
- /*virtual*/ BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b );
+ /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b );
/*virtual*/ void *getPlatformWindow();
/*virtual*/ void bringToFront();
@@ -115,7 +115,7 @@ public:
static std::vector<std::string> getDynamicFallbackFontList();
protected:
- LLWindowWin32(
+ 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);