diff options
| -rwxr-xr-x | indra/llimage/llimagepng.cpp | 4 | ||||
| -rwxr-xr-x | indra/llimage/llpngwrapper.cpp | 9 | ||||
| -rwxr-xr-x | indra/llimage/llpngwrapper.h | 3 | ||||
| -rwxr-xr-x | indra/llui/llmenugl.cpp | 72 | ||||
| -rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 9 | ||||
| -rwxr-xr-x | indra/newview/llfloatersnapshot.cpp | 18 | ||||
| -rwxr-xr-x | indra/newview/llmanipscale.cpp | 14 | ||||
| -rwxr-xr-x | indra/newview/llmanipscale.h | 3 | ||||
| -rwxr-xr-x | indra/newview/llpanelgrouplandmoney.cpp | 37 | ||||
| -rwxr-xr-x | indra/newview/llpanelsnapshot.cpp | 35 | ||||
| -rwxr-xr-x | indra/newview/llviewerparcelmgr.cpp | 6 | 
11 files changed, 157 insertions, 53 deletions
diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index 294f68b122..7735dc1379 100755 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -67,7 +67,7 @@ BOOL LLImagePNG::updateData()  	}  	LLPngWrapper::ImageInfo infop; -	if (! pngWrapper.readPng(getData(), NULL, &infop)) +	if (! pngWrapper.readPng(getData(), getDataSize(), NULL, &infop))  	{  		setLastError(pngWrapper.getErrorMessage());  		return FALSE; @@ -102,7 +102,7 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time)  		return FALSE;  	} -	if (! pngWrapper.readPng(getData(), raw_image)) +	if (! pngWrapper.readPng(getData(), getDataSize(), raw_image))  	{  		setLastError(pngWrapper.getErrorMessage());  		return FALSE; diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index 2cc7d3c460..aad139f570 100755 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp @@ -87,6 +87,12 @@ void LLPngWrapper::errorHandler(png_structp png_ptr, png_const_charp msg)  void LLPngWrapper::readDataCallback(png_structp png_ptr, png_bytep dest, png_size_t length)  {  	PngDataInfo *dataInfo = (PngDataInfo *) png_get_io_ptr(png_ptr); +	if(dataInfo->mOffset + length > dataInfo->mDataSize) +	{ +		png_error(png_ptr, "Data read error. Requested data size exceeds available data size."); +		return; +	} +  	U8 *src = &dataInfo->mData[dataInfo->mOffset];  	memcpy(dest, src, length);  	dataInfo->mOffset += static_cast<U32>(length); @@ -114,7 +120,7 @@ void LLPngWrapper::writeFlush(png_structp png_ptr)  // The scanline also begins at the bottom of  // the image (per SecondLife conventions) instead of at the top, so we  // must assign row-pointers in "reverse" order. -BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop) +BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop)  {  	try  	{ @@ -133,6 +139,7 @@ BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop)  		PngDataInfo dataPtr;  		dataPtr.mData = src;  		dataPtr.mOffset = 0; +		dataPtr.mDataSize = dataSize;  		png_set_read_fn(mReadPngPtr, &dataPtr, &readDataCallback);  		png_set_sig_bytes(mReadPngPtr, 0); diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h index 739f435996..27d7df3bef 100755 --- a/indra/llimage/llpngwrapper.h +++ b/indra/llimage/llpngwrapper.h @@ -44,7 +44,7 @@ public:  	};  	BOOL isValidPng(U8* src); -	BOOL readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop = NULL); +	BOOL readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop = NULL);  	BOOL writePng(const LLImageRaw* rawImage, U8* dst);  	U32  getFinalSize();  	const std::string& getErrorMessage(); @@ -61,6 +61,7 @@ private:  	{  		U8 *mData;  		U32 mOffset; +		S32 mDataSize;  	};  	static void writeFlush(png_structp png_ptr); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index d3ed4a1286..31df853ab4 100755 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -60,6 +60,7 @@  #include "v2math.h"  #include <set>  #include <boost/tokenizer.hpp> +#include <boost/foreach.hpp>  // static  LLMenuHolderGL *LLMenuGL::sMenuContainer = NULL; @@ -2038,15 +2039,7 @@ void LLMenuGL::arrange( void )  		// torn off menus are not constrained to the size of the screen  		U32 max_width = getTornOff() ? U32_MAX : menu_region_rect.getWidth(); -		U32 max_height = U32_MAX; -		if (!getTornOff()) -		{ -			max_height = getRect().mTop - menu_region_rect.mBottom; -			if (menu_region_rect.mTop - getRect().mTop > (S32)max_height) -			{ -				max_height = menu_region_rect.mTop - getRect().mTop; -			} -		} +		U32 max_height = getTornOff() ? U32_MAX: menu_region_rect.getHeight();  		// *FIX: create the item first and then ask for its dimensions?  		S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); // *TODO: Translate @@ -2104,13 +2097,15 @@ void LLMenuGL::arrange( void )  		}  		else  		{ +			BOOST_FOREACH(LLMenuItemGL* itemp, mItems) +			{ +				// do first so LLMenuGLItemCall can call on_visible to determine if visible +				itemp->buildDrawLabel(); +			}  			item_list_t::iterator item_iter;  			for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter)  			{ -				// do first so LLMenuGLItemCall can call on_visible to determine if visible -				(*item_iter)->buildDrawLabel(); -		  				if ((*item_iter)->getVisible())  				{  					if (!getTornOff()  @@ -2118,34 +2113,43 @@ void LLMenuGL::arrange( void )  						&& *item_iter != mSpilloverBranch  						&& height + (*item_iter)->getNominalHeight() > max_height - spillover_item_height)  					{ -						// no room for any more items -						createSpilloverBranch(); - -						std::vector<LLMenuItemGL*> items_to_remove; -						std::copy(item_iter, mItems.end(), std::back_inserter(items_to_remove)); -						std::vector<LLMenuItemGL*>::iterator spillover_iter; -						for (spillover_iter= items_to_remove.begin(); spillover_iter != items_to_remove.end(); ++spillover_iter) +						// don't show only one item +						int visible_items = 0; +						item_list_t::iterator count_iter; +						for (count_iter = item_iter; count_iter != mItems.end(); ++count_iter)  						{ -							LLMenuItemGL* itemp = (*spillover_iter); -							removeChild(itemp); -							mSpilloverMenu->addChild(itemp); +							if((*count_iter)->getVisible()) +								visible_items++;  						} +						if (visible_items>1) +						{ +							// no room for any more items +							createSpilloverBranch(); +							std::vector<LLMenuItemGL*> items_to_remove; +							std::copy(item_iter, mItems.end(), std::back_inserter(items_to_remove)); +							std::vector<LLMenuItemGL*>::iterator spillover_iter; +							for (spillover_iter= items_to_remove.begin(); spillover_iter != items_to_remove.end(); ++spillover_iter) +							{ +								LLMenuItemGL* itemp = (*spillover_iter); +								removeChild(itemp); +								mSpilloverMenu->addChild(itemp); +							} -						addChild(mSpilloverBranch); -						height += mSpilloverBranch->getNominalHeight(); -						width = llmax( width, mSpilloverBranch->getNominalWidth() ); +							addChild(mSpilloverBranch); -						break; -					} -					else -					{ -						// track our rect -						height += (*item_iter)->getNominalHeight(); -						width = llmax( width, (*item_iter)->getNominalWidth() ); +							height += mSpilloverBranch->getNominalHeight(); +							width = llmax( width, mSpilloverBranch->getNominalWidth() ); + +							break; +						}  					} +					// track our rect +					height += (*item_iter)->getNominalHeight(); +					width = llmax( width, (*item_iter)->getNominalWidth() ); +  					if (mScrollable)  					{  						// Determining visible items boundaries @@ -2369,7 +2373,9 @@ void LLMenuGL::createSpilloverBranch()  		branch_params.label = label;  		branch_params.branch = mSpilloverMenu;  		branch_params.font.style = "italic"; - +		branch_params.highlight_bg_color=LLUIColorTable::instance().getColor("MenuItemHighlightBgColor"); +		branch_params.highlight_fg_color=LLUIColorTable::instance().getColor("MenuItemHighlightFgColor"); +		branch_params.enabled_color=LLUIColorTable::instance().getColor("MenuItemEnabledColor");  		mSpilloverBranch = LLUICtrlFactory::create<LLMenuItemBranchGL>(branch_params);  	} diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 1b5804ec83..06b96dd1ea 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -133,6 +133,10 @@ attributedStringInfo getSegments(NSAttributedString *str)      [[NSNotificationCenter defaultCenter] addObserver:self  											 selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification  											   object:[self window]]; +     +    [[NSNotificationCenter defaultCenter] addObserver:self +											 selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification +											   object:[self window]];  }  - (void)setOldResize:(bool)oldresize @@ -159,6 +163,11 @@ attributedStringInfo getSegments(NSAttributedString *str)      callWindowUnhide();  } +- (void)windowDidBecomeKey:(NSNotification *)notification; +{ +    mModifiers = [NSEvent modifierFlags]; +} +  - (void)dealloc  {  	[[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 8677028942..04329ff66e 100755 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -383,12 +383,20 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)  			S32 w = gViewerWindow->getWindowWidthRaw();  			LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL;  			width_ctrl->setValue(w); +			if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) +			{ +				width_ctrl->setIncrement(w >> 1); +			}  		}  		if (height_ctrl->getValue().asInteger() == 0)  		{  			S32 h = gViewerWindow->getWindowHeightRaw();  			LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL;  			height_ctrl->setValue(h); +			if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) +			{ +				height_ctrl->setIncrement(h >> 1); +			}  		}  		// Clamp snapshot resolution to window size when showing UI or HUD in snapshot. @@ -823,6 +831,11 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL  		{  			getWidthSpinner(view)->setValue(width);  			getHeightSpinner(view)->setValue(height); +			if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) +			{ +				getWidthSpinner(view)->setIncrement(width >> 1); +				getHeightSpinner(view)->setIncrement(height >> 1); +			}  		}  		if(original_width != width || original_height != height) @@ -942,6 +955,11 @@ void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view  {  	getWidthSpinner(view)->forceSetValue(width);  	getHeightSpinner(view)->forceSetValue(height); +	if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) +	{ +		getWidthSpinner(view)->setIncrement(width >> 1); +		getHeightSpinner(view)->setIncrement(height >> 1); +	}  }  // static diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 2810941d83..cb505c9d4c 100755 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -352,6 +352,10 @@ BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask )  	updateSnapGuides(bbox); +	mFirstClickX = x; +	mFirstClickY = y; +	mIsFirstClick = true; +  	mDragStartPointGlobal = gAgent.getPosGlobalFromAgent(box_corner_agent);  	mDragStartCenterGlobal = gAgent.getPosGlobalFromAgent(box_center_agent);  	LLVector3 far_corner_agent = bbox.localToAgent( unitVectorToLocalBBoxExtent( -1.f * partToUnitVector( mManipPart ), bbox ) ); @@ -415,7 +419,15 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask)  		}  		else  		{ -			drag( x, y ); +			if((mFirstClickX != x) || (mFirstClickY != y)) +			{ +				mIsFirstClick = false; +			} + +			if(!mIsFirstClick) +			{ +				drag( x, y ); +			}  		}  		LL_DEBUGS("UserInput") << "hover handled by LLManipScale (active)" << LL_ENDL;		  	} diff --git a/indra/newview/llmanipscale.h b/indra/newview/llmanipscale.h index 7cc3c99810..e93b3d4f83 100755 --- a/indra/newview/llmanipscale.h +++ b/indra/newview/llmanipscale.h @@ -172,6 +172,9 @@ private:  	ESnapRegimes	mSnapRegime; //<! Which, if any, snap regime the cursor is currently residing in.  	F32				mManipulatorScales[NUM_MANIPULATORS];  	F32				mBoxHandleSize[NUM_MANIPULATORS];		// The size of the handles at the corners of the bounding box +	S32				mFirstClickX; +	S32				mFirstClickY; +	bool			mIsFirstClick;  };  #endif  // LL_MANIPSCALE_H diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 375c54479d..e7002395f8 100755 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -421,20 +421,43 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)  		msg->getUUID("QueryData", "OwnerID", owner_id, 0);  		msg->getUUID("TransactionData", "TransactionID", trans_id); -		S32 total_contribution = 0;  		if(owner_id.isNull())  		{  			// special block which has total contribution  			++first_block; +			S32 committed = 0; +			S32 billable_area = 0; +			for(S32 i = first_block; i < count; ++i) +			{ +				msg->getS32("QueryData", "BillableArea", billable_area, i); +				committed+=billable_area; +			} + +			S32 total_contribution;  			msg->getS32("QueryData", "ActualArea", total_contribution, 0);  			mPanel.getChild<LLUICtrl>("total_contributed_land_value")->setTextArg("[AREA]", llformat("%d", total_contribution)); + +			mPanel.getChild<LLUICtrl>("total_land_in_use_value")->setTextArg("[AREA]", llformat("%d", committed)); +			S32 available = total_contribution - committed; +			mPanel.getChild<LLUICtrl>("land_available_value")->setTextArg("[AREA]", llformat("%d", available)); + + +			if ( mGroupOverLimitTextp && mGroupOverLimitIconp ) + +			{ +				mGroupOverLimitIconp->setVisible(available < 0); +				mGroupOverLimitTextp->setVisible(available < 0); +			} +  		}  		if ( trans_id != mTransID ) return; +  		// This power was removed to make group roles simpler  		//if ( !gAgent.hasPowerInGroup(mGroupID, GP_LAND_VIEW_OWNED) ) return;  		if (!gAgent.isInGroup(mPanel.mGroupID)) return; +  		mGroupParcelsp->setCommentText(mEmptyParcelsText);  		std::string name; @@ -447,7 +470,6 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)  		std::string sim_name;  		std::string land_sku;  		std::string land_type; -		S32 committed = 0;  		for(S32 i = first_block; i < count; ++i)  		{ @@ -477,7 +499,6 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)  			S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;  			std::string location = sim_name + llformat(" (%d, %d)", region_x, region_y);  			std::string area; -			committed+=billable_area;  			if(billable_area == actual_area) @@ -516,16 +537,6 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)  			mGroupParcelsp->addElement(row);  		} - -		mPanel.getChild<LLUICtrl>("total_land_in_use_value")->setTextArg("[AREA]", llformat("%d", committed)); - -		S32 available = total_contribution - committed; -		mPanel.getChild<LLUICtrl>("land_available_value")->setTextArg("[AREA]", llformat("%d", available)); -		if ( mGroupOverLimitTextp && mGroupOverLimitIconp ) -		{ -			mGroupOverLimitIconp->setVisible(available < 0); -			mGroupOverLimitTextp->setVisible(available < 0); -		}  	}  } diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index 56569e3207..106fb4997e 100755 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -37,6 +37,19 @@  #include "llsidetraypanelcontainer.h"  #include "llviewercontrol.h" // gSavedSettings +const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512 + +S32 power_of_two(S32 sz, S32 upper) +{ +	S32 res = upper; +	while( upper >= sz) +	{ +		res = upper; +		upper >>= 1; +	} +	return res; +} +  // virtual  BOOL LLPanelSnapshot::postBuild()  { @@ -164,8 +177,26 @@ void LLPanelSnapshot::cancel()  void LLPanelSnapshot::onCustomResolutionCommit()  {  	LLSD info; -	info["w"] = getChild<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger(); -	info["h"] = getChild<LLUICtrl>(getHeightSpinnerName())->getValue().asInteger(); +	LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(getWidthSpinnerName()); +	LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(getHeightSpinnerName()); +	if (getName() == "panel_snapshot_inventory") +	{ +		S32 width = widthSpinner->getValue().asInteger(); +		width = power_of_two(width, MAX_TEXTURE_SIZE); +		info["w"] = width; +		widthSpinner->setIncrement(width >> 1); +		widthSpinner->forceSetValue(width); +		S32 height =  heightSpinner->getValue().asInteger(); +		height = power_of_two(height, MAX_TEXTURE_SIZE); +		heightSpinner->setIncrement(height >> 1); +		heightSpinner->forceSetValue(height); +		info["h"] = height; +	} +	else +	{ +		info["w"] = widthSpinner->getValue().asInteger(); +		info["h"] = heightSpinner->getValue().asInteger(); +	}  	LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info));  } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 7c94442f09..2f4365036c 100755 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -1562,6 +1562,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use  		if (parcel == parcel_mgr.mAgentParcel)  		{ +			// new agent parcel  			S32 bitmap_size =	parcel_mgr.mParcelsPerEdge  								* parcel_mgr.mParcelsPerEdge  								/ 8; @@ -1591,6 +1592,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use  				}  			}  		} +		else if (local_id == parcel_mgr.mAgentParcel->getLocalID()) +		{ +			// updated agent parcel +			parcel_mgr.mAgentParcel->unpackMessage(msg); +		}  	}  	// Handle updating selections, if necessary.  | 
