Innitial commit. Did as much as I can for llmediactrl without diving too deep into llviewermedia

This commit is contained in:
Shyotl
2011-07-18 04:21:36 -05:00
parent 52570a7f61
commit 25be08f236
10 changed files with 682 additions and 202 deletions

View File

@@ -62,6 +62,28 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& media_data)
}
void LLFloaterMediaBrowser::geometryChanged(S32 x, S32 y, S32 width, S32 height)
{
// Make sure the layout of the browser control is updated, so this calculation is correct.
LLLayoutStack::updateClass();
// TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
LLCoordWindow window_size;
getWindow()->getSize(&window_size);
// Adjust width and height for the size of the chrome on the Media Browser window.
width += getRect().getWidth() - mBrowser->getRect().getWidth();
height += getRect().getHeight() - mBrowser->getRect().getHeight();
LLRect geom;
geom.setOriginAndSize(x, window_size.mY - (y + height), width, height);
lldebugs << "geometry change: " << geom << llendl;
handleReshape(geom,false);
}
void LLFloaterMediaBrowser::draw()
{
childSetEnabled("go", !mAddressCombo->getValue().asString().empty());
@@ -105,6 +127,7 @@ BOOL LLFloaterMediaBrowser::postBuild()
mAddressCombo = getChild<LLComboBox>("address");
mAddressCombo->setCommitCallback(onEnterAddress);
mAddressCombo->setCallbackUserData(this);
mAddressCombo->sortByName();
childSetAction("back", onClickBack, this);
childSetAction("forward", onClickForward, this);
@@ -146,7 +169,10 @@ void LLFloaterMediaBrowser::buildURLHistory()
}
// initialize URL history in the plugin
mBrowser->getMediaPlugin()->initializeUrlHistory(browser_history);
if(mBrowser && mBrowser->getMediaPlugin())
{
mBrowser->getMediaPlugin()->initializeUrlHistory(browser_history);
}
}
std::string LLFloaterMediaBrowser::getSupportURL()
@@ -171,6 +197,15 @@ void LLFloaterMediaBrowser::handleMediaEvent(LLPluginClassMedia* self, EMediaEve
childSetEnabled("back", self->getHistoryBackAvailable());
childSetEnabled("forward", self->getHistoryForwardAvailable());
}
else if(event == MEDIA_EVENT_CLOSE_REQUEST)
{
// The browser instance wants its window closed.
close();
}
else if(event == MEDIA_EVENT_GEOMETRY_CHANGE)
{
geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight());
}
}
void LLFloaterMediaBrowser::setCurrentURL(const std::string& url)
{
@@ -213,7 +248,15 @@ void LLFloaterMediaBrowser::onClickRefresh(void* user_data)
LLFloaterMediaBrowser* self = (LLFloaterMediaBrowser*)user_data;
self->mAddressCombo->remove(0);
self->mBrowser->navigateTo(self->mCurrentURL);
if( self->mBrowser->getMediaPlugin() && self->mBrowser->getMediaPlugin()->pluginSupportsMediaBrowser())
{
bool ignore_cache = true;
self->mBrowser->getMediaPlugin()->browse_reload( ignore_cache );
}
else
{
self->mBrowser->navigateTo(self->mCurrentURL);
}
}
//static