FHEADER_INLINE void FHeaderElement::mouseMoveEvent(Event::FMouseEvent* e) { if (isSizable() && LeftButton == e->button && FHeaderElement_SizeMode) { int nWidth = e->mouse.x - FHeaderElement_Rect.left + (FHeaderElement_Rect.right - FHeaderElement_MouseX); if (nWidth < 0) nWidth = 0; if (getMinWidth() > nWidth) nWidth = getMinWidth(); if (getMaxWidth() > 0 && getMaxWidth() < nWidth) nWidth = getMaxWidth(); FHeader *pHeader = NULL; if (NULL != getParent()) { pHeader = static_cast<FHeader*>(getParent()->getInterface(FOOWC_HEADER)); } setWidth(nWidth); if (NULL != pHeader) { pHeader->elementWidthChanged(this, nWidth); } } __super::mouseMoveEvent(e); }
void Window::saveWindowState() { // Saving X, Y and Width and Height for resizables in the config if (!mWindowName.empty() && mWindowName != "window") { config.setValue(mWindowName + "WinX", getX()); config.setValue(mWindowName + "WinY", getY()); if (mSaveVisible) config.setValue(mWindowName + "Visible", isVisible()); if (mStickyButton) config.setValue(mWindowName + "Sticky", isSticky()); if (mGrip) { if (getMinWidth() > getWidth()) setWidth(getMinWidth()); else if (getMaxWidth() < getWidth()) setWidth(getMaxWidth()); if (getMinHeight() > getHeight()) setHeight(getMinHeight()); else if (getMaxHeight() < getHeight()) setHeight(getMaxHeight()); config.setValue(mWindowName + "WinWidth", getWidth()); config.setValue(mWindowName + "WinHeight", getHeight()); } } }
void LLNearbyChatBar::onToggleNearbyChatPanel() { LLView* nearby_chat = getChildView("nearby_chat"); if (nearby_chat->getVisible()) { if (!isMinimized()) { mExpandedHeight = getRect().getHeight(); } setResizeLimits(getMinWidth(), COLLAPSED_HEIGHT); nearby_chat->setVisible(FALSE); reshape(getRect().getWidth(), COLLAPSED_HEIGHT); enableResizeCtrls(true, true, false); storeRectControl(); } else { nearby_chat->setVisible(TRUE); setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); reshape(getRect().getWidth(), mExpandedHeight); enableResizeCtrls(true); storeRectControl(); } gSavedSettings.setBOOL("nearbychat_history_visibility", mNearbyChat->getVisible()); }
void Window::setContentSize(int width, int height) { width = width + 2 * getPadding(); height = height + getPadding() + getTitleBarHeight(); if (getMinWidth() > width) width = getMinWidth(); else if (getMaxWidth() < width) width = getMaxWidth(); if (getMinHeight() > height) height = getMinHeight(); else if (getMaxHeight() < height) height = getMaxHeight(); setSize(width, height); }
void iWidget::updateAlignment(int32 clientWidth, int32 clientHeight) { int32 width = getMinWidth(); int32 height = getMinHeight(); switch (iWidget::getHorizontalAlignment()) { case iHorizontalAlignment::Left: _relativeX = 0; break; case iHorizontalAlignment::Strech: _relativeX = 0; width = clientWidth; break; case iHorizontalAlignment::Center: _relativeX = (clientWidth - width) / 2; break; case iHorizontalAlignment::Right: _relativeX = clientWidth - width; break; case iHorizontalAlignment::Absolut: con_err("absolut positioning only supported for dialogs"); break; default:; }; switch (iWidget::getVerticalAlignment()) { case iVerticalAlignment::Top: _relativeY = 0; break; case iVerticalAlignment::Strech: _relativeY = 0; height = clientHeight; break; case iVerticalAlignment::Center: _relativeY = (clientHeight - height) / 2; break; case iVerticalAlignment::Bottom: _relativeY = clientHeight - height; break; case iVerticalAlignment::Absolut: con_err("absolut positioning only supported for dialogs"); break; default:; } _actualWidth = width; _actualHeight = height; }
//static void LLFloaterNotificationConsole::updateResizeLimits() { const LLFloater::Params& floater_params = LLFloater::getDefaultParams(); S32 floater_header_size = floater_params.header_height; LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels"); setResizeLimits(getMinWidth(), floater_header_size + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels())); }
void Window::setDefaultSize(int defaultX, int defaultY, int defaultWidth, int defaultHeight) { if (getMinWidth() > defaultWidth) defaultWidth = getMinWidth(); else if (getMaxWidth() < defaultWidth) defaultWidth = getMaxWidth(); if (getMinHeight() > defaultHeight) defaultHeight = getMinHeight(); else if (getMaxHeight() < defaultHeight) defaultHeight = getMaxHeight(); mDefaultX = defaultX; mDefaultY = defaultY; mDefaultWidth = defaultWidth; mDefaultHeight = defaultHeight; }
void Popup::setContentSize(int width, int height) { width += 2 * getPadding(); height += 2 * getPadding(); if (getMinWidth() > width) width = getMinWidth(); else if (getMaxWidth() < width) width = getMaxWidth(); if (getMinHeight() > height) height = getMinHeight(); else if (getMaxHeight() < height) height = getMaxHeight(); setSize(width, height); mRedraw = true; }
void Window::loadWindowState() { const std::string &name = mWindowName; assert(!name.empty()); setPosition((int) config.getValue(name + "WinX", mDefaultX), (int) config.getValue(name + "WinY", mDefaultY)); if (mSaveVisible) setVisible((bool) config.getValue(name + "Visible", mDefaultVisible)); if (mStickyButton) setSticky((bool) config.getValue(name + "Sticky", isSticky())); if (mGrip) { int width = (int) config.getValue(name + "WinWidth", mDefaultWidth); int height = (int) config.getValue(name + "WinHeight", mDefaultHeight); if (getMinWidth() > width) width = getMinWidth(); else if (getMaxWidth() < width) width = getMaxWidth(); if (getMinHeight() > height) height = getMinHeight(); else if (getMaxHeight() < height) height = getMaxHeight(); setSize(width, height); } else { setSize(mDefaultWidth, mDefaultHeight); } // Check if the window is off screen... checkIfIsOffScreen(); }
void Window::setDefaultSize(int defaultWidth, int defaultHeight, ImageRect::ImagePosition position, int offsetX, int offsetY) { if (getMinWidth() > defaultWidth) defaultWidth = getMinWidth(); else if (getMaxWidth() < defaultWidth) defaultWidth = getMaxWidth(); if (getMinHeight() > defaultHeight) defaultHeight = getMinHeight(); else if (getMaxHeight() < defaultHeight) defaultHeight = getMaxHeight(); int posX = 0, posY = 0; getRelativeOffset(position, posX, posY, defaultWidth, defaultHeight, 0, 0); mDefaultWidth = defaultWidth; mDefaultHeight = defaultHeight; mDefaultPosition = position; mDefaultOffsetX = posX - offsetX; mDefaultOffsetY = posY - offsetY; }
bool LLNearbyChatBar::applyRectControl() { bool rect_controlled = LLFloater::applyRectControl(); if (!mNearbyChat->getVisible()) { reshape(getRect().getWidth(), getMinHeight()); enableResizeCtrls(true, true, false); } else { enableResizeCtrls(true); setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT); } return rect_controlled; }
void FloaterAO::onClickMore() { LLRect fullSize=gSavedPerAccountSettings.getRect("floater_rect_animation_overrider_full"); LLRect smallSize=getRect(); if(fullSize.getHeight()<getMinHeight()) fullSize.setOriginAndSize(fullSize.mLeft,fullSize.mBottom,fullSize.getWidth(),getRect().getHeight()); if(fullSize.getWidth()<getMinWidth()) fullSize.setOriginAndSize(fullSize.mLeft,fullSize.mBottom,getRect().getWidth(),fullSize.getHeight()); mMore=TRUE; mSmallInterfacePanel->setVisible(FALSE); mMainInterfacePanel->setVisible(TRUE); setCanResize(TRUE); gSavedPerAccountSettings.setBOOL("UseFullAOInterface",TRUE); reshape(getRect().getWidth(),fullSize.getHeight()); }
int32_t CBC_PDF417Reader::getMinCodewordWidth(CFX_PtrArray& p) { int32_t a = getMinWidth((CBC_ResultPoint*)p.GetAt(6), (CBC_ResultPoint*)p.GetAt(2)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; int32_t b = getMinWidth((CBC_ResultPoint*)p.GetAt(7), (CBC_ResultPoint*)p.GetAt(3)) * CBC_PDF417Common::MODULES_IN_CODEWORD / CBC_PDF417Common::MODULES_IN_STOP_PATTERN; int32_t c = getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) < a ? getMinWidth((CBC_ResultPoint*)p.GetAt(0), (CBC_ResultPoint*)p.GetAt(4)) : a; int32_t d = getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) < b ? getMinWidth((CBC_ResultPoint*)p.GetAt(1), (CBC_ResultPoint*)p.GetAt(5)) : b; return c < d ? c : d; }
double TransparentScrollBarH::calcButtonWidth() { auto scrollButton = qobject_cast<TransparentScrollButtonH*>(getScrollButton()); return std::max((int)(calcScrollBarRatio() * view_->width()), scrollButton->getMinWidth()); }
void Window::loadWindowState() { const std::string &name = mWindowName; const std::string skinName = config.getValue(name + "Skin", mSkin->getFilePath()); assert(!name.empty()); if (mGrip) { int width = (int) config.getValue(name + "WinWidth", mDefaultWidth); int height = (int) config.getValue(name + "WinHeight", mDefaultHeight); if (getMinWidth() > width) width = getMinWidth(); else if (getMaxWidth() < width) width = getMaxWidth(); if (getMinHeight() > height) height = getMinHeight(); else if (getMaxHeight() < height) height = getMaxHeight(); setSize(width, height); } else { setSize(mDefaultWidth, mDefaultHeight); } int x = (int) config.getValue(name + "WinX", -1); int y = (int) config.getValue(name + "WinY", -1); if (x != -1 || y != -1) { // These two tags are deprecated. Convert them to the new system, then // remove them to avoid client coordinate confusion. config.removeValue(mWindowName + "WinX"); config.removeValue(mWindowName + "WinY"); saveRelativeLocation(x, y); } int position = (int) config.getValue(name + "Position", -1); mOffsetX = (int) config.getValue(name + "OffsetX", mDefaultOffsetX); mOffsetY = (int) config.getValue(name + "OffsetY", mDefaultOffsetY); if (position != -1) { mPosition = (ImageRect::ImagePosition) position; setLocationRelativeTo(mPosition, mOffsetX, mOffsetY); } else { setLocationRelativeTo(mDefaultPosition, mDefaultOffsetX, mDefaultOffsetY); } if (mSaveVisibility) { setVisible((bool) config.getValue(name + "Visible", mDefaultVisible)); mOldVisibility = (bool) config.getValue(name + "Hidden", false); } if (skinName.compare(mSkin->getFilePath()) != 0) { mSkin->instances--; mSkin = skinLoader->load(skinName, mDefaultSkinPath); } }
// virtual void LLFloaterTexturePicker::draw() { S32 floater_header_size = getHeaderHeight(); if (mOwner) { // draw cone of context pointing back to texture swatch LLRect owner_rect; mOwner->localRectToOtherView(mOwner->getLocalRect(), &owner_rect, this); LLRect local_rect = getLocalRect(); if (gFocusMgr.childHasKeyboardFocus(this) && mOwner->isInVisibleChain() && mContextConeOpacity > 0.001f) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable(GL_CULL_FACE); gGL.begin(LLRender::QUADS); { gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mTop); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mTop); gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); gGL.vertex2i(local_rect.mRight, local_rect.mBottom); gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); } gGL.end(); } } if (gFocusMgr.childHasMouseCapture(getDragHandle())) { mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); } else { mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); } updateImageStats(); // if we're inactive, gray out "apply immediate" checkbox getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected); getChildView("Select")->setEnabled(mActive); getChildView("Pipette")->setEnabled(mActive); getChild<LLUICtrl>("Pipette")->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); //BOOL allow_copy = FALSE; if( mOwner ) { mTexturep = NULL; if(mImageAssetID.notNull()) { mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, MIPMAP_YES); mTexturep->setBoostLevel(LLViewerTexture::BOOST_PREVIEW); } if (mTentativeLabel) { mTentativeLabel->setVisible( FALSE ); } getChildView("Default")->setEnabled(mImageAssetID != mOwner->getDefaultImageAssetID()); getChildView("Blank")->setEnabled(mImageAssetID != mWhiteImageAssetID ); getChildView("None")->setEnabled(mOwner->getAllowNoTexture() && !mImageAssetID.isNull() ); LLFloater::draw(); if( isMinimized() ) { return; } // Border LLRect border( BORDER_PAD, getRect().getHeight() - floater_header_size - BORDER_PAD, ((getMinWidth() / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD, BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - getMinHeight())); gl_rect_2d( border, LLColor4::black, FALSE ); // Interior LLRect interior = border; interior.stretch( -1 ); // If the floater is focused, don't apply its alpha to the texture (STORM-677). const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); if( mTexturep ) { if( mTexturep->getComponents() == 4 ) { gl_rect_2d_checkerboard( interior, alpha ); } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep, UI_VERTEX_COLOR % alpha ); // Pump the priority mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); } else if (!mFallbackImage.isNull()) { mFallbackImage->draw(interior, UI_VERTEX_COLOR % alpha); } else { gl_rect_2d( interior, LLColor4::grey % alpha, TRUE ); // Draw X gl_draw_x(interior, LLColor4::black ); } // Draw Tentative Label over the image if( mOwner->getTentative() && !mViewModel->isDirty() ) { mTentativeLabel->setVisible( TRUE ); drawChild(mTentativeLabel); } if (mSelectedItemPinned) return; LLFolderView* folder_view = mInventoryPanel->getRootFolder(); if (!folder_view) return; LLInventoryFilter* filter = folder_view->getFilter(); if (!filter) return; bool is_filter_active = folder_view->getCompletedFilterGeneration() < filter->getCurrentGeneration() && filter->isNotDefault(); // After inventory panel filter is applied we have to update // constraint rect for the selected item because of folder view // AutoSelectOverride set to TRUE. We force PinningSelectedItem // flag to FALSE state and setting filter "dirty" to update // scroll container to show selected item (see LLFolderView::doIdle()). if (!is_filter_active && !mSelectedItemPinned) { folder_view->setPinningSelectedItem(mSelectedItemPinned); folder_view->dirtyFilter(); folder_view->arrangeFromRoot(); mSelectedItemPinned = TRUE; } } }
//static void LLFloaterNotificationConsole::updateResizeLimits() { LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels"); setResizeLimits(getMinWidth(), LLFLOATER_HEADER_SIZE + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels())); }