diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llmediactrl.cpp | 88 | ||||
-rw-r--r-- | indra/newview/llmediactrl.h | 3 | ||||
-rw-r--r-- | indra/newview/llpanellogin.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llpanellogin.h | 6 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 2 |
5 files changed, 65 insertions, 44 deletions
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 00043d1e72..803bacc567 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -805,44 +805,8 @@ void LLMediaCtrl::draw() F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth(); F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight(); - LLRect r = getRect(); - S32 width, height; - S32 x_offset = 0; - S32 y_offset = 0; - - if(mStretchToFill) - { - if(mMaintainAspectRatio) - { - F32 media_aspect = (F32)(media_plugin->getWidth()) / (F32)(media_plugin->getHeight()); - F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight()); - if(media_aspect > view_aspect) - { - // max width, adjusted height - width = r.getWidth(); - height = llmin(llmax(ll_round(width / media_aspect), 0), r.getHeight()); - } - else - { - // max height, adjusted width - height = r.getHeight(); - width = llmin(llmax(ll_round(height * media_aspect), 0), r.getWidth()); - } - } - else - { - width = r.getWidth(); - height = r.getHeight(); - } - } - else - { - width = llmin(media_plugin->getWidth(), r.getWidth()); - height = llmin(media_plugin->getHeight(), r.getHeight()); - } - - x_offset = (r.getWidth() - width) / 2; - y_offset = (r.getHeight() - height) / 2; + S32 x_offset, y_offset, width, height; + calcOffsetsAndSize(&x_offset, &y_offset, &width, &height); // draw the browser gGL.begin( LLRender::QUADS ); @@ -901,8 +865,56 @@ void LLMediaCtrl::draw() //////////////////////////////////////////////////////////////////////////////// // +void LLMediaCtrl::calcOffsetsAndSize(S32 *x_offset, S32 *y_offset, S32 *width, S32 *height) +{ + const LLRect &r = getRect(); + *x_offset = *y_offset = 0; + + if (mStretchToFill) + { + if (mMaintainAspectRatio) + { + F32 media_aspect = (F32)(mMediaSource->getMediaPlugin()->getWidth()) / (F32)(mMediaSource->getMediaPlugin()->getHeight()); + F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight()); + if (media_aspect > view_aspect) + { + // max width, adjusted height + *width = r.getWidth(); + *height = llmin(llmax(ll_round(*width / media_aspect), 0), r.getHeight()); + } + else + { + // max height, adjusted width + *height = r.getHeight(); + *width = llmin(llmax(ll_round(*height * media_aspect), 0), r.getWidth()); + } + } + else + { + *width = r.getWidth(); + *height = r.getHeight(); + } + } + else + { + *width = llmin(mMediaSource->getMediaPlugin()->getWidth(), r.getWidth()); + *height = llmin(mMediaSource->getMediaPlugin()->getHeight(), r.getHeight()); + } + + *x_offset = (r.getWidth() - *width) / 2; + *y_offset = (r.getHeight() - *height) / 2; +} + +//////////////////////////////////////////////////////////////////////////////// +// void LLMediaCtrl::convertInputCoords(S32& x, S32& y) { + S32 x_offset, y_offset, width, height; + calcOffsetsAndSize(&x_offset, &y_offset, &width, &height); + + x -= x_offset; + y -= y_offset; + bool coords_opengl = false; if(mMediaSource && mMediaSource->hasMedia()) diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 125a67e23e..11400c8274 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -181,6 +181,9 @@ public: protected: void convertInputCoords(S32& x, S32& y); + private: + void calcOffsetsAndSize(S32 *x_offset, S32 *y_offset, S32 *width, S32 *height); + private: void onVisibilityChanged ( const LLSD& new_visibility ); void onPopup(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index a88c10521c..0bcbdf7e67 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -75,6 +75,7 @@ LLPanelLogin *LLPanelLogin::sInstance = NULL; BOOL LLPanelLogin::sCapslockDidNotification = FALSE; +BOOL LLPanelLogin::sCredentialSet = FALSE; class LLLoginLocationAutoHandler : public LLCommandHandler { @@ -176,6 +177,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, setBackgroundOpaque(TRUE); mPasswordModified = FALSE; + LLPanelLogin::sInstance = this; LLView* login_holder = gViewerWindow->getLoginPanelHolder(); @@ -458,6 +460,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential, LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL; return; } + sCredentialSet = TRUE; LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL; LLSD identifier = credential->getIdentifier(); @@ -680,10 +683,8 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) } if ( new_start_slurl.getLocationString().length() ) { - if (location_combo->getCurrentIndex() == -1) - { - location_combo->setLabel(new_start_slurl.getLocationString()); - } + + location_combo->setLabel(new_start_slurl.getLocationString()); sInstance->mLocationLength = new_start_slurl.getLocationString().length(); sInstance->updateLoginButtons(); } @@ -862,6 +863,7 @@ void LLPanelLogin::onClickConnect(void *) } else { + sCredentialSet = FALSE; LLPointer<LLCredential> cred; BOOL remember; getFields(cred, remember); diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 869f2f8d39..82ef048493 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -56,9 +56,11 @@ public: void* callback_data); static void setFields(LLPointer<LLCredential> credential, BOOL remember); - + static void getFields(LLPointer<LLCredential>& credential, BOOL& remember); + static BOOL isCredentialSet() { return sCredentialSet; } + static BOOL areCredentialFieldsDirty(); static void setLocation(const LLSLURL& slurl); static void autologinToLocation(const LLSLURL& slurl); @@ -115,6 +117,8 @@ private: static LLPanelLogin* sInstance; static BOOL sCapslockDidNotification; bool mFirstLoginThisInstall; + + static BOOL sCredentialSet; unsigned int mUsernameLength; unsigned int mPasswordLength; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8295ce029b..df1d2a3946 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -766,7 +766,7 @@ bool idle_startup() // Show the login dialog login_show(); // connect dialog is already shown, so fill in the names - if (gUserCredential.notNull()) + if (gUserCredential.notNull() && !LLPanelLogin::isCredentialSet()) { LLPanelLogin::setFields( gUserCredential, gRememberPassword); } |