EXT-1954 Implement Inspector Info i rollover icon
parent
4f4be142b3
commit
07749af387
|
|
@ -486,6 +486,11 @@ void LLButton::onMouseLeave(S32 x, S32 y, MASK mask)
|
|||
mNeedsHighlight = FALSE;
|
||||
}
|
||||
|
||||
void LLButton::setHighlight(bool b)
|
||||
{
|
||||
mNeedsHighlight = b;
|
||||
}
|
||||
|
||||
BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
if (!childrenHandleHover(x, y, mask))
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ public:
|
|||
BOOL getToggleState() const;
|
||||
void setToggleState(BOOL b);
|
||||
|
||||
void setHighlight(bool b);
|
||||
void setFlashing( BOOL b );
|
||||
BOOL getFlashing() const { return mFlashing; }
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,10 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
|
|||
: LLPanel(p),
|
||||
mMaxWidth(p.max_width),
|
||||
mHasClickCallback(p.click_callback.isProvided()),
|
||||
mPadding(p.padding)
|
||||
mPadding(p.padding),
|
||||
mTextBox(NULL),
|
||||
mInfoButton(NULL),
|
||||
mPlayMediaButton(NULL)
|
||||
{
|
||||
LLTextBox::Params params;
|
||||
params.initial_value = "tip_text";
|
||||
|
|
@ -194,25 +197,26 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
|
|||
S32 TOOLTIP_PLAYBUTTON_SIZE = 0;
|
||||
if (p.image.isProvided())
|
||||
{
|
||||
LLIconCtrl::Params icon_params;
|
||||
icon_params.name = "tooltip_icon";
|
||||
LLButton::Params icon_params;
|
||||
icon_params.name = "tooltip_info";
|
||||
LLRect icon_rect;
|
||||
LLUIImage* imagep = p.image;
|
||||
TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16);
|
||||
icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
|
||||
icon_params.rect = icon_rect;
|
||||
icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM;
|
||||
icon_params.image = p.image;
|
||||
icon_params.mouse_opaque = false;
|
||||
LLIconCtrl* tooltip_icon = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
|
||||
addChild(tooltip_icon);
|
||||
|
||||
// move text over to fit image in
|
||||
mTextBox->translate(TOOLTIP_ICON_SIZE + mPadding, 0);
|
||||
//icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM;
|
||||
icon_params.image_unselected(imagep);
|
||||
icon_params.scale_image(true);
|
||||
icon_params.flash_color(icon_params.highlight_color());
|
||||
mInfoButton = LLUICtrlFactory::create<LLButton>(icon_params);
|
||||
if (p.click_callback.isProvided())
|
||||
{
|
||||
tooltip_icon->setMouseUpCallback(boost::bind(p.click_callback()));
|
||||
mInfoButton->setCommitCallback(boost::bind(p.click_callback()));
|
||||
}
|
||||
addChild(mInfoButton);
|
||||
|
||||
// move text over to fit image in
|
||||
mTextBox->translate(TOOLTIP_ICON_SIZE + mPadding, 0);
|
||||
}
|
||||
|
||||
if (p.time_based_media.isProvided() && p.time_based_media == true)
|
||||
|
|
@ -221,11 +225,12 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
|
|||
p_button.name(std::string("play_media"));
|
||||
TOOLTIP_PLAYBUTTON_SIZE = 16;
|
||||
LLRect button_rect;
|
||||
button_rect.setOriginAndSize((mPadding +TOOLTIP_ICON_SIZE),mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
|
||||
button_rect.setOriginAndSize((mPadding +TOOLTIP_ICON_SIZE+ mPadding ), mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
|
||||
p_button.rect = button_rect;
|
||||
p_button.image_selected.name("button_anim_pause.tga");
|
||||
p_button.image_unselected.name("button_anim_play.tga");
|
||||
p_button.scale_image(true);
|
||||
|
||||
mPlayMediaButton = LLUICtrlFactory::create<LLButton>(p_button);
|
||||
if(p.click_playmedia_callback.isProvided())
|
||||
{
|
||||
|
|
@ -240,6 +245,11 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
|
|||
// move text over to fit image in
|
||||
mTextBox->translate(TOOLTIP_PLAYBUTTON_SIZE + mPadding, 0);
|
||||
}
|
||||
|
||||
if (p.click_callback.isProvided())
|
||||
{
|
||||
setMouseUpCallback(boost::bind(p.click_callback()));
|
||||
}
|
||||
}
|
||||
|
||||
void LLToolTip::setValue(const LLSD& value)
|
||||
|
|
@ -286,6 +296,9 @@ void LLToolTip::setVisible(BOOL visible)
|
|||
|
||||
BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
//mInfoButton->setFlashing(true);
|
||||
mInfoButton->setHighlight(true);
|
||||
|
||||
LLPanel::handleHover(x, y, mask);
|
||||
if (mHasClickCallback)
|
||||
{
|
||||
|
|
@ -294,6 +307,13 @@ BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void LLToolTip::onMouseLeave(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
//mInfoButton->setFlashing(true);
|
||||
mInfoButton->setHighlight(false);
|
||||
LLUICtrl::onMouseLeave(x, y, mask);
|
||||
}
|
||||
|
||||
void LLToolTip::draw()
|
||||
{
|
||||
F32 alpha = 1.f;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public:
|
|||
};
|
||||
/*virtual*/ void draw();
|
||||
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||
|
||||
/*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
|
||||
/*virtual*/ void setValue(const LLSD& value);
|
||||
/*virtual*/ void setVisible(BOOL visible);
|
||||
|
||||
|
|
@ -106,6 +106,7 @@ public:
|
|||
|
||||
private:
|
||||
class LLTextBox* mTextBox;
|
||||
class LLButton* mInfoButton;
|
||||
class LLButton* mPlayMediaButton;
|
||||
LLFrameTimer mFadeTimer;
|
||||
LLFrameTimer mVisibleTimer;
|
||||
|
|
|
|||
|
|
@ -733,32 +733,41 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
|
|||
tooltip_msg.append( nodep->mName );
|
||||
}
|
||||
|
||||
// Does this face have media?
|
||||
const LLTextureEntry* tep = hover_object->getTE(mHoverPick.mObjectFace);
|
||||
const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
|
||||
viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL;
|
||||
LLPluginClassMedia* media_plugin = NULL;
|
||||
|
||||
bool is_time_based_media = false;
|
||||
bool is_media_playing = false;
|
||||
|
||||
if (media_impl && (media_impl->hasMedia()))
|
||||
// Does this face have media?
|
||||
const LLTextureEntry* tep = hover_object->getTE(mHoverPick.mObjectFace);
|
||||
|
||||
if(tep)
|
||||
{
|
||||
LLStringUtil::format_map_t args;
|
||||
const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
|
||||
if (mep)
|
||||
{
|
||||
viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL;
|
||||
LLPluginClassMedia* media_plugin = NULL;
|
||||
|
||||
if (media_impl.notNull() && (media_impl->hasMedia()))
|
||||
{
|
||||
LLStringUtil::format_map_t args;
|
||||
|
||||
media_plugin = media_impl->getMediaPlugin();
|
||||
if(media_plugin->pluginSupportsMediaTime())
|
||||
{
|
||||
is_time_based_media = true;
|
||||
args["[CurrentURL]"] = media_impl->getMediaURL();
|
||||
is_media_playing = media_impl->isMediaPlaying();
|
||||
media_plugin = media_impl->getMediaPlugin();
|
||||
if(media_plugin)
|
||||
{ if(media_plugin->pluginSupportsMediaTime())
|
||||
{
|
||||
is_time_based_media = true;
|
||||
args["[CurrentURL]"] = media_impl->getMediaURL();
|
||||
is_media_playing = media_impl->isMediaPlaying();
|
||||
}
|
||||
else
|
||||
{
|
||||
is_time_based_media = false;
|
||||
args["[CurrentURL]"] = media_plugin->getLocation();
|
||||
}
|
||||
//tooltip_msg.append(LLTrans::getString("CurrentURL", args));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
is_time_based_media = false;
|
||||
args["[CurrentURL]"] = media_plugin->getLocation();
|
||||
}
|
||||
//tooltip_msg.append(LLTrans::getString("CurrentURL", args));
|
||||
}
|
||||
|
||||
bool needs_tip = needs_tooltip(nodep);
|
||||
|
|
@ -769,7 +778,7 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
|
|||
mPick = mHoverPick;
|
||||
LLToolTipMgr::instance().show(LLToolTip::Params()
|
||||
.message(tooltip_msg)
|
||||
.image(LLUI::getUIImage("Info"))
|
||||
.image(LLUI::getUIImage("Info_Off"))
|
||||
.click_callback(boost::bind(showObjectInspector, hover_object->getID()))
|
||||
.time_based_media(is_time_based_media)
|
||||
.media_playing(is_media_playing)
|
||||
|
|
@ -1012,11 +1021,16 @@ void LLToolPie::playCurrentMedia(const LLPickInfo& info)
|
|||
|
||||
// Does this face have media?
|
||||
const LLTextureEntry* tep = objectp->getTE(info.mObjectFace);
|
||||
if (!tep)
|
||||
return;
|
||||
|
||||
const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
|
||||
if(!mep)
|
||||
return;
|
||||
|
||||
LLPluginClassMedia* media_plugin = NULL;
|
||||
|
||||
if (mep
|
||||
&& gSavedSettings.getBOOL("MediaOnAPrimUI"))
|
||||
if (gSavedSettings.getBOOL("MediaOnAPrimUI"))
|
||||
{
|
||||
viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
|
||||
|
||||
|
|
@ -1141,12 +1155,17 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick)
|
|||
|
||||
// Does this face have media?
|
||||
const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
|
||||
if(!tep)
|
||||
return false;
|
||||
|
||||
LLMediaEntry* mep = (tep->hasMedia()) ? tep->getMediaData() : NULL;
|
||||
|
||||
if(!mep)
|
||||
return false;
|
||||
|
||||
viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL;
|
||||
|
||||
if (tep
|
||||
&& mep
|
||||
&& gSavedSettings.getBOOL("MediaOnAPrimUI")
|
||||
if (gSavedSettings.getBOOL("MediaOnAPrimUI")
|
||||
&& media_impl.notNull())
|
||||
{
|
||||
if (!LLViewerMediaFocus::getInstance()->isFocusedOnFace(pick.getObject(), pick.mObjectFace) )
|
||||
|
|
@ -1191,6 +1210,9 @@ bool LLToolPie::handleMediaHover(const LLPickInfo& pick)
|
|||
|
||||
// Does this face have media?
|
||||
const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
|
||||
if(!tep)
|
||||
return false;
|
||||
|
||||
const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
|
||||
if (mep
|
||||
&& gSavedSettings.getBOOL("MediaOnAPrimUI"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue