Automated merge with ssh://rick@hg.lindenlab.com/viewer/viewer-2-0/

master
Rick Pasetto 2010-02-11 14:05:54 -08:00
commit cd73d68846
9 changed files with 398 additions and 58 deletions

View File

@ -162,7 +162,9 @@ bool LLDockControl::isDockVisible()
{
case LEFT: // to keep compiler happy
break;
case BOTTOM:
case TOP:
{
// check is dock inside parent rect
LLRect dockParentRect =
mDockWidget->getParent()->calcScreenRect();
@ -173,6 +175,9 @@ bool LLDockControl::isDockVisible()
}
break;
}
default:
break;
}
}
}
@ -254,6 +259,42 @@ void LLDockControl::moveDockable()
}
mDockTongueY = dockRect.mTop;
break;
case BOTTOM:
x = dockRect.getCenterX() - dockableRect.getWidth() / 2;
y = dockRect.mBottom;
// unique docking used with dock tongue, so add tongue height o the Y coordinate
if (use_tongue)
{
y -= mDockTongue->getHeight();
}
// check is dockable inside root view rect
if (x < rootRect.mLeft)
{
x = rootRect.mLeft;
}
if (x + dockableRect.getWidth() > rootRect.mRight)
{
x = rootRect.mRight - dockableRect.getWidth();
}
// calculate dock tongue position
dockParentRect = mDockWidget->getParent()->calcScreenRect();
if (dockRect.getCenterX() < dockParentRect.mLeft)
{
mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2;
}
else if (dockRect.getCenterX() > dockParentRect.mRight)
{
mDockTongueX = dockParentRect.mRight - mDockTongue->getWidth() / 2;;
}
else
{
mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2;
}
mDockTongueY = dockRect.mTop + mDockTongue->getHeight();
break;
}

View File

@ -47,8 +47,9 @@ class LLDockControl
public:
enum DocAt
{
TOP
,LEFT
TOP,
LEFT,
BOTTOM
};
public:

View File

@ -4578,6 +4578,50 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>MediaShowOnOthers</key>
<map>
<key>Comment</key>
<string>Whether or not to show media on other avatars</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>MediaShowOutsideParcel</key>
<map>
<key>Comment</key>
<string>Whether or not to show media from outside the current parcel</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>MediaShowWithinParcel</key>
<map>
<key>Comment</key>
<string>Whether or not to show media within the current parcel</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>MediaTentativeAutoPlay</key>
<map>
<key>Comment</key>
<string>This is a tentative flag that may be temporarily set off by the user, until she teleports</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>MemoryLogFrequency</key>
<map>
<key>Comment</key>

View File

@ -61,6 +61,7 @@
#include "llresmgr.h"
#include "llworld.h"
#include "llstatgraph.h"
#include "llviewermedia.h"
#include "llviewermenu.h" // for gMenuBarView
#include "llviewerparcelmgr.h"
#include "llviewerthrottle.h"
@ -130,7 +131,6 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
// status bar can possible overlay menus?
setMouseOpaque(FALSE);
setIsChrome(TRUE);
// size of day of the weeks and year
sDays.reserve(7);
@ -140,9 +140,39 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mHealthTimer = new LLFrameTimer();
LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml");
}
// status bar can never get a tab
setFocusRoot(FALSE);
LLStatusBar::~LLStatusBar()
{
delete mBalanceTimer;
mBalanceTimer = NULL;
delete mHealthTimer;
mHealthTimer = NULL;
// LLView destructor cleans up children
}
//-----------------------------------------------------------------------
// Overrides
//-----------------------------------------------------------------------
// virtual
void LLStatusBar::draw()
{
refresh();
LLPanel::draw();
}
BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
show_navbar_context_menu(this,x,y);
return TRUE;
}
BOOL LLStatusBar::postBuild()
{
gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3));
// build date necessary data (must do after panel built)
setupDate();
@ -158,7 +188,10 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mBtnVolume = getChild<LLButton>( "volume_btn" );
mBtnVolume->setClickedCallback( onClickVolume, this );
mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this));
mBtnVolume->setIsChrome(TRUE);
mMediaToggle = getChild<LLButton>("media_toggle_btn");
mMediaToggle->setClickedCallback( &LLStatusBar::onClickMediaToggle, this );
mMediaToggle->setMouseEnterCallback(boost::bind(&LLFloaterReg::showInstance, "nearby_media", LLSD(), true));
gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2));
@ -218,39 +251,6 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mPanelVolumePulldown->setShape(volume_pulldown_rect);
mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
mPanelVolumePulldown->setVisible(FALSE);
}
LLStatusBar::~LLStatusBar()
{
delete mBalanceTimer;
mBalanceTimer = NULL;
delete mHealthTimer;
mHealthTimer = NULL;
// LLView destructor cleans up children
}
//-----------------------------------------------------------------------
// Overrides
//-----------------------------------------------------------------------
// virtual
void LLStatusBar::draw()
{
refresh();
LLPanel::draw();
}
BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
show_navbar_context_menu(this,x,y);
return TRUE;
}
BOOL LLStatusBar::postBuild()
{
gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3));
return TRUE;
}
@ -356,6 +356,8 @@ void LLStatusBar::refresh()
// update the master volume button state
bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
mBtnVolume->setToggleState(mute_audio);
mMediaToggle->setValue(!LLViewerMedia::isAnyMediaShowing());
}
void LLStatusBar::setVisibleForMouselook(bool visible)
@ -527,6 +529,14 @@ static void onClickVolume(void* data)
LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio);
}
//static
void LLStatusBar::onClickMediaToggle(void* data)
{
LLStatusBar *status_bar = (LLStatusBar*)data;
// "Selected" means it was showing the "play" icon (so media was playing), and now it shows "pause", so turn off media
LLViewerMedia::setAllMediaEnabled(! status_bar->mMediaToggle->getValue());
}
// sets the static variables necessary for the date
void LLStatusBar::setupDate()
{

View File

@ -87,6 +87,7 @@ public:
S32 getSquareMetersCommitted() const;
S32 getSquareMetersLeft() const;
private:
// simple method to setup the part that holds the date
void setupDate();
@ -96,6 +97,8 @@ private:
static void onMouseEnterVolume(LLUICtrl* ctrl);
static void onClickStatGraph(void* data);
static void onClickMediaToggle(void* data);
private:
LLTextBox *mTextHealth;
@ -105,6 +108,7 @@ private:
LLStatGraph *mSGPacketLoss;
LLButton *mBtnVolume;
LLButton *mMediaToggle;
S32 mBalance;
S32 mHealth;

View File

@ -50,6 +50,9 @@
#include "llcallbacklist.h"
#include "llparcel.h"
#include "llaudioengine.h" // for gAudiop
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llviewerregion.h"
#include "llevent.h" // LLSimpleListener
#include "llnotificationsutil.h"
@ -63,6 +66,10 @@
#include <boost/signals2.hpp>
/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "ParcelMediaAutoPlayEnable";
/*static*/ const char* LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING = "MediaShowOnOthers";
/*static*/ const char* LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING = "MediaShowWithinParcel";
/*static*/ const char* LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING = "MediaShowOutsideParcel";
// Move this to its own file.
@ -254,6 +261,8 @@ static LLTimer sMediaCreateTimer;
static const F32 LLVIEWERMEDIA_CREATE_DELAY = 1.0f;
static F32 sGlobalVolume = 1.0f;
static F64 sLowestLoadableImplInterest = 0.0f;
static bool sAnyMediaShowing = false;
static boost::signals2::connection sTeleportFinishConnection;
//////////////////////////////////////////////////////////////////////////////////////////
static void add_media_impl(LLViewerMediaImpl* media)
@ -366,8 +375,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
// The current media URL is not empty.
// If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent,
// do a navigate.
bool auto_play = (media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING));
bool auto_play = media_impl->isAutoPlayable();
if((was_loaded || auto_play) && !update_from_self)
{
needs_navigate = url_changed;
@ -391,7 +399,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
media_impl->mMediaEntryURL = media_entry->getCurrentURL();
if(media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING))
if(media_impl->isAutoPlayable())
{
needs_navigate = true;
}
@ -688,6 +696,7 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
// static
void LLViewerMedia::updateMedia(void *dummy_arg)
{
sAnyMediaShowing = false;
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@ -818,7 +827,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
impl_count_total++;
}
// Overrides if the window is minimized or we lost focus (taking care
// not to accidentally "raise" the priority either)
if (!gViewerWindow->getActive() /* viewer window minimized? */
@ -840,7 +849,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
new_priority = LLPluginClassMedia::PRIORITY_UNLOADED;
}
}
pimpl->setPriority(new_priority);
if(pimpl->getUsedInUI())
@ -854,6 +863,29 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
total_cpu += pimpl->getCPUUsage();
// Only set sAnyMediaShowing if it isn't used in the UI. If it isn't
// parcel media, do the normal "hasMedia()" check. If it is parcel media,
// hasMedia() seems to always be true, so we do some other checks to see
// if there actually is parcel media showing
if (!pimpl->getUsedInUI())
{
if (! pimpl->isParcelMedia())
{
if (pimpl->hasMedia())
{
sAnyMediaShowing = true;
}
}
else {
// Parcel media showing?
if (!LLViewerParcelMedia::getURL().empty() && LLViewerParcelMedia::getParcelMedia().notNull())
{
sAnyMediaShowing = true;
}
}
}
}
// Re-calculate this every time.
@ -893,11 +925,40 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
//////////////////////////////////////////////////////////////////////////////////////////
// static
bool LLViewerMedia::isAnyMediaShowing()
{
return sAnyMediaShowing;
}
//////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerMedia::setAllMediaEnabled(bool val)
{
// Set "tentative" autoplay first. We need to do this here or else
// re-enabling won't start up the media below.
gSavedSettings.setBOOL("MediaTentativeAutoPlay", val);
// Then
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
for(; iter != end; iter++)
{
LLViewerMediaImpl* pimpl = *iter;
if (!pimpl->getUsedInUI())
pimpl->setDisabled(!val);
}
}
//////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerMedia::initClass()
{
gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL);
gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL);
sTeleportFinishConnection = LLViewerParcelMgr::getInstance()->
setTeleportFinishedCallback(boost::bind(&LLViewerMedia::onTeleportFinished));
}
//////////////////////////////////////////////////////////////////////////////////////////
@ -905,6 +966,15 @@ void LLViewerMedia::initClass()
void LLViewerMedia::cleanupClass()
{
gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL);
sTeleportFinishConnection.disconnect();
}
//////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerMedia::onTeleportFinished()
{
// On teleport, clear this setting (i.e. set it to true)
gSavedSettings.setBOOL("MediaTentativeAutoPlay", true);
}
//////////////////////////////////////////////////////////////////////////////////////////
@ -2057,6 +2127,21 @@ void LLViewerMediaImpl::scaleMouse(S32 *mouse_x, S32 *mouse_y)
#endif
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::isMediaTimeBased()
{
bool result = false;
if(mMediaSource)
{
result = mMediaSource->pluginSupportsMediaTime();
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool LLViewerMediaImpl::isMediaPlaying()
{
@ -2118,7 +2203,7 @@ void LLViewerMediaImpl::setDisabled(bool disabled)
else
{
// We just (re)enabled this media. Do a navigate if auto-play is in order.
if(mMediaAutoPlay && gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING))
if(isAutoPlayable())
{
navigateTo(mMediaEntryURL, "", true, true);
}
@ -2145,6 +2230,12 @@ bool LLViewerMediaImpl::isForcedUnloaded() const
}
}
// If this media's class is not supposed to be shown, unload
if (!shouldShowBasedOnClass())
{
return true;
}
return false;
}
@ -2630,3 +2721,112 @@ void LLViewerMediaImpl::setTextureID(LLUUID id)
}
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isAutoPlayable() const
{
return (mMediaAutoPlay &&
gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) &&
gSavedSettings.getBOOL("MediaTentativeAutoPlay"));
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::shouldShowBasedOnClass() const
{
// If this is parcel media or in the UI, return true always
if (getUsedInUI() || isParcelMedia()) return true;
bool attached_to_another_avatar = isAttachedToAnotherAvatar();
bool inside_parcel = isInAgentParcel();
// llinfos << " hasFocus = " << hasFocus() <<
// " others = " << (attached_to_another_avatar && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING)) <<
// " within = " << (inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING)) <<
// " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << llendl;
// If it has focus, we should show it
if (hasFocus())
return true;
// If it is attached to an avatar and the pref is off, we shouldn't show it
if (attached_to_another_avatar)
return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING);
if (inside_parcel)
return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING);
else
return gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING);
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isAttachedToAnotherAvatar() const
{
bool result = false;
std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
for ( ; iter != end; iter++)
{
if (isObjectAttachedToAnotherAvatar(*iter))
{
result = true;
break;
}
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
//static
bool LLViewerMediaImpl::isObjectAttachedToAnotherAvatar(LLVOVolume *obj)
{
bool result = false;
LLXform *xform = obj;
// Walk up parent chain
while (NULL != xform)
{
LLViewerObject *object = dynamic_cast<LLViewerObject*> (xform);
if (NULL != object)
{
LLVOAvatar *avatar = object->asAvatar();
if (NULL != avatar && avatar != gAgent.getAvatarObject())
{
result = true;
break;
}
}
xform = xform->getParent();
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isInAgentParcel() const
{
bool result = false;
std::list< LLVOVolume* >::const_iterator iter = mObjectList.begin();
std::list< LLVOVolume* >::const_iterator end = mObjectList.end();
for ( ; iter != end; iter++)
{
LLVOVolume *object = *iter;
if (LLViewerMediaImpl::isObjectInAgentParcel(object))
{
result = true;
break;
}
}
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////
//
// static
bool LLViewerMediaImpl::isObjectInAgentParcel(LLVOVolume *obj)
{
return (LLViewerParcelMgr::getInstance()->inAgentParcel(obj->getPositionGlobal()));
}

View File

@ -48,7 +48,7 @@ class LLViewerMediaImpl;
class LLUUID;
class LLViewerMediaTexture;
class LLMediaEntry;
class LLVOVolume ;
class LLVOVolume;
class LLMimeDiscoveryResponder;
typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
@ -76,7 +76,10 @@ class LLViewerMedia
public:
// String to get/set media autoplay in gSavedSettings
static const char *AUTO_PLAY_MEDIA_SETTING;
static const char* AUTO_PLAY_MEDIA_SETTING;
static const char* SHOW_MEDIA_ON_OTHERS_SETTING;
static const char* SHOW_MEDIA_WITHIN_PARCEL_SETTING;
static const char* SHOW_MEDIA_OUTSIDE_PARCEL_SETTING;
typedef std::vector<LLViewerMediaImpl*> impl_list;
@ -99,6 +102,11 @@ class LLViewerMedia
static bool textureHasMedia(const LLUUID& texture_id);
static void setVolume(F32 volume);
// Is any media currently "showing"? Includes Parcel Media. Does not include media in the UI.
static bool isAnyMediaShowing();
// Set all media enabled or disabled, depending on val. Does not include media in the UI.
static void setAllMediaEnabled(bool val);
static void updateMedia(void* dummy_arg = NULL);
static void initClass();
@ -116,7 +124,9 @@ class LLViewerMedia
// This is the comparitor used to sort the list.
static bool priorityComparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2);
private:
static void onTeleportFinished();
};
// Implementation functions not exported into header file
@ -199,14 +209,16 @@ public:
void updateImagesMediaStreams();
LLUUID getMediaTextureID() const;
void suspendUpdates(bool suspend) { mSuspendUpdates = suspend; };
void suspendUpdates(bool suspend) { mSuspendUpdates = suspend; }
void setVisible(bool visible);
bool getVisible() const { return mVisible; };
bool getVisible() const { return mVisible; }
bool isVisible() const { return mVisible; }
bool isMediaTimeBased();
bool isMediaPlaying();
bool isMediaPaused();
bool hasMedia() const;
bool isMediaFailed() const { return mMediaSourceFailed; };
bool isMediaFailed() const { return mMediaSourceFailed; }
void setMediaFailed(bool val) { mMediaSourceFailed = val; }
void resetPreviousMediaState();
@ -222,10 +234,10 @@ public:
// returns true if this instance could be playable based on autoplay setting, current load state, etc.
bool isPlayable() const;
void setIsParcelMedia(bool is_parcel_media) { mIsParcelMedia = is_parcel_media; };
bool isParcelMedia() const { return mIsParcelMedia; };
void setIsParcelMedia(bool is_parcel_media) { mIsParcelMedia = is_parcel_media; }
bool isParcelMedia() const { return mIsParcelMedia; }
ECursorType getLastSetCursor() { return mLastSetCursor; };
ECursorType getLastSetCursor() { return mLastSetCursor; }
// utility function to create a ready-to-use media instance from a desired media type.
static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height);
@ -326,6 +338,18 @@ public:
void cancelMimeTypeProbe();
// Is this media attached to an avatar *not* self
bool isAttachedToAnotherAvatar() const;
// Is this media in the agent's parcel?
bool isInAgentParcel() const;
private:
bool isAutoPlayable() const;
bool shouldShowBasedOnClass() const;
static bool isObjectAttachedToAnotherAvatar(LLVOVolume *obj);
static bool isObjectInAgentParcel(LLVOVolume *obj);
private:
// a single media url with some data and an impl.
LLPluginClassMedia* mMediaSource;

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

View File

@ -3,6 +3,7 @@
background_opaque="true"
background_visible="true"
bg_opaque_color="MouseGray"
chrome="true"
follows="top|right"
height="19"
layout="topleft"
@ -10,6 +11,7 @@
mouse_opaque="false"
name="status"
top="19"
tab_stop="false"
width="1000">
<panel.string
name="StatBarDaysOfWeek">
@ -73,7 +75,7 @@
pad_bottom="2"
tool_tip="Click to buy more L$"
top="2"
width="71" />
width="45" />
<text
type="string"
font="SansSerifSmall"
@ -86,9 +88,23 @@
left_pad="0"
name="TimeText"
tool_tip="Current time (Pacific)"
width="89">
width="80">
24:00 AM PST
</text>
<button
follows="right|top"
height="15"
image_selected="Pause_Off"
image_unselected="Play_Off"
image_pressed="Play_Press"
image_pressed_selected="Pause_Press"
is_toggle="true"
left_pad="15"
top="2"
name="media_toggle_btn"
tool_tip="Click to toggle media"
width="16" >
</button>
<button
follows="right|top"
height="15"
@ -96,7 +112,7 @@
image_pressed="Audio_Press"
image_unselected="Audio_Off"
is_toggle="true"
left_pad="18"
left_pad="5"
top="2"
name="volume_btn"
tool_tip="Global Volume Control"