// virtual void LLFloaterTexturePicker::draw() { 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 childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected); childSetEnabled("Select", mActive); childSetEnabled("Pipette", mActive); childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); //RN: reset search bar to reflect actual search query (all caps, for example) mSearchEdit->setText(mInventoryPanel->getFilterSubString()); //BOOL allow_copy = FALSE; if( mOwner ) { mTexturep = NULL; if(mImageAssetID.notNull()) { mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); } else if (!mFallbackImageName.empty()) { mTexturep = gImageList.getImageFromFile(mFallbackImageName); mTexturep->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); } if (mTentativeLabel) { mTentativeLabel->setVisible( FALSE ); } childSetEnabled("Default", mImageAssetID != mOwner->getDefaultImageAssetID()); childSetEnabled("Blank", mImageAssetID != mWhiteImageAssetID ); childSetEnabled("Invisible", mOwner->getAllowInvisibleTexture() && mImageAssetID != mInvisibleImageAssetID ); childSetEnabled("None", mOwner->getAllowNoTexture() && !mImageAssetID.isNull() ); LLFloater::draw(); if( isMinimized() ) { return; } // Border LLRect border( BORDER_PAD, getRect().getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD, ((TEX_PICKER_MIN_WIDTH / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD, BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - TEX_PICKER_MIN_HEIGHT)); gl_rect_2d( border, LLColor4::black, FALSE ); // Interior LLRect interior = border; interior.stretch( -1 ); if( mTexturep ) { if( mTexturep->getComponents() == 4 ) { gl_rect_2d_checkerboard( interior ); } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep ); // Pump the priority mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); // Draw Tentative Label over the image if( mOwner->getTentative() && !mIsDirty ) { mTentativeLabel->setVisible( TRUE ); drawChild(mTentativeLabel); } } else { gl_rect_2d( interior, LLColor4::grey, TRUE ); // Draw X gl_draw_x(interior, LLColor4::black ); } } }
void InputSettingsWindow::inputEvent(uint16_t scancode) { if(!activeInput) return; if(!isActiveWindow() || isMinimized()) return; int16_t state = mapper().state(scancode); if(dynamic_cast<DigitalInput*>(activeInput)) { if(Keyboard::isAnyKey(scancode) && mapper().state(scancode)) { for(unsigned i = 0; i < Keyboard::Count; i++) { //don't map escape key, as it is reserved by the user interface if(scancode == keyboard(i)[Keyboard::Escape]) return; } setAssignment(string() << mapper().modifierString() << Scancode::encode(scancode)); } else if(Keyboard::isAnyModifier(scancode) && !config().input.modifierEnable) { setAssignment(string() << Scancode::encode(scancode)); } else if(Mouse::isAnyButton(scancode) && !mapper().state(scancode)) { //ensure button was clicked inside list box unsigned wx = 0, wy = 0; QWidget *widget = buttonBox; while(widget) { wx += widget->geometry().x(); wy += widget->geometry().y(); widget = widget->parentWidget(); } unsigned px = QCursor::pos().x(); unsigned py = QCursor::pos().y(); if(px < wx || px >= wx + buttonBox->size().width()) return; if(py < wy || py >= wy + buttonBox->size().height()) return; setAssignment(string() << mapper().modifierString() << Scancode::encode(scancode)); } else if(Joypad::isAnyHat(scancode)) { string position; if(state == Joypad::HatUp) position = ".Up"; else if(state == Joypad::HatDown) position = ".Down"; else if(state == Joypad::HatLeft) position = ".Left"; else if(state == Joypad::HatRight) position = ".Right"; else return; setAssignment(string() << mapper().modifierString() << Scancode::encode(scancode) << position); } else if(Joypad::isAnyAxis(scancode) && mapper().distance(scancode) > 64) { if(mapper().calibrated == false) { MappedInput *temp = activeInput; activeInput = 0; mapper().calibrate(); activeInput = temp; return; } if(mapper().isTrigger[Joypad::numberDecode(scancode)][Joypad::axisDecode(scancode)] == false) { string position; if(state < -24576) position = ".Lo"; else if(state > +24576) position = ".Hi"; else return; setAssignment(string() << mapper().modifierString() << Scancode::encode(scancode) << position); } else { if(state >= 0) return; setAssignment(string() << mapper().modifierString() << Scancode::encode(scancode) << ".Trigger"); } } else if(Joypad::isAnyButton(scancode) && mapper().state(scancode)) { setAssignment(string() << mapper().modifierString() << Scancode::encode(scancode)); } } else if(dynamic_cast<AnalogInput*>(activeInput)) { if(Mouse::isAnyButton(scancode) && mapper().state(scancode)) { //actual assignment occurs during (x,y)AxisButton::released() activeMouse = Mouse::numberDecode(scancode); } else if(Joypad::isAnyAxis(scancode) && mapper().distance(scancode) > 64) { if(mapper().calibrated == false) { MappedInput *temp = activeInput; activeInput = 0; mapper().calibrate(); activeInput = temp; return; } if(mapper().isTrigger[Joypad::numberDecode(scancode)][Joypad::axisDecode(scancode)] == false) { if(state < -24576 || state > +24576) { setAssignment(string() << Scancode::encode(scancode)); } } } } }
void LLPreviewTexture::draw() { updateDimensions(); LLPreview::draw(); if (!isMinimized()) { LLGLSUIDefault gls_ui; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); const LLRect& border = mClientRect; LLRect interior = mClientRect; interior.stretch(-PREVIEW_BORDER_WIDTH ); // ...border gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f)); gl_rect_2d_checkerboard(interior); if (mImage.notNull()) { // Draw the texture glColor3f( 1.f, 1.f, 1.f ); gl_draw_scaled_image(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mImage); // Pump the texture priority F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA : (F32)(interior.getWidth() * interior.getHeight()); mImage->addTextureStats(pixel_area); if (pixel_area > 0.f) { //boost the previewed image priority to the highest to make it to get loaded first. mImage->setAdditionalDecodePriority(1.0f); } std::string assetid(mImageID.asString()); if (mIsCopyable) childSetText("uuid", assetid); if (uploaderkey.isNull()&&(mImage->mDecodedComment.find("a")!=mImage->mDecodedComment.end())) { uploaderkey = LLUUID(mImage->mDecodedComment["a"]); childSetText("uploader", mImage->mDecodedComment["a"]); // Ansariel: Changed to boost::bind callback //gCacheName->get(uploaderkey, FALSE, callbackLoadAvatarName); gCacheName->get(uploaderkey, false, boost::bind(&callbackLoadAvatarName, _1, _2, _3, this)); } if (color.empty()&&(mImage->mDecodedComment.find("c")!=mImage->mDecodedComment.end())) { color = mImage->mDecodedComment["c"]; } if (time.empty()&&(mImage->mDecodedComment.find("z")!=mImage->mDecodedComment.end())) { time=mImage->mDecodedComment["z"]; std::string year = time.substr(0,4); std::string month = time.substr(4,2); std::string day = time.substr(6,2); std::string hour = time.substr(8,2); std::string minute = time.substr(10,2); std::string second = time.substr(12,2); time = llformat("%s/%s/%s - %s:%s:%s",year.c_str(),month.c_str(),day.c_str(),hour.c_str(),minute.c_str(),second.c_str()); childSetText("uploadtime", time); } // Don't bother decoding more than we can display, unless // we're loading the full image. if (!mLoadingFullImage) { S32 int_width = interior.getWidth(); S32 int_height = interior.getHeight(); mImage->setKnownDrawSize(int_width, int_height); } else { // Don't use this feature mImage->setKnownDrawSize(0, 0); } if (mLoadingFullImage) { // *TODO: Translate LLFontGL::getFontSansSerif()->renderUTF8(std::string("Receiving:"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::DROP_SHADOW); F32 data_progress = mImage->getDownloadProgress(); // Draw the progress bar. const S32 BAR_HEIGHT = 12; const S32 BAR_LEFT_PAD = 80; S32 left = interior.mLeft + 4 + BAR_LEFT_PAD; S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2; S32 top = interior.mBottom + 4 + BAR_HEIGHT; S32 right = left + bar_width; S32 bottom = top - BAR_HEIGHT; LLColor4 background_color(0.f, 0.f, 0.f, 0.75f); LLColor4 decoded_color(0.f, 1.f, 0.f, 1.0f); LLColor4 downloaded_color(0.f, 0.5f, 0.f, 1.0f); gl_rect_2d(left, top, right, bottom, background_color); if (data_progress > 0.0f) { // Downloaded bytes right = left + llfloor(data_progress * (F32)bar_width); if (right > left) { gl_rect_2d(left, top, right, bottom, downloaded_color); } } } else if (!mSavedFileTimer.hasExpired()) { // *TODO: Translate LLFontGL::getFontSansSerif()->renderUTF8(std::string("File Saved"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::DROP_SHADOW); } } } }
void LLPreviewTexture::draw() { updateDimensions(); LLPreview::draw(); if (!isMinimized()) { LLGLSUIDefault gls_ui; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); const LLRect& border = mClientRect; LLRect interior = mClientRect; interior.stretch( -PREVIEW_BORDER_WIDTH ); // ...border gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f)); gl_rect_2d_checkerboard( interior ); if ( mImage.notNull() ) { // Draw the texture glColor3f( 1.f, 1.f, 1.f ); gl_draw_scaled_image(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mImage); // Pump the texture priority F32 pixel_area = mLoadingFullImage ? (F32)MAX_IMAGE_AREA : (F32)(interior.getWidth() * interior.getHeight() ); mImage->addTextureStats( pixel_area ); if(pixel_area > 0.f) { //boost the previewed image priority to the highest to make it to get loaded first. mImage->setAdditionalDecodePriority(1.0f) ; } // Don't bother decoding more than we can display, unless // we're loading the full image. if (!mLoadingFullImage) { S32 int_width = interior.getWidth(); S32 int_height = interior.getHeight(); mImage->setKnownDrawSize(int_width, int_height); } else { // Don't use this feature mImage->setKnownDrawSize(0, 0); } if( mLoadingFullImage ) { // *TODO: Translate LLFontGL::getFontSansSerif()->renderUTF8(std::string("Receiving:"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::DROP_SHADOW); F32 data_progress = mImage->mDownloadProgress; // Draw the progress bar. const S32 BAR_HEIGHT = 12; const S32 BAR_LEFT_PAD = 80; S32 left = interior.mLeft + 4 + BAR_LEFT_PAD; S32 bar_width = getRect().getWidth() - left - RESIZE_HANDLE_WIDTH - 2; S32 top = interior.mBottom + 4 + BAR_HEIGHT; S32 right = left + bar_width; S32 bottom = top - BAR_HEIGHT; LLColor4 background_color(0.f, 0.f, 0.f, 0.75f); LLColor4 decoded_color(0.f, 1.f, 0.f, 1.0f); LLColor4 downloaded_color(0.f, 0.5f, 0.f, 1.0f); gl_rect_2d(left, top, right, bottom, background_color); if (data_progress > 0.0f) { // Downloaded bytes right = left + llfloor(data_progress * (F32)bar_width); if (right > left) { gl_rect_2d(left, top, right, bottom, downloaded_color); } } } else if( !mSavedFileTimer.hasExpired() ) { // *TODO: Translate LLFontGL::getFontSansSerif()->renderUTF8(std::string("File Saved"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::DROP_SHADOW); } } } }
void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) { LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); // HACK to allow seeing the buttons when you have the app in a window. // Keep the visibility the same as it if (tool == gToolNull) { return; } if ( isMinimized() ) { // SL looks odd if we draw the tools while the window is minimized return; } // Focus buttons BOOL focus_visible = ( tool == LLToolCamera::getInstance() ); mBtnFocus ->setToggleState( focus_visible ); mRadioZoom ->setVisible( focus_visible ); mRadioOrbit ->setVisible( focus_visible ); mRadioPan ->setVisible( focus_visible ); childSetVisible("slider zoom", focus_visible); childSetEnabled("slider zoom", gCameraBtnZoom); mRadioZoom ->set( !gCameraBtnOrbit && !gCameraBtnPan && !(mask == MASK_ORBIT) && !(mask == (MASK_ORBIT | MASK_ALT)) && !(mask == MASK_PAN) && !(mask == (MASK_PAN | MASK_ALT)) ); mRadioOrbit ->set( gCameraBtnOrbit || (mask == MASK_ORBIT) || (mask == (MASK_ORBIT | MASK_ALT)) ); mRadioPan ->set( gCameraBtnPan || (mask == MASK_PAN) || (mask == (MASK_PAN | MASK_ALT)) ); // multiply by correction factor because volume sliders go [0, 0.5] childSetValue( "slider zoom", gAgent.getCameraZoomFraction() * 0.5f); // Move buttons BOOL move_visible = (tool == LLToolGrab::getInstance()); if (mBtnMove) mBtnMove ->setToggleState( move_visible ); // HACK - highlight buttons for next click if (mRadioMove) { mRadioMove ->setVisible( move_visible ); mRadioMove ->set( !gGrabBtnSpin && !gGrabBtnVertical && !(mask == MASK_VERTICAL) && !(mask == MASK_SPIN) ); } if (mRadioLift) { mRadioLift ->setVisible( move_visible ); mRadioLift ->set( gGrabBtnVertical || (mask == MASK_VERTICAL) ); } if (mRadioSpin) { mRadioSpin ->setVisible( move_visible ); mRadioSpin ->set( gGrabBtnSpin || (mask == MASK_SPIN) ); } // Edit buttons BOOL edit_visible = tool == LLToolCompTranslate::getInstance() || tool == LLToolCompRotate::getInstance() || tool == LLToolCompScale::getInstance() || tool == LLToolFace::getInstance() || tool == LLToolIndividual::getInstance() || tool == LLToolPipette::getInstance(); mBtnEdit ->setToggleState( edit_visible ); mRadioPosition ->setVisible( edit_visible ); mRadioRotate ->setVisible( edit_visible ); mRadioStretch ->setVisible( edit_visible ); if (mRadioSelectFace) { mRadioSelectFace->setVisible( edit_visible ); mRadioSelectFace->set( tool == LLToolFace::getInstance() ); } if (mCheckSelectIndividual) { mCheckSelectIndividual->setVisible(edit_visible); //mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); } mRadioPosition ->set( tool == LLToolCompTranslate::getInstance() ); mRadioRotate ->set( tool == LLToolCompRotate::getInstance() ); mRadioStretch ->set( tool == LLToolCompScale::getInstance() ); if (mComboGridMode) { mComboGridMode->setVisible( edit_visible ); S32 index = mComboGridMode->getCurrentIndex(); mComboGridMode->removeall(); switch (mObjectSelection->getSelectType()) { case SELECT_TYPE_HUD: mComboGridMode->add(getString("grid_screen_text")); mComboGridMode->add(getString("grid_local_text")); //mComboGridMode->add(getString("grid_reference_text")); break; case SELECT_TYPE_WORLD: mComboGridMode->add(getString("grid_world_text")); mComboGridMode->add(getString("grid_local_text")); mComboGridMode->add(getString("grid_reference_text")); break; case SELECT_TYPE_ATTACHMENT: mComboGridMode->add(getString("grid_attachment_text")); mComboGridMode->add(getString("grid_local_text")); mComboGridMode->add(getString("grid_reference_text")); break; } mComboGridMode->setCurrentByIndex(index); } if (mTextGridMode) mTextGridMode->setVisible( edit_visible ); // Snap to grid disabled for grab tool - very confusing if (mCheckSnapToGrid) mCheckSnapToGrid->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ ); if (mBtnGridOptions) mBtnGridOptions->setVisible( edit_visible /* || tool == LLToolGrab::getInstance() */ ); //mCheckSelectLinked ->setVisible( edit_visible ); if (mCheckStretchUniform) mCheckStretchUniform->setVisible( edit_visible ); if (mCheckStretchTexture) mCheckStretchTexture->setVisible( edit_visible ); if (mBtnLink) mBtnLink->setVisible( edit_visible ); if (mBtnUnlink) mBtnUnlink->setVisible( edit_visible ); //TODO: Move these into llselectmgr // Check to see if we can link things bool can_link = false; if (!gSavedSettings.getBOOL("EditLinkedParts")) { if(LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() >= 2) { struct f : public LLSelectedObjectFunctor { virtual bool apply(LLViewerObject* object) { return object->permModify(); } } func; const bool firstonly = true; can_link = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); } } mBtnLink->setEnabled(can_link); // Check to see if we can unlink things bool can_unlink = false; if (tool != LLToolFace::getInstance()) { if (LLSelectMgr::getInstance()->selectGetAllRootsValid() && LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && !LLSelectMgr::getInstance()->getSelection()->isAttachment()) { // LL's viewer unlinks the last linkset selected, // regardless of how many linksets or prims are selected total. // Preserve that behavior when enabling the unlink option. if (gSavedSettings.getBOOL("EditLinkedParts")) { struct f : public LLSelectedNodeFunctor { virtual bool apply(LLSelectNode* pNode) { // Return the first selection node that is // 1) not a root prim // 2) or a root prim that has child prims // or in other words: any prim that is part of a linkset return (pNode->getObject() != pNode->getObject()->getRootEdit()) || (pNode->getObject()->numChildren() != 0); } } func; if (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(&func, TRUE)) { // the selection contains at least one prim (child or root) that is part of a linkset can_unlink = true; } } else { if (LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != LLSelectMgr::getInstance()->getSelection()->getObjectCount()) { can_unlink = true; } } } } mBtnUnlink->setEnabled(can_unlink); // Create buttons BOOL create_visible = (tool == LLToolCompCreate::getInstance()); mBtnCreate ->setToggleState( tool == LLToolCompCreate::getInstance() ); updateTreeGrassCombo(create_visible); if (mCheckCopySelection && mCheckCopySelection->get()) { // don't highlight any placer button for (std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++) { mButtons[i]->setToggleState(FALSE); mButtons[i]->setVisible( create_visible ); } } else { // Highlight the correct placer button for( std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++ ) { LLPCode pcode = LLToolPlacer::getObjectType(); void *userdata = mButtons[i]->getCallbackUserData(); LLPCode *cur = (LLPCode*) userdata; BOOL state = (pcode == *cur); mButtons[i]->setToggleState( state ); mButtons[i]->setVisible( create_visible ); } } if (mCheckSticky) mCheckSticky ->setVisible( create_visible ); if (mCheckCopySelection) mCheckCopySelection ->setVisible( create_visible ); if (mCheckCopyCenters) mCheckCopyCenters ->setVisible( create_visible ); if (mCheckCopyRotates) mCheckCopyRotates ->setVisible( create_visible ); if (mCheckCopyCenters) mCheckCopyCenters->setEnabled( mCheckCopySelection->get() ); if (mCheckCopyRotates) mCheckCopyRotates->setEnabled( mCheckCopySelection->get() ); // Land buttons BOOL land_visible = (tool == LLToolBrushLand::getInstance() || tool == LLToolSelectLand::getInstance() ); if (mBtnLand) mBtnLand ->setToggleState( land_visible ); // mRadioEditLand ->set( tool == LLToolBrushLand::getInstance() ); if (mRadioSelectLand) mRadioSelectLand->set( tool == LLToolSelectLand::getInstance() ); // mRadioEditLand ->setVisible( land_visible ); if (mRadioSelectLand) mRadioSelectLand->setVisible( land_visible ); S32 dozer_mode = gSavedSettings.getS32("RadioLandBrushAction"); if (mRadioDozerFlatten) { mRadioDozerFlatten ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 0); mRadioDozerFlatten ->setVisible( land_visible ); } if (mRadioDozerRaise) { mRadioDozerRaise ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 1); mRadioDozerRaise ->setVisible( land_visible ); } if (mRadioDozerLower) { mRadioDozerLower ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 2); mRadioDozerLower ->setVisible( land_visible ); } if (mRadioDozerSmooth) { mRadioDozerSmooth ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 3); mRadioDozerSmooth ->setVisible( land_visible ); } if (mRadioDozerNoise) { mRadioDozerNoise ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 4); mRadioDozerNoise ->setVisible( land_visible ); } if (mRadioDozerRevert) { mRadioDozerRevert ->set( tool == LLToolBrushLand::getInstance() && dozer_mode == 5); mRadioDozerRevert ->setVisible( land_visible ); } if (mBtnApplyToSelection) { mBtnApplyToSelection->setVisible( land_visible ); mBtnApplyToSelection->setEnabled( land_visible && !LLViewerParcelMgr::getInstance()->selectionEmpty() && tool != LLToolSelectLand::getInstance()); } if (mSliderDozerSize) { mSliderDozerSize ->setVisible( land_visible ); childSetVisible("Bulldozer:", land_visible); childSetVisible("Dozer Size:", land_visible); } if (mSliderDozerForce) { mSliderDozerForce ->setVisible( land_visible ); childSetVisible("Strength:", land_visible); } childSetVisible("obj_count", !land_visible); childSetVisible("prim_count", !land_visible); mTab->setVisible(!land_visible); mPanelLandInfo->setVisible(land_visible); }
void *Container::processEvent(Event *e) { if (m_tabBar == NULL) return NULL; UserWnd *userWnd; Contact *contact; CommandDef *cmd; Message *msg; switch (e->type()){ case EventMessageReceived: msg = (Message*)(e->param()); if (msg->type() == MessageStatus){ contact = getContacts()->contact(msg->contact()); if (contact) contactChanged(contact); return NULL; } if (msg->getFlags() & MESSAGE_NOVIEW) return NULL; if (CorePlugin::m_plugin->getContainerMode()){ if (isActiveWindow() && !isMinimized()){ userWnd = m_tabBar->currentWnd(); if (userWnd && (userWnd->id() == msg->contact())) userWnd->markAsRead(); }else{ msg = (Message*)(e->param()); userWnd = wnd(msg->contact()); if (userWnd) QTimer::singleShot(0, this, SLOT(flash())); } } case EventMessageRead: msg = (Message*)(e->param()); userWnd = wnd(msg->contact()); if (userWnd){ bool bBold = false; for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){ if ((*it).contact != msg->contact()) continue; bBold = true; break; } m_tabBar->setBold(msg->contact(), bBold); } break; case EventActiveContact: if (!isActiveWindow()) return NULL; userWnd = m_tabBar->currentWnd(); if (userWnd) return (void*)(userWnd->id()); break; case EventContactDeleted: contact = (Contact*)(e->param()); userWnd = wnd(contact->id()); if (userWnd) removeUserWnd(userWnd); break; case EventContactChanged: contact = (Contact*)(e->param()); userWnd = wnd(contact->id()); if (userWnd){ if (contact->getIgnore()){ removeUserWnd(userWnd); break; } m_tabBar->changeTab(contact->id()); contactChanged(contact); } case EventClientsChanged: setupAccel(); break; case EventContactStatus: contact = (Contact*)(e->param()); userWnd = m_tabBar->wnd(contact->id()); if (userWnd){ unsigned style = 0; string wrkIcons; const char *statusIcon = NULL; contact->contactInfo(style, statusIcon, &wrkIcons); bool bTyping = false; while (!wrkIcons.empty()){ if (getToken(wrkIcons, ',') == "typing"){ bTyping = true; break; } } if (userWnd->m_bTyping != bTyping){ userWnd->m_bTyping = bTyping; if (bTyping){ userWnd->setStatus(g_i18n("%1 is typing", contact) .arg(contact->getName())); }else{ userWnd->setStatus(""); } userWnd = m_tabBar->currentWnd(); if (userWnd && (contact->id() == userWnd->id())) m_status->message(userWnd->status()); } } break; case EventContactClient: contactChanged((Contact*)(e->param())); break; case EventInit: init(); break; case EventCommandExec: cmd = (CommandDef*)(e->param()); userWnd = m_tabBar->currentWnd(); if (userWnd && ((unsigned)(cmd->param) == userWnd->id())){ if (cmd->menu_id == MenuContainerContact){ m_tabBar->raiseTab(cmd->id); return e->param(); } if (cmd->id == CmdClose){ delete userWnd; return e->param(); } if (cmd->id == CmdInfo){ CommandDef c = *cmd; c.menu_id = MenuContact; c.param = (void*)userWnd->id(); Event eExec(EventCommandExec, &c); eExec.process(); return e->param(); } } break; case EventCheckState: cmd = (CommandDef*)(e->param()); userWnd = m_tabBar->currentWnd(); if (userWnd && ((unsigned)(cmd->param) == userWnd->id()) && (cmd->menu_id == MenuContainerContact) && (cmd->id == CmdContainerContacts)){ list<UserWnd*> userWnds = m_tabBar->windows(); CommandDef *cmds = new CommandDef[userWnds.size() + 1]; memset(cmds, 0, sizeof(CommandDef) * (userWnds.size() + 1)); unsigned n = 0; for (list<UserWnd*>::iterator it = userWnds.begin(); it != userWnds.end(); ++it){ cmds[n].id = (*it)->id(); cmds[n].flags = COMMAND_DEFAULT; cmds[n].text_wrk = strdup((*it)->getName().utf8()); cmds[n].icon = (*it)->getIcon(); cmds[n].text = "_"; cmds[n].menu_id = n + 1; if (n < sizeof(accels) / sizeof(const char*)) cmds[n].accel = accels[n]; if (*it == m_tabBar->currentWnd()) cmds[n].flags |= COMMAND_CHECKED; n++; } cmd->param = cmds; cmd->flags |= COMMAND_RECURSIVE; return e->param(); } break; } return NULL; }
void MdiWindow::mouseReleaseEvent(QMouseEvent *event) { QStyleOptionTitleBar option; option.initFrom(this); option.titleBarFlags = windowFlags(); option.titleBarState = windowState(); option.subControls = QStyle::SC_All; option.activeSubControls = QStyle::SC_None; if (!isMinimized()) { option.rect.setHeight(height() - widget()->height()); } if (!isMaximized() && style()->subControlRect(QStyle::CC_TitleBar, &option, QStyle::SC_TitleBarMaxButton, this).contains(event->pos())) { setWindowFlags(Qt::SubWindow | Qt::CustomizeWindowHint | Qt::FramelessWindowHint); showMaximized(); SessionsManager::markSessionModified(); } else if (!isMinimized() && style()->subControlRect(QStyle::CC_TitleBar, &option, QStyle::SC_TitleBarMinButton, this).contains(event->pos())) { const QList<QMdiSubWindow*> subWindows(mdiArea()->subWindowList()); int activeSubWindows(0); for (int i = 0; i < subWindows.count(); ++i) { if (!subWindows.at(i)->isMinimized()) { ++activeSubWindows; } } storeState(); setWindowFlags(Qt::SubWindow); showMinimized(); if (activeSubWindows == 1) { MainWindow *mainWindow(MainWindow::findMainWindow(mdiArea())); if (mainWindow) { mainWindow->getWindowsManager()->setActiveWindowByIndex(-1); } else { mdiArea()->setActiveSubWindow(NULL); } } else if (activeSubWindows > 1) { ActionsManager::triggerAction(ActionsManager::ActivatePreviouslyUsedTabAction, mdiArea()); } SessionsManager::markSessionModified(); } else if (isMinimized()) { restoreState(); } QMdiSubWindow::mouseReleaseEvent(event); }
bool MainWindow::isActive() { return isActiveWindow() && !isMinimized(); }