summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerwindow.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerwindow.h')
-rw-r--r--indra/newview/llviewerwindow.h207
1 files changed, 107 insertions, 100 deletions
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index eae1bf0343..21507699b0 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -2,31 +2,25 @@
* @file llviewerwindow.h
* @brief Description of the LLViewerWindow class.
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* 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
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * 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
+ * This library 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
+ * Lesser General Public License for more details.
*
- * 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.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -47,9 +41,15 @@
#include "llwindowcallbacks.h"
#include "lltimer.h"
#include "llstat.h"
-#include "llnotifications.h"
#include "llmousehandler.h"
#include "llcursortypes.h"
+#include "llhandle.h"
+#include "llimage.h"
+
+#include <boost/function.hpp>
+#include <boost/signals2.hpp>
+#include <boost/scoped_ptr.hpp>
+
class LLView;
class LLViewerObject;
@@ -57,11 +57,13 @@ class LLUUID;
class LLProgressView;
class LLTool;
class LLVelocityBar;
-class LLTextBox;
+class LLPanel;
class LLImageRaw;
class LLHUDIcon;
class LLWindow;
class LLRootView;
+class LLViewerWindowListener;
+class LLPopupView;
#define PICK_HALF_WIDTH 5
#define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1)
@@ -69,32 +71,31 @@ class LLRootView;
class LLPickInfo
{
public:
+ typedef enum
+ {
+ PICK_OBJECT,
+ PICK_FLORA,
+ PICK_LAND,
+ PICK_ICON,
+ PICK_PARCEL_WALL,
+ PICK_INVALID
+ } EPickType;
+
+public:
LLPickInfo();
LLPickInfo(const LLCoordGL& mouse_pos,
- const LLRect& screen_region,
MASK keyboard_mask,
BOOL pick_transparent,
BOOL pick_surface_info,
void (*pick_callback)(const LLPickInfo& pick_info));
- ~LLPickInfo();
void fetchResults();
LLPointer<LLViewerObject> getObject() const;
LLUUID getObjectID() const { return mObjectID; }
- void drawPickBuffer() const;
+ bool isValid() const { return mPickType != PICK_INVALID; }
static bool isFlora(LLViewerObject* object);
- typedef enum
- {
- PICK_OBJECT,
- PICK_FLORA,
- PICK_LAND,
- PICK_ICON,
- PICK_PARCEL_WALL,
- PICK_INVALID
- } EPickType;
-
public:
LLCoordGL mMousePt;
MASK mKeyMask;
@@ -114,16 +115,12 @@ public:
LLVector3 mNormal;
LLVector3 mBinormal;
BOOL mPickTransparent;
- LLRect mScreenRegion;
void getSurfaceInfo();
private:
void updateXYCoords();
BOOL mWantSurfaceInfo; // do we populate mUVCoord, mNormal, mBinormal?
- U8 mPickBuffer[PICK_DIAMETER * PICK_DIAMETER * 4];
- F32 mPickDepthBuffer[PICK_DIAMETER * PICK_DIAMETER];
- BOOL mPickParcelWall;
};
@@ -147,6 +144,8 @@ public:
void adjustControlRectanglesForFirstUse(const LLRect& window);
void initWorldUI();
+ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
+
//
// LLWindowCallback interface implementation
//
@@ -154,7 +153,6 @@ public:
/*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); // NOT going to handle extended
- /*virtual*/ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
/*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ BOOL handleCloseRequest(LLWindow *window);
@@ -163,7 +161,8 @@ public:
/*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*/ void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
+ /*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data);
+ void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ void handleMouseLeave(LLWindow *window);
/*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y);
/*virtual*/ void handleFocus(LLWindow *window);
@@ -186,27 +185,42 @@ public:
/*virtual*/ std::string translateString(const char* tag);
/*virtual*/ std::string translateString(const char* tag,
const std::map<std::string, std::string>& args);
+
+ // signal on bottom tray width changed
+ typedef boost::function<void (void)> bottom_tray_callback_t;
+ typedef boost::signals2::signal<void (void)> bottom_tray_signal_t;
+ bottom_tray_signal_t mOnBottomTrayWidthChanged;
+ boost::signals2::connection setOnBottomTrayWidthChanged(bottom_tray_callback_t cb) { return mOnBottomTrayWidthChanged.connect(cb); }
+ // signal on update of WorldView rect
+ typedef boost::function<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_callback_t;
+ typedef boost::signals2::signal<void (LLRect old_world_rect, LLRect new_world_rect)> world_rect_signal_t;
+ world_rect_signal_t mOnWorldViewRectUpdated;
+ boost::signals2::connection setOnWorldViewRectUpdated(world_rect_callback_t cb) { return mOnWorldViewRectUpdated.connect(cb); }
//
// ACCESSORS
//
LLRootView* getRootView() const;
+ // 3D world area in scaled pixels (via UI scale), use for most UI computations
+ LLRect getWorldViewRectScaled() const;
+ S32 getWorldViewHeightScaled() const;
+ S32 getWorldViewWidthScaled() const;
+
+ // 3D world area, in raw unscaled pixels
+ LLRect getWorldViewRectRaw() const { return mWorldViewRectRaw; }
+ S32 getWorldViewHeightRaw() const;
+ S32 getWorldViewWidthRaw() const;
+
+ // Window in scaled pixels (via UI scale), use for most UI computations
+ LLRect getWindowRectScaled() const { return mWindowRectScaled; }
+ S32 getWindowHeightScaled() const;
+ S32 getWindowWidthScaled() const;
+
// Window in raw pixels as seen on screen.
- const LLRect& getWindowRect() const { return mWindowRect; };
- // portion of window that shows 3d world
- const LLRect& getWorldViewRect() const { return mWorldViewRect; };
- LLRect getVirtualWorldViewRect() const;
- S32 getWorldViewHeight() const;
- S32 getWorldViewWidth() const;
- S32 getWindowDisplayHeight() const;
- S32 getWindowDisplayWidth() const;
-
- // Window in scaled pixels (via UI scale), use this for
- // UI elements checking size.
- const LLRect& getVirtualWindowRect() const { return mVirtualWindowRect; };
- S32 getWindowHeight() const;
- S32 getWindowWidth() const;
+ LLRect getWindowRectRaw() const { return mWindowRectRaw; }
+ S32 getWindowHeightRaw() const;
+ S32 getWindowWidthRaw() const;
LLWindow* getWindow() const { return mWindow; }
void* getPlatformWindow() const;
@@ -228,7 +242,6 @@ public:
BOOL getRightMouseDown() const { return mRightMouseDown; }
const LLPickInfo& getLastPick() const { return mLastPick; }
- const LLPickInfo& getHoverPick() const { return mHoverPick; }
void setup2DViewport(S32 x_offset = 0, S32 y_offset = 0);
void setup3DViewport(S32 x_offset = 0, S32 y_offset = 0);
@@ -243,10 +256,6 @@ public:
// Is window of our application frontmost?
BOOL getActive() const { return mActive; }
- void getTargetWindow(BOOL& fullscreen, S32& width, S32& height) const;
- // The 'target' is where the user wants the window to be. It may not be
- // there yet, because we may be supressing fullscreen prior to login.
-
const std::string& getInitAlert() { return mInitAlert; }
//
@@ -268,7 +277,6 @@ public:
void setProgressMessage(const std::string& msg);
void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null );
LLProgressView *getProgressView() const;
- void handleLoginComplete();
void updateObjectUnderCursor();
@@ -276,13 +284,18 @@ public:
void updateLayout();
void updateMouseDelta();
void updateKeyboardFocus();
- void updatePicking(S32 x, S32 y, MASK mask);
-
- void updateWorldViewRect();
+ void updateWorldViewRect(bool use_full_window=false);
+ LLView* getNonSideTrayView() { return mNonSideTrayView.get(); }
+ LLView* getFloaterViewHolder() { return mFloaterViewHolder.get(); }
BOOL handleKey(KEY key, MASK mask);
void handleScrollWheel (S32 clicks);
+ // add and remove views from "popup" layer
+ void addPopup(LLView* popup);
+ void removePopup(LLView* popup);
+ void clearPopups();
+
// Hide normal UI when a logon fails, re-show everything when logon is attempted again
void setNormalControlsVisible( BOOL visible );
void setMenuBackgroundColor(bool god_mode = false, bool dev_grid = false);
@@ -308,7 +321,7 @@ public:
} ESnapshotType;
BOOL saveSnapshot(const std::string& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR);
BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,
- BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_IMAGE_SIZE );
+ BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_SNAPSHOT_IMAGE_SIZE );
BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ;
BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); }
void resetSnapshotLoc() const { sSnapshotDir.clear(); }
@@ -325,12 +338,8 @@ public:
void performPick();
void returnEmptyPicks();
-
- void pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& pick_info),
- BOOL pick_transparent = FALSE, BOOL get_surface_info = FALSE);
+ void pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& pick_info), BOOL pick_transparent = FALSE);
LLPickInfo pickImmediate(S32 x, S32 y, BOOL pick_transparent);
- static void hoverPickCallback(const LLPickInfo& pick_info);
-
LLHUDIcon* cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 depth,
LLVector3* intersection);
@@ -361,27 +370,21 @@ public:
// Prints window implementation details
void dumpState();
- // Request display setting changes
- void toggleFullscreen(BOOL show_progress);
-
// handle shutting down GL and bringing it back up
- void requestResolutionUpdate(bool fullscreen_checked);
- void requestResolutionUpdate(); // doesn't affect fullscreen
- BOOL checkSettings();
+ void requestResolutionUpdate();
+ void checkSettings();
void restartDisplay(BOOL show_progress_bar);
- BOOL changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar);
+ BOOL changeDisplaySettings(LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar);
BOOL getIgnoreDestroyWindow() { return mIgnoreActivate; }
- F32 getDisplayAspectRatio() const;
F32 getWorldViewAspectRatio() const;
const LLVector2& getDisplayScale() const { return mDisplayScale; }
void calcDisplayScale();
-
- void drawPickBuffer() const;
+ static LLRect calcScaledRect(const LLRect & rect, const LLVector2& display_scale);
private:
bool shouldShowToolTipFor(LLMouseHandler *mh);
static bool onAlert(const LLSD& notify);
-
+
void switchToolByMask(MASK mask);
void destroyWindow();
void drawMouselookInstructions();
@@ -397,12 +400,12 @@ public:
protected:
BOOL mActive;
- BOOL mWantFullscreen;
- BOOL mShowFullscreenProgress;
- LLRect mWindowRect;
- LLRect mVirtualWindowRect;
- LLRect mWorldViewRect; // specifies area of screen where we render the 3D world
- LLRootView* mRootView; // a view of size mWindowRect, containing all child views
+
+ LLRect mWindowRectRaw; // whole window, including UI
+ LLRect mWindowRectScaled; // whole window, scaled by UI size
+ LLRect mWorldViewRectRaw; // area of screen for 3D world
+ LLRect mWorldViewRectScaled; // area of screen for 3D world scaled by UI size
+ LLRootView* mRootView; // a view of size mWindowRectRaw, containing all child views
LLVector2 mDisplayScale;
LLCoordGL mCurrentMousePoint; // last mouse position in GL coords
@@ -415,8 +418,9 @@ protected:
LLProgressView *mProgressView;
- LLTextBox* mToolTip;
- BOOL mToolTipBlocked; // True after a key press or a mouse button event. False once the mouse moves again.
+ LLFrameTimer mToolTipFadeTimer;
+ LLPanel* mToolTip;
+ std::string mLastToolTipMessage;
LLRect mToolTipStickyRect; // Once a tool tip is shown, it will stay visible until the mouse leaves this rect.
BOOL mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse.
@@ -427,12 +431,9 @@ protected:
// Variables used for tool override switching based on modifier keys. JC
MASK mLastMask; // used to detect changes in modifier mask
LLTool* mToolStored; // the tool we're overriding
- BOOL mSuppressToolbox; // sometimes hide the toolbox, despite
- // having a camera tool selected
BOOL mHideCursorPermanent; // true during drags, mouselook
BOOL mCursorHidden;
LLPickInfo mLastPick;
- LLPickInfo mHoverPick;
std::vector<LLPickInfo> mPicks;
LLRect mPickScreenRegion; // area of frame buffer for rendering pick frames (generally follows mouse to avoid going offscreen)
LLTimer mPickTimer; // timer for scheduling n picks per second
@@ -442,20 +443,30 @@ protected:
BOOL mIgnoreActivate;
std::string mInitAlert; // Window / GL initialization requires an alert
+
+ LLHandle<LLView> mWorldViewPlaceholder; // widget that spans the portion of screen dedicated to rendering the 3d world
+ LLHandle<LLView> mNonSideTrayView; // parent of world view + bottom bar, etc...everything but the side tray
+ LLHandle<LLView> mFloaterViewHolder; // container for floater_view
+ LLPopupView* mPopupView; // container for transient popups
class LLDebugText* mDebugText; // Internal class for debug text
bool mResDirty;
bool mStatesDirty;
- bool mIsFullscreenChecked; // Did the user check the fullscreen checkbox in the display settings
U32 mCurrResolutionIndex;
+ boost::scoped_ptr<LLViewerWindowListener> mViewerWindowListener;
+
protected:
static std::string sSnapshotBaseName;
static std::string sSnapshotDir;
static std::string sMovieBaseName;
-};
+
+private:
+ // Object temporarily hovered over while dragging
+ LLPointer<LLViewerObject> mDragHoveredObject;
+};
void toggle_flying(void*);
void toggle_first_person();
@@ -469,13 +480,9 @@ void update_saved_window_size(const std::string& control,S32 delta_width, S32 de
extern LLViewerWindow* gViewerWindow;
-extern LLFrameTimer gMouseIdleTimer; // how long has it been since the mouse last moved?
extern LLFrameTimer gAwayTimer; // tracks time before setting the avatar away state to true
extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away
-extern BOOL gDebugSelect;
-
-extern BOOL gDebugFastUIRender;
extern LLViewerObject* gDebugRaycastObject;
extern LLVector3 gDebugRaycastIntersection;
extern LLVector2 gDebugRaycastTexCoord;
@@ -487,7 +494,7 @@ extern S32 CHAT_BAR_HEIGHT;
extern BOOL gDisplayCameraPos;
extern BOOL gDisplayWindInfo;
-extern BOOL gDisplayNearestWater;
extern BOOL gDisplayFOV;
+extern BOOL gDisplayBadge;
#endif