diff options
| author | Rye Mutt <rye@alchemyviewer.org> | 2024-08-18 18:34:15 -0400 | 
|---|---|---|
| committer | Rye Mutt <rye@alchemyviewer.org> | 2024-08-18 18:36:33 -0400 | 
| commit | b214de1cc39ec6fff0d896dbacdb38b605833870 (patch) | |
| tree | c5d990331101e69f60693e013e89926d56d853c6 | |
| parent | a242e8bee2c7f0b0906c850e065adddd5314275d (diff) | |
Fix findChild during draw in texture previews
| -rw-r--r-- | indra/newview/llpreviewtexture.cpp | 33 | ||||
| -rw-r--r-- | indra/newview/llpreviewtexture.h | 5 | 
2 files changed, 26 insertions, 12 deletions
| diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 2a5d7f2450..1b657d9ea1 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -129,6 +129,10 @@ void LLPreviewTexture::populateRatioList()  // virtual  bool LLPreviewTexture::postBuild()  { +    mButtonsPanel = getChild<LLLayoutPanel>("buttons_panel"); +    mDimensionsText = getChild<LLUICtrl>("dimensions"); +    mAspectRatioText = getChild<LLUICtrl>("aspect_ratio"); +      if (mCopyToInv)      {          getChild<LLButton>("Keep")->setLabel(getString("Copy")); @@ -346,15 +350,20 @@ void LLPreviewTexture::reshape(S32 width, S32 height, bool called_from_parent)  {      LLPreview::reshape(width, height, called_from_parent); -    LLRect dim_rect(getChildView("dimensions")->getRect()); -      S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE;      // add space for dimensions and aspect ratio -    S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD; -    if (getChild<LLLayoutPanel>("buttons_panel")->getVisible()) +    S32 info_height = CLIENT_RECT_VPAD; + +    if (mDimensionsText) +    { +        LLRect dim_rect(mDimensionsText->getRect()); +        info_height += dim_rect.mTop; +    } + +    if (mButtonsPanel && mButtonsPanel->getVisible())      { -        info_height += getChild<LLLayoutPanel>("buttons_panel")->getRect().getHeight(); +        info_height += mButtonsPanel->getRect().getHeight();      }      LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0);      client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD); @@ -404,8 +413,8 @@ void LLPreviewTexture::hideCtrlButtons()  {      getChildView("desc txt")->setVisible(false);      getChildView("desc")->setVisible(false); -    getChild<LLLayoutStack>("preview_stack")->collapsePanel(getChild<LLLayoutPanel>("buttons_panel"), true); -    getChild<LLLayoutPanel>("buttons_panel")->setVisible(false); +    getChild<LLLayoutStack>("preview_stack")->collapsePanel(mButtonsPanel, true); +    mButtonsPanel->setVisible(false);      getChild<LLComboBox>("combo_aspect_ratio")->setCurrentByIndex(0); //unconstrained      reshape(getRect().getWidth(), getRect().getHeight());  } @@ -538,8 +547,8 @@ void LLPreviewTexture::updateDimensions()      // Update the width/height display every time -    getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]",  llformat("%d", img_width)); -    getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", img_height)); +    mDimensionsText->setTextArg("[WIDTH]", llformat("%d", img_width)); +    mDimensionsText->setTextArg("[HEIGHT]", llformat("%d", img_height));      mLastHeight = img_height;      mLastWidth = img_width; @@ -554,9 +563,9 @@ void LLPreviewTexture::updateDimensions()          gFloaterView->adjustToFitScreen(this, false); -        LLRect dim_rect(getChildView("dimensions")->getRect()); -        LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect()); -        getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft); +        LLRect dim_rect(mDimensionsText->getRect()); +        LLRect aspect_label_rect(mAspectRatioText->getRect()); +        mAspectRatioText->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);      }  } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index e55d61ef10..44f3f07339 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -34,6 +34,7 @@  class LLComboBox;  class LLImageRaw; +class LLLayoutPanel;  class LLPreviewTexture : public LLPreview  { @@ -105,5 +106,9 @@ private:      LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ;      std::vector<std::string>        mRatiosList; + +    LLLayoutPanel* mButtonsPanel = nullptr; +    LLUICtrl* mDimensionsText = nullptr; +    LLUICtrl* mAspectRatioText = nullptr;  };  #endif  // LL_LLPREVIEWTEXTURE_H | 
