diff options
| author | Jon Wolk <jwolk@lindenlab.com> | 2007-12-19 00:56:59 +0000 | 
|---|---|---|
| committer | Jon Wolk <jwolk@lindenlab.com> | 2007-12-19 00:56:59 +0000 | 
| commit | 7dd08303a3ebf9718c2c60a4d94b81d5d7845f8c (patch) | |
| tree | 6195a8585cc7998647afcaec2167e728e4abd3c1 /indra/newview/llviewerwindow.cpp | |
| parent | 4d87303e78c1accde85b217b325e0c08930b0c4c (diff) | |
svn merge -r 75354:76103 svn+ssh://svn.lindenlab.com/svn/linden/branches/voice-group-moderation-3 -> release.  Finished product of QAR-134
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 209 | 
1 files changed, 68 insertions, 141 deletions
| diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index a3611b2272..4c96083337 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -266,6 +266,8 @@ const S32 PICK_DIAMETER = 2 * PICK_HALF_WIDTH+1;  const F32 MIN_DISPLAY_SCALE = 0.85f; +const S32 CONSOLE_BOTTOM_PAD = 20; +  #ifdef SABINRIG  /// ALL RIG STUFF  bool rigControl = false; @@ -663,18 +665,17 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask  	// Topmost view gets a chance before the hierarchy  	LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); -	BOOL mouse_over_top_ctrl = FALSE;  	if (top_ctrl)  	{  		S32 local_x, local_y;  		top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );  		if (top_ctrl->pointInView(local_x, local_y))  		{ -			mouse_over_top_ctrl = TRUE; -			if(top_ctrl->handleMouseDown(local_x, local_y, mask))  -			{ -				return TRUE; -			} +			return top_ctrl->handleMouseDown(local_x, local_y, mask); +		} +		else +		{ +			setTopCtrl(NULL);  		}  	} @@ -686,11 +687,6 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask  			llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;  			LLView::sMouseHandlerMessage = "";  		} -		if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl) -		{ -			// always defocus top view if we click off of it -			top_ctrl->setFocus(FALSE); -		}  		return TRUE;  	}  	else if (LLView::sDebugMouseHandling) @@ -698,12 +694,6 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask  		llinfos << "Left Mouse Down not handled by view" << llendl;  	} -	if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl) -	{ -		// always defocus top view if we click off of it -		top_ctrl->setFocus(FALSE); -	} -  	if (gDisconnected)  	{  		return FALSE; @@ -716,7 +706,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask  			// This is necessary to force clicks in the world to cause edit  			// boxes that might have keyboard focus to relinquish it, and hence  			// cause a commit to update their value.  JC -			gFocusMgr.setKeyboardFocus(NULL, NULL); +			gFocusMgr.setKeyboardFocus(NULL);  			return TRUE;  		}  	} @@ -760,18 +750,17 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window,  LLCoordGL pos, MASK ma  	// Check for hit on UI.  	LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); -	BOOL mouse_over_top_ctrl = FALSE;  	if (top_ctrl)  	{  		S32 local_x, local_y;  		top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );  		if (top_ctrl->pointInView(local_x, local_y))  		{ -			mouse_over_top_ctrl = TRUE; -			if(top_ctrl->handleDoubleClick(local_x, local_y, mask)) -			{ -				return TRUE; -			} +			return top_ctrl->handleDoubleClick(local_x, local_y, mask); +		} +		else +		{ +			setTopCtrl(NULL);  		}  	} @@ -782,11 +771,6 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window,  LLCoordGL pos, MASK ma  			llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;  			LLView::sMouseHandlerMessage = "";  		} -		if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl) -		{ -			// always defocus top view if we click off of it -			top_ctrl->setFocus(FALSE); -		}  		return TRUE;  	}  	else if (LLView::sDebugMouseHandling) @@ -794,12 +778,6 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window,  LLCoordGL pos, MASK ma  		llinfos << "Left Mouse Down not handled by view" << llendl;  	} -	if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl) -	{ -		// always defocus top view if we click off of it -		top_ctrl->setFocus(FALSE); -	} -  		// Why is this here?  JC 9/3/2002  	if (gNoRender)   	{ @@ -970,18 +948,17 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window,  LLCoordGL pos, MASK  	}  	LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl(); -	BOOL mouse_over_top_ctrl = FALSE;  	if (top_ctrl)  	{  		S32 local_x, local_y;  		top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );  		if (top_ctrl->pointInView(local_x, local_y))  		{ -			mouse_over_top_ctrl = TRUE; -			if(top_ctrl->handleRightMouseDown(local_x, local_y, mask))  -			{ -				return TRUE; -			} +			return top_ctrl->handleRightMouseDown(local_x, local_y, mask); +		} +		else +		{ +			setTopCtrl(NULL);  		}  	} @@ -992,11 +969,6 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window,  LLCoordGL pos, MASK  			llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl;  			LLView::sMouseHandlerMessage = "";  		} -		if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl) -		{ -			// always defocus top view if we click off of it -			top_ctrl->setFocus(FALSE); -		}  		return TRUE;  	}  	else if (LLView::sDebugMouseHandling) @@ -1004,12 +976,6 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window,  LLCoordGL pos, MASK  		llinfos << "Right Mouse Down not handled by view" << llendl;  	} -	if (top_ctrl && top_ctrl->hasFocus() && !mouse_over_top_ctrl) -	{ -		// always defocus top view if we click off of it -		top_ctrl->setFocus(FALSE); -	} -  	if (gToolMgr)  	{  		if(gToolMgr->getCurrentTool()->handleRightMouseDown( x, y, mask ) ) @@ -1017,7 +983,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window,  LLCoordGL pos, MASK  			// This is necessary to force clicks in the world to cause edit  			// boxes that might have keyboard focus to relinquish it, and hence  			// cause a commit to update their value.  JC -			gFocusMgr.setKeyboardFocus(NULL, NULL); +			gFocusMgr.setKeyboardFocus(NULL);  			return TRUE;  		}  	} @@ -1266,7 +1232,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)  	// JC - Leave keyboard focus, so if you're popping in and out editing  	// a script, you don't have to click in the editor again and again. -	// gFocusMgr.setKeyboardFocus( NULL, NULL ); +	// gFocusMgr.setKeyboardFocus( NULL );  	gShowTextEditCursor = FALSE;  	// If losing focus while keys are down, reset them. @@ -1746,14 +1712,6 @@ void LLViewerWindow::initBase()  	gDebugView->setVisible(TRUE);  	mRootView->addChild(gDebugView); -	// HUD elements just below floaters -	LLRect hud_rect = full_window; -	hud_rect.mTop -= 24; -	hud_rect.mBottom += STATUS_BAR_HEIGHT; -	gHUDView = new LLHUDView("hud_view", hud_rect); -	gHUDView->setFollowsAll(); -	mRootView->addChild(gHUDView); -  	// Add floater view at the end so it will be on top, and give it tab priority over others  	mRootView->addChild(gFloaterView, -1);  	mRootView->addChild(gSnapshotFloaterView); @@ -1871,27 +1829,10 @@ void LLViewerWindow::initWorldUI()  	S32 width = mRootView->getRect().getWidth();  	LLRect full_window(0, height, width, 0); -	if ( gToolBar == NULL )			// Don't re-enter if objects are alreay created +	if ( gBottomPanel == NULL )			// Don't re-enter if objects are alreay created  	{ -		LLRect bar_rect(-1, STATUS_BAR_HEIGHT, width+1, -1); -		gToolBar = new LLToolBar("toolbar", bar_rect); - -		LLRect chat_bar_rect(-1,CHAT_BAR_HEIGHT, width+1, -1); -		chat_bar_rect.translate(0, STATUS_BAR_HEIGHT-1); -		gChatBar = new LLChatBar("chat", chat_bar_rect); - -		bar_rect.translate(0, STATUS_BAR_HEIGHT-1); -		bar_rect.translate(0, CHAT_BAR_HEIGHT-1); -		gOverlayBar = new LLOverlayBar("overlay", bar_rect); -  		// panel containing chatbar, toolbar, and overlay, over floaters -		LLRect bottom_rect(-1, 2*STATUS_BAR_HEIGHT + CHAT_BAR_HEIGHT, width+1, -1); -		gBottomPanel = new LLBottomPanel("bottom panel", bottom_rect); - -		// the order here is important -		gBottomPanel->addChild(gChatBar); -		gBottomPanel->addChild(gToolBar); -		gBottomPanel->addChild(gOverlayBar); +		gBottomPanel = new LLBottomPanel(mRootView->getRect());  		mRootView->addChild(gBottomPanel);  		// View for hover information @@ -1933,8 +1874,7 @@ void LLViewerWindow::initWorldUI()  		mRootView->addChild(gMorphView);  		gMorphView->setVisible(FALSE); -		gFloaterMute = new LLFloaterMute(); -		gFloaterMute->setVisible(FALSE); +		gFloaterMute = LLFloaterMute::getInstance();  		LLWorldMapView::initClass(); @@ -2450,6 +2390,12 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)  		if(LLMenuGL::getKeyboardMode())  			LLMenuGL::setKeyboardMode(FALSE); +		if (gFocusMgr.getTopCtrl()) +		{ +			gFocusMgr.setTopCtrl(NULL); +			return TRUE; +		} +  		// *TODO: get this to play well with mouselook and hidden  		// cursor modes, etc, and re-enable.  		//if (gFocusMgr.getMouseCapture()) @@ -2979,23 +2925,9 @@ BOOL LLViewerWindow::handlePerFrameHover()  	}  	// Update rectangles for the various toolbars -	if (gToolBar && gChatBar && gOverlayBar && gNotifyBoxView && gConsole) +	if (gOverlayBar && gNotifyBoxView && gConsole)  	{  		LLRect bar_rect(-1, STATUS_BAR_HEIGHT, getWindowWidth()+1, -1); -		if (gToolBar->getVisible()) -		{ -			gToolBar->setRect(bar_rect); -			bar_rect.translate(0, STATUS_BAR_HEIGHT-1); -		} - -		if (gChatBar->getVisible()) -		{ -			// fix up the height -			LLRect chat_bar_rect = bar_rect; -			chat_bar_rect.mTop = chat_bar_rect.mBottom + CHAT_BAR_HEIGHT + 1; -			gChatBar->setRect(chat_bar_rect); -			bar_rect.translate(0, CHAT_BAR_HEIGHT-1); -		}  		LLRect notify_box_rect = gNotifyBoxView->getRect();  		notify_box_rect.mBottom = bar_rect.mBottom; @@ -3015,42 +2947,16 @@ BOOL LLViewerWindow::handlePerFrameHover()  		if (gOverlayBar->getVisible())  		{ -			LLRect overlay_rect = bar_rect; -			overlay_rect.mTop = overlay_rect.mBottom + OVERLAY_BAR_HEIGHT; - -			// Fitt's Law: Push buttons flush with bottom of screen if -			// nothing else visible. -			if (!gToolBar->getVisible() -				&& !gChatBar->getVisible()) -			{ -				// *NOTE: this is highly depenent on the XML -				// describing the position of the buttons -				overlay_rect.translate(0, 0); -			} - -			gOverlayBar->setRect(overlay_rect); -			gOverlayBar->updateRect(); -			bar_rect.translate(0, gOverlayBar->getRect().getHeight()); - -			gFloaterView->setSnapOffsetBottom(OVERLAY_BAR_HEIGHT); +			gFloaterView->setSnapOffsetBottom(gHUDView->getRect().mBottom);  		}  		else  		{  			gFloaterView->setSnapOffsetBottom(0);  		} -		// fix rectangle of bottom panel focus indicator -		if(gBottomPanel && gBottomPanel->getFocusIndicator()) -		{ -			LLRect focus_rect = gBottomPanel->getFocusIndicator()->getRect(); -			focus_rect.mTop = (gToolBar->getVisible() ? STATUS_BAR_HEIGHT : 0) +  -				(gChatBar->getVisible() ? CHAT_BAR_HEIGHT : 0) - 2; -			gBottomPanel->getFocusIndicator()->setRect(focus_rect); -		} -  		// Always update console  		LLRect console_rect = gConsole->getRect(); -		console_rect.mBottom = bar_rect.mBottom + 8; +		console_rect.mBottom = gHUDView->getRect().mBottom + CONSOLE_BOTTOM_PAD;  		gConsole->reshape(console_rect.getWidth(), console_rect.getHeight());  		gConsole->setRect(console_rect);  	} @@ -3628,13 +3534,6 @@ void LLViewerWindow::performPick()  			// if you are the parent  			parent = objectp;  		} -		std::vector<LLPointer<LLViewerObject>,std::allocator<LLPointer<LLViewerObject> > > children = parent->getChildren(); -		for( std::vector<LLPointer<LLViewerObject>,std::allocator<LLPointer<LLViewerObject> > >::iterator i= children.begin(); i!= children.end(); ++i ) -		{ -			//go through -			LLViewerObject* foo = *i; -			foo->getRotation(); -		}  		if (objectp->mbCanSelect)  		{  			te_offset = (te_offset == 16) ? NO_FACE : te_offset; @@ -4561,9 +4460,9 @@ void LLViewerWindow::drawMouselookInstructions()  // These functions are here only because LLViewerWindow used to do the work that gFocusMgr does now.  // They let other objects continue to work without change. -void LLViewerWindow::setKeyboardFocus(LLUICtrl* new_focus,void (*on_focus_lost)(LLUICtrl* old_focus)) +void LLViewerWindow::setKeyboardFocus(LLUICtrl* new_focus)  { -	gFocusMgr.setKeyboardFocus( new_focus, on_focus_lost ); +	gFocusMgr.setKeyboardFocus( new_focus );  }  LLUICtrl* LLViewerWindow::getKeyboardFocus() @@ -5033,7 +4932,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,  	}  	mIgnoreActivate = FALSE; -	gFocusMgr.setKeyboardFocus(keyboard_focus, NULL); +	gFocusMgr.setKeyboardFocus(keyboard_focus);  	mWantFullscreen = mWindow->getFullscreen();  	mShowFullscreenProgress = FALSE; @@ -5233,16 +5132,22 @@ LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename,  //////////////////////////////////////////////////////////////////////////// -LLBottomPanel::LLBottomPanel(const LLString &name, const LLRect &rect) :  -	LLPanel(name, rect, FALSE), +LLBottomPanel::LLBottomPanel(const LLRect &rect) :  +	LLPanel("", rect, FALSE),  	mIndicator(NULL)  {  	// bottom panel is focus root, so Tab moves through the toolbar and button bar, and overlay  	setFocusRoot(TRUE); -	// don't capture mouse clicks that don't hit a child -	setMouseOpaque(FALSE); -	setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM); +	// flag this panel as chrome so buttons don't grab keyboard focus  	setIsChrome(TRUE); + +	mFactoryMap["toolbar"] = LLCallbackMap(createToolBar, NULL); +	mFactoryMap["overlay"] = LLCallbackMap(createOverlayBar, NULL); +	mFactoryMap["hud"] = LLCallbackMap(createHUD, NULL); +	gUICtrlFactory->buildPanel(this, "panel_bars.xml", &getFactoryMap()); +	 +	setOrigin(rect.mLeft, rect.mBottom); +	reshape(rect.getWidth(), rect.getHeight());  }  void LLBottomPanel::setFocusIndicator(LLView * indicator) @@ -5260,3 +5165,25 @@ void LLBottomPanel::draw()  	}  	LLPanel::draw();  } + +void* LLBottomPanel::createHUD(void* data) +{ +	delete gHUDView; +	gHUDView = new LLHUDView(); +	return gHUDView; +} + + +void* LLBottomPanel::createOverlayBar(void* data) +{ +	delete gOverlayBar; +	gOverlayBar = new LLOverlayBar(); +	return gOverlayBar; +} + +void* LLBottomPanel::createToolBar(void* data) +{ +	delete gToolBar; +	gToolBar = new LLToolBar(); +	return gToolBar; +} | 
