diff options
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/llfloater.cpp | 106 | ||||
| -rw-r--r-- | indra/llui/llfloater.h | 4 | ||||
| -rw-r--r-- | indra/llui/llmenugl.cpp | 42 | ||||
| -rw-r--r-- | indra/llui/lltexteditor.cpp | 48 | ||||
| -rw-r--r-- | indra/llui/lltexteditor.h | 4 | 
5 files changed, 129 insertions, 75 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 66642d8f34..22acf46125 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -347,18 +347,6 @@ void LLFloater::init(const LLString& title,  			LLResizeHandle::LEFT_TOP );  		addChild(mResizeHandle[3]);  	} -	else -	{ -		mResizeBar[0]	= NULL; -		mResizeBar[1]	= NULL; -		mResizeBar[2]	= NULL; -		mResizeBar[3]	= NULL; - -		mResizeHandle[0] = NULL; -		mResizeHandle[1] = NULL; -		mResizeHandle[2] = NULL; -		mResizeHandle[3] = NULL; -	}  	// Close button.  	if (close_btn) @@ -372,6 +360,13 @@ void LLFloater::init(const LLString& title,  		mButtonsEnabled[BUTTON_MINIMIZE] = TRUE;  	} +	// Keep track of whether this window has ever been dragged while it +	// was minimized.  If it has, we'll remember its position for the +	// next time it's minimized. +	mHasBeenDraggedWhileMinimized = FALSE; +	mPreviousMinimizedLeft = 0; +	mPreviousMinimizedBottom = 0; +  	buildButtons();  	// JC - Don't do this here, because many floaters first construct themselves, @@ -737,6 +732,16 @@ void LLFloater::userSetShape(const LLRect& new_rect)  			}  		}  	} +	else +	{ +		// If minimized, and origin has changed, set +		// mHasBeenDraggedWhileMinimized to TRUE +		if ((new_rect.mLeft != old_rect.mLeft) || +			(new_rect.mBottom != old_rect.mBottom)) +		{ +			mHasBeenDraggedWhileMinimized = TRUE; +		} +	}  }  void LLFloater::setMinimized(BOOL minimize) @@ -749,9 +754,19 @@ void LLFloater::setMinimized(BOOL minimize)  		reshape( MINIMIZED_WIDTH, LLFLOATER_HEADER_SIZE, TRUE); -		S32 left, bottom; -		gFloaterView->getMinimizePosition(&left, &bottom); -		setOrigin( left, bottom ); +		// If the floater has been dragged while minimized in the +		// past, then locate it at its previous minimized location. +		// Otherwise, ask the view for a minimize position. +		if (mHasBeenDraggedWhileMinimized) +		{ +			setOrigin(mPreviousMinimizedLeft, mPreviousMinimizedBottom); +		} +		else +		{ +			S32 left, bottom; +			gFloaterView->getMinimizePosition(&left, &bottom); +			setOrigin( left, bottom ); +		}  		if (mButtonsEnabled[BUTTON_MINIMIZE])  		{ @@ -804,6 +819,15 @@ void LLFloater::setMinimized(BOOL minimize)  	}  	else  	{ +		// If this window has been dragged while minimized (at any time), +		// remember its position for the next time it's minimized. +		if (mHasBeenDraggedWhileMinimized) +		{ +			const LLRect& currentRect = getRect(); +			mPreviousMinimizedLeft = currentRect.mLeft; +			mPreviousMinimizedBottom = currentRect.mBottom; +		} +  		reshape( mPreviousRect.getWidth(), mPreviousRect.getHeight(), TRUE );  		setOrigin( mPreviousRect.mLeft, mPreviousRect.mBottom ); @@ -1020,7 +1044,6 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask)  	if( mMinimized )  	{  		// Offer the click to the close button. -		// Any other click = restore  		if( mButtonsEnabled[BUTTON_CLOSE] )  		{  			S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; @@ -1034,9 +1057,22 @@ BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask)  			}  		} -		// restore -		bringToFront( x, y ); -		return TRUE; +		// Offer the click to the restore button. +		if( mButtonsEnabled[BUTTON_RESTORE] ) +		{ +			S32 local_x = x - mButtons[BUTTON_RESTORE]->getRect().mLeft; +			S32 local_y = y - mButtons[BUTTON_RESTORE]->getRect().mBottom; + +			if (mButtons[BUTTON_RESTORE]->pointInView(local_x, local_y) +				&& mButtons[BUTTON_RESTORE]->handleMouseDown(local_x, local_y, mask)) +			{ +				// restore button handled it, return +				return TRUE; +			} +		} + +		// Otherwise pass to drag handle for movement +		return mDragHandle->handleMouseDown(x, y, mask);  	}  	else  	{ @@ -1448,30 +1484,14 @@ void	LLFloater::setCanResize(BOOL can_resize)  {  	if (mResizable && !can_resize)  	{ -		removeChild(mResizeBar[0]); -		removeChild(mResizeBar[1]); -		removeChild(mResizeBar[2]); -		removeChild(mResizeBar[3]); -		removeChild(mResizeHandle[0]); -		removeChild(mResizeHandle[1]); -		removeChild(mResizeHandle[2]); -		removeChild(mResizeHandle[3]); -		delete mResizeBar[0]; -		delete mResizeBar[1]; -		delete mResizeBar[2]; -		delete mResizeBar[3]; -		delete mResizeHandle[0]; -		delete mResizeHandle[1]; -		delete mResizeHandle[2]; -		mResizeHandle[3] = NULL; -		mResizeBar[0] = NULL; -		mResizeBar[1] = NULL; -		mResizeBar[2] = NULL; -		mResizeBar[3] = NULL; -		mResizeHandle[0] = NULL; -		mResizeHandle[1] = NULL; -		mResizeHandle[2] = NULL; -		mResizeHandle[3] = NULL; +		for (S32 i = 0; i < 4; i++)  +		{ +			removeChild(mResizeBar[i], TRUE); +			mResizeBar[i] = NULL;  + +			removeChild(mResizeHandle[i], TRUE); +			mResizeHandle[i] = NULL; +		}  	}  	else if (!mResizable && can_resize)  	{ diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index c71f3df3e8..1491f75683 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -261,6 +261,10 @@ protected:  	static handle_map_t	sFloaterMap;  	std::vector<LLView*> mMinimizedHiddenChildren; + +	BOOL			mHasBeenDraggedWhileMinimized; +	S32				mPreviousMinimizedBottom; +	S32				mPreviousMinimizedLeft;  };  ///////////////////////////////////////////////////////////// diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 2cae50bd04..5857f49a3e 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -152,6 +152,14 @@ LLXMLNodePtr LLMenuItemGL::getXML(bool save_children) const  		out << LLKeyboard::stringFromKey(mAcceleratorKey);  		node->createChild("shortcut", TRUE)->setStringValue(out.str()); +		 +#ifdef LL_DARWIN +		// Write in special tag if this key is really a ctrl combination on the Mac +		if (mAcceleratorMask & MASK_MAC_CONTROL) +		{ +			node->createChild("useMacCtrl", TRUE)->setBoolValue( TRUE ); +		} +#endif // LL_DARWIN  	}  	return node; @@ -184,7 +192,7 @@ BOOL LLMenuItemGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)  BOOL LLMenuItemGL::handleAcceleratorKey(KEY key, MASK mask)  { -	if( mEnabled && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == mAcceleratorMask) ) +	if( mEnabled && (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )  	{  		doIt();  		return TRUE; @@ -216,7 +224,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLKeyBinding*> *listp)  		for (list_it = listp->begin(); list_it != listp->end(); ++list_it)  		{  			accelerator = *list_it; -			if ((accelerator->mKey == mAcceleratorKey) && (accelerator->mMask == mAcceleratorMask)) +			if ((accelerator->mKey == mAcceleratorKey) && (accelerator->mMask == (mAcceleratorMask & MASK_NORMALKEYS)))  			{  			// *NOTE: get calling code to throw up warning or route @@ -240,7 +248,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLKeyBinding*> *listp)  			if (accelerator)  			{  				accelerator->mKey = mAcceleratorKey; -				accelerator->mMask = mAcceleratorMask; +				accelerator->mMask = (mAcceleratorMask & MASK_NORMALKEYS);  // 				accelerator->mName = mLabel;  			}  			listp->push_back(accelerator);//addData(accelerator); @@ -264,7 +272,16 @@ void LLMenuItemGL::appendAcceleratorString( LLString& st )  	// Standard Mac names for modifier keys in menu equivalents  	// We could use the symbol characters, but they only exist in certain fonts.  	if( mAcceleratorMask & MASK_CONTROL ) -		st.append( "Cmd-" );		// Symbol would be "\xE2\x8C\x98" +	{ +		if ( mAcceleratorMask & MASK_MAC_CONTROL ) +		{ +			st.append( "Ctrl-" ); +		} +		else +		{ +			st.append( "Cmd-" );		// Symbol would be "\xE2\x8C\x98" +		} +	}  	if( mAcceleratorMask & MASK_ALT )  		st.append( "Opt-" );		// Symbol would be "\xE2\x8C\xA5"  	if( mAcceleratorMask & MASK_SHIFT ) @@ -279,7 +296,7 @@ void LLMenuItemGL::appendAcceleratorString( LLString& st )  #endif  	LLString keystr = LLKeyboard::stringFromKey( mAcceleratorKey ); -	if ((mAcceleratorMask & (MASK_CONTROL|MASK_ALT|MASK_SHIFT)) && +	if ((mAcceleratorMask & MASK_NORMALKEYS) &&  		(keystr[0] == '-' || keystr[0] == '='))  	{  		st.append( " " ); @@ -978,7 +995,7 @@ void LLMenuItemCallGL::buildDrawLabel( void )  BOOL LLMenuItemCallGL::handleAcceleratorKey( KEY key, MASK mask )  { - 	if( (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == mAcceleratorMask) ) + 	if( (!gKeyboard->getKeyRepeated(key) || mAllowKeyRepeat) && (key == mAcceleratorKey) && (mask == (mAcceleratorMask & MASK_NORMALKEYS)) )  	{  		LLPointer<LLEvent> fired_event = new LLEvent(this);  		fireEvent(fired_event, "on_build"); @@ -1945,10 +1962,23 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory  				child->hasName(LL_MENU_ITEM_CHECK_GL_TAG))  			{  				MASK mask = 0; +							 +#ifdef LL_DARWIN +				// See if this Mac accelerator should really use the ctrl key and not get mapped to cmd +				BOOL useMacCtrl = FALSE; +				child->getAttributeBOOL("useMacCtrl", useMacCtrl); +#endif // LL_DARWIN +				  				LLString shortcut;  				child->getAttributeString("shortcut", shortcut);  				if (shortcut.find("control") != shortcut.npos)  				{ +#ifdef LL_DARWIN +					if ( useMacCtrl ) +					{ +						mask |= MASK_MAC_CONTROL; +					} +#endif // LL_DARWIN  					mask |= MASK_CONTROL;  				}  				if (shortcut.find("alt") != shortcut.npos) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 7506559b98..eb59765927 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -83,9 +83,9 @@ BOOL LLTextCmd::hasExtCharValue( llwchar value )  }  // Utility funcs -S32 LLTextCmd::insert(LLTextEditor* editor, S32 pos, const LLWString &utf8str) +S32 LLTextCmd::insert(LLTextEditor* editor, S32 pos, const LLWString &wstr)  { -	return editor->insertStringNoUndo( pos, utf8str ); +	return editor->insertStringNoUndo( pos, wstr );  }  S32 LLTextCmd::remove(LLTextEditor* editor, S32 pos, S32 length)  { @@ -102,29 +102,29 @@ class LLTextCmdInsert : public LLTextCmd  {  public:  	LLTextCmdInsert(S32 pos, BOOL group_with_next, const LLWString &ws) -		: LLTextCmd(pos, group_with_next), mString(ws) +		: LLTextCmd(pos, group_with_next), mWString(ws)  	{  	}  	virtual BOOL execute( LLTextEditor* editor, S32* delta )  	{ -		*delta = insert(editor, mPos, mString ); -		LLWString::truncate(mString, *delta); -		//mString = wstring_truncate(mString, *delta); +		*delta = insert(editor, mPos, mWString ); +		LLWString::truncate(mWString, *delta); +		//mWString = wstring_truncate(mWString, *delta);  		return (*delta != 0);  	}	  	virtual S32 undo( LLTextEditor* editor )  	{ -		remove(editor, mPos, mString.length() ); +		remove(editor, mPos, mWString.length() );  		return mPos;  	}  	virtual S32 redo( LLTextEditor* editor )  	{ -		insert(editor, mPos, mString ); -		return mPos + mString.length(); +		insert(editor, mPos, mWString ); +		return mPos + mWString.length();  	}  private: -	LLWString mString; +	LLWString mWString;  };  /////////////////////////////////////////////////////////////////// @@ -133,7 +133,7 @@ class LLTextCmdAddChar : public LLTextCmd  {  public:  	LLTextCmdAddChar( S32 pos, BOOL group_with_next, llwchar wc) -		: LLTextCmd(pos, group_with_next), mString(1, wc), mBlockExtensions(FALSE) +		: LLTextCmd(pos, group_with_next), mWString(1, wc), mBlockExtensions(FALSE)  	{  	}  	virtual void blockExtensions() @@ -142,13 +142,13 @@ public:  	}  	virtual BOOL canExtend(S32 pos)  	{ -		return !mBlockExtensions && (pos == mPos + (S32)mString.length()); +		return !mBlockExtensions && (pos == mPos + (S32)mWString.length());  	}  	virtual BOOL execute( LLTextEditor* editor, S32* delta )  	{ -		*delta = insert(editor, mPos, mString); -		LLWString::truncate(mString, *delta); -		//mString = wstring_truncate(mString, *delta); +		*delta = insert(editor, mPos, mWString); +		LLWString::truncate(mWString, *delta); +		//mWString = wstring_truncate(mWString, *delta);  		return (*delta != 0);  	}  	virtual BOOL extendAndExecute( LLTextEditor* editor, S32 pos, llwchar wc, S32* delta )	 @@ -159,23 +159,23 @@ public:  		*delta = insert(editor, pos, ws);  		if( *delta > 0 )  		{ -			mString += wc; +			mWString += wc;  		}  		return (*delta != 0);  	}  	virtual S32 undo( LLTextEditor* editor )  	{ -		remove(editor, mPos, mString.length() ); +		remove(editor, mPos, mWString.length() );  		return mPos;  	}  	virtual S32 redo( LLTextEditor* editor )  	{ -		insert(editor, mPos, mString ); -		return mPos + mString.length(); +		insert(editor, mPos, mWString ); +		return mPos + mWString.length();  	}  private: -	LLWString	mString; +	LLWString	mWString;  	BOOL		mBlockExtensions;  }; @@ -222,14 +222,14 @@ public:  	}  	virtual BOOL execute( LLTextEditor* editor, S32* delta )  	{  -		mString = editor->getWSubString(mPos, mLen); +		mWString = editor->getWSubString(mPos, mLen);  		*delta = remove(editor, mPos, mLen );  		return (*delta != 0);  	}  	virtual S32 undo( LLTextEditor* editor )  	{ -		insert(editor, mPos, mString ); -		return mPos + mString.length(); +		insert(editor, mPos, mWString ); +		return mPos + mWString.length();  	}  	virtual S32 redo( LLTextEditor* editor )  	{ @@ -237,7 +237,7 @@ public:  		return mPos;  	}  private: -	LLWString	mString; +	LLWString	mWString;  	S32				mLen;  }; diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 1a82d3e8c8..0b6e291843 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -309,7 +309,7 @@ protected:  	S32				append(const LLWString &wstr, const BOOL group_with_next_op);  	// direct operations -	S32				insertStringNoUndo(S32 pos, const LLWString &utf8str); // returns num of chars actually inserted +	S32				insertStringNoUndo(S32 pos, const LLWString &wstr); // returns num of chars actually inserted  	S32 			removeStringNoUndo(S32 pos, S32 length);  	S32				overwriteCharNoUndo(S32 pos, llwchar wc); @@ -475,7 +475,7 @@ public:  	virtual BOOL	hasExtCharValue( llwchar value );  	// Define these here so they can access LLTextEditor through the friend relationship -	S32				insert(LLTextEditor* editor, S32 pos, const LLWString &utf8str); +	S32				insert(LLTextEditor* editor, S32 pos, const LLWString &wstr);  	S32 			remove(LLTextEditor* editor, S32 pos, S32 length);  	S32				overwrite(LLTextEditor* editor, S32 pos, llwchar wc);  | 
