Anonymous avatar Anonymous committed a8fcf0b Merge

Comments (0)

Files changed (1170)

indra/integration_tests/llui_libtest/CMakeLists.txt

 # Sort by high-level to low-level
 target_link_libraries(llui_libtest
     llui
+    llinventory
     llmessage
     ${LLRENDER_LIBRARIES}
     ${LLIMAGE_LIBRARIES}

File contents unchanged.

indra/llcommon/llassettype.cpp

 
 	addEntry(LLAssetType::AT_LINK, 				new AssetEntry("LINK",				"link",		"sym link",			false,		false,		true));
 	addEntry(LLAssetType::AT_LINK_FOLDER, 		new AssetEntry("FOLDER_LINK",		"link_f", 	"sym folder link",	false,		false,		true));
-	addEntry(LLAssetType::AT_MESH,              new AssetEntry("MESH",              "mesh",     "mesh",             false, false, false));
+	addEntry(LLAssetType::AT_MESH,              new AssetEntry("MESH",              "mesh",     "mesh",             false,      false,      false));
+	addEntry(LLAssetType::AT_WIDGET,            new AssetEntry("WIDGET",            "widget",   "widget",           false,      false,      false));
 	addEntry(LLAssetType::AT_NONE, 				new AssetEntry("NONE",				"-1",		NULL,		  		FALSE,		FALSE,		FALSE));
 
 };

indra/llcommon/llassettype.h

 
 		AT_LINK_FOLDER = 25,
 			// Inventory folder link
+		
+		AT_WIDGET = 40,
+			// UI Widget: this is *not* an inventory asset type, only a viewer side asset (e.g. button, other ui items...)
+		
 		AT_MESH = 49,
-		    // Mesh data in our proprietary SLM format
-
+			// Mesh data in our proprietary SLM format
+		
 		AT_COUNT = 50,
 
 			// +*********************************************************+
Add a comment to this file

indra/llcommon/llprocesslauncher.h

File contents unchanged.

indra/llcommon/stdenums.h

 	DAD_ANIMATION		= 12,
 	DAD_GESTURE			= 13,
 	DAD_LINK			= 14,
-	DAD_MESH           		= 15,
-	DAD_COUNT			= 16,   // number of types in this enum
+	DAD_MESH            = 15,
+	DAD_WIDGET          = 16,
+	DAD_COUNT           = 17,   // number of types in this enum
 };
 
 // Reasons for drags to be denied.

indra/llinventory/llinventorytype.cpp

 	addEntry(LLInventoryType::IT_ANIMATION,           new InventoryEntry("animation", "animation",     1, LLAssetType::AT_ANIMATION));  
 	addEntry(LLInventoryType::IT_GESTURE,             new InventoryEntry("gesture",   "gesture",       1, LLAssetType::AT_GESTURE)); 
 	addEntry(LLInventoryType::IT_MESH,                new InventoryEntry("mesh",      "mesh",          1, LLAssetType::AT_MESH));
+	addEntry(LLInventoryType::IT_WIDGET,              new InventoryEntry("widget",    "widget",        1, LLAssetType::AT_WIDGET));
 }
 
 
 	LLInventoryType::IT_NONE,			// 37	AT_NONE
 	LLInventoryType::IT_NONE,			// 38	AT_NONE
 	LLInventoryType::IT_NONE,			// 39	AT_NONE
-	LLInventoryType::IT_NONE,			// 40	AT_NONE
+	LLInventoryType::IT_WIDGET,			// 40	AT_WIDGET
 	LLInventoryType::IT_NONE,			// 41	AT_NONE
 	LLInventoryType::IT_NONE,			// 42	AT_NONE
 	LLInventoryType::IT_NONE,			// 43	AT_NONE
 	LLInventoryType::IT_NONE,			// 46	AT_NONE
 	LLInventoryType::IT_NONE,			// 47	AT_NONE
 	LLInventoryType::IT_NONE,			// 48	AT_NONE
-	LLInventoryType::IT_MESH            // 49	AT_MESH
+	LLInventoryType::IT_MESH,			// 49	AT_MESH
 };
 
 // static

indra/llinventory/llinventorytype.h

 		IT_ANIMATION = 19,
 		IT_GESTURE = 20,
 		IT_MESH = 22,
-		IT_COUNT = 23,
+		IT_WIDGET = 23,
+		IT_COUNT = 24,
 
 		IT_NONE = -1
 	};
Add a comment to this file

indra/llrender/llglheaders.h

File contents unchanged.

indra/llui/CMakeLists.txt

 include(00-Common)
 include(LLCommon)
 include(LLImage)
+include(LLInventory)
 include(LLMath)
 include(LLMessage)
 include(LLRender)
 include_directories(
     ${LLCOMMON_INCLUDE_DIRS}
     ${LLIMAGE_INCLUDE_DIRS}
+    ${LLINVENTORY_INCLUDE_DIRS}
     ${LLMATH_INCLUDE_DIRS}
     ${LLMESSAGE_INCLUDE_DIRS}
     ${LLRENDER_INCLUDE_DIRS}
     llcheckboxctrl.cpp
     llclipboard.cpp
     llcombobox.cpp
+    llcommandmanager.cpp
     llconsole.cpp
     llcontainerview.cpp
     llctrlselectioninterface.cpp
     lltimectrl.cpp
     lltransutil.cpp
     lltoggleablemenu.cpp
+    lltoolbar.cpp
     lltooltip.cpp
     llui.cpp
     lluicolortable.cpp
     llcheckboxctrl.h
     llclipboard.h
     llcombobox.h
+    llcommandmanager.h
     llconsole.h
     llcontainerview.h
     llctrlselectioninterface.h
     lltextvalidate.h
     lltimectrl.h
     lltoggleablemenu.h
+    lltoolbar.h
     lltooltip.h
     lltransutil.h
     lluicolortable.h
     ${LLRENDER_LIBRARIES}
     ${LLWINDOW_LIBRARIES}
     ${LLIMAGE_LIBRARIES}
+    ${LLINVENTORY_LIBRARIES}
     ${LLVFS_LIBRARIES}    # ugh, just for LLDir
     ${LLXUIXML_LIBRARIES}
     ${LLXML_LIBRARIES}

indra/llui/llbutton.cpp

 	label_color_selected("label_color_selected"),	// requires is_toggle true
 	label_color_disabled("label_color_disabled"),
 	label_color_disabled_selected("label_color_disabled_selected"),
-	highlight_color("highlight_color"),
 	image_color("image_color"),
 	image_color_disabled("image_color_disabled"),
 	image_overlay_color("image_overlay_color", LLColor4::white),
 	scale_image("scale_image", true),
 	hover_glow_amount("hover_glow_amount"),
 	commit_on_return("commit_on_return", true),
+	display_pressed_state("display_pressed_state", true),
 	use_draw_context_alpha("use_draw_context_alpha", true),
 	badge("badge"),
 	handle_right_mouse("handle_right_mouse"),
-	held_down_delay("held_down_delay")
+	held_down_delay("held_down_delay"),
+	button_flash_count("button_flash_count"),
+	button_flash_rate("button_flash_rate")
 {
 	addSynonym(is_toggle, "toggle");
 	changeDefault(initial_value, LLSD(false));
 	mSelectedLabelColor(p.label_color_selected()),
 	mDisabledLabelColor(p.label_color_disabled()),
 	mDisabledSelectedLabelColor(p.label_color_disabled_selected()),
-	mHighlightColor(p.highlight_color()),
 	mImageColor(p.image_color()),
 	mFlashBgColor(p.flash_color()),
 	mDisabledImageColor(p.image_color_disabled()),
 	mCommitOnReturn(p.commit_on_return),
 	mFadeWhenDisabled(FALSE),
 	mForcePressedState(false),
+	mDisplayPressedState(p.display_pressed_state),
 	mLastDrawCharsCount(0),
 	mMouseDownSignal(NULL),
 	mMouseUpSignal(NULL),
 	mHeldDownSignal(NULL),
 	mUseDrawContextAlpha(p.use_draw_context_alpha),
-	mHandleRightMouse(p.handle_right_mouse)
+	mHandleRightMouse(p.handle_right_mouse),
+	mButtonFlashCount(p.button_flash_count),
+	mButtonFlashRate(p.button_flash_rate)
 {
 	static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
 	static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>());
 	LLUICtrl::onCommit();
 }
 
+boost::signals2::connection LLButton::setClickedCallback(const CommitCallbackParam& cb)
+{
+	return setClickedCallback(initCommitCallback(cb));
+}
+boost::signals2::connection LLButton::setMouseDownCallback(const CommitCallbackParam& cb)
+{
+	return setMouseDownCallback(initCommitCallback(cb));
+}
+boost::signals2::connection LLButton::setMouseUpCallback(const CommitCallbackParam& cb)
+{
+	return setMouseUpCallback(initCommitCallback(cb));
+}
+boost::signals2::connection LLButton::setHeldDownCallback(const CommitCallbackParam& cb)
+{
+	return setHeldDownCallback(initCommitCallback(cb));
+}
+
+
 boost::signals2::connection LLButton::setClickedCallback( const commit_signal_t::slot_type& cb )
 {
 	if (!mCommitSignal) mCommitSignal = new commit_signal_t();
 }
 
 
-// *TODO: Deprecate (for backwards compatability only)
+// *TODO: Deprecate (for backwards compatibility only)
 boost::signals2::connection LLButton::setClickedCallback( button_callback_t cb, void* data )
 {
 	return setClickedCallback(boost::bind(cb, data));
 	return TRUE;
 }
 
-
-void LLButton::onMouseEnter(S32 x, S32 y, MASK mask)
-{
-	LLUICtrl::onMouseEnter(x, y, mask);
-
-	if (isInEnabledChain())
-		mNeedsHighlight = TRUE;
-}
-
 void LLButton::onMouseLeave(S32 x, S32 y, MASK mask)
 {
 	LLUICtrl::onMouseLeave(x, y, mask);
 
 BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
 {
+	if (isInEnabledChain() 
+		&& (!gFocusMgr.getMouseCapture() || gFocusMgr.getMouseCapture() == this))
+		mNeedsHighlight = TRUE;
+
 	if (!childrenHandleHover(x, y, mask))
 	{
 		if (mMouseDownTimer.getStarted())
 	return TRUE;
 }
 
+void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
+{
+	overlay_width = mImageOverlay->getWidth();
+	overlay_height = mImageOverlay->getHeight();
+
+	F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f);
+	overlay_width = llround((F32)overlay_width * scale_factor);
+	overlay_height = llround((F32)overlay_height * scale_factor);
+}
+
 
 // virtual
 void LLButton::draw()
 {
 	F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
 	bool flash = FALSE;
-	static LLUICachedControl<F32> button_flash_rate("ButtonFlashRate", 0);
-	static LLUICachedControl<S32> button_flash_count("ButtonFlashCount", 0);
 
 	if( mFlashing )
 	{
 		F32 elapsed = mFlashingTimer.getElapsedTimeF32();
-		S32 flash_count = S32(elapsed * button_flash_rate * 2.f);
+		S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f);
 		// flash on or off?
-		flash = (flash_count % 2 == 0) || flash_count > S32((F32)button_flash_count * 2.f);
+		flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f);
 	}
 
 	bool pressed_by_keyboard = FALSE;
 	LLColor4 glow_color = LLColor4::white;
 	LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA;
 	LLUIImage* imagep = NULL;
-	if (pressed)
+	if (pressed && mDisplayPressedState)
 	{
 		imagep = selected ? mImagePressedSelected : mImagePressed;
 	}
 	}
 
 	// Unselected label assignments
-	LLWString label;
-
-	if( getToggleState() )
-	{
-		label = mSelectedLabel;
-	}
-	else
-	{
-		label = mUnselectedLabel;
-	}
+	LLWString label = getCurrentLabel();
 
 	// overlay with keyboard focus border
 	if (hasFocus())