From b7c909367e2cf022588413accae9d2dc6bd8cf34 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 6 Apr 2017 21:29:43 +0300 Subject: MAINT-7267 Fixed UI missing last symbol of string on hi-res monitors. --- indra/llui/lltextbase.cpp | 37 ++++++++++++++++++++++++------------- indra/llui/lltextbase.h | 11 ++++++----- 2 files changed, 30 insertions(+), 18 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index f3a99dcef2..c570285856 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1505,8 +1505,8 @@ void LLTextBase::reflow() segment_set_t::iterator seg_iter = mSegments.begin(); S32 seg_offset = 0; S32 line_start_index = 0; - const S32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin - S32 remaining_pixels = text_available_width; + const F32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin + F32 remaining_pixels = text_available_width; S32 line_count = 0; // find and erase line info structs starting at start_index and going to end of document @@ -1532,14 +1532,15 @@ void LLTextBase::reflow() S32 cur_index = segment->getStart() + seg_offset; // ask segment how many character fit in remaining space - S32 character_count = segment->getNumChars(getWordWrap() ? llmax(0, remaining_pixels) : S32_MAX, + S32 character_count = segment->getNumChars(getWordWrap() ? llmax(0, ll_round(remaining_pixels)) : S32_MAX, seg_offset, cur_index - line_start_index, S32_MAX, line_count - seg_line_offset); - S32 segment_width, segment_height; - bool force_newline = segment->getDimensions(seg_offset, character_count, segment_width, segment_height); + F32 segment_width; + S32 segment_height; + bool force_newline = segment->getDimensionsF32(seg_offset, character_count, segment_width, segment_height); // grow line height as necessary based on reported height of this segment line_height = llmax(line_height, segment_height); remaining_pixels -= segment_width; @@ -1548,11 +1549,13 @@ void LLTextBase::reflow() S32 last_segment_char_on_line = segment->getStart() + seg_offset; - S32 text_actual_width = text_available_width - remaining_pixels; + // Note: make sure text will fit in width - use ceil, but also make sure + // ceil is used only once per line + S32 text_actual_width = llceil(text_available_width - remaining_pixels); S32 text_left = getLeftOffset(text_actual_width); LLRect line_rect(text_left, cur_top, - text_left + text_actual_width, + text_left + text_actual_width, cur_top - line_height); // if we didn't finish the current segment... @@ -3066,7 +3069,15 @@ boost::signals2::connection LLTextBase::setIsObjectBlockedCallback(const is_bloc LLTextSegment::~LLTextSegment() {} -bool LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const { width = 0; height = 0; return false;} +bool LLTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { width = 0; height = 0; return false; } +bool LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +{ + F32 fwidth = 0; + bool result = getDimensionsF32(first_char, num_chars, fwidth, height); + width = ll_round(fwidth); + return result; +} + S32 LLTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const { return 0; } S32 LLTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const { return 0; } void LLTextSegment::updateLayout(const LLTextBase& editor) {} @@ -3314,7 +3325,7 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip) mTooltip = tooltip; } -bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLNormalTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { height = 0; width = 0; @@ -3323,7 +3334,7 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt height = mFontHeight; const LLWString &text = getWText(); // if last character is a newline, then return true, forcing line break - width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars); + width = mStyle->getFont()->getWidthF32(text.c_str(), mStart + first_char, num_chars); } return false; } @@ -3491,7 +3502,7 @@ LLInlineViewSegment::~LLInlineViewSegment() mView->die(); } -bool LLInlineViewSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLInlineViewSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { if (first_char == 0 && num_chars == 0) { @@ -3578,7 +3589,7 @@ LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLT LLLineBreakTextSegment::~LLLineBreakTextSegment() { } -bool LLLineBreakTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLLineBreakTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { width = 0; height = mFontHeight; @@ -3607,7 +3618,7 @@ LLImageTextSegment::~LLImageTextSegment() static const S32 IMAGE_HPAD = 3; -bool LLImageTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const +bool LLImageTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { width = 0; height = mStyle->getFont()->getLineHeight(); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index c7b6203445..5fdde445ef 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -61,8 +61,9 @@ public: mEnd(end) {} virtual ~LLTextSegment(); + bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; - virtual bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + virtual bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; virtual S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; /** @@ -126,7 +127,7 @@ public: LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); virtual ~LLNormalTextSegment(); - /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); @@ -212,7 +213,7 @@ public: LLInlineViewSegment(const Params& p, S32 start, S32 end); ~LLInlineViewSegment(); - /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; /*virtual*/ void updateLayout(const class LLTextBase& editor); /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); @@ -236,7 +237,7 @@ public: LLLineBreakTextSegment(LLStyleConstSP style,S32 pos); LLLineBreakTextSegment(S32 pos); ~LLLineBreakTextSegment(); - bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); @@ -249,7 +250,7 @@ class LLImageTextSegment : public LLTextSegment public: LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor); ~LLImageTextSegment(); - bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; + /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 char_offset, S32 max_chars, S32 line_ind) const; F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); -- cgit v1.3 From 0dcb423cf3dc42e11621eece972801b036657e91 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 25 Apr 2017 17:48:34 +0300 Subject: MAINT-7145 Eliminate LLSingleton circular references --- indra/llcommon/llsingleton.cpp | 32 +++++++++++++++++++++++++++----- indra/llui/llnotifications.cpp | 18 ++++++------------ indra/newview/lldaycyclemanager.cpp | 22 ---------------------- indra/newview/llenvmanager.cpp | 21 ++++++++++++++++++++- indra/newview/llsky.cpp | 2 -- indra/newview/llstartup.cpp | 1 + indra/newview/llwlparammanager.cpp | 25 ++++++++----------------- indra/newview/llwlparammanager.h | 5 +++-- 8 files changed, 65 insertions(+), 61 deletions(-) (limited to 'indra/llui') diff --git a/indra/llcommon/llsingleton.cpp b/indra/llcommon/llsingleton.cpp index 9025e53bb2..a3a87edd88 100644 --- a/indra/llcommon/llsingleton.cpp +++ b/indra/llcommon/llsingleton.cpp @@ -220,6 +220,9 @@ void LLSingletonBase::capture_dependency(list_t& initializing, EInitState initSt std::find(initializing.begin(), initializing.end(), this); if (found != initializing.end()) { + list_t::const_iterator it_next = found; + it_next++; + // Report the circularity. Requiring the coder to dig through the // logic to diagnose exactly how we got here is less than helpful. std::ostringstream out; @@ -238,11 +241,30 @@ void LLSingletonBase::capture_dependency(list_t& initializing, EInitState initSt // otherwise we'd be returning a pointer to a partially- // constructed object! But from initSingleton() is okay: that // method exists specifically to support circularity. - // Decide which log helper to call based on initState. They have - // identical signatures. - ((initState == CONSTRUCTING)? logerrs : logwarns) - ("LLSingleton circularity: ", out.str().c_str(), - demangle(typeid(*this).name()).c_str(), ""); + // Decide which log helper to call. + if (initState == CONSTRUCTING) + { + logerrs("LLSingleton circularity in Constructor: ", out.str().c_str(), + demangle(typeid(*this).name()).c_str(), ""); + } + else if (it_next == initializing.end()) + { + // Points to self after construction, but during initialization. + // Singletons can initialize other classes that depend onto them, + // so this is expected. + // + // Example: LLNotifications singleton initializes default channels. + // Channels register themselves with singleton once done. + logdebugs("LLSingleton circularity: ", out.str().c_str(), + demangle(typeid(*this).name()).c_str(), ""); + } + else + { + // Actual circularity with other singleton (or single singleton is used extensively). + // Dependency can be unclear. + logwarns("LLSingleton circularity: ", out.str().c_str(), + demangle(typeid(*this).name()).c_str(), ""); + } } else { diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 0cb959a315..604092d536 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1405,20 +1405,14 @@ void LLNotifications::createDefaultChannels() mDefaultChannels.push_back(new LLPersistentNotificationChannel()); // connect action methods to these channels - LLNotifications::instance().getChannel("Enabled")-> - connectFailedFilter(&defaultResponse); - LLNotifications::instance().getChannel("Expiration")-> - connectChanged(boost::bind(&LLNotifications::expirationHandler, this, _1)); + getChannel("Enabled")->connectFailedFilter(&defaultResponse); + getChannel("Expiration")->connectChanged(boost::bind(&LLNotifications::expirationHandler, this, _1)); // uniqueHandler slot should be added as first slot of the signal due to // usage LLStopWhenHandled combiner in LLStandardSignal - LLNotifications::instance().getChannel("Unique")-> - connectAtFrontChanged(boost::bind(&LLNotifications::uniqueHandler, this, _1)); - LLNotifications::instance().getChannel("Unique")-> - connectFailedFilter(boost::bind(&LLNotifications::failedUniquenessTest, this, _1)); - LLNotifications::instance().getChannel("Ignore")-> - connectFailedFilter(&handleIgnoredNotification); - LLNotifications::instance().getChannel("VisibilityRules")-> - connectFailedFilter(&visibilityRuleMached); + getChannel("Unique")->connectAtFrontChanged(boost::bind(&LLNotifications::uniqueHandler, this, _1)); + getChannel("Unique")->connectFailedFilter(boost::bind(&LLNotifications::failedUniquenessTest, this, _1)); + getChannel("Ignore")->connectFailedFilter(&handleIgnoredNotification); + getChannel("VisibilityRules")->connectFailedFilter(&visibilityRuleMached); } diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp index e7bf989850..803e2b2fb2 100644 --- a/indra/newview/lldaycyclemanager.cpp +++ b/indra/newview/lldaycyclemanager.cpp @@ -163,28 +163,6 @@ void LLDayCycleManager::initSingleton() { LL_DEBUGS("Windlight") << "Loading all day cycles" << LL_ENDL; loadAllPresets(); - - // presets loaded, can set params - if (LLEnvManagerNew::instance().getUseDayCycle()) - { - LLSD params; - std::string preferred_day = LLEnvManagerNew::getInstance()->getDayCycleName(); - if (getPreset(preferred_day, params)) - { - // Same as through useDayCycle(), but it will call LLDayCycleManager and we are initializing - // so no need to cycle - LLWLParamManager::getInstance()->applyDayCycleParams(params, LLEnvKey::SCOPE_LOCAL); - } - else - { - LL_WARNS() << "No day cycle named " << preferred_day << ", reverting LLWLParamManager to defaults" << LL_ENDL; - LLWLParamManager::getInstance()->setDefaultDay(); - } - } - else - { - LLWLParamManager::getInstance()->setDefaultDay(); - } } void LLDayCycleManager::loadAllPresets() diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index b97e483fd9..12c3070474 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -476,7 +476,7 @@ void LLEnvManagerNew::onRegionSettingsResponse(const LLSD& content) mCachedRegionPrefs = new_settings; // Load region sky presets. - LLWLParamManager::instance().refreshRegionPresets(); + LLWLParamManager::instance().refreshRegionPresets(getRegionSettings().getSkyMap()); // If using server settings, update managers. if (getUseRegionSettings()) @@ -509,6 +509,25 @@ void LLEnvManagerNew::initSingleton() LL_DEBUGS("Windlight") << "Initializing LLEnvManagerNew" << LL_ENDL; loadUserPrefs(); + + // preferences loaded, can set params + std::string preferred_day = getDayCycleName(); + if (!useDayCycle(preferred_day, LLEnvKey::SCOPE_LOCAL)) + { + LL_WARNS() << "No day cycle named " << preferred_day << ", reverting LLWLParamManager to defaults" << LL_ENDL; + LLWLParamManager::instance().setDefaultDay(); + } + + std::string sky = getSkyPresetName(); + if (!useSkyPreset(sky)) + { + LL_WARNS() << "No sky preset named " << sky << ", falling back to defaults" << LL_ENDL; + LLWLParamManager::instance().setDefaultSky(); + + // *TODO: Fix user preferences accordingly. + } + + LLWLParamManager::instance().resetAnimator(0.5 /*noon*/, getUseDayCycle()); } void LLEnvManagerNew::updateSkyFromPrefs() diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp index 7a292fe0ef..3ef89ba920 100644 --- a/indra/newview/llsky.cpp +++ b/indra/newview/llsky.cpp @@ -341,8 +341,6 @@ void LLSky::init(const LLVector3 &sun_direction) LLGLState::checkTextureChannels(); mUpdatedThisFrame = TRUE; - - LLEnvManagerNew::instance().usePrefs(); //inits day cycles and water } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0a85344025..33b6352bf5 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1462,6 +1462,7 @@ bool idle_startup() LLGLState::checkStates(); LLGLState::checkTextureChannels(); + LLEnvManagerNew::getInstance()->usePrefs(); // Load all presets and settings gSky.init(initial_sun_direction); LLGLState::checkStates(); diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index debe467a9a..4b4393b07b 100644 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -50,7 +50,6 @@ #include "llagent.h" #include "llviewerregion.h" -#include "llenvmanager.h" #include "llwlparamset.h" #include "llpostprocess.h" @@ -251,13 +250,13 @@ void LLWLParamManager::addAllSkies(const LLWLParamKey::EScope scope, const LLSD& } } -void LLWLParamManager::refreshRegionPresets() +void LLWLParamManager::refreshRegionPresets(const LLSD& region_sky_presets) { // Remove all region sky presets because they may belong to a previously visited region. clearParamSetsOfScope(LLEnvKey::SCOPE_REGION); // Add all sky presets belonging to the current region. - addAllSkies(LLEnvKey::SCOPE_REGION, LLEnvManagerNew::instance().getRegionSettings().getSkyMap()); + addAllSkies(LLEnvKey::SCOPE_REGION, region_sky_presets); } void LLWLParamManager::loadAllPresets() @@ -489,7 +488,6 @@ bool LLWLParamManager::applyDayCycleParams(const LLSD& params, LLEnvKey::EScope void LLWLParamManager::setDefaultDay() { mDay.loadDayCycleFromFile("Default.xml"); - resetAnimator(0.5, LLEnvManagerNew::getInstance()->getUseDayCycle()); } bool LLWLParamManager::applySkyParams(const LLSD& params) @@ -499,6 +497,12 @@ bool LLWLParamManager::applySkyParams(const LLSD& params) return true; } +void LLWLParamManager::setDefaultSky() +{ + getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams); +} + + void LLWLParamManager::resetAnimator(F32 curTime, bool run) { mAnimator.setTrack(mDay.mTimeMap, mDay.mDayRate, @@ -677,19 +681,6 @@ void LLWLParamManager::initSingleton() loadAllPresets(); - // *HACK - sets cloud scrolling to what we want... fix this better in the future - std::string sky = LLEnvManagerNew::instance().getSkyPresetName(); - if (!getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), mCurParams)) - { - LL_WARNS() << "No sky preset named " << sky << ", falling back to defaults" << LL_ENDL; - getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams); - - // *TODO: Fix user preferences accordingly. - } - - // set it to noon - resetAnimator(0.5, LLEnvManagerNew::instance().getUseDayCycle()); - // but use linden time sets it to what the estate is mAnimator.setTimeType(LLWLAnimator::TIME_LINDEN); } diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h index db3c285e76..a8029839a7 100644 --- a/indra/newview/llwlparammanager.h +++ b/indra/newview/llwlparammanager.h @@ -29,7 +29,6 @@ #include #include -#include "llenvmanager.h" #include "llwlparamset.h" #include "llwlanimator.h" #include "llwldaycycle.h" @@ -246,6 +245,8 @@ public: /// apply specified fixed sky params bool applySkyParams(const LLSD& params); + void setDefaultSky(); + // get where the light is pointing inline LLVector4 getLightDir(void) const; @@ -305,7 +306,7 @@ public: void addAllSkies(LLEnvKey::EScope scope, const LLSD& preset_map); /// refresh region-scope presets - void refreshRegionPresets(); + void refreshRegionPresets(const LLSD& region_sky_presets); // returns all skies referenced by the current day cycle (in mDay), with their final names // side effect: applies changes to all internal structures! (trashes all unreferenced skies in scope, keys in day cycle rescoped to scope, etc.) -- cgit v1.3 From d65e6e83821bf134805282e5c2ff66f76c819fe6 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 5 May 2017 17:47:36 +0300 Subject: MAINT-7386 FIXED app/objectim slurl consumes the rest of the chat string --- indra/llui/llurlentry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index b211829496..a4243ebfa1 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -917,7 +917,7 @@ std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLab // LLUrlEntryObjectIM::LLUrlEntryObjectIM() { - mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\?.*", + mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\?\\S*\\w", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_objectim.xml"; } -- cgit v1.3