aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerwindow.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerwindow.h234
1 files changed, 137 insertions, 97 deletions
diff --git a/linden/indra/newview/llviewerwindow.h b/linden/indra/newview/llviewerwindow.h
index da5fa4e..683d331 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 //
@@ -128,6 +195,7 @@ public:
128 195
129 LLWindow* getWindow() const { return mWindow; } 196 LLWindow* getWindow() const { return mWindow; }
130 void* getPlatformWindow() const { return mWindow->getPlatformWindow(); } 197 void* getPlatformWindow() const { return mWindow->getPlatformWindow(); }
198 void* getMediaWindow() const { return mWindow->getMediaWindow(); }
131 void focusClient() const { return mWindow->focusClient(); }; 199 void focusClient() const { return mWindow->focusClient(); };
132 200
133 LLCoordGL getLastMouse() const { return mLastMousePoint; } 201 LLCoordGL getLastMouse() const { return mLastMousePoint; }
@@ -143,17 +211,17 @@ public:
143 BOOL getLeftMouseDown() const { return mLeftMouseDown; } 211 BOOL getLeftMouseDown() const { return mLeftMouseDown; }
144 BOOL getRightMouseDown() const { return mRightMouseDown; } 212 BOOL getRightMouseDown() const { return mRightMouseDown; }
145 213
146 LLUICtrl* getTopCtrl() const; 214 const LLPickInfo& getLastPick() const { return mLastPick; }
147 BOOL hasTopCtrl(LLView* view) const; 215 const LLPickInfo& getHoverPick() const { return mHoverPick; }
148 216
149 void setupViewport(S32 x_offset = 0, S32 y_offset = 0); 217 void setupViewport(S32 x_offset = 0, S32 y_offset = 0);
150 void setup3DRender(); 218 void setup3DRender();
151 void setup2DRender(); 219 void setup2DRender();
152 220
153 BOOL isPickPending() { return mPickPending; }
154
155 LLVector3 mouseDirectionGlobal(const S32 x, const S32 y) const; 221 LLVector3 mouseDirectionGlobal(const S32 x, const S32 y) const;
156 LLVector3 mouseDirectionCamera(const S32 x, const S32 y) const; 222 LLVector3 mouseDirectionCamera(const S32 x, const S32 y) const;
223 LLVector3 mousePointHUD(const S32 x, const S32 y) const;
224
157 225
158 // Is window of our application frontmost? 226 // Is window of our application frontmost?
159 BOOL getActive() const { return mActive; } 227 BOOL getActive() const { return mActive; }
@@ -162,7 +230,7 @@ public:
162 // The 'target' is where the user wants the window to be. It may not be 230 // 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. 231 // there yet, because we may be supressing fullscreen prior to login.
164 232
165 const LLString& getInitAlert() { return mInitAlert; } 233 const std::string& getInitAlert() { return mInitAlert; }
166 234
167 // 235 //
168 // MANIPULATORS 236 // MANIPULATORS
@@ -172,15 +240,16 @@ public:
172 void setCursor( ECursorType c ); 240 void setCursor( ECursorType c );
173 void showCursor(); 241 void showCursor();
174 void hideCursor(); 242 void hideCursor();
243 BOOL getCursorHidden() { return mCursorHidden; }
175 void moveCursorToCenter(); // move to center of window 244 void moveCursorToCenter(); // move to center of window
176 245
177 void setShowProgress(const BOOL show); 246 void setShowProgress(const BOOL show);
178 BOOL getShowProgress() const; 247 BOOL getShowProgress() const;
179 void moveProgressViewToFront(); 248 void moveProgressViewToFront();
180 void setProgressString(const LLString& string); 249 void setProgressString(const std::string& string);
181 void setProgressPercent(const F32 percent); 250 void setProgressPercent(const F32 percent);
182 void setProgressMessage(const LLString& msg); 251 void setProgressMessage(const std::string& msg);
183 void setProgressCancelButtonVisible( BOOL b, const LLString& label ); 252 void setProgressCancelButtonVisible( BOOL b, const std::string& label = LLStringUtil::null );
184 LLProgressView *getProgressView() const; 253 LLProgressView *getProgressView() const;
185 254
186 void updateObjectUnderCursor(); 255 void updateObjectUnderCursor();
@@ -192,26 +261,12 @@ public:
192 261
193 // Hide normal UI when a logon fails, re-show everything when logon is attempted again 262 // Hide normal UI when a logon fails, re-show everything when logon is attempted again
194 void setNormalControlsVisible( BOOL visible ); 263 void setNormalControlsVisible( BOOL visible );
195 void setMenuBackgroundColor(bool god_mode = false, bool dev_grid = false); 264 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 265
210 void reshape(S32 width, S32 height); 266 void reshape(S32 width, S32 height);
211 void sendShapeToSim(); 267 void sendShapeToSim();
212 268
213 void draw(); 269 void draw();
214// void drawSelectedObjects();
215 void updateDebugText(); 270 void updateDebugText();
216 void drawDebugText(); 271 void drawDebugText();
217 272
@@ -219,39 +274,55 @@ public:
219 274
220 static void movieSize(S32 new_width, S32 new_height); 275 static void movieSize(S32 new_width, S32 new_height);
221 276
277 // snapshot functionality.
278 // perhaps some of this should move to llfloatershapshot? -MG
222 typedef enum e_snapshot_type 279 typedef enum e_snapshot_type
223 { 280 {
224 SNAPSHOT_TYPE_COLOR, 281 SNAPSHOT_TYPE_COLOR,
225 SNAPSHOT_TYPE_DEPTH, 282 SNAPSHOT_TYPE_DEPTH,
226 SNAPSHOT_TYPE_OBJECT_ID 283 SNAPSHOT_TYPE_OBJECT_ID
227 } ESnapshotType; 284 } ESnapshotType;
228 285 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, 286 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 ); 287 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) ; 288 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()); 289 BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); }
290 void resetSnapshotLoc() const { sSnapshotDir.clear(); }
291 BOOL saveImageNumbered(LLImageFormatted *image);
292
293 // Reset the directory where snapshots are saved.
294 // Client will open directory picker on next snapshot save.
295 void resetSnapshotLoc();
234 296
235 void playSnapshotAnimAndSound(); 297 void playSnapshotAnimAndSound();
236 298
237 // draws selection boxes around selected objects, must call displayObjects first 299 // draws selection boxes around selected objects, must call displayObjects first
238 void renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud ); 300 void renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud );
239 void performPick(); 301 void performPick();
302 void returnEmptyPicks();
240 303
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 304
247 LLViewerObject* getObjectUnderCursor(const F32 depth = 16.0f); 305 void pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& pick_info),
306 BOOL pick_transparent = FALSE, BOOL get_surface_info = FALSE);
307 LLPickInfo pickImmediate(S32 x, S32 y, BOOL pick_transparent);
308 static void hoverPickCallback(const LLPickInfo& pick_info);
309
310 LLViewerObject* cursorIntersect(S32 mouse_x = -1, S32 mouse_y = -1, F32 depth = 512.f,
311 LLViewerObject *this_object = NULL,
312 S32 this_face = -1,
313 S32* face_hit = NULL,
314 LLVector3 *intersection = NULL,
315 LLVector2 *uv = NULL,
316 LLVector3 *normal = NULL,
317 LLVector3 *binormal = NULL);
318
248 319
249 // Returns a pointer to the last object hit 320 // Returns a pointer to the last object hit
250 LLViewerObject *lastObjectHit(); 321 //LLViewerObject *getObject();
251 LLViewerObject *lastNonFloraObjectHit(); 322 //LLViewerObject *lastNonFloraObjectHit();
252 323
253 const LLVector3d& lastObjectHitOffset(); 324 //const LLVector3d& getObjectOffset();
254 const LLVector3d& lastNonFloraObjectHitOffset(); 325 //const LLVector3d& lastNonFloraObjectHitOffset();
255 326
256 // mousePointOnLand() returns true if found point 327 // mousePointOnLand() returns true if found point
257 BOOL mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global); 328 BOOL mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d *land_pos_global);
@@ -278,41 +349,25 @@ public:
278 349
279 LLAlertDialog* alertXml(const std::string& xml_filename, 350 LLAlertDialog* alertXml(const std::string& xml_filename,
280 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL); 351 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL);
281 LLAlertDialog* alertXml(const std::string& xml_filename, const LLString::format_map_t& args, 352 LLAlertDialog* alertXml(const std::string& xml_filename, const LLStringUtil::format_map_t& args,
282 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL); 353 LLAlertDialog::alert_callback_t callback = NULL, void* user_data = NULL);
283 LLAlertDialog* alertXmlEditText(const std::string& xml_filename, const LLString::format_map_t& args, 354 LLAlertDialog* alertXmlEditText(const std::string& xml_filename, const LLStringUtil::format_map_t& args,
284 LLAlertDialog::alert_callback_t callback, void* user_data, 355 LLAlertDialog::alert_callback_t callback, void* user_data,
285 LLAlertDialog::alert_text_callback_t text_callback, void *text_data, 356 LLAlertDialog::alert_text_callback_t text_callback, void *text_data,
286 const LLString::format_map_t& edit_args = LLString::format_map_t(), 357 const LLStringUtil::format_map_t& edit_args = LLStringUtil::format_map_t(),
287 BOOL draw_asterixes = FALSE); 358 BOOL draw_asterixes = FALSE);
288 359
289 static bool alertCallback(S32 modal); 360 static bool alertCallback(S32 modal);
290 361
291#ifdef SABINRIG
292 //Silly rig stuff
293 void printFeedback(); //RIG STUFF!
294#endif //SABINRIG
295
296private: 362private:
363 bool shouldShowToolTipFor(LLMouseHandler *mh);
297 void switchToolByMask(MASK mask); 364 void switchToolByMask(MASK mask);
298 void destroyWindow(); 365 void destroyWindow();
299 void drawMouselookInstructions(); 366 void drawMouselookInstructions();
300 void stopGL(BOOL save_state = TRUE); 367 void stopGL(BOOL save_state = TRUE);
301 void restoreGL(const LLString& progress_message = LLString::null); 368 void restoreGL(const std::string& progress_message = LLStringUtil::null);
302 void initFonts(F32 zoom_factor = 1.f); 369 void initFonts(F32 zoom_factor = 1.f);
303 370 void schedulePick(LLPickInfo& pick_info);
304 void analyzeHit(
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
316 371
317public: 372public:
318 LLWindow* mWindow; // graphical window object 373 LLWindow* mWindow; // graphical window object
@@ -348,26 +403,26 @@ protected:
348 BOOL mSuppressToolbox; // sometimes hide the toolbox, despite 403 BOOL mSuppressToolbox; // sometimes hide the toolbox, despite
349 // having a camera tool selected 404 // having a camera tool selected
350 BOOL mHideCursorPermanent; // true during drags, mouselook 405 BOOL mHideCursorPermanent; // true during drags, mouselook
351 LLCoordGL mPickPoint; 406 BOOL mCursorHidden;
352 LLCoordGL mPickOffset; 407 LLPickInfo mLastPick;
353 MASK mPickMask; 408 LLPickInfo mHoverPick;
354 BOOL mPickPending; 409 std::vector<LLPickInfo> mPicks;
355 void (*mPickCallback)(S32 x, S32 y, MASK mask); 410 LLRect mPickScreenRegion; // area of frame buffer for rendering pick frames (generally follows mouse to avoid going offscreen)
411 LLTimer mPickTimer; // timer for scheduling n picks per second
356 412
357 LLString mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta" 413 std::string mOverlayTitle; // Used for special titles such as "Second Life - Special E3 2003 Beta"
358 414
359 BOOL mIgnoreActivate; 415 BOOL mIgnoreActivate;
360 U8* mPickBuffer;
361 416
362 LLString mInitAlert; // Window / GL initialization requires an alert 417 std::string mInitAlert; // Window / GL initialization requires an alert
363 418
364 class LLDebugText* mDebugText; // Internal class for debug text 419 class LLDebugText* mDebugText; // Internal class for debug text
365 420
366protected: 421protected:
367 static char sSnapshotBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ 422 static std::string sSnapshotBaseName;
368 static char sSnapshotDir[LL_MAX_PATH]; /* Flawfinder: ignore */ 423 static std::string sSnapshotDir;
369 424
370 static char sMovieBaseName[LL_MAX_PATH]; /* Flawfinder: ignore */ 425 static std::string sMovieBaseName;
371}; 426};
372 427
373class LLBottomPanel : public LLPanel 428class LLBottomPanel : public LLPanel
@@ -391,10 +446,8 @@ void toggle_flying(void*);
391void toggle_first_person(); 446void toggle_first_person();
392void toggle_build(void*); 447void toggle_build(void*);
393void reset_viewer_state_on_sim(void); 448void reset_viewer_state_on_sim(void);
394void update_saved_window_size(const LLString& control,S32 delta_width, S32 delta_height); 449void update_saved_window_size(const std::string& control,S32 delta_width, S32 delta_height);
395// 450
396// Constants
397//
398 451
399 452
400// 453//
@@ -408,28 +461,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 461extern LLFrameTimer gAwayTimer; // tracks time before setting the avatar away state to true
409extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away 462extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away
410 463
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; 464extern BOOL gDebugSelect;
429extern BOOL gPickFaces;
430extern BOOL gPickTransparent;
431 465
432extern BOOL gDebugFastUIRender; 466extern BOOL gDebugFastUIRender;
467extern LLViewerObject* gDebugRaycastObject;
468extern LLVector3 gDebugRaycastIntersection;
469extern LLVector2 gDebugRaycastTexCoord;
470extern LLVector3 gDebugRaycastNormal;
471extern LLVector3 gDebugRaycastBinormal;
472
433extern S32 CHAT_BAR_HEIGHT; 473extern S32 CHAT_BAR_HEIGHT;
434 474
435extern BOOL gDisplayCameraPos; 475extern BOOL gDisplayCameraPos;