aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerwindow.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewerwindow.h')
-rw-r--r--linden/indra/newview/llviewerwindow.h238
1 files changed, 141 insertions, 97 deletions
diff --git a/linden/indra/newview/llviewerwindow.h b/linden/indra/newview/llviewerwindow.h
index da5fa4e..21df0d5 100644
--- a/linden/indra/newview/llviewerwindow.h
+++ b/linden/indra/newview/llviewerwindow.h
@@ -51,14 +51,77 @@
51class LLView; 51class LLView;
52class LLViewerObject; 52class LLViewerObject;
53class LLUUID; 53class LLUUID;
54class LLMouseHandler;
55class LLProgressView; 54class LLProgressView;
56class LLTool; 55class LLTool;
57class LLVelocityBar; 56class LLVelocityBar;
58class LLViewerWindow;
59class LLTextBox; 57class LLTextBox;
60class LLImageRaw; 58class LLImageRaw;
61class LLHUDIcon; 59class LLHUDIcon;
60class LLMouseHandler;
61
62#define PICK_HALF_WIDTH 5
63#define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1)
64
65class LLPickInfo
66{
67public:
68 LLPickInfo();
69 LLPickInfo(const LLCoordGL& mouse_pos,
70 const LLRect& screen_region,
71 MASK keyboard_mask,
72 BOOL pick_transparent,
73 BOOL pick_surface_info,
74 void (*pick_callback)(const LLPickInfo& pick_info));
75 ~LLPickInfo();
76
77 void fetchResults();
78 LLPointer<LLViewerObject> getObject() const;
79 LLUUID getObjectID() const { return mObjectID; }
80 void drawPickBuffer() const;
81
82 static bool isFlora(LLViewerObject* object);
83
84 typedef enum e_pick_type
85 {
86 PICK_OBJECT,
87 PICK_FLORA,
88 PICK_LAND,
89 PICK_ICON,
90 PICK_PARCEL_WALL,
91 PICK_INVALID
92 } EPickType;
93
94public:
95 LLCoordGL mMousePt;
96 MASK mKeyMask;
97 void (*mPickCallback)(const LLPickInfo& pick_info);
98
99 EPickType mPickType;
100 LLCoordGL mPickPt;
101 LLVector3d mPosGlobal;
102 LLVector3 mObjectOffset;
103 LLUUID mObjectID;
104 S32 mObjectFace;
105 LLHUDIcon* mHUDIcon;
106 LLVector3 mIntersection;
107 LLVector2 mUVCoords;
108 LLVector2 mSTCoords;
109 LLCoordScreen mXYCoords;
110 LLVector3 mNormal;
111 LLVector3 mBinormal;
112 BOOL mPickTransparent;
113 LLRect mScreenRegion;
114 void getSurfaceInfo();
115
116private:
117 void updateXYCoords();
118
119 BOOL mWantSurfaceInfo; // do we populate mUVCoord, mNormal, mBinormal?
120 U8 mPickBuffer[PICK_DIAMETER * PICK_DIAMETER * 4];
121 F32 mPickDepthBuffer[PICK_DIAMETER * PICK_DIAMETER];
122 BOOL mPickParcelWall;
123
124};
62 125
63#define MAX_IMAGE_SIZE 6144 //6 * 1024, max snapshot image size 6144 * 6144 126#define MAX_IMAGE_SIZE 6144 //6 * 1024, max snapshot image size 6144 * 6144
64 127
@@ -68,12 +131,16 @@ public:
68 // 131 //
69 // CREATORS 132 // CREATORS
70 // 133 //
71 LLViewerWindow(char* title, char* name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth); 134 LLViewerWindow(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth);
72 virtual ~LLViewerWindow(); 135 virtual ~LLViewerWindow();
73 136
137 void shutdownViews();
138 void shutdownGL();
139
74 void initGLDefaults(); 140 void initGLDefaults();
75 void initBase(); 141 void initBase();
76 void adjustRectanglesForFirstUse(const LLRect& full_window); 142 void adjustRectanglesForFirstUse(const LLRect& window);
143 void adjustControlRectanglesForFirstUse(const LLRect& window);
77 void initWorldUI(); 144 void initWorldUI();
78 145
79 // 146 //
@@ -108,6 +175,9 @@ public:
108 /*virtual*/ BOOL handleTimerEvent(LLWindow *window); 175 /*virtual*/ BOOL handleTimerEvent(LLWindow *window);
109 /*virtual*/ BOOL handleDeviceChange(LLWindow *window); 176 /*virtual*/ BOOL handleDeviceChange(LLWindow *window);
110 177
178 /*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg);
179 /*virtual*/ void handlePauseWatchdog(LLWindow *window);
180 /*virtual*/ void handleResumeWatchdog(LLWindow *window);
111 181
112 182
113 // 183 //
@@ -128,6 +198,7 @@ public:
128 198
129 LLWindow* getWindow() const { return mWindow; } 199 LLWindow* getWindow() const { return mWindow; }
130 void* getPlatformWindow() const { return mWindow->getPlatformWindow(); } 200 void* getPlatformWindow() const { return mWindow->getPlatformWindow(); }
201 void* getMediaWindow() const { return mWindow->getMediaWindow(); }
131 void focusClient() const { return mWindow->focusClient(); }; 202 void focusClient() const { return mWindow->focusClient(); };
132 203
133 LLCoordGL getLastMouse() const { return mLastMousePoint; } 204 LLCoordGL getLastMouse() const { return mLastMousePoint; }
@@ -143,17 +214,17 @@ public:
143 BOOL getLeftMouseDown() const { return mLeftMouseDown; } 214 BOOL getLeftMouseDown() const { return mLeftMouseDown; }
144 BOOL getRightMouseDown() const { return mRightMouseDown; } 215 BOOL getRightMouseDown() const { return mRightMouseDown; }
145 216
146 LLUICtrl* getTopCtrl() const; 217 const LLPickInfo& getLastPick() const { return mLastPick; }
147 BOOL hasTopCtrl(LLView* view) const; 218 const LLPickInfo& getHoverPick() const { return mHoverPick; }
148 219
149 void setupViewport(S32 x_offset = 0, S32 y_offset = 0); 220 void setupViewport(S32 x_offset = 0, S32 y_offset = 0);
150 void setup3DRender(); 221 void setup3DRender();
151 void setup2DRender(); 222 void setup2DRender();
152 223
153 BOOL isPickPending() { return mPickPending; }
154
155 LLVector3 mouseDirectionGlobal(const S32 x, const S32 y) const; 224 LLVector3 mouseDirectionGlobal(const S32 x, const S32 y) const;
156 LLVector3 mouseDirectionCamera(const S32 x, const S32 y) const; 225 LLVector3 mouseDirectionCamera(const S32 x, const S32 y) const;
226 LLVector3 mousePointHUD(const S32 x, const S32 y) const;
227
157 228
158 // Is window of our application frontmost? 229 // Is window of our application frontmost?
159 BOOL getActive() const { return mActive; } 230 BOOL getActive() const { return mActive; }
@@ -162,7 +233,7 @@ public:
162 // The 'target' is where the user wants the window to be. It may not be 233 // The 'target' is where the user wants the window to be. It may not be
163 // there yet, because we may be supressing fullscreen prior to login. 234 // there yet, because we may be supressing fullscreen prior to login.
164 235
165 const LLString& getInitAlert() { return mInitAlert; } 236 const std::string& getInitAlert() { return mInitAlert; }
166 237
167 // 238 //
168 // MANIPULATORS 239 // MANIPULATORS
@@ -172,15 +243,16 @@ public:
172 void setCursor( ECursorType c ); 243 void setCursor( ECursorType c );
173 void showCursor(); 244 void showCursor();
174 void hideCursor(); 245 void hideCursor();
246 BOOL getCursorHidden() { return mCursorHidden; }
175 void moveCursorToCenter(); // move to center of window 247 void moveCursorToCenter(); // move to center of window
176 248
177 void setShowProgress(const BOOL show); 249 void setShowProgress(const BOOL show);
178 BOOL getShowProgress() const; 250 BOOL getShowProgress() const;
179 void moveProgressViewToFront(); 251 void moveProgressViewToFront();
180 void setProgressString(const LLString& string); 252 void setProgressString(const std::string& string);
181 void setProgressPercent(const F32 percent); 253 void setProgressPercent(const F32 percent);
182 void setProgressMessage(const LLString& msg); 254 void setProgressMessage(const std::string& msg);
183 void setProgressCancelButtonVisible( BOOL b, const LLString& label ); 255 void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null );
184 LLProgressView *getProgressView() const; 256 LLProgressView *getProgressView() const;
185 257
186 void updateObjectUnderCursor(); 258 void updateObjectUnderCursor();
@@ -192,26 +264,12 @@ public:
192 264
193 // Hide normal UI when a logon fails, re-show everything when logon is attempted again 265 // Hide normal UI when a logon fails, re-show everything when logon is attempted again
194 void setNormalControlsVisible( BOOL visible ); 266 void setNormalControlsVisible( BOOL visible );
195 void setMenuBackgroundColor(bool god_mode = false, bool dev_grid = false); 267 void setMenuBackgroundColor(bool god_mode = false, bool dev_grid = false);
196
197 // Handle the application becoming active (frontmost) or inactive
198 //BOOL handleActivate(BOOL activate);
199
200 void setKeyboardFocus(LLUICtrl* new_focus); // new_focus = NULL to release the focus.
201 LLUICtrl* getKeyboardFocus();
202 BOOL hasKeyboardFocus( const LLUICtrl* possible_focus ) const;
203 BOOL childHasKeyboardFocus( const LLView* parent ) const;
204
205 void setMouseCapture(LLMouseHandler* new_captor); // new_captor = NULL to release the mouse.
206 LLMouseHandler* getMouseCaptor() const;
207
208 void setTopCtrl(LLUICtrl* new_top); // set new_top = NULL to release top_view.
209 268
210 void reshape(S32 width, S32 height); 269 void reshape(S32 width, S32 height);
211 void sendShapeToSim(); 270 void sendShapeToSim();
212 271
213 void draw(); 272 void draw();
214// void drawSelectedObjects();
215 void updateDebugText(); 273 void updateDebugText();
216 void drawDebugText(); 274 void drawDebugText();
217 275
@@ -219,39 +277,55 @@ public:
219 277
220 static void movieSize(S32 new_width, S32 new_height); 278 static void movieSize(S32 new_width, S32 new_height);
221 279
280 // snapshot functionality.
281 // perhaps some of this should move to llfloatershapshot? -MG
222 typedef enum e_snapshot_type 282 typedef enum e_snapshot_type
223 { 283 {
224 SNAPSHOT_TYPE_COLOR, 284 SNAPSHOT_TYPE_COLOR,
225 SNAPSHOT_TYPE_DEPTH, 285 SNAPSHOT_TYPE_DEPTH,
226 SNAPSHOT_TYPE_OBJECT_ID 286 SNAPSHOT_TYPE_OBJECT_ID
227 } ESnapshotType; 287 } ESnapshotType;
228 288 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);
229 BOOL saveSnapshot(const LLString& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR);
230 BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE, 289 BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,
231 BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_IMAGE_SIZE ); 290 BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_IMAGE_SIZE );
232 BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ; 291 BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ;
233 BOOL saveImageNumbered(LLImageRaw *raw, const LLString& extension = LLString()); 292 BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); }
293 void resetSnapshotLoc() const { sSnapshotDir.clear(); }
294 BOOL saveImageNumbered(LLImageFormatted *image);
295
296 // Reset the directory where snapshots are saved.
297 // Client will open directory picker on next snapshot save.
298 void resetSnapshotLoc();
234 299
235 void playSnapshotAnimAndSound(); 300 void playSnapshotAnimAndSound();
236 301
237 // draws selection boxes around selected objects, must call displayObjects first 302 // draws selection boxes around selected objects, must call displayObjects first
238 void renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud ); 303 void renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud );
239 void performPick(); 304 void performPick();
305 void returnEmptyPicks();
240 306
241 void hitObjectOrLandGlobalAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(S32 x, S32 y, MASK mask), BOOL pick_transparent = FALSE, BOOL pick_parcel_walls = FALSE);
242 void hitObjectOrLandGlobalImmediate(S32 x, S32 y, void (*callback)(S32 x, S32 y, MASK mask), BOOL pick_transparent);
243
244 void hitUIElementAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(S32 x, S32 y, MASK mask));
245 void hitUIElementImmediate(S32 x, S32 y, void (*callback)(S32 x, S32 y, MASK mask));
246 307
247 LLViewerObject* getObjectUnderCursor(const F32 depth = 16.0f); 308 void pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& pick_info),
309 BOOL pick_transparent = FALSE, BOOL get_surface_info = FALSE);
310 LLPickInfo pickImmediate(S32 x, S32 y, BOOL pick_transparent);
311 static void hoverPickCallback(const LLPickInfo& pick_info);
312
313 LLViewerObject* cursorIntersect(S32 mouse_x = -1, S32 mouse_y = -1, F32 depth = 512.f,
314 LLViewerObject *this_object = NULL,
315 S32 this_face = -1,
316 S32* face_hit = NULL,
317 LLVector3 *intersection = NULL,
318 LLVector2 *uv = NULL,
319 LLVector3 *normal = NULL,
320 LLVector3 *binormal = NULL);
321
248 322
249 // Returns a pointer to the last object hit 323 // Returns a pointer to the last object hit
250 LLViewerObject *lastObjectHit(); 324 //LLViewerObject *getObject();
251 LLViewerObject *lastNonFloraObjectHit(); 325 //LLViewerObject *lastNonFloraObjectHit();
252 326
253 const LLVector3d& lastObjectHitOffset(); 327 //const LLVector3d& getObjectOffset();
254 const LLVector3d& lastNonFloraObjectHitOffset(); 328 //const LLVector3d& lastNonFloraObjectHitOffset();
255 329
256 // mousePointOnLand() returns true if found point 330 // mousePointOnLand() returns true if found point
257 BOOL mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global); 331 BOOL mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global);
@@ -278,42 +352,27 @@ public:
278 352
279 LLAlertDialog* alertXml(const std::string& xml_filename, 353 LLAlertDialog* alertXml(const std::string& xml_filename,
280 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL); 354 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL);
281 LLAlertDialog* alertXml(const std::string& xml_filename, const LLString::format_map_t& args, 355 LLAlertDialog* alertXml(const std::string& xml_filename, const LLStringUtil::format_map_t& args,
282 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL); 356 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL);
283 LLAlertDialog* alertXmlEditText(const std::string& xml_filename, const LLString::format_map_t& args, 357 LLAlertDialog* alertXmlEditText(const std::string& xml_filename, const LLStringUtil::format_map_t& args,
284 LLAlertDialog::alert_callback_t callback, void* user_data, 358 LLAlertDialog::alert_callback_t callback, void* user_data,
285 LLAlertDialog::alert_text_callback_t text_callback, void *text_data, 359 LLAlertDialog::alert_text_callback_t text_callback, void *text_data,
286 const LLString::format_map_t& edit_args = LLString::format_map_t(), 360 const LLStringUtil::format_map_t& edit_args = LLStringUtil::format_map_t(),
287 BOOL draw_asterixes = FALSE); 361 BOOL draw_asterixes = FALSE);
288 362
289 static bool alertCallback(S32 modal); 363 static bool alertCallback(S32 modal);
290 364
291#ifdef SABINRIG
292 //Silly rig stuff
293 void printFeedback(); //RIG STUFF!
294#endif //SABINRIG
295
296private: 365private:
366 bool shouldShowToolTipFor(LLMouseHandler *mh);
297 void switchToolByMask(MASK mask); 367 void switchToolByMask(MASK mask);
298 void destroyWindow(); 368 void destroyWindow();
299 void drawMouselookInstructions(); 369 void drawMouselookInstructions();
300 void stopGL(BOOL save_state = TRUE); 370 void stopGL(BOOL save_state = TRUE);
301 void restoreGL(const LLString& progress_message = LLString::null); 371 void restoreGL(const std::string& progress_message = LLStringUtil::null);
302 void initFonts(F32 zoom_factor = 1.f); 372 void initFonts(F32 zoom_factor = 1.f);
303 373 void schedulePick(LLPickInfo& pick_info);
304 void analyzeHit( 374 S32 getChatConsoleBottomPad(); // Vertical padding for child console rect, varied by bottom clutter
305 S32 x, // input
306 S32 y_from_bot, // input
307 LLViewerObject* objectp, // input
308 U32 te_offset, // input
309 LLUUID* hit_object_id_p,// output
310 S32* hit_face_p, // output
311 LLVector3d* hit_pos_p, // output
312 BOOL* hit_land, // output
313 F32* hit_u_coord, // output
314 F32* hit_v_coord); // output
315 375
316
317public: 376public:
318 LLWindow* mWindow; // graphical window object 377 LLWindow* mWindow; // graphical window object
319 378
@@ -348,26 +407,26 @@ protected:
348 BOOL mSuppressToolbox; // sometimes hide the toolbox, despite 407 BOOL mSuppressToolbox; // sometimes hide the toolbox, despite
349 // having a camera tool selected 408 // having a camera tool selected
350 BOOL mHideCursorPermanent; // true during drags, mouselook 409 BOOL mHideCursorPermanent; // true during drags, mouselook
351 LLCoordGL mPickPoint; 410 BOOL mCursorHidden;
352 LLCoordGL mPickOffset; 411 LLPickInfo mLastPick;
353 MASK mPickMask; 412 LLPickInfo mHoverPick;
354 BOOL mPickPending; 413 std::vector<LLPickInfo> mPicks;
355 void (*mPickCallback)(S32 x, S32 y, MASK mask); 414 LLRect mPickScreenRegion; // area of frame buffer for rendering pick frames (generally follows mouse to avoid going offscreen)
415 LLTimer mPickTimer; // timer for scheduling n picks per second
356 416
357 LLString mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta" 417 std::string mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta"
358 418
359 BOOL mIgnoreActivate; 419 BOOL mIgnoreActivate;
360 U8* mPickBuffer;
361 420
362 LLString mInitAlert; // Window / GL initialization requires an alert 421 std::string mInitAlert; // Window / GL initialization requires an alert
363 422
364 class LLDebugText* mDebugText; // Internal class for debug text 423 class LLDebugText* mDebugText; // Internal class for debug text
365 424
366protected: 425protected:
367 static char sSnapshotBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ 426 static std::string sSnapshotBaseName;
368 static char sSnapshotDir[LL_MAX_PATH]; /* Flawfinder: ignore */ 427 static std::string sSnapshotDir;
369 428
370 static char sMovieBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ 429 static std::string sMovieBaseName;
371}; 430};
372 431
373class LLBottomPanel : public LLPanel 432class LLBottomPanel : public LLPanel
@@ -391,10 +450,8 @@ void toggle_flying(void*);
391void toggle_first_person(); 450void toggle_first_person();
392void toggle_build(void*); 451void toggle_build(void*);
393void reset_viewer_state_on_sim(void); 452void reset_viewer_state_on_sim(void);
394void update_saved_window_size(const LLString& control,S32 delta_width, S32 delta_height); 453void update_saved_window_size(const std::string& control,S32 delta_width, S32 delta_height);
395// 454
396// Constants
397//
398 455
399 456
400// 457//
@@ -408,28 +465,15 @@ extern LLFrameTimer gMouseIdleTimer; // how long has it been since the mouse l
408extern LLFrameTimer gAwayTimer; // tracks time before setting the avatar away state to true 465extern LLFrameTimer gAwayTimer; // tracks time before setting the avatar away state to true
409extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away 466extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away
410 467
411extern LLVector3d gLastHitPosGlobal;
412extern LLVector3d gLastHitObjectOffset;
413extern LLUUID gLastHitObjectID;
414extern S32 gLastHitObjectFace;
415extern BOOL gLastHitLand;
416extern F32 gLastHitUCoord;
417extern F32 gLastHitVCoord;
418
419
420extern LLVector3d gLastHitNonFloraPosGlobal;
421extern LLVector3d gLastHitNonFloraObjectOffset;
422extern LLUUID gLastHitNonFloraObjectID;
423extern S32 gLastHitNonFloraObjectFace;
424
425extern S32 gLastHitUIElement;
426extern LLHUDIcon* gLastHitHUDIcon;
427extern BOOL gLastHitParcelWall;
428extern BOOL gDebugSelect; 468extern BOOL gDebugSelect;
429extern BOOL gPickFaces;
430extern BOOL gPickTransparent;
431 469
432extern BOOL gDebugFastUIRender; 470extern BOOL gDebugFastUIRender;
471extern LLViewerObject* gDebugRaycastObject;
472extern LLVector3 gDebugRaycastIntersection;
473extern LLVector2 gDebugRaycastTexCoord;
474extern LLVector3 gDebugRaycastNormal;
475extern LLVector3 gDebugRaycastBinormal;
476
433extern S32 CHAT_BAR_HEIGHT; 477extern S32 CHAT_BAR_HEIGHT;
434 478
435extern BOOL gDisplayCameraPos; 479extern BOOL gDisplayCameraPos;