BOOL LLPanelGroupInvite::postBuild() { BOOL recurse = TRUE; mImplementation->mLoadingText = getString("loading"); mImplementation->mRoleNames = getChild<LLComboBox>("role_name", recurse); mImplementation->mGroupName = getChild<LLTextBox>("group_name_text", recurse); mImplementation->mInvitees = getChild<LLNameListCtrl>("invitee_list", recurse); if ( mImplementation->mInvitees ) { mImplementation->mInvitees->setCallbackUserData(mImplementation); mImplementation->mInvitees->setCommitOnSelectionChange(TRUE); mImplementation->mInvitees->setCommitCallback(impl::callbackSelect); } LLButton* button = getChild<LLButton>("add_button", recurse); if ( button ) { // default to opening avatarpicker automatically // (*impl::callbackClickAdd)((void*)this); button->setClickedCallback(impl::callbackClickAdd); button->setCallbackUserData(this); } mImplementation->mRemoveButton = getChild<LLButton>("remove_button", recurse); if ( mImplementation->mRemoveButton ) { mImplementation->mRemoveButton-> setClickedCallback(impl::callbackClickRemove); mImplementation->mRemoveButton->setCallbackUserData(mImplementation); mImplementation->mRemoveButton->setEnabled(FALSE); } mImplementation->mOKButton = getChild<LLButton>("ok_button", recurse); if ( mImplementation->mOKButton ) { mImplementation->mOKButton-> setClickedCallback(impl::callbackClickOK); mImplementation->mOKButton->setCallbackUserData(mImplementation); mImplementation->mOKButton->setEnabled(FALSE); } button = getChild<LLButton>("cancel_button", recurse); if ( button ) { button->setClickedCallback(impl::callbackClickCancel); button->setCallbackUserData(mImplementation); } mImplementation->mOwnerWarning = getString("confirm_invite_owner_str"); update(); return (mImplementation->mRoleNames && mImplementation->mInvitees && mImplementation->mRemoveButton); }
LLNotifyBox::LLNotifyBox(LLPointer<LLNotifyBoxTemplate> xml_template, const LLStringUtil::format_map_t& args, notify_callback_t callback, void* user_data, BOOL is_caution, const option_list_t& extra_options, BOOL layout_script_dialog) : LLPanel(xml_template->mLabel, LLRect(), BORDER_NO), LLEventTimer(xml_template->mDuration), mIsTip(FALSE), mAnimating(TRUE), mUnique(xml_template->mUnique), mNextBtn(NULL), mBehavior(new LLNotifyBehavior(callback, user_data)), mNumOptions(0), mDefaultOption(0) { // clicking on a button does not steal current focus setIsChrome(TRUE); // class init if (!sFont) { sFont = LLFontGL::sSansSerif; sFontSmall = LLFontGL::sSansSerifSmall; } // setup paramaters mMessage = xml_template->mMessage; format(mMessage, args); // use name + formatted text as unique key if (mUnique) { sOpenUniqueNotifyBoxes[xml_template->mLabel + mMessage] = this; } option_list_t options = xml_template->mOptions; options.insert(options.end(), extra_options.begin(), extra_options.end()); // initialize mIsTip = xml_template->mIsTip; setFocusRoot(!mIsTip); // caution flag can be set explicitly by specifying it in the // call to the c'tor, or it can be set implicitly if the // notify xml template specifies that it is a caution // // tip-style notification handle 'caution' differently - // they display the tip in a different color mIsCaution = (xml_template->mIsCaution || is_caution); // Don't animate if behind other windows if( gNotifyBoxView->getChildCount() > 0 ) mAnimating = FALSE; else mAnimating = TRUE; mNumOptions = options.size(); mDefaultOption = xml_template->mDefaultOption; LLRect rect = mIsTip ? getNotifyTipRect(mMessage) : getNotifyRect(mNumOptions, layout_script_dialog, mIsCaution); setRect(rect); setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT)); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); LLIconCtrl* icon; LLTextEditor* text; const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); const S32 BOTTOM = (S32)sFont->getLineHeight(); S32 x = HPAD + HPAD; S32 y = TOP; if (mIsTip) { // use the tip notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_tip_icon.tga")); } else if (mIsCaution) { // use the caution notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_caution_icon.tga")); } else { // use the default notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + 32; // add a caution textbox at the top of a caution notification LLTextBox* caution_box = NULL; if (mIsCaution && !mIsTip) { S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; caution_box = new LLTextBox( std::string("caution_box"), LLRect(x, y, getRect().getWidth() - 2, caution_height), LLStringUtil::null, sFont, FALSE); caution_box->setFontStyle(LLFontGL::BOLD); caution_box->setColor(gColors.getColor("NotifyCautionWarnColor")); caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor")); caution_box->setBorderVisible(FALSE); caution_box->setWrappedText(LLNotifyBox::getTemplateMessage("ScriptQuestionCautionWarn")); addChild(caution_box); // adjust the vertical position of the next control so that // it appears below the caution textbox y = y - caution_height; } const S32 BOTTOM_PAD = VPAD * 3; const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, mMessage, sFont, FALSE); text->setWordWrap(TRUE); text->setTabStop(FALSE); text->setMouseOpaque(FALSE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(FALSE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent text->setReadOnlyFgColor ( gColors.getColor("NotifyTextColor") ); text->setEnabled(FALSE); // makes it read-only text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) addChild(text); if (mIsTip) { if (!gSavedSettings.getBOOL("HideNotificationsInChat")) { // TODO: Make a separate archive for these. LLChat chat(mMessage); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::getInstance(LLSD())->addChatHistory(chat); } } else { LLButton* btn; btn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, onClickNext, this, sFont); btn->setScaleImage(TRUE); btn->setToolTip(std::string("Next")); // *TODO: Translate addChild(btn); mNextBtn = btn; // make caution notification buttons slightly narrower // so that 3 of them can fit without overlapping the "next" button S32 btn_width = mIsCaution? 84 : 90; LLRect btn_rect; for (S32 i = 0; i < mNumOptions; i++) { S32 index = i; S32 btn_height= BTN_HEIGHT; const LLFontGL* font = sFont; S32 ignore_pad = 0; if (layout_script_dialog) { // Add two "blank" option spaces, before the "Ignore" button index = i + 2; if (i == 0) { // Ignore button is smaller, less wide btn_height = BTN_HEIGHT_SMALL; font = sFontSmall; ignore_pad = 10; } } btn_rect.setOriginAndSize(x + (index % 3) * (btn_width+HPAD+HPAD) + ignore_pad, BOTTOM_PAD + (index / 3) * (BTN_HEIGHT+VPAD), btn_width - 2*ignore_pad, btn_height); InstanceAndS32* userdata = new InstanceAndS32; userdata->mSelf = this; userdata->mButton = i; mBtnCallbackData.push_back(userdata); btn = new LLButton(options[i], btn_rect, LLStringUtil::null, onClickButton, userdata); btn->setFont(font); if (mIsCaution) { btn->setImageColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor")); btn->setDisabledImageColor(LLUI::sColorsGroup->getColor("ButtonCautionImageColor")); } addChild(btn, -1); if (i == mDefaultOption) { setDefaultBtn(btn); } } sNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sNotifyBoxCount == 1 && mNextBtn) { mNextBtn->setVisible(FALSE); } } }
void LLPanelPermissions::refresh() { LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); if(BtnDeedToGroup) { std::string deedText; if (gWarningSettings.getBOOL("DeedObject")) { deedText = getString("text deed continued"); } else { deedText = getString("text deed"); } BtnDeedToGroup->setLabelSelected(deedText); BtnDeedToGroup->setLabelUnselected(deedText); } BOOL root_selected = TRUE; LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); if(!nodep || 0 == object_count) { nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); root_selected = FALSE; } //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment(); //attachment_selected = false; LLViewerObject* objectp = NULL; if(nodep) objectp = nodep->getObject(); if(!nodep || !objectp)// || attachment_selected) { // ...nothing selected disableAll(); return; } // figure out a few variables const BOOL is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = { getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), getString("text modify info 4") }; if (!is_perm_modify) { string_index += 2; } if (!is_one_object) { ++string_index; } childSetEnabled("perm_modify", TRUE); childSetText("perm_modify", MODIFY_INFO_STRINGS[string_index]); childSetEnabled("Permissions:", TRUE); // Update creator text field childSetEnabled("Creator:", TRUE); BOOL creators_identical; std::string creator_name; creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); childSetText("Creator Name", creator_name); childSetEnabled("Creator Name", TRUE); // Update owner text field childSetEnabled("Owner:", TRUE); std::string owner_name; const BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); if (mOwnerID.isNull()) { if (LLSelectMgr::getInstance()->selectIsGroupOwned()) { // Group owned already displayed by selectGetOwner } else { // Display last owner if public std::string last_owner_name; LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); // It should never happen that the last owner is null and the owner // is null, but it seems to be a bug in the simulator right now. JC if (!mLastOwnerID.isNull() && !last_owner_name.empty()) { owner_name.append(", last "); owner_name.append(last_owner_name); } } } childSetText("Owner Name", owner_name); childSetEnabled("Owner Name", TRUE); // update group text field childSetEnabled("Group:", TRUE); childSetText("Group Name", LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if (mLabelGroupName) { mLabelGroupName->setNameID(group_id,TRUE); mLabelGroupName->setEnabled(TRUE); } } else { if (mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); mLabelGroupName->refresh(LLUUID::null,LLStringUtil::null, LLStringUtil::null, TRUE); mLabelGroupName->setEnabled(FALSE); } } childSetEnabled("button set group", owners_identical && (mOwnerID == gAgent.getID())); childSetEnabled("Name:", TRUE); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); childSetEnabled("Description:", TRUE); LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); if (is_one_object) { if (keyboard_focus_view != LineEditorObjectName) { childSetText("Object Name",nodep->mName); } if (LineEditorObjectDesc) { if (keyboard_focus_view != LineEditorObjectDesc) { LineEditorObjectDesc->setText(nodep->mDescription); } } } else { childSetText("Object Name", LLStringUtil::null); LineEditorObjectDesc->setText(LLStringUtil::null); } // figure out the contents of the name, description, & category BOOL edit_name_desc = FALSE; if (is_one_object && objectp->permModify()) { edit_name_desc = TRUE; } if (edit_name_desc) { childSetEnabled("Object Name", TRUE); childSetEnabled("Object Description", TRUE); } else { childSetEnabled("Object Name", FALSE); childSetEnabled("Object Description", FALSE); } S32 total_sale_price = 0; S32 individual_sale_price = 0; BOOL is_for_sale_mixed = FALSE; BOOL is_sale_price_mixed = FALSE; U32 num_for_sale = FALSE; LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, is_for_sale_mixed, is_sale_price_mixed, total_sale_price, individual_sale_price); const BOOL self_owned = (gAgent.getID() == mOwnerID); const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); if (!owners_identical) { childSetEnabled("Cost", FALSE); childSetText("Edit Cost", LLStringUtil::null); childSetEnabled("Edit Cost", FALSE); } // You own these objects. else if (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) { // If there are multiple items for sale then set text to PRICE PER UNIT. if (num_for_sale > 1) { childSetText("Cost", getString("Cost Per Unit")); } else { childSetText("Cost", getString("Cost Default")); } LLSpinCtrl *edit_price = getChild<LLSpinCtrl>("Edit Cost"); if (!edit_price->hasFocus()) { // If the sale price is mixed then set the cost to MIXED, otherwise // set to the actual cost. if ((num_for_sale > 0) && is_for_sale_mixed) { edit_price->setTentative(TRUE); } else if ((num_for_sale > 0) && is_sale_price_mixed) { edit_price->setTentative(TRUE); } else { edit_price->setValue(individual_sale_price); } } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. BOOL enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : FALSE; childSetEnabled("Cost", enable_edit); childSetEnabled("Edit Cost", enable_edit); } // Someone, not you, owns these objects. else if (!public_owned) { childSetEnabled("Cost", FALSE); childSetEnabled("Edit Cost", FALSE); // Don't show a price if none of the items are for sale. if (num_for_sale) childSetText("Edit Cost", llformat("%d",total_sale_price)); else childSetText("Edit Cost", LLStringUtil::null); // If multiple items are for sale, set text to TOTAL PRICE. if (num_for_sale > 1) childSetText("Cost", getString("Cost Total")); else childSetText("Cost", getString("Cost Default")); } // This is a public object. else { childSetEnabled("Cost", FALSE); childSetText("Cost", getString("Cost Default")); childSetText("Edit Cost", LLStringUtil::null); childSetEnabled("Edit Cost", FALSE); } // Enable and disable the permissions checkboxes // based on who owns the object. // TODO: Creator permissions U32 base_mask_on = 0; U32 base_mask_off = 0; U32 owner_mask_off = 0; U32 owner_mask_on = 0; U32 group_mask_on = 0; U32 group_mask_off = 0; U32 everyone_mask_on = 0; U32 everyone_mask_off = 0; U32 next_owner_mask_on = 0; U32 next_owner_mask_off = 0; BOOL valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, &base_mask_on, &base_mask_off); //BOOL valid_owner_perms =// LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); BOOL valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, &group_mask_on, &group_mask_off); BOOL valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, &everyone_mask_on, &everyone_mask_off); BOOL valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, &next_owner_mask_on, &next_owner_mask_off); if (gSavedSettings.getBOOL("DebugPermissions") ) { if (valid_base_perms) { childSetText("B:", "B: " + mask_to_string(base_mask_on)); childSetVisible("B:", TRUE); childSetText("O:", "O: " + mask_to_string(owner_mask_on)); childSetVisible("O:", TRUE); childSetText("G:", "G: " + mask_to_string(group_mask_on)); childSetVisible("G:", TRUE); childSetText("E:", "E: " + mask_to_string(everyone_mask_on)); childSetVisible("E:", TRUE); childSetText("N:", "N: " + mask_to_string(next_owner_mask_on)); childSetVisible("N:", TRUE); } U32 flag_mask = 0x0; if (objectp->permMove()) flag_mask |= PERM_MOVE; if (objectp->permModify()) flag_mask |= PERM_MODIFY; if (objectp->permCopy()) flag_mask |= PERM_COPY; if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; childSetText("F:", "F:" + mask_to_string(flag_mask)); childSetVisible("F:", TRUE); } else { childSetVisible("B:", FALSE); childSetVisible("O:", FALSE); childSetVisible("G:", FALSE); childSetVisible("E:", FALSE); childSetVisible("N:", FALSE); childSetVisible("F:", FALSE); } BOOL has_change_perm_ability = FALSE; BOOL has_change_sale_ability = FALSE; if (valid_base_perms && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { has_change_perm_ability = TRUE; } if (valid_base_perms && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { has_change_sale_ability = TRUE; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) { // ...must select root to choose permissions childSetValue("perm_modify", getString("text modify warning")); } if (has_change_perm_ability) { childSetEnabled("checkbox share with group", TRUE); childSetEnabled("checkbox allow everyone move", owner_mask_on & PERM_MOVE); childSetEnabled("checkbox allow everyone copy", owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { childSetEnabled("checkbox share with group", FALSE); childSetEnabled("checkbox allow everyone move", FALSE); childSetEnabled("checkbox allow everyone copy", FALSE); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); // Set the checkbox to tentative if the prices of each object selected // are not the same. childSetTentative("checkbox for sale", is_for_sale_mixed); childSetEnabled("sale type", num_for_sale && can_transfer && !is_sale_price_mixed); childSetEnabled("Next owner can:", TRUE); childSetEnabled("checkbox next owner can modify", base_mask_on & PERM_MODIFY); childSetEnabled("checkbox next owner can copy", base_mask_on & PERM_COPY); childSetEnabled("checkbox next owner can transfer", next_owner_mask_on & PERM_COPY); } else { childSetEnabled("checkbox for sale", FALSE); childSetEnabled("sale type", FALSE); childSetEnabled("Next owner can:", FALSE); childSetEnabled("checkbox next owner can modify", FALSE); childSetEnabled("checkbox next owner can copy", FALSE); childSetEnabled("checkbox next owner can transfer", FALSE); } if (valid_group_perms) { if ((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { childSetValue("checkbox share with group", TRUE); childSetTentative("checkbox share with group", FALSE); childSetEnabled("button deed", gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } else if ((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { childSetValue("checkbox share with group", FALSE); childSetTentative("checkbox share with group", FALSE); childSetEnabled("button deed", FALSE); } else { childSetValue("checkbox share with group", TRUE); childSetTentative("checkbox share with group", TRUE); childSetEnabled("button deed", gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } if (valid_everyone_perms) { // Move if (everyone_mask_on & PERM_MOVE) { childSetValue("checkbox allow everyone move", TRUE); childSetTentative("checkbox allow everyone move", FALSE); } else if (everyone_mask_off & PERM_MOVE) { childSetValue("checkbox allow everyone move", FALSE); childSetTentative("checkbox allow everyone move", FALSE); } else { childSetValue("checkbox allow everyone move", TRUE); childSetTentative("checkbox allow everyone move", TRUE); } // Copy == everyone can't copy if (everyone_mask_on & PERM_COPY) { childSetValue("checkbox allow everyone copy", TRUE); childSetTentative("checkbox allow everyone copy", !can_copy || !can_transfer); } else if (everyone_mask_off & PERM_COPY) { childSetValue("checkbox allow everyone copy", FALSE); childSetTentative("checkbox allow everyone copy", FALSE); } else { childSetValue("checkbox allow everyone copy", TRUE); childSetTentative("checkbox allow everyone copy", TRUE); } } if (valid_next_perms) { // Modify == next owner canot modify if (next_owner_mask_on & PERM_MODIFY) { childSetValue("checkbox next owner can modify", TRUE); childSetTentative("checkbox next owner can modify", FALSE); } else if (next_owner_mask_off & PERM_MODIFY) { childSetValue("checkbox next owner can modify", FALSE); childSetTentative("checkbox next owner can modify", FALSE); } else { childSetValue("checkbox next owner can modify", TRUE); childSetTentative("checkbox next owner can modify", TRUE); } // Copy == next owner cannot copy if (next_owner_mask_on & PERM_COPY) { childSetValue("checkbox next owner can copy", TRUE); childSetTentative("checkbox next owner can copy", !can_copy); } else if (next_owner_mask_off & PERM_COPY) { childSetValue("checkbox next owner can copy", FALSE); childSetTentative("checkbox next owner can copy", FALSE); } else { childSetValue("checkbox next owner can copy", TRUE); childSetTentative("checkbox next owner can copy", TRUE); } // Transfer == next owner cannot transfer if (next_owner_mask_on & PERM_TRANSFER) { childSetValue("checkbox next owner can transfer", TRUE); childSetTentative("checkbox next owner can transfer", !can_transfer); } else if (next_owner_mask_off & PERM_TRANSFER) { childSetValue("checkbox next owner can transfer", FALSE); childSetTentative("checkbox next owner can transfer", FALSE); } else { childSetValue("checkbox next owner can transfer", TRUE); childSetTentative("checkbox next owner can transfer", TRUE); } } // reflect sale information LLSaleInfo sale_info; BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); LLSaleInfo::EForSale sale_type = sale_info.getSaleType(); LLComboBox* combo_sale_type = getChild<LLComboBox>("sale type"); if (valid_sale_info) { combo_sale_type->setValue( sale_type == LLSaleInfo::FS_NOT ? LLSaleInfo::FS_COPY : sale_type); combo_sale_type->setTentative( FALSE); // unfortunately this doesn't do anything at the moment. } else { // default option is sell copy, determined to be safest combo_sale_type->setValue( LLSaleInfo::FS_COPY); combo_sale_type->setTentative( TRUE); // unfortunately this doesn't do anything at the moment. } childSetValue("checkbox for sale", (num_for_sale != 0)); // HACK: There are some old objects in world that are set for sale, // but are no-transfer. We need to let users turn for-sale off, but only // if for-sale is set. bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); if (cannot_actually_sell) { if (num_for_sale && has_change_sale_ability) { childSetEnabled("checkbox for sale", true); } } // Check search status of objects const BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; const BOOL all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); childSetEnabled("search_check", has_change_sale_ability && all_volume); childSetValue("search_check", include_in_search); childSetTentative("search_check", !all_include_in_search); // Click action (touch, sit, buy) U8 click_action = 0; if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action)) { LLComboBox* combo_click_action = getChild<LLComboBox>("clickaction"); if(combo_click_action) { const std::string combo_value = click_action_to_string_value(click_action); combo_click_action->setValue(LLSD(combo_value)); } } childSetEnabled("label click action", is_perm_modify && all_volume); childSetEnabled("clickaction", is_perm_modify && all_volume); }
void fetchScriptLimitsRegionSummaryResponder::httpSuccess() { const LLSD& content_ref = getContent(); #ifdef USE_FAKE_RESPONSES LLSD fake_content; LLSD summary = LLSD::emptyMap(); LLSD available = LLSD::emptyArray(); LLSD available_urls = LLSD::emptyMap(); LLSD available_memory = LLSD::emptyMap(); LLSD used = LLSD::emptyArray(); LLSD used_urls = LLSD::emptyMap(); LLSD used_memory = LLSD::emptyMap(); used_urls["type"] = "urls"; used_urls["amount"] = FAKE_NUMBER_OF_URLS; available_urls["type"] = "urls"; available_urls["amount"] = FAKE_AVAILABLE_URLS; used_memory["type"] = "memory"; used_memory["amount"] = FAKE_AMOUNT_OF_MEMORY; available_memory["type"] = "memory"; available_memory["amount"] = FAKE_AVAILABLE_MEMORY; //summary response:{'summary':{'available':[{'amount':i731,'type':'urls'},{'amount':i895577,'type':'memory'},{'amount':i731,'type':'urls'},{'amount':i895577,'type':'memory'}],'used':[{'amount':i329,'type':'urls'},{'amount':i66741,'type':'memory'}]}} used.append(used_urls); used.append(used_memory); available.append(available_urls); available.append(available_memory); summary["available"] = available; summary["used"] = used; fake_content["summary"] = summary; const LLSD& content = fake_content; #else const LLSD& content = content_ref; #endif if (!content.isMap()) { failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); return; } #ifdef DUMP_REPLIES_TO_LLINFOS LLSDNotationStreamer notation_streamer(content); std::ostringstream nice_llsd; nice_llsd << notation_streamer; OSMessageBox(nice_llsd.str(), "summary response:", 0); LL_WARNS() << "summary response:" << *content << LL_ENDL; #endif LLFloaterScriptLimits* instance = LLFloaterScriptLimits::findInstance(); if(!instance) { LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL; } else { LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels"); if(tab) { LLPanelScriptLimitsRegionMemory* panel_memory = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_memory_panel"); if(panel_memory) { panel_memory->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); LLButton* btn = panel_memory->getChild<LLButton>("refresh_list_btn"); if(btn) { btn->setEnabled(true); } panel_memory->setRegionSummary(content); } } } }
//--------------------------------------------------------------------------- LLNotifyBox::LLNotifyBox(LLNotificationPtr notification, BOOL layout_script_dialog) : LLPanel(notification->getName(), LLRect(), BORDER_NO), LLEventTimer(notification->getExpiration() == LLDate() ? LLDate(LLDate::now().secondsSinceEpoch() + (F64)gSavedSettings.getF32("NotifyTipDuration")) : notification->getExpiration()), LLInstanceTracker<LLNotifyBox, LLUUID>(notification->getID()), mNotification(notification), mIsTip(notification->getType() == "notifytip"), mAnimating(TRUE), mNextBtn(NULL), mNumOptions(0), mNumButtons(0), mAddedDefaultBtn(FALSE), mLayoutScriptDialog(layout_script_dialog) { // clicking on a button does not steal current focus setIsChrome(TRUE); // class init if (!sFont) { sFont = LLFontGL::getFontSansSerif(); sFontSmall = LLFontGL::getFontSansSerifSmall(); } // setup paramaters mMessage = notification->getMessage(); // initialize setFocusRoot(!mIsTip); // caution flag can be set explicitly by specifying it in the // notification payload, or it can be set implicitly if the // notify xml template specifies that it is a caution // // tip-style notification handle 'caution' differently - // they display the tip in a different color mIsCaution = notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH; // Only animate first window if( gNotifyBoxView->getChildCount() > 0 ) mAnimating = FALSE; else mAnimating = TRUE; LLNotificationFormPtr form(notification->getForm()); mNumOptions = form->getNumElements(); LLRect rect = mIsTip ? getNotifyTipRect(mMessage) : getNotifyRect(mNumOptions, layout_script_dialog, mIsCaution); setRect(rect); setFollows(mIsTip ? (FOLLOWS_BOTTOM|FOLLOWS_RIGHT) : (FOLLOWS_TOP|FOLLOWS_RIGHT)); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); LLIconCtrl* icon; LLTextEditor* text; const S32 TOP = getRect().getHeight() - (mIsTip ? (S32)sFont->getLineHeight() : 32); const S32 BOTTOM = (S32)sFont->getLineHeight(); S32 x = HPAD + HPAD; S32 y = TOP; if (mIsTip) { // use the tip notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_tip_icon.tga")); } else if (mIsCaution) { // use the caution notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_caution_icon.tga")); } else { // use the default notification icon icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+32, TOP-32), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + 32; // add a caution textbox at the top of a caution notification LLTextBox* caution_box = NULL; if (mIsCaution && !mIsTip) { S32 caution_height = ((S32)sFont->getLineHeight() * 2) + VPAD; caution_box = new LLTextBox( std::string("caution_box"), LLRect(x, y, getRect().getWidth() - 2, caution_height), LLStringUtil::null, sFont, FALSE); caution_box->setFontStyle(LLFontGL::BOLD); caution_box->setColor(gColors.getColor("NotifyCautionWarnColor")); caution_box->setBackgroundColor(gColors.getColor("NotifyCautionBoxColor")); caution_box->setBorderVisible(FALSE); caution_box->setWrappedText(notification->getMessage()); addChild(caution_box); // adjust the vertical position of the next control so that // it appears below the caution textbox y = y - caution_height; } else { const S32 BTN_TOP = BOTTOM_PAD + (((mNumOptions-1+2)/3)) * (BTN_HEIGHT+VPAD); // Tokenization on \n is handled by LLTextBox const S32 MAX_LENGTH = 512 + 20 + DB_FIRST_NAME_BUF_SIZE + DB_LAST_NAME_BUF_SIZE + DB_INV_ITEM_NAME_BUF_SIZE; // For script dialogs: add space for title. text = new LLTextEditor(std::string("box"), LLRect(x, y, getRect().getWidth()-2, mIsTip ? BOTTOM : BTN_TOP+16), MAX_LENGTH, mMessage, sFont, FALSE); text->setWordWrap(TRUE); text->setTabStop(FALSE); text->setMouseOpaque(FALSE); text->setBorderVisible(FALSE); text->setTakesNonScrollClicks(FALSE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( LLColor4::transparent ); // the background color of the box is manually // rendered under the text box, therefore we want // the actual text box to be transparent text->setReadOnlyFgColor ( gColors.getColor("NotifyTextColor") ); text->setEnabled(FALSE); // makes it read-only text->setTabStop(FALSE); // can't tab to it (may be a problem for scrolling via keyboard) addChild(text); } if (mIsTip) { // TODO: Make a separate archive for these. LLChat chat(mMessage); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::getInstance(LLSD())->addChatHistory(chat); } else { LLButton* btn; btn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, onClickNext, this, sFont); btn->setScaleImage(TRUE); btn->setToolTip(std::string("Next")); // *TODO: Translate addChild(btn); mNextBtn = btn; for (S32 i = 0; i < mNumOptions; i++) { LLSD form_element = form->getElement(i); if (form_element["type"].asString() != "button") { continue; } addButton(form_element["name"].asString(), form_element["text"].asString(), TRUE, form_element["default"].asBoolean()); } if (mNumButtons == 0) { addButton("OK", "OK", FALSE, TRUE); mAddedDefaultBtn = TRUE; } sNotifyBoxCount++; if (sNotifyBoxCount <= 0) { llwarns << "A notification was mishandled. sNotifyBoxCount = " << sNotifyBoxCount << llendl; } // If this is the only notify box, don't show the next button if (sNotifyBoxCount == 1 && mNextBtn) { mNextBtn->setVisible(FALSE); } } }
BOOL LLFloaterTools::postBuild() { // Hide until tool selected setVisible(FALSE); // Since we constantly show and hide this during drags, don't // make sounds on visibility changes. setSoundFlags(LLView::SILENT); getDragHandle()->setEnabled( true ); LLRect rect; mBtnFocus = getChild<LLButton>("button focus");//btn; childSetAction("button focus",LLFloaterTools::setEditTool, (void*)LLToolCamera::getInstance()); mBtnMove = getChild<LLButton>("button move"); childSetAction("button move",LLFloaterTools::setEditTool, (void*)LLToolGrab::getInstance()); mBtnEdit = getChild<LLButton>("button edit"); childSetAction("button edit",LLFloaterTools::setEditTool, (void*)LLToolCompTranslate::getInstance()); mBtnCreate = getChild<LLButton>("button create"); childSetAction("button create",LLFloaterTools::setEditTool, (void*)LLToolCompCreate::getInstance()); mBtnLand = getChild<LLButton>("button land" ); childSetAction("button land",LLFloaterTools::setEditTool, (void*)LLToolSelectLand::getInstance()); mTextStatus = getChild<LLTextBox>("text status"); childSetCommitCallback("slider zoom",commit_slider_zoom,this); mRadioZoom = getChild<LLCheckBoxCtrl>("radio zoom"); childSetCommitCallback("radio zoom",commit_radio_zoom,this); mRadioOrbit = getChild<LLCheckBoxCtrl>("radio orbit"); childSetCommitCallback("radio orbit",commit_radio_orbit,this); mRadioPan = getChild<LLCheckBoxCtrl>("radio pan"); childSetCommitCallback("radio pan",commit_radio_pan,this); mRadioMove = getChild<LLCheckBoxCtrl>("radio move"); childSetCommitCallback("radio move",click_popup_grab_drag,this); mRadioLift = getChild<LLCheckBoxCtrl>("radio lift"); childSetCommitCallback("radio lift",click_popup_grab_lift,this); mRadioSpin = getChild<LLCheckBoxCtrl>("radio spin"); childSetCommitCallback("radio spin",click_popup_grab_spin,NULL); mRadioPosition = getChild<LLCheckBoxCtrl>("radio position"); childSetCommitCallback("radio position",commit_select_tool,LLToolCompTranslate::getInstance()); mRadioRotate = getChild<LLCheckBoxCtrl>("radio rotate"); childSetCommitCallback("radio rotate",commit_select_tool,LLToolCompRotate::getInstance()); mRadioStretch = getChild<LLCheckBoxCtrl>("radio stretch"); childSetCommitCallback("radio stretch",commit_select_tool,LLToolCompScale::getInstance()); mRadioSelectFace = getChild<LLCheckBoxCtrl>("radio select face"); childSetCommitCallback("radio select face",commit_select_tool,LLToolFace::getInstance()); mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts"); childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts")); childSetCommitCallback("checkbox edit linked parts",commit_select_component,this); mCheckSnapToGrid = getChild<LLCheckBoxCtrl>("checkbox snap to grid"); childSetValue("checkbox snap to grid",(BOOL)gSavedSettings.getBOOL("SnapEnabled")); mBtnGridOptions = getChild<LLButton>("Options..."); childSetAction("Options...",onClickGridOptions, this); mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform"); childSetValue("checkbox uniform",(BOOL)gSavedSettings.getBOOL("ScaleUniform")); mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures"); childSetValue("checkbox stretch textures",(BOOL)gSavedSettings.getBOOL("ScaleStretchTextures")); mTextGridMode = getChild<LLTextBox>("text ruler mode"); mComboGridMode = getChild<LLComboBox>("combobox grid mode"); childSetCommitCallback("combobox grid mode",commit_grid_mode, this); //Banana:KC - stuff for show highlight mShowHighlight = (BOOL)gSavedSettings.getBOOL("PhoenixRenderHighlightSelections"); //Banana: save show highlight state on open so it can be restored on close mCheckShowHighlight = getChild<LLCheckBoxCtrl>("checkbox show highlight"); childSetValue("checkbox show highlight",mShowHighlight); childSetCommitCallback("checkbox show highlight",commit_show_highlight, this); //Banana:KC - handiness mCheckActualRoot = getChild<LLCheckBoxCtrl>("checkbox actual root"); // // Create Buttons // static const std::string toolNames[]={ "ToolCube", "ToolPrism", "ToolPyramid", "ToolTetrahedron", "ToolCylinder", "ToolHemiCylinder", "ToolCone", "ToolHemiCone", "ToolSphere", "ToolHemiSphere", "ToolTorus", "ToolTube", "ToolRing", "ToolTree", "ToolGrass"}; void* toolData[]={ &LLToolPlacerPanel::sCube, &LLToolPlacerPanel::sPrism, &LLToolPlacerPanel::sPyramid, &LLToolPlacerPanel::sTetrahedron, &LLToolPlacerPanel::sCylinder, &LLToolPlacerPanel::sCylinderHemi, &LLToolPlacerPanel::sCone, &LLToolPlacerPanel::sConeHemi, &LLToolPlacerPanel::sSphere, &LLToolPlacerPanel::sSphereHemi, &LLToolPlacerPanel::sTorus, &LLToolPlacerPanel::sSquareTorus, &LLToolPlacerPanel::sTriangleTorus, &LLToolPlacerPanel::sTree, &LLToolPlacerPanel::sGrass}; for(size_t t=0; t<LL_ARRAY_SIZE(toolNames); ++t) { LLButton *found = getChild<LLButton>(toolNames[t]); if(found) { found->setClickedCallback(setObjectType,toolData[t]); mButtons.push_back( found ); } else { llwarns << "Tool button not found! DOA Pending." << llendl; } } mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection")); mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky"); childSetValue("checkbox sticky",(BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected")); mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers"); childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters")); mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates"); childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates")); mRadioSelectLand = getChild<LLCheckBoxCtrl>("radio select land"); childSetCommitCallback("radio select land",commit_select_tool, LLToolSelectLand::getInstance()); mRadioDozerFlatten = getChild<LLCheckBoxCtrl>("radio flatten"); childSetCommitCallback("radio flatten",click_popup_dozer_mode, (void*)0); mRadioDozerRaise = getChild<LLCheckBoxCtrl>("radio raise"); childSetCommitCallback("radio raise",click_popup_dozer_mode, (void*)1); mRadioDozerLower = getChild<LLCheckBoxCtrl>("radio lower"); childSetCommitCallback("radio lower",click_popup_dozer_mode, (void*)2); mRadioDozerSmooth = getChild<LLCheckBoxCtrl>("radio smooth"); childSetCommitCallback("radio smooth",click_popup_dozer_mode, (void*)3); mRadioDozerNoise = getChild<LLCheckBoxCtrl>("radio noise"); childSetCommitCallback("radio noise",click_popup_dozer_mode, (void*)4); mRadioDozerRevert = getChild<LLCheckBoxCtrl>("radio revert"); childSetCommitCallback("radio revert",click_popup_dozer_mode, (void*)5); mBtnApplyToSelection = getChild<LLButton>("button apply to selection"); childSetAction("button apply to selection",click_apply_to_selection, (void*)0); mSliderDozerSize = getChild<LLSlider>("slider brush size"); childSetCommitCallback("slider brush size", commit_slider_dozer_size, (void*)0); childSetValue( "slider brush size", gSavedSettings.getF32("LandBrushSize")); mSliderDozerForce = getChild<LLSlider>("slider force"); childSetCommitCallback("slider force",commit_slider_dozer_force, (void*)0); // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here childSetValue( "slider force", log10(gSavedSettings.getF32("LandBrushForce"))); childSetAction("button more", click_show_more, this); //Banana:KC childSetAction("button less", click_show_more, this); //Banana:KC mTab = getChild<LLTabContainer>("Object Info Tabs"); if(mTab) { mTab->setVisible( gSavedSettings.getBOOL("BananaToolboxShowMore") ); //Banana:KC mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT); mTab->setVisible( gSavedSettings.getBOOL("BananaToolboxShowMore") ); //Banana:KC mTab->setBorderVisible(FALSE); mTab->selectFirstTab(); } mStatusText["rotate"] = getString("status_rotate"); mStatusText["scale"] = getString("status_scale"); mStatusText["move"] = getString("status_move"); mStatusText["modifyland"] = getString("status_modifyland"); mStatusText["camera"] = getString("status_camera"); mStatusText["grab"] = getString("status_grab"); mStatusText["place"] = getString("status_place"); mStatusText["selectland"] = getString("status_selectland"); return TRUE; }
// Per-frame updates of visibility void LLOverlayBar::refresh() { BOOL buttons_changed = FALSE; BOOL im_received = gIMMgr->getIMReceived(); int unread_count = gIMMgr->getIMUnreadCount(); LLButton* button = getChild<LLButton>("IM Received"); if (button && button->getVisible() != im_received || button && button->getVisible()) { if (unread_count > 0) { if (unread_count > 1) { std::stringstream ss; ss << unread_count << " " << getString("unread_count_string_plural"); button->setLabel(ss.str()); } else { button->setLabel("1 " + mOriginalIMLabel); } } button->setVisible(im_received); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL busy = gAgent.getBusy(); button = getChild<LLButton>("Set Not Busy"); if (button && button->getVisible() != busy) { button->setVisible(busy); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera(); button = getChild<LLButton>("Flycam"); if (button && button->getVisible() != flycam) { button->setVisible(flycam); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL mouselook_grabbed; mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX) || gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX); button = getChild<LLButton>("Mouselook"); if (button && button->getVisible() != mouselook_grabbed) { button->setVisible(mouselook_grabbed); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { // sitting = gAgent.getAvatarObject()->mIsSitting; // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) sitting = gAgent.getAvatarObject()->mIsSitting && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); // [/RLVa:KB] } button = getChild<LLButton>("Stand Up"); if (button && button->getVisible() != sitting) { button->setVisible(sitting); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } moveChildToBackOfTabGroup(mAORemote); moveChildToBackOfTabGroup(mWindlightRemote); moveChildToBackOfTabGroup(mMediaRemote); moveChildToBackOfTabGroup(mVoiceRemote); // turn off the whole bar in mouselook if (gAgent.cameraMouselook()) { childSetVisible("media_remote_container", FALSE); childSetVisible("voice_remote_container", FALSE); childSetVisible("windlight_remote_container", FALSE); childSetVisible("ao_remote_container", FALSE); childSetVisible("state_buttons", FALSE); } else { // update "remotes" childSetVisible("media_remote_container", TRUE); childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); static BOOL *sEnableWindlightRemote = rebind_llcontrol<BOOL>("EnableWindlightRemote", &gSavedSettings, true); childSetVisible("windlight_remote_container", (*sEnableWindlightRemote)); static BOOL *sEnableAORemote = rebind_llcontrol<BOOL>("EnableAORemote", &gSavedSettings, true); childSetVisible("ao_remote_container", (*sEnableAORemote)); childSetVisible("state_buttons", TRUE); } static BOOL *sChatVisible = rebind_llcontrol<BOOL>("ChatVisible", &gSavedSettings, true); // always let user toggle into and out of chatbar childSetVisible("chat_bar", *sChatVisible);//gSavedSettings.getBOOL("ChatVisible")); if (buttons_changed) { layoutButtons(); } }
BOOL LLPreviewGesture::postBuild() { LLLineEditor* edit; LLComboBox* combo; LLButton* btn; LLScrollListCtrl* list; LLTextBox* text; LLCheckBoxCtrl* check; edit = getChild<LLLineEditor>("trigger_editor"); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mTriggerEditor = edit; text = getChild<LLTextBox>("replace_text"); text->setEnabled(FALSE); mReplaceText = text; edit = getChild<LLLineEditor>("replace_editor"); edit->setEnabled(FALSE); edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitCallback(onCommitSetDirty); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mReplaceEditor = edit; combo = getChild<LLComboBox>( "modifier_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mModifierCombo = combo; combo = getChild<LLComboBox>( "key_combo"); combo->setCommitCallback(onCommitSetDirty); combo->setCallbackUserData(this); mKeyCombo = combo; list = getChild<LLScrollListCtrl>("library_list"); list->setCommitCallback(onCommitLibrary); list->setDoubleClickCallback(onClickAdd); list->setCallbackUserData(this); mLibraryList = list; btn = getChild<LLButton>( "add_btn"); btn->setClickedCallback(onClickAdd); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mAddBtn = btn; btn = getChild<LLButton>( "up_btn"); btn->setClickedCallback(onClickUp); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mUpBtn = btn; btn = getChild<LLButton>( "down_btn"); btn->setClickedCallback(onClickDown); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDownBtn = btn; btn = getChild<LLButton>( "delete_btn"); btn->setClickedCallback(onClickDelete); btn->setCallbackUserData(this); btn->setEnabled(FALSE); mDeleteBtn = btn; list = getChild<LLScrollListCtrl>("step_list"); list->setCommitCallback(onCommitStep); list->setCallbackUserData(this); mStepList = list; // Options text = getChild<LLTextBox>("options_text"); text->setBorderVisible(TRUE); mOptionsText = text; combo = getChild<LLComboBox>( "animation_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitAnimation); combo->setCallbackUserData(this); mAnimationCombo = combo; LLRadioGroup* group; group = getChild<LLRadioGroup>("animation_trigger_type"); group->setVisible(FALSE); group->setCommitCallback(onCommitAnimationTrigger); group->setCallbackUserData(this); mAnimationRadio = group; combo = getChild<LLComboBox>( "sound_list"); combo->setVisible(FALSE); combo->setCommitCallback(onCommitSound); combo->setCallbackUserData(this); mSoundCombo = combo; edit = getChild<LLLineEditor>("chat_editor"); edit->setVisible(FALSE); edit->setCommitCallback(onCommitChat); //edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitOnFocusLost(TRUE); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mChatEditor = edit; check = getChild<LLCheckBoxCtrl>( "wait_anim_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitAnimCheck = check; check = getChild<LLCheckBoxCtrl>( "wait_time_check"); check->setVisible(FALSE); check->setCommitCallback(onCommitWait); check->setCallbackUserData(this); mWaitTimeCheck = check; edit = getChild<LLLineEditor>("wait_time_editor"); edit->setEnabled(FALSE); edit->setVisible(FALSE); edit->setPrevalidate(LLLineEditor::prevalidateFloat); // edit->setKeystrokeCallback(onKeystrokeCommit); edit->setCommitOnFocusLost(TRUE); edit->setCommitCallback(onCommitWaitTime); edit->setCallbackUserData(this); edit->setIgnoreTab(TRUE); mWaitTimeEditor = edit; // Buttons at the bottom check = getChild<LLCheckBoxCtrl>( "active_check"); check->setCommitCallback(onCommitActive); check->setCallbackUserData(this); mActiveCheck = check; btn = getChild<LLButton>( "save_btn"); btn->setClickedCallback(onClickSave); btn->setCallbackUserData(this); mSaveBtn = btn; btn = getChild<LLButton>( "preview_btn"); btn->setClickedCallback(onClickPreview); btn->setCallbackUserData(this); mPreviewBtn = btn; // Populate the comboboxes addModifiers(); addKeys(); addAnimations(); addSounds(); const LLInventoryItem* item = getItem(); if (item) { childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); } return TRUE; }
LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) : LLPanel(name, LLRect(), FALSE), // not mouse opaque mBalance(0), mHealth(100), mSquareMetersCredit(0), mSquareMetersCommitted(0) { // status bar can possible overlay menus? setMouseOpaque(FALSE); setIsChrome(TRUE); mBalanceTimer = new LLFrameTimer(); mHealthTimer = new LLFrameTimer(); LLUICtrlFactory::getInstance()->buildPanel(this,"panel_status_bar.xml"); // status bar can never get a tab setFocusRoot(FALSE); mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); mTextBalance = getChild<LLTextBox>("BalanceText" ); mTextHealth = getChild<LLTextBox>("HealthText" ); mTextTime = getChild<LLTextBox>("TimeText" ); childSetAction("scriptout", onClickScriptDebug, this); childSetAction("health", onClickHealth, this); childSetAction("no_fly", onClickFly, this); childSetAction("buyland", onClickBuyLand, this ); childSetAction("no_build", onClickBuild, this ); childSetAction("no_scripts", onClickScripts, this ); childSetAction("restrictpush", onClickPush, this ); childSetAction("status_no_voice", onClickVoice, this ); childSetCommitCallback("search_editor", onCommitSearch, this); childSetAction("search_btn", onClickSearch, this); childSetVisible("search_editor", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("search_btn", gSavedSettings.getBOOL("ShowSearchBar")); childSetVisible("menubar_search_bevel_bg", gSavedSettings.getBOOL("ShowSearchBar")); childSetAction("buycurrency", onClickBuyCurrency, this ); childSetActionTextbox("BalanceText", onClickBalance ); childSetActionTextbox("ParcelNameText", onClickParcelInfo ); // TODO: Disable buying currency when connected to non-SL grids // that don't support currency yet -- MC LLButton* buybtn = getChild<LLButton>("buycurrency"); buybtn->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); // Adding Net Stat Graph S32 x = getRect().getWidth() - 2; S32 y = 0; LLRect r; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGBandwidth = new LLStatGraph("BandwidthGraph", r); mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); std::string text = childGetText("bandwidth_tooltip") + " "; LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven mSGBandwidth->setLabel(bandwidth_tooltip.getString()); mSGBandwidth->setUnits("Kbps"); mSGBandwidth->setPrecision(0); mSGBandwidth->setMouseOpaque(FALSE); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; r.set( x-SIM_STAT_WIDTH, y+MENU_BAR_HEIGHT-1, x, y+1); mSGPacketLoss = new LLStatGraph("PacketLossPercent", r); mSGPacketLoss->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); text = childGetText("packet_loss_tooltip") + " "; LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven mSGPacketLoss->setLabel(packet_loss_tooltip.getString()); mSGPacketLoss->setUnits("%"); mSGPacketLoss->setMin(0.f); mSGPacketLoss->setMax(5.f); mSGPacketLoss->setThreshold(0, 0.5f); mSGPacketLoss->setThreshold(1, 1.f); mSGPacketLoss->setThreshold(2, 3.f); mSGPacketLoss->setPrecision(1); mSGPacketLoss->setMouseOpaque(FALSE); mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); childSetActionTextbox("stat_btn", onClickStatGraph); }
void lggBeamMapFloater::draw() { LLRect swatch_rect; LLButton* createButton = empanel->getChild<LLButton>("custom_beam_btn"); createButton->localRectToOtherView(createButton->getLocalRect(), &swatch_rect, this); LLRect local_rect = getLocalRect(); if (gFocusMgr.childHasKeyboardFocus(this) && createButton->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(swatch_rect.mLeft, swatch_rect.mTop); gGL.vertex2i(swatch_rect.mRight, swatch_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(swatch_rect.mLeft, swatch_rect.mBottom); gGL.vertex2i(swatch_rect.mLeft, swatch_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(swatch_rect.mRight, swatch_rect.mTop); gGL.vertex2i(swatch_rect.mRight, swatch_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(swatch_rect.mRight, swatch_rect.mBottom); gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); } gGL.end(); } static F32* opacity = rebind_llcontrol<F32>("PickerContextOpacity", &gSavedSettings, true); mContextConeOpacity = lerp(mContextConeOpacity, *opacity, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); //getChild<LLPanel>("beamshape_draw")->setBackgroundColor(getChild<LLColorSwatchCtrl>("back_color_swatch")->get()); LLFloater::draw(); LLRect rec = getChild<LLPanel>("beamshape_draw")->getRect(); gGL.pushMatrix(); gGL.color4fv(LLColor4::white.mV); gl_circle_2d(rec.getCenterX(),rec.getCenterY(),2.0f,(S32)30,false); gGL.color4fv(LLColor4::black.mV); gl_circle_2d(rec.getCenterX(),rec.getCenterY(),30.0f,(S32)30,false); gGL.color4fv(LLColor4::white.mV); gl_circle_2d(rec.getCenterX(),rec.getCenterY(),60.0f,(S32)30,false); gGL.color4fv(LLColor4::black.mV); gl_circle_2d(rec.getCenterX(),rec.getCenterY(),90.0f,(S32)30,false); gGL.color4fv(LLColor4::white.mV); gl_circle_2d(rec.getCenterX(),rec.getCenterY(),120.0f,(S32)30,false); for(int i = 0; i < (int)dots.size();i++) { gGL.color4fv(LLColor4::white.mV); gl_circle_2d(dots[i].x,dots[i].y,9.0f,(S32)30,true); gGL.color4fv(LLColor4::black.mV); gl_circle_2d(dots[i].x,dots[i].y,8.0f,(S32)30,true); gGL.color4fv(dots[i].c.mV); gl_circle_2d(dots[i].x,dots[i].y,7.0f,(S32)30,true); } gGL.popMatrix(); }
void LLPanelGroupGeneral::setGroupID(const LLUUID& id) { LLPanelGroupTab::setGroupID(id); // <FS> Get group key display and copy URI/name button pointers LLTextEditor* groupKeyEditor = getChild<LLTextEditor>("group_key"); LLButton* copyURIButton = getChild<LLButton>("copy_uri"); LLButton* copyNameButton = getChild<LLButton>("copy_name"); // happens when a new group is created // </FS> if(id == LLUUID::null) { // <FS> if (groupKeyEditor) groupKeyEditor->setValue(LLSD()); if (copyURIButton) copyURIButton->setEnabled(FALSE); if (copyNameButton) copyNameButton->setEnabled(FALSE); // </FS> reset(); return; } // <FS> // fill in group key if (groupKeyEditor) groupKeyEditor->setValue(id.asString()); // activate copy URI button if (copyURIButton) copyURIButton->setEnabled(TRUE); // </FS> BOOL accept_notices = FALSE; BOOL list_in_profile = FALSE; LLGroupData data; if(gAgent.getGroupData(mGroupID,data)) { accept_notices = data.mAcceptNotices; list_in_profile = data.mListInProfile; } mCtrlReceiveNotices = getChild<LLCheckBoxCtrl>("receive_notices"); if (mCtrlReceiveNotices) { mCtrlReceiveNotices->set(accept_notices); mCtrlReceiveNotices->setEnabled(data.mID.notNull()); } mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile"); if (mCtrlListGroup) { mCtrlListGroup->set(list_in_profile); mCtrlListGroup->setEnabled(data.mID.notNull()); } // <exodus> mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat"); if (mCtrlReceiveGroupChat) { if(data.mID.notNull()) { mCtrlReceiveGroupChat->set(!exoGroupMuteList::instance().isMuted(data.mID)); } mCtrlReceiveGroupChat->setEnabled(data.mID.notNull()); } // </exodus> mCtrlShowInGroupList->setEnabled(data.mID.notNull()); mActiveTitleLabel = getChild<LLTextBox>("active_title_label"); mComboActiveTitle = getChild<LLComboBox>("active_title"); mFounderName->setVisible(true); mInsignia->setImageAssetID(LLUUID::null); resetDirty(); activate(); }
void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) { LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list"); if(!list) { LL_WARNS() << "Error getting the scripts_list control" << LL_ENDL; return; } S32 number_parcels = content["parcels"].size(); LLStringUtil::format_map_t args_parcels; args_parcels["[PARCELS]"] = llformat ("%d", number_parcels); std::string msg_parcels = LLTrans::getString("ScriptLimitsParcelsOwned", args_parcels); getChild<LLUICtrl>("parcels_listed")->setValue(LLSD(msg_parcels)); uuid_vec_t names_requested; // This makes the assumption that all objects will have the same set // of attributes, ie they will all have, or none will have locations // This is a pretty safe assumption as it's reliant on server version. bool has_locations = false; bool has_local_ids = false; for(S32 i = 0; i < number_parcels; i++) { std::string parcel_name = content["parcels"][i]["name"].asString(); LLUUID parcel_id = content["parcels"][i]["id"].asUUID(); S32 number_objects = content["parcels"][i]["objects"].size(); S32 local_id = 0; if(content["parcels"][i].has("local_id")) { // if any locations are found flag that we can use them and turn on the highlight button has_local_ids = true; local_id = content["parcels"][i]["local_id"].asInteger(); } for(S32 j = 0; j < number_objects; j++) { S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB; S32 urls = content["parcels"][i]["objects"][j]["resources"]["urls"].asInteger(); std::string name_buf = content["parcels"][i]["objects"][j]["name"].asString(); LLUUID task_id = content["parcels"][i]["objects"][j]["id"].asUUID(); LLUUID owner_id = content["parcels"][i]["objects"][j]["owner_id"].asUUID(); // This field may not be sent by all server versions, but it's OK if // it uses the LLSD default of false bool is_group_owned = content["parcels"][i]["objects"][j]["is_group_owned"].asBoolean(); F32 location_x = 0.0f; F32 location_y = 0.0f; F32 location_z = 0.0f; if(content["parcels"][i]["objects"][j].has("location")) { // if any locations are found flag that we can use them and turn on the highlight button LLVector3 vec = ll_vector3_from_sd(content["parcels"][i]["objects"][j]["location"]); has_locations = true; location_x = vec.mV[0]; location_y = vec.mV[1]; location_z = vec.mV[2]; } std::string owner_buf; // in the future the server will give us owner names, so see if we're there yet: if(content["parcels"][i]["objects"][j].has("owner_name")) { owner_buf = content["parcels"][i]["objects"][j]["owner_name"].asString(); } // ...and if not use the slightly more painful method of disovery: else { BOOL name_is_cached; if (is_group_owned) { name_is_cached = gCacheName->getGroupName(owner_id, owner_buf); } else { name_is_cached = LLAvatarNameCache::getNSName(owner_id, owner_buf); // username } if(!name_is_cached) { if(std::find(names_requested.begin(), names_requested.end(), owner_id) == names_requested.end()) { names_requested.push_back(owner_id); gCacheName->get(owner_id, is_group_owned, // username boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache, this, _1, _2)); } } } LLScrollListItem::Params item_params; item_params.value = task_id; LLScrollListCell::Params cell_params; //cell_params.font = LLFontGL::getFontSansSerif(); cell_params.column = "size"; cell_params.value = size; item_params.columns.add(cell_params); cell_params.column = "urls"; cell_params.value = urls; item_params.columns.add(cell_params); cell_params.column = "name"; cell_params.value = name_buf; item_params.columns.add(cell_params); cell_params.column = "owner"; cell_params.value = owner_buf; item_params.columns.add(cell_params); cell_params.column = "parcel"; cell_params.value = parcel_name; item_params.columns.add(cell_params); cell_params.column = "location"; cell_params.value = has_locations ? llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z) : ""; item_params.columns.add(cell_params); list->addRow(item_params); LLSD element; element["owner_id"] = owner_id; element["id"] = task_id; element["local_id"] = local_id; mObjectListItems.push_back(element); } } if (has_locations) { LLButton* btn = getChild<LLButton>("highlight_btn"); if(btn) { btn->setVisible(true); } } if (has_local_ids) { LLButton* btn = getChild<LLButton>("return_btn"); if(btn) { btn->setVisible(true); } } // save the structure to make object return easier mContent = content; }
void fetchScriptLimitsAttachmentInfoResponder::httpSuccess() { const LLSD& content_ref = getContent(); #ifdef USE_FAKE_RESPONSES // just add the summary, as that's all I'm testing currently! LLSD fake_content = LLSD::emptyMap(); LLSD summary = LLSD::emptyMap(); LLSD available = LLSD::emptyArray(); LLSD available_urls = LLSD::emptyMap(); LLSD available_memory = LLSD::emptyMap(); LLSD used = LLSD::emptyArray(); LLSD used_urls = LLSD::emptyMap(); LLSD used_memory = LLSD::emptyMap(); used_urls["type"] = "urls"; used_urls["amount"] = FAKE_NUMBER_OF_URLS; available_urls["type"] = "urls"; available_urls["amount"] = FAKE_AVAILABLE_URLS; used_memory["type"] = "memory"; used_memory["amount"] = FAKE_AMOUNT_OF_MEMORY; available_memory["type"] = "memory"; available_memory["amount"] = FAKE_AVAILABLE_MEMORY; used.append(used_urls); used.append(used_memory); available.append(available_urls); available.append(available_memory); summary["available"] = available; summary["used"] = used; fake_content["summary"] = summary; fake_content["attachments"] = content_ref["attachments"]; const LLSD& content = fake_content; #else const LLSD& content = content_ref; #endif if (!content.isMap()) { failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); return; } #ifdef DUMP_REPLIES_TO_LLINFOS LLSDNotationStreamer notation_streamer(content); std::ostringstream nice_llsd; nice_llsd << notation_streamer; OSMessageBox(nice_llsd.str(), "attachment response:", 0); LL_INFOS() << "attachment response:" << content << LL_ENDL; #endif LLFloaterScriptLimits* instance = LLFloaterScriptLimits::findInstance(); if(!instance) { LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL; } else { LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels"); if(tab) { LLPanelScriptLimitsAttachment* panel = (LLPanelScriptLimitsAttachment*)tab->getChild<LLPanel>("script_limits_my_avatar_panel"); if(panel) { panel->getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); LLButton* btn = panel->getChild<LLButton>("refresh_list_btn"); if(btn) { btn->setEnabled(true); } panel->setAttachmentDetails(content); } else { LL_WARNS() << "Failed to get script_limits_my_avatar_panel" << LL_ENDL; } } else { LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL; } } }
// Per-frame updates of visibility void LLOverlayBar::refresh() { BOOL buttons_changed = FALSE; BOOL im_received = gIMMgr->getIMReceived(); LLButton* button = getChild<LLButton>("IM Received"); if (button && button->getVisible() != im_received) { button->setVisible(im_received); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL busy = gAgent.getBusy(); button = getChild<LLButton>("Set Not Busy"); if (button && button->getVisible() != busy) { button->setVisible(busy); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera(); button = getChild<LLButton>("Flycam"); if (button && button->getVisible() != flycam) { button->setVisible(flycam); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL mouselook_grabbed; mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX) || gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX); button = getChild<LLButton>("Mouselook"); if (button && button->getVisible() != mouselook_grabbed) { button->setVisible(mouselook_grabbed); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { sitting = gAgent.getAvatarObject()->mIsSitting; } button = getChild<LLButton>("Stand Up"); if (button && button->getVisible() != sitting) { button->setVisible(sitting); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } moveChildToBackOfTabGroup(mMediaRemote); moveChildToBackOfTabGroup(mVoiceRemote); // turn off the whole bar in mouselook if (gAgent.cameraMouselook()) { childSetVisible("media_remote_container", FALSE); childSetVisible("voice_remote_container", FALSE); childSetVisible("state_buttons", FALSE); } else { // update "remotes" childSetVisible("media_remote_container", TRUE); childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); childSetVisible("state_buttons", TRUE); } // always let user toggle into and out of chatbar childSetVisible("chat_bar", gSavedSettings.getBOOL("ChatVisible")); if (buttons_changed) { layoutButtons(); } }
BOOL LLPanelGroup::postBuild() { mTabContainer = getChild<LLTabContainer>("group_tab_container"); if (mTabContainer) { // Select the initial tab specified via constructor const BOOL recurse = TRUE; LLPanelGroupTab* tabp = getChild<LLPanelGroupTab>(mInitialTab, recurse); if (!tabp) { //our initial tab selection was invalid, just select the //first tab then or default to selecting the initial //selected tab specified in the layout file tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); //no tab was initially selected through constructor //or the XML, select the first tab if (!tabp) { mTabContainer->selectFirstTab(); tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); } } else { mTabContainer->selectTabPanel(tabp); } mCurrentTab = tabp; // Add click callbacks. S32 i; S32 tab_count = mTabContainer->getTabCount(); for (i = tab_count - 1; i >=0; --i) { LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack // Pass on whether or not to allow edit to tabs. panelp->setAllowEdit(mAllowEdit); panelp->addObserver(this); mTabContainer->setTabChangeCallback(panelp, onClickTab); mTabContainer->setTabUserData(panelp, this); } updateTabVisibility(); // Act as though this tab was just activated. mCurrentTab->activate(); } mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); LLButton* button = getChild<LLButton>("btn_ok"); if (button) { button->setClickedCallback(onBtnOK); button->setCallbackUserData(this); button->setVisible(mAllowEdit); } button = getChild<LLButton>("btn_cancel"); if (button) { button->setClickedCallback(onBtnCancel); button->setCallbackUserData(this); button->setVisible(mAllowEdit); } button = getChild<LLButton>("btn_apply"); if (button) { button->setClickedCallback(onBtnApply); button->setVisible(mAllowEdit); button->setEnabled(FALSE); mApplyBtn = button; } button = getChild<LLButton>("btn_refresh"); if (button) { button->setClickedCallback(onBtnRefresh); button->setCallbackUserData(this); button->setVisible(mAllowEdit); } return TRUE; }
LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, const std::string& message, const std::string& from_name, const LLUUID& group_id, const LLUUID& group_insignia, const std::string& group_name, const U32& t, const bool& has_inventory, const std::string& inventory_name, LLOfferInfo* inventory_offer) : LLPanel(std::string("groupnotify"), LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), mAnimating(TRUE), mTimer(), mGroupID(group_id), mHasInventory(has_inventory), mInventoryOffer(inventory_offer) { setFocusRoot(TRUE); time_t timestamp = (time_t)t; std::string time_buf = g_formatted_time(timestamp); setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); // TODO: add a color for group notices setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); LLIconCtrl* icon; LLTextEditor* text; const S32 VPAD = 2; const S32 TOP = getRect().getHeight() - 32; // Get past the top menu bar const S32 BOTTOM_PAD = VPAD * 2; const S32 BTN_TOP = BOTTOM_PAD + BTN_HEIGHT + VPAD; const S32 RIGHT = getRect().getWidth() - HPAD - HPAD; const S32 LINE_HEIGHT = 16; const S32 LABEL_WIDTH = 64; const S32 ICON_WIDTH = 64; S32 y = TOP; S32 x = HPAD + HPAD; class NoticeText : public LLTextBox { public: NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL) : LLTextBox(name, rect, text, font) { setHAlign(LLFontGL::RIGHT); setFontStyle(LLFontGL::DROP_SHADOW_SOFT); setBorderVisible(FALSE); setColor( gColors.getColor("GroupNotifyTextColor") ); setBackgroundColor( gColors.getColor("GroupNotifyBoxColor") ); } }; // Title addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),std::string("Group Notice"),LLFontGL::sSansSerifHuge)); y -= llfloor(1.5f*LINE_HEIGHT); x += HPAD + HPAD + ICON_WIDTH; std::stringstream from; from << "Sent by " << from_name << ", " << group_name; addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::sSansSerif)); y -= (LINE_HEIGHT + VPAD); x = HPAD + HPAD; // TODO: change this to be the group icon. if (!group_insignia.isNull()) { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), group_insignia); } else { icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), std::string("notify_box_icon.tga")); } icon->setMouseOpaque(FALSE); addChild(icon); x += HPAD + HPAD + ICON_WIDTH; // If we have inventory with this message, leave room for the name. S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); text = new LLViewerTextEditor(std::string("box"), LLRect(x, y, RIGHT, box_bottom), DB_GROUP_NOTICE_MSG_STR_LEN, LLStringUtil::null, LLFontGL::sSansSerif, FALSE); static const LLStyleSP headerstyle(new LLStyle(true,LLColor4::black,"SansSerifBig")); static const LLStyleSP datestyle(new LLStyle(true,LLColor4::black,"serif")); text->appendStyledText(subject,false,false,&headerstyle); text->appendStyledText(time_buf,false,false,&datestyle); // Sadly, our LLTextEditor can't handle both styled and unstyled text // at the same time. Hence this space must be styled. JC text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); text->appendColoredText(message,false,false,LLColor4::grey4); LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); text->setCursor(0,0); text->setEnabled(FALSE); text->setWordWrap(TRUE); //text->setTabStop(FALSE); // was interfering with copy-and-paste text->setTabsToNextField(TRUE); text->setMouseOpaque(TRUE); text->setBorderVisible(TRUE); text->setTakesNonScrollClicks(TRUE); text->setHideScrollbarForShortDocs(TRUE); text->setReadOnlyBgColor ( semi_transparent ); text->setWriteableBgColor ( semi_transparent ); addChild(text); y = box_bottom - VPAD; if (mHasInventory) { addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),std::string("Attached: "),LLFontGL::sSansSerif)); LLAssetType::EType atype; LLInventoryType::EType itype; atype = mInventoryOffer->mType; itype = LLInventoryType::defaultForAssetType( atype ); LLUIImagePtr item_icon = get_item_icon(atype, itype, 0, FALSE); x += LABEL_WIDTH + HPAD; std::stringstream ss; ss << " " << inventory_name; LLTextBox *line = new LLTextBox(std::string("object_name"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str(),LLFontGL::sSansSerif); line->setEnabled(FALSE); line->setBorderVisible(TRUE); line->setDisabledColor(LLColor4::blue4); line->setFontStyle(LLFontGL::NORMAL); line->setBackgroundVisible(true); line->setBackgroundColor( semi_transparent ); addChild(line); icon = new LLIconCtrl(std::string("icon"), LLRect(x, y, x+16, y-16), item_icon->getName()); icon->setMouseOpaque(FALSE); addChild(icon); } LLButton* btn; btn = new LLButton(std::string("next"), LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), std::string("notify_next.png"), std::string("notify_next.png"), LLStringUtil::null, onClickNext, this, LLFontGL::sSansSerif); btn->setToolTip(std::string("Next")); // *TODO: Translate btn->setScaleImage(TRUE); addChild(btn); mNextBtn = btn; S32 btn_width = 80; S32 wide_btn_width = 120; LLRect btn_rect; x = 3 * HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, btn_width, BTN_HEIGHT); btn = new LLButton(std::string("OK"), btn_rect, LLStringUtil::null, onClickOk, this); addChild(btn, -1); setDefaultBtn(btn); x += btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); btn = new LLButton(std::string("Group Notices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); btn->setToolTip(std::string("View past notices or opt-out of receiving these messages here.")); // TODO: Translate addChild(btn, -1); if (mHasInventory && mInventoryOffer) { x += wide_btn_width + HPAD; btn_rect.setOriginAndSize(x, BOTTOM_PAD, wide_btn_width, BTN_HEIGHT); std::string btn_lbl(""); if(is_openable(mInventoryOffer->mType)) { btn_lbl = "Open Attachment"; } else { btn_lbl = "Save Attachment"; } mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, onClickSaveInventory, this); mSaveInventoryBtn->setVisible(mHasInventory); addChild(mSaveInventoryBtn); } sGroupNotifyBoxCount++; // If this is the only notify box, don't show the next button if (sGroupNotifyBoxCount == 1) { mNextBtn->setVisible(FALSE); } }
void LLAlertDialog::createDialog(const std::vector<LLString>* optionsp, S32 default_option, const LLString& msg_in, const LLString::format_map_t& args, const LLString& edit_text) { setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); const LLFontGL* font = gResMgr->getRes( font_name ); const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); const S32 EDITOR_HEIGHT = 20; // Buttons std::vector<LLString> default_option_list; mNumOptions = optionsp->size(); if( 0 == mNumOptions ) { default_option_list.push_back("Close"); optionsp = &default_option_list; default_option = 0; mNumOptions = 1; } const std::vector<LLString>& options = *optionsp; mButtonData = new ButtonData[mNumOptions]; // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth("OO"); for( S32 i = 0; i < mNumOptions; i++ ) { S32 w = S32(font->getWidth( options[i] ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; button_width = llmax( w, button_width ); } S32 btn_total_width = button_width; if( mNumOptions > 1 ) { btn_total_width = (mNumOptions * button_width) + ((mNumOptions - 1) * BTN_HPAD); } // Message: create text box using raw string, as text has been structure deliberately // Use size of created text box to generate dialog box size LLString msg = msg_in; format( msg, args ); llwarns << "Alert: " << msg << llendl; LLTextBox* msg_box = new LLTextBox( "Alert message", msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); const LLRect& text_rect = msg_box->getRect(); S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD; S32 dialog_height = text_rect.getHeight() + 3 * VPAD + BTN_HEIGHT; if (hasTitleBar()) { dialog_height += LINE_HEIGHT; // room for title bar } if (edit_text.size() > 0) { dialog_width = llmax(dialog_width, S32(font->getWidth( edit_text ) + 0.99f)); dialog_height += EDITOR_HEIGHT; } if (mCaution) { // Make room for the caution icon. dialog_width += 32 + HPAD; } reshape( dialog_width, dialog_height, FALSE ); S32 msg_y = mRect.getHeight() - VPAD; S32 msg_x = HPAD; if (hasTitleBar()) { msg_y -= LINE_HEIGHT; // room for title } if (mCaution) { LLIconCtrl* icon = new LLIconCtrl("icon", LLRect(msg_x, msg_y, msg_x+32, msg_y-32), "notify_caution_icon.tga"); icon->setMouseOpaque(FALSE); addChild(icon); msg_x += 32 + HPAD; msg_box->setColor( LLUI::sColorsGroup->getColor( "AlertCautionTextColor" ) ); } else { msg_box->setColor( LLUI::sColorsGroup->getColor( "AlertTextColor" ) ); } LLRect rect; rect.setLeftTopAndSize( msg_x, msg_y, text_rect.getWidth(), text_rect.getHeight() ); msg_box->setRect( rect ); addChild(msg_box); // Buttons S32 button_left = (mRect.getWidth() - btn_total_width) / 2; for( S32 i = 0; i < mNumOptions; i++ ) { LLRect button_rect; button_rect.setOriginAndSize( button_left, VPAD, button_width, BTN_HEIGHT ); LLButton* btn = new LLButton( "btn", button_rect, "","", "", &LLAlertDialog::onButtonPressed, (void*)(&mButtonData[i]), font, options[i], options[i]); mButtonData[i].mSelf = this; mButtonData[i].mButton = btn; mButtonData[i].mOption = i; addChild(btn); if( i == default_option ) { btn->setFocus(TRUE); } button_left += button_width + BTN_HPAD; } // (Optional) Edit Box if (edit_text.size() > 0) { S32 y = VPAD + BTN_HEIGHT + VPAD/2; mLineEditor = new LLLineEditor("lineeditor", LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y), edit_text, LLFontGL::sSansSerif, STD_STRING_STR_LEN); // make sure all edit keys get handled properly mLineEditor->setHandleEditKeysDirectly(TRUE); addChild(mLineEditor); } }
BOOL LLToolBar::postBuild() { childSetCommitCallback("communicate_btn", onClickCommunicate, this); childSetControlName("communicate_btn", "ShowCommunicate"); childSetAction("chat_btn", onClickChat, this); childSetControlName("chat_btn", "ChatVisible"); childSetAction("appearance_btn", onClickAppearance, this); childSetControlName("appearance_btn", ""); childSetAction("fly_btn", onClickFly, this); childSetControlName("fly_btn", "FlyBtnState"); childSetAction("sit_btn", onClickSit, this); childSetControlName("sit_btn", "SitBtnState"); childSetAction("snapshot_btn", onClickSnapshot, this); childSetControlName("snapshot_btn", ""); childSetAction("directory_btn", onClickDirectory, this); childSetControlName("directory_btn", "ShowDirectory"); childSetAction("build_btn", onClickBuild, this); childSetControlName("build_btn", "BuildBtnState"); childSetAction("radar_btn", onClickRadar, this); childSetControlName("radar_btn", "ShowMiniMap"); childSetAction("map_btn", onClickMap, this); childSetControlName("map_btn", "ShowWorldMap"); childSetAction("inventory_btn", onClickInventory, this); childSetControlName("inventory_btn", "ShowInventory"); childSetAction("avatar_list_btn", onClickAvatarList, this); childSetControlName("avatar_list_btn", "ShowAvatarList"); for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *view = *child_iter; LLButton* buttonp = dynamic_cast<LLButton*>(view); if(buttonp) { buttonp->setSoundFlags(LLView::SILENT); } } #if LL_DARWIN if(mResizeHandle == NULL) { LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); mResizeHandle = new LLFakeResizeHandle(std::string(""), rect, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT); this->addChildAtEnd(mResizeHandle); LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack"); toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight()); } #endif // LL_DARWIN layoutButtons(); return TRUE; }
// Per-frame updates of visibility void LLOverlayBar::refresh() { BOOL buttons_changed = FALSE; BOOL im_received = gIMMgr->getIMReceived(); int unread_count = gIMMgr->getIMUnreadCount(); LLButton* button = getChild<LLButton>("New IM"); if ((button && button->getVisible() != im_received) || (button && button->getVisible())) { if (unread_count > 0) { if (unread_count > 1) { std::stringstream ss; ss << unread_count << " " << getString("unread_count_string_plural"); button->setLabel(ss.str()); } else { button->setLabel("1 " + mOriginalIMLabel); } } button->setVisible(im_received); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL busy = gAgent.getBusy(); button = getChild<LLButton>("Set Not Busy"); if (button && button->getVisible() != busy) { button->setVisible(busy); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL flycam = LLViewerJoystick::getInstance()->getOverrideCamera(); button = getChild<LLButton>("Flycam"); if (button && button->getVisible() != flycam) { button->setVisible(flycam); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL mouselook_grabbed; mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX) || gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX); button = getChild<LLButton>("Mouselook"); if (button && button->getVisible() != mouselook_grabbed) { button->setVisible(mouselook_grabbed); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { // sitting = gAgent.getAvatarObject()->mIsSitting; // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) sitting = gAgent.getAvatarObject()->mIsSitting && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); // [/RLVa:KB] } button = getChild<LLButton>("Stand Up"); if (button && button->getVisible() != sitting) { button->setVisible(sitting); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } BOOL teleporting = FALSE; if ((gAgent.getTeleportState() == LLAgent::TELEPORT_START) || (gAgent.getTeleportState() == LLAgent::TELEPORT_REQUESTED) || (gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING) || (gAgent.getTeleportState() == LLAgent::TELEPORT_START)) { teleporting = TRUE; } else { teleporting = FALSE; } button = getChild<LLButton>("Cancel TP"); if (button && button->getVisible() != teleporting) { button->setVisible(teleporting); sendChildToFront(button); moveChildToBackOfTabGroup(button); buttons_changed = TRUE; } moveChildToBackOfTabGroup(mMediaRemote); moveChildToBackOfTabGroup(mVoiceRemote); // turn off the whole bar in mouselook static BOOL last_mouselook = FALSE; BOOL in_mouselook = gAgent.cameraMouselook(); if(last_mouselook != in_mouselook) { last_mouselook = in_mouselook; if (in_mouselook) { childSetVisible("media_remote_container", FALSE); childSetVisible("voice_remote_container", FALSE); childSetVisible("AdvSettings_container", FALSE); childSetVisible("AdvSettings_container_exp", FALSE); childSetVisible("state_buttons", FALSE); } else { // update "remotes" childSetVisible("media_remote_container", TRUE); childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); childSetVisible("AdvSettings_container", !sAdvSettingsPopup);//!gSavedSettings.getBOOL("wlfAdvSettingsPopup")); childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup);//gSavedSettings.getBOOL("wlfAdvSettingsPopup")); childSetVisible("state_buttons", TRUE); } } if(!in_mouselook) childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); // always let user toggle into and out of chatbar static const LLCachedControl<bool> chat_visible("ChatVisible",true); childSetVisible("chat_bar", chat_visible); if (buttons_changed) { layoutButtons(); } }
LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal) : LLModalDialog( notification->getLabel(), 100, 100, modal ), // dummy size. Will reshape below. LLInstanceTracker<LLAlertDialog, LLUUID>(notification->getID()), mDefaultOption( 0 ), mCheck(NULL), mCaution(notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH), mLabel(notification->getName()), mLineEditor(NULL), mNote(notification) { const LLFontGL* font = LLResMgr::getInstance()->getRes( FONT_NAME ); const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f); const S32 EDITOR_HEIGHT = 20; LLNotificationFormPtr form = mNote->getForm(); std::string edit_text_name; std::string edit_text_contents; bool is_password = false; setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); typedef std::vector<std::pair<std::string, std::string> > options_t; options_t supplied_options; // for now, get LLSD to iterator over form elements LLSD form_sd = form->asLLSD(); S32 option_index = 0; for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it) { std::string type = (*it)["type"].asString(); if (type == "button") { if((*it)["default"]) { mDefaultOption = option_index; } supplied_options.push_back(std::make_pair((*it)["name"].asString(), (*it)["text"].asString())); ButtonData data; data.mSelf = this; if (option_index == mNote->getURLOption()) { data.mURL = mNote->getURL(); } mButtonData.push_back(data); option_index++; } else if (type == "text") { edit_text_contents = (*it)["value"].asString(); edit_text_name = (*it)["name"].asString(); } else if (type == "password") { edit_text_contents = (*it)["value"].asString(); edit_text_name = (*it)["name"].asString(); is_password = true; } } // Buttons options_t options; if (supplied_options.empty()) { options.push_back(std::make_pair(std::string("close"), std::string("Close"))); // add data for ok button. ButtonData ok_button; ok_button.mSelf = this; mButtonData.push_back(ok_button); mDefaultOption = 0; } else { options = supplied_options; } S32 num_options = options.size(); // Calc total width of buttons S32 button_width = 0; S32 sp = font->getWidth(std::string("OO")); for( S32 i = 0; i < num_options; i++ ) { S32 w = S32(font->getWidth( options[i].second ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD; button_width = llmax( w, button_width ); } S32 btn_total_width = button_width; if( num_options > 1 ) { btn_total_width = (num_options * button_width) + ((num_options - 1) * BTN_HPAD); } // Message: create text box using raw string, as text has been structure deliberately // Use size of created text box to generate dialog box size std::string msg = mNote->getMessage(); llwarns << "Alert: " << msg << llendl; LLTextBox* msg_box = new LLTextBox( std::string("Alert message"), msg, (F32)MAX_ALLOWED_MSG_WIDTH, font ); const LLRect& text_rect = msg_box->getRect(); S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD; S32 dialog_height = text_rect.getHeight() + 3 * VPAD + BTN_HEIGHT; if (hasTitleBar()) { dialog_height += LINE_HEIGHT; // room for title bar } // it's ok for the edit text body to be empty, but we want the name to exist if we're going to draw it if (!edit_text_name.empty()) { dialog_height += EDITOR_HEIGHT + VPAD; dialog_width = llmax(dialog_width, (S32)(font->getWidth( edit_text_contents ) + 0.99f)); } if (mCaution) { // Make room for the caution icon. dialog_width += 32 + HPAD; } reshape( dialog_width, dialog_height, FALSE ); S32 msg_y = getRect().getHeight() - VPAD; S32 msg_x = HPAD; if (hasTitleBar()) { msg_y -= LINE_HEIGHT; // room for title } if (mCaution) { LLIconCtrl* icon = new LLIconCtrl(std::string("icon"), LLRect(msg_x, msg_y, msg_x+32, msg_y-32), std::string("notify_caution_icon.tga")); icon->setMouseOpaque(FALSE); addChild(icon); msg_x += 32 + HPAD; msg_box->setColor( LLUI::sColorsGroup->getColor( "AlertCautionTextColor" ) ); } else { msg_box->setColor( LLUI::sColorsGroup->getColor( "AlertTextColor" ) ); } LLRect rect; rect.setLeftTopAndSize( msg_x, msg_y, text_rect.getWidth(), text_rect.getHeight() ); msg_box->setRect( rect ); addChild(msg_box); // Buttons S32 button_left = (getRect().getWidth() - btn_total_width) / 2; for( S32 i = 0; i < num_options; i++ ) { LLRect button_rect; button_rect.setOriginAndSize( button_left, VPAD, button_width, BTN_HEIGHT ); LLButton* btn = new LLButton( options[i].first, button_rect, "","", "", NULL, NULL, font, options[i].second, options[i].second); mButtonData[i].mButton = btn; btn->setClickedCallback(&LLAlertDialog::onButtonPressed, (void*)(&mButtonData[i])); addChild(btn); if( i == mDefaultOption ) { btn->setFocus(TRUE); } button_left += button_width + BTN_HPAD; } // (Optional) Edit Box if (!edit_text_name.empty()) { S32 y = VPAD + BTN_HEIGHT + VPAD/2; mLineEditor = new LLLineEditor(edit_text_name, LLRect( HPAD, y+EDITOR_HEIGHT, dialog_width-HPAD, y), edit_text_contents, LLFontGL::getFontSansSerif(), STD_STRING_STR_LEN); // make sure all edit keys get handled properly (DEV-22396) mLineEditor->setHandleEditKeysDirectly(TRUE); addChild(mLineEditor); } if (mLineEditor) { mLineEditor->setDrawAsterixes(is_password); setEditTextArgs(notification->getSubstitutions()); } std::string ignore_label; if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE) { setCheckBox(LLNotifications::instance().getGlobalString("skipnexttime"), ignore_label); } else if (form->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE) { setCheckBox(LLNotifications::instance().getGlobalString("alwayschoose"), ignore_label); } }
void LLIMToastNotifyPanel::compactButtons() { //we can't set follows in xml since it broke toasts behavior setFollows(FOLLOWS_LEFT|FOLLOWS_RIGHT|FOLLOWS_TOP); const child_list_t* children = getControlPanel()->getChildList(); S32 offset = 0; // Children were added by addChild() which uses push_front to insert them into list, // so to get buttons in correct order reverse iterator is used (EXT-5906) for (child_list_t::const_reverse_iterator it = children->rbegin(); it != children->rend(); it++) { LLButton * button = dynamic_cast<LLButton*> (*it); if (button != NULL) { button->setOrigin( offset,button->getRect().mBottom); button->setLeftHPad(2 * HPAD); button->setRightHPad(2 * HPAD); // set zero width before perform autoResize() button->setRect(LLRect(button->getRect().mLeft, button->getRect().mTop, button->getRect().mLeft, button->getRect().mBottom)); button->setAutoResize(true); button->autoResize(); offset += HPAD + button->getRect().getWidth(); button->setFollowsNone(); } } if (mParentText) { mParentText->needsReflow(); } }
LLFloaterTestImpl::LLFloaterTestImpl() : LLFloater(std::string("test"), LLRect(0, 500, 700, 0), std::string("Test UI")) { const S32 HPAD = 5; const S32 VPAD = 5; const S32 LEFT = HPAD; const S32 RIGHT = getRect().getWidth() - HPAD; const S32 TOP = getRect().getHeight() - LLFLOATER_HEADER_SIZE - VPAD; const S32 BOTTOM = VPAD; const S32 LINE = 15; //S32 x = LEFT; S32 y = TOP; LLTextBox* text = NULL; LLButton* btn = NULL; LLTabContainer* tab = NULL; LLPanel* panel = NULL; LLCheckBoxCtrl* check = NULL; LLComboBox* combo = NULL; btn = new LLButton(std::string("can't click"), LLRect(LEFT+150, y, LEFT+150+100, y-LINE), LLStringUtil::null, boost::bind(&LLFloaterTestImpl::onClickButton)); btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); btn->setFont(LLFontGL::getFontSansSerifSmall()); addChild(btn); text = new LLTextBox(std::string("simple_text"), std::string("simple sans-serif text that is mouse opaque opaque opaque"), 50, // max_width LLFontGL::getFontSansSerifSmall(), TRUE); // mouse_opaque text->setClickedCallback(boost::bind(&onClickText)); text->setRect(LLRect(LEFT, y, RIGHT, y-LINE)); addChild(text); y -= VPAD + LINE; btn = new LLButton(std::string("can click"), LLRect(LEFT+150, y, LEFT+150+100, y-LINE), LLStringUtil::null, boost::bind(&LLFloaterTestImpl::onClickButton)); btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); btn->setFont(LLFontGL::getFontSansSerifSmall()); addChild(btn); text = new LLTextBox(std::string("simple2_text"), LLRect(LEFT, y, RIGHT, y-LINE), std::string("monospaced, non-opaque text with tooltip, non-opaque non-opaque"), LLFontGL::getFontMonospace(), FALSE); // mouse_opaque text->setToolTip(std::string("I'm a tooltip")); addChild(text); y -= VPAD + LINE; tab = new LLTabContainer(std::string("test_tab"), LLRect(LEFT, y, RIGHT, BOTTOM), LLTabContainer::TOP, TRUE, // bordered FALSE); // horizontal addChild(tab); mTab = tab; tab->setCommitCallback(boost::bind(&LLFloaterTestImpl::onClickTab)); //----------------------------------------------------------------------- // First tab container panel //----------------------------------------------------------------------- panel = new LLPanel(std::string("first_tab_panel"), LLRect(0, 400, 400, 0), // dummy rect TRUE); // bordered tab->addTabPanel(panel, std::string("First"), TRUE); // select y = panel->getRect().getHeight() - VPAD; text = new LLTextBox(std::string("unicode_text"), LLRect(LEFT, y, RIGHT, y-LINE), std::string("File"), LLFontGL::getFontSansSerif(), TRUE); // mouse_opaque text->setToolTip(std::string("This should be Unicode text")); panel->addChild(text); y -= VPAD + LINE; btn = new LLButton(std::string("unicode_btn"), LLRect(LEFT, y, LEFT+100, y-20)); btn->setLabel(std::string("unicode")); panel->addChild(btn); y -= VPAD + 20; btn = new LLButton(std::string("image_btn"), LLRect(LEFT, y, LEFT+32, y-32), std::string("tool_zoom.tga"), std::string("tool_zoom_active.tga"), LLStringUtil::null, boost::bind(&LLFloaterTestImpl::onClickButton), LLFontGL::getFontSansSerifSmall()); btn->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP); panel->addChild(btn); y -= VPAD + 32; check = new LLCheckBoxCtrl(std::string("simple_check"), LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT), std::string("Simple Checkbox"), LLFontGL::getFontSansSerifSmall(), boost::bind(&LLFloaterTestImpl::onCommitCheck), TRUE, // initial_value FALSE, // radio_style std::string("UIFloaterTestBool")); // control_which panel->addChild(check); y -= VPAD + LLCHECKBOXCTRL_HEIGHT; check = new LLCheckBoxCtrl(std::string("unicode_check"), LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT), std::string("TODO: Unicode Checkbox"), LLFontGL::getFontSansSerifSmall(), boost::bind(&LLFloaterTestImpl::onCommitCheck), TRUE, // initial_value FALSE, // radio_style LLStringUtil::null); // control_which panel->addChild(check); mCheckUnicode = check; y -= VPAD + LLCHECKBOXCTRL_HEIGHT; combo = new LLComboBox(std::string("combo"), LLRect(LEFT, y, LEFT+100, y-LLCOMBOBOX_HEIGHT), std::string("Combobox Label"), boost::bind(&LLFloaterTestImpl::onCommitCombo, _1,_2) ); combo->add(std::string("first item")); combo->add(std::string("second item")); combo->add(std::string("should go to the top"), ADD_TOP); combo->add(std::string("disabled item"), NULL, ADD_BOTTOM, FALSE); panel->addChild(combo); y -= VPAD + LLCOMBOBOX_HEIGHT; LLIconCtrl* icon = new LLIconCtrl( std::string("test_icon"), LLRect(LEFT, y, LEFT+32, y-32), std::string("object_cone.tga") ); panel->addChild(icon); mIcon = icon; y -= VPAD + 32; LLLineEditor* line = new LLLineEditor( std::string("test_line"), LLRect(LEFT, y, LEFT+200, y-20), std::string("test some unicode text here"), LLFontGL::getFontSansSerif(), 200, // max_length_bytes boost::bind(&LLFloaterTestImpl::onCommitLine), boost::bind(&LLFloaterTestImpl::onKeyLine), boost::bind(&LLFloaterTestImpl::onFocusLostLine)); line->setHandleEditKeysDirectly(true); panel->addChild(line); y -= VPAD + 20; LLRadioGroup* group = new LLRadioGroup( std::string("radio_group"), LLRect(LEFT, y, LEFT+200, y - 50), 0, // initial_index boost::bind(&LLFloaterTestImpl::onChangeRadioGroup), TRUE); // border panel->addChild(group); S32 yy = 100; group->addRadioButton(std::string("Radio1"), std::string("Radio 1"), LLRect(0, yy, 200, yy-LINE), LLFontGL::getFontSansSerifSmall()); yy -= LINE; group->addRadioButton(std::string("Radio2"), std::string("Radio 2"), LLRect(0, yy, 200, yy-LINE), LLFontGL::getFontSansSerifSmall()); yy -= LINE; group->addRadioButton(std::string("Radio3"), std::string("Radio 3"), LLRect(0, yy, 200, yy-LINE), LLFontGL::getFontSansSerifSmall()); yy -= LINE; //----------------------------------------------------------------------- // Second tab container panel //----------------------------------------------------------------------- panel = new LLPanel(std::string("second_tab_panel"), LLRect(0, 400, 400, 0), // dummy rect TRUE); // bordered tab->addTabPanel(panel, std::string("Second"), FALSE); // select y = panel->getRect().getHeight() - VPAD; btn = new LLButton(std::string("Simple Button"), LLRect(LEFT, y, LEFT+100, y - 20), LLStringUtil::null, boost::bind(&LLFloaterTestImpl::onClickButton)); btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT); panel->addChild(btn); mBtnSimple = btn; //----------------------------------------------------------------------- // Hook us up with the floater view //----------------------------------------------------------------------- open(); /* Flawfinder: ignore */ center(); }
BOOL LLPanelGroup::postBuild() { mTabContainer = getChild<LLTabContainer>("group_tab_container"); if (mTabContainer) { //our initial tab selection was invalid, just select the //first tab then or default to selecting the initial //selected tab specified in the layout file LLPanelGroupTab* tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); //no tab was initially selected through constructor //or the XML, select the first tab if (!tabp) { mTabContainer->selectFirstTab(); tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); } mCurrentTab = tabp; // Add click callbacks. for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack // Pass on whether or not to allow edit to tabs. panelp->setAllowEdit(mAllowEdit); panelp->addObserver(this); } mTabContainer->setCommitCallback(boost::bind(&LLPanelGroup::handleClickTab,this)); updateTabVisibility(); // Act as though this tab was just activated. mCurrentTab->activate(); } mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); LLButton* button = getChild<LLButton>("btn_ok"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnOK,this)); button->setVisible(mAllowEdit); } button = getChild<LLButton>("btn_cancel"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnCancel,this)); button->setEnabled(mAllowEdit); // Cancel should always be enabled for standalone group floater, this is expected behavior and may be used for simply closing } button = getChild<LLButton>("btn_apply"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnApply,this)); button->setEnabled(FALSE); mApplyBtn = button; } button = getChild<LLButton>("btn_refresh"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnRefresh,this)); } return TRUE; }
void LLPanelPermissions::refresh() { LLStringUtil::format_map_t argsCurrency; argsCurrency["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol(); LLButton* BtnDeedToGroup = getChild<LLButton>("button deed"); if(BtnDeedToGroup) { std::string deedText; if (gSavedSettings.getWarning("DeedObject")) { deedText = getString("text deed continued"); } else { deedText = getString("text deed"); } BtnDeedToGroup->setLabelSelected(deedText); BtnDeedToGroup->setLabelUnselected(deedText); } BOOL root_selected = TRUE; LLSelectNode* nodep = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); S32 object_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); if(!nodep || 0 == object_count) { nodep = LLSelectMgr::getInstance()->getSelection()->getFirstNode(); object_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); root_selected = FALSE; } //BOOL attachment_selected = LLSelectMgr::getInstance()->getSelection()->isAttachment(); //attachment_selected = false; LLViewerObject* objectp = NULL; if(nodep) objectp = nodep->getObject(); if(!nodep || !objectp)// || attachment_selected) { // ...nothing selected childSetEnabled("perm_modify",false); childSetText("perm_modify",LLStringUtil::null); childSetEnabled("Creator:",false); childSetText("Creator Name",LLStringUtil::null); childSetEnabled("Creator Name",false); childSetEnabled("button creator profile",false); childSetEnabled("Owner:",false); childSetText("Owner Name",LLStringUtil::null); childSetEnabled("Owner Name",false); childSetEnabled("button owner profile",false); childSetEnabled("Last Owner:",false); childSetText("Last Owner Name",LLStringUtil::null); childSetEnabled("Last Owner Name",false); childSetEnabled("button last owner profile",false); childSetEnabled("Group:",false); childSetText("Group Name",LLStringUtil::null); childSetEnabled("Group Name",false); childSetEnabled("button set group",false); childSetEnabled("button open group",false); childSetText("Object Name",LLStringUtil::null); childSetEnabled("Object Name",false); childSetEnabled("Name:",false); childSetText("Group Name",LLStringUtil::null); childSetEnabled("Group Name",false); childSetEnabled("Description:",false); childSetText("Object Description",LLStringUtil::null); childSetEnabled("Object Description",false); childSetEnabled("Permissions:",false); childSetValue("checkbox share with group",FALSE); childSetEnabled("checkbox share with group",false); childSetEnabled("button deed",false); childSetValue("checkbox allow everyone move",FALSE); childSetEnabled("checkbox allow everyone move",false); childSetValue("checkbox allow everyone copy",FALSE); childSetEnabled("checkbox allow everyone copy",false); //Next owner can: childSetEnabled("Next owner can:",false); childSetValue("checkbox next owner can modify",FALSE); childSetEnabled("checkbox next owner can modify",false); childSetValue("checkbox next owner can copy",FALSE); childSetEnabled("checkbox next owner can copy",false); childSetValue("checkbox next owner can transfer",FALSE); childSetEnabled("checkbox next owner can transfer",false); //checkbox for sale childSetValue("checkbox for sale",FALSE); childSetEnabled("checkbox for sale",false); //checkbox include in search childSetValue("search_check", FALSE); childSetEnabled("search_check", false); LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { RadioSaleType->setSelectedIndex(-1); RadioSaleType->setEnabled(FALSE); } childSetEnabled("Cost",false); childSetText("Cost", getString("Cost Default", argsCurrency)); childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); childSetEnabled("label click action",false); LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); if(ComboClickAction) { ComboClickAction->setEnabled(FALSE); ComboClickAction->clear(); } childSetVisible("B:",false); childSetVisible("O:",false); childSetVisible("G:",false); childSetVisible("E:",false); childSetVisible("N:",false); childSetVisible("F:",false); return; } // figure out a few variables BOOL is_one_object = (object_count == 1); // BUG: fails if a root and non-root are both single-selected. BOOL is_perm_modify = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsModify()) || LLSelectMgr::getInstance()->selectGetModify(); BOOL is_nonpermanent_enforced = (LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPermanentEnforced()) || LLSelectMgr::getInstance()->selectGetNonPermanentEnforced(); const LLFocusableElement* keyboard_focus_view = gFocusMgr.getKeyboardFocus(); S32 string_index = 0; std::string MODIFY_INFO_STRINGS[] = { getString("text modify info 1"), getString("text modify info 2"), getString("text modify info 3"), getString("text modify info 4"), getString("text modify info 5"), getString("text modify info 6") }; if(!is_perm_modify) { string_index += 2; } else if (!is_nonpermanent_enforced) { string_index += 4; } if(!is_one_object) { ++string_index; } childSetEnabled("perm_modify",true); childSetText("perm_modify",MODIFY_INFO_STRINGS[string_index]); std::string pfAttrName; if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsNonPathfinding()) || LLSelectMgr::getInstance()->selectGetNonPathfinding()) { pfAttrName = "Pathfinding_Object_Attr_None"; } else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsPermanent()) || LLSelectMgr::getInstance()->selectGetPermanent()) { pfAttrName = "Pathfinding_Object_Attr_Permanent"; } else if ((LLSelectMgr::getInstance()->getSelection()->getFirstRootNode() && LLSelectMgr::getInstance()->selectGetRootsCharacter()) || LLSelectMgr::getInstance()->selectGetCharacter()) { pfAttrName = "Pathfinding_Object_Attr_Character"; } else { pfAttrName = "Pathfinding_Object_Attr_MultiSelect"; } getChildView("pathfinding_attributes_value")->setEnabled(TRUE); getChild<LLUICtrl>("pathfinding_attributes_value")->setValue(LLTrans::getString(pfAttrName)); childSetEnabled("Permissions:",true); // Update creator text field childSetEnabled("Creator:",true); BOOL creators_identical; std::string creator_name; creators_identical = LLSelectMgr::getInstance()->selectGetCreator(mCreatorID, creator_name); childSetText("Creator Name",creator_name); childSetEnabled("Creator Name",TRUE); childSetEnabled("button creator profile", creators_identical && mCreatorID.notNull() ); // Update owner text field childSetEnabled("Owner:",true); BOOL owners_identical; std::string owner_name; owners_identical = LLSelectMgr::getInstance()->selectGetOwner(mOwnerID, owner_name); // llinfos << "owners_identical " << (owners_identical ? "TRUE": "FALSE") << llendl; std::string last_owner_name; LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); if (mOwnerID.isNull()) { if(LLSelectMgr::getInstance()->selectIsGroupOwned()) { // Group owned already displayed by selectGetOwner } else { // Display last owner if public std::string last_owner_name; LLSelectMgr::getInstance()->selectGetLastOwner(mLastOwnerID, last_owner_name); // It should never happen that the last owner is null and the owner // is null, but it seems to be a bug in the simulator right now. JC if (!mLastOwnerID.isNull() && !last_owner_name.empty()) { owner_name.append(", last "); owner_name.append( last_owner_name ); } } } // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) bool fRlvEnableOwner = true; if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ) { // Only filter the owner name if: the selection is all owned by the same avie and not group owned if ( (owners_identical) && (!LLSelectMgr::getInstance()->selectIsGroupOwned()) ) { owner_name = RlvStrings::getAnonym(owner_name); fRlvEnableOwner = false; } } // [/RLVa:KB] childSetText("Owner Name",owner_name); childSetEnabled("Owner Name",TRUE); // childSetEnabled("button owner profile",owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) childSetEnabled("button owner profile", fRlvEnableOwner && owners_identical && (mOwnerID.notNull() || LLSelectMgr::getInstance()->selectIsGroupOwned())); // [/RLVa:KB] childSetText("Last Owner Name",last_owner_name); childSetEnabled("Last Owner Name",TRUE); childSetEnabled("button last owner profile",owners_identical && mLastOwnerID.notNull()); // update group text field childSetEnabled("Group:",true); childSetText("Group Name",LLStringUtil::null); LLUUID group_id; BOOL groups_identical = LLSelectMgr::getInstance()->selectGetGroup(group_id); if (groups_identical) { if(mLabelGroupName) { mLabelGroupName->setNameID(group_id, TRUE); mLabelGroupName->setEnabled(TRUE); } } else { if(mLabelGroupName) { mLabelGroupName->setNameID(LLUUID::null, TRUE); mLabelGroupName->refresh(LLUUID::null, LLStringUtil::null, true); mLabelGroupName->setEnabled(FALSE); } } childSetEnabled("button set group",owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced); childSetEnabled("button open group", group_id.notNull()); // figure out the contents of the name, description, & category BOOL edit_name_desc = FALSE; if(is_one_object && objectp->permModify() && !objectp->isPermanentEnforced()) { edit_name_desc = TRUE; } childSetEnabled("Name:",true); LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name"); childSetEnabled("Description:",true); LLLineEditor* LineEditorObjectDesc = getChild<LLLineEditor>("Object Description"); if(is_one_object) { if(keyboard_focus_view != LineEditorObjectName) { childSetText("Object Name",nodep->mName); } if(LineEditorObjectDesc) { if(keyboard_focus_view != LineEditorObjectDesc) { LineEditorObjectDesc->setText(nodep->mDescription); } } } else { childSetText("Object Name",LLStringUtil::null); LineEditorObjectDesc->setText(LLStringUtil::null); } if(edit_name_desc) { childSetEnabled("Object Name",true); childSetEnabled("Object Description",true); } else { childSetEnabled("Object Name",false); childSetEnabled("Object Description",false); } S32 total_sale_price = 0; S32 individual_sale_price = 0; BOOL is_for_sale_mixed = FALSE; BOOL is_sale_price_mixed = FALSE; U32 num_for_sale = FALSE; LLSelectMgr::getInstance()->selectGetAggregateSaleInfo(num_for_sale, is_for_sale_mixed, is_sale_price_mixed, total_sale_price, individual_sale_price); const BOOL self_owned = (gAgent.getID() == mOwnerID); const BOOL group_owned = LLSelectMgr::getInstance()->selectIsGroupOwned() ; const BOOL public_owned = (mOwnerID.isNull() && !LLSelectMgr::getInstance()->selectIsGroupOwned()); const BOOL can_transfer = LLSelectMgr::getInstance()->selectGetRootsTransfer(); const BOOL can_copy = LLSelectMgr::getInstance()->selectGetRootsCopy(); if(!owners_identical) { childSetEnabled("Cost",false); childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); } // You own these objects. else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE))) { // If there are multiple items for sale then set text to PRICE PER UNIT. if (num_for_sale > 1) { childSetText("Cost",getString("Cost Per Unit", argsCurrency)); } else { childSetText("Cost",getString("Cost Default", argsCurrency)); } LLLineEditor *editPrice = getChild<LLLineEditor>("Edit Cost"); if(keyboard_focus_view != editPrice) { // If the sale price is mixed then set the cost to MIXED, otherwise // set to the actual cost. if (num_for_sale > 0 && is_for_sale_mixed) { childSetText("Edit Cost",getString("Sale Mixed")); } else if (num_for_sale > 0 && is_sale_price_mixed) { childSetText("Edit Cost",getString("Cost Mixed")); } else { childSetText("Edit Cost",llformat("%d",individual_sale_price)); } } // The edit fields are only enabled if you can sell this object // and the sale price is not mixed. bool enable_edit = (num_for_sale && can_transfer) ? !is_for_sale_mixed : false; childSetEnabled("Cost",enable_edit); childSetEnabled("Edit Cost",enable_edit); } // Someone, not you, owns these objects. else if(!public_owned) { childSetEnabled("Cost",false); childSetEnabled("Edit Cost",false); // Don't show a price if none of the items are for sale. if (num_for_sale) childSetText("Edit Cost",llformat("%d",total_sale_price)); else childSetText("Edit Cost",LLStringUtil::null); // If multiple items are for sale, set text to TOTAL PRICE. if (num_for_sale > 1) childSetText("Cost", getString("Cost Total", argsCurrency)); else childSetText("Cost", getString("Cost Default", argsCurrency)); } // This is a public object. else { childSetEnabled("Cost",false); childSetText("Cost", getString("Cost Default", argsCurrency)); childSetText("Edit Cost",LLStringUtil::null); childSetEnabled("Edit Cost",false); } // Enable and disable the permissions checkboxes // based on who owns the object. // TODO: Creator permissions BOOL valid_base_perms = FALSE; BOOL valid_owner_perms = FALSE; BOOL valid_group_perms = FALSE; BOOL valid_everyone_perms = FALSE; BOOL valid_next_perms = FALSE; U32 base_mask_on; U32 base_mask_off; U32 owner_mask_on; U32 owner_mask_off; U32 group_mask_on; U32 group_mask_off; U32 everyone_mask_on; U32 everyone_mask_off; U32 next_owner_mask_on = 0; U32 next_owner_mask_off = 0; valid_base_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_BASE, &base_mask_on, &base_mask_off); valid_owner_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_OWNER, &owner_mask_on, &owner_mask_off); valid_group_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_GROUP, &group_mask_on, &group_mask_off); valid_everyone_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_EVERYONE, &everyone_mask_on, &everyone_mask_off); valid_next_perms = LLSelectMgr::getInstance()->selectGetPerm(PERM_NEXT_OWNER, &next_owner_mask_on, &next_owner_mask_off); if( gSavedSettings.getBOOL("DebugPermissions") ) { std::string perm_string; if (valid_base_perms) { perm_string = "B: "; perm_string += mask_to_string(base_mask_on); childSetText("B:",perm_string); childSetVisible("B:",true); perm_string = "O: "; perm_string += mask_to_string(owner_mask_on); childSetText("O:",perm_string); childSetVisible("O:",true); perm_string = "G: "; perm_string += mask_to_string(group_mask_on); childSetText("G:",perm_string); childSetVisible("G:",true); perm_string = "E: "; perm_string += mask_to_string(everyone_mask_on); childSetText("E:",perm_string); childSetVisible("E:",true); perm_string = "N: "; perm_string += mask_to_string(next_owner_mask_on); childSetText("N:",perm_string); childSetVisible("N:",true); } perm_string = "F: "; U32 flag_mask = 0x0; if (objectp->permMove()) flag_mask |= PERM_MOVE; if (objectp->permModify()) flag_mask |= PERM_MODIFY; if (objectp->permCopy()) flag_mask |= PERM_COPY; if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER; perm_string += mask_to_string(flag_mask); childSetText("F:",perm_string); childSetVisible("F:",true); } else { childSetVisible("B:",false); childSetVisible("O:",false); childSetVisible("G:",false); childSetVisible("E:",false); childSetVisible("N:",false); childSetVisible("F:",false); } bool has_change_perm_ability = false; bool has_change_sale_ability = false; if(valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_MANIPULATE)))) { has_change_perm_ability = true; } if(valid_base_perms && is_nonpermanent_enforced && (self_owned || (group_owned && gAgent.hasPowerInGroup(group_id, GP_OBJECT_SET_SALE)))) { has_change_sale_ability = true; } if (!has_change_perm_ability && !has_change_sale_ability && !root_selected) { // ...must select root to choose permissions childSetValue("perm_modify", getString("text modify warning")); } if (has_change_perm_ability) { childSetEnabled("checkbox share with group",true); childSetEnabled("checkbox allow everyone move",owner_mask_on & PERM_MOVE); childSetEnabled("checkbox allow everyone copy",owner_mask_on & PERM_COPY && owner_mask_on & PERM_TRANSFER); } else { childSetEnabled("checkbox share with group", FALSE); childSetEnabled("checkbox allow everyone move", FALSE); childSetEnabled("checkbox allow everyone copy", FALSE); } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { childSetEnabled("checkbox for sale", can_transfer || (!can_transfer && num_for_sale)); // Set the checkbox to tentative if the prices of each object selected // are not the same. childSetTentative("checkbox for sale", is_for_sale_mixed); childSetEnabled("sale type",num_for_sale && can_transfer && !is_sale_price_mixed); childSetEnabled("Next owner can:", TRUE); childSetEnabled("checkbox next owner can modify",base_mask_on & PERM_MODIFY); childSetEnabled("checkbox next owner can copy",base_mask_on & PERM_COPY); childSetEnabled("checkbox next owner can transfer",next_owner_mask_on & PERM_COPY); } else { childSetEnabled("checkbox for sale",FALSE); childSetEnabled("sale type",FALSE); childSetEnabled("Next owner can:",FALSE); childSetEnabled("checkbox next owner can modify",FALSE); childSetEnabled("checkbox next owner can copy",FALSE); childSetEnabled("checkbox next owner can transfer",FALSE); } if(valid_group_perms) { if((group_mask_on & PERM_COPY) && (group_mask_on & PERM_MODIFY) && (group_mask_on & PERM_MOVE)) { childSetValue("checkbox share with group",TRUE); childSetTentative("checkbox share with group",FALSE); childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } else if((group_mask_off & PERM_COPY) && (group_mask_off & PERM_MODIFY) && (group_mask_off & PERM_MOVE)) { childSetValue("checkbox share with group",FALSE); childSetTentative("checkbox share with group",false); childSetEnabled("button deed",false); } else { childSetValue("checkbox share with group",TRUE); childSetTentative("checkbox share with group",true); childSetEnabled("button deed",gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) && (group_mask_on & PERM_MOVE) && (owner_mask_on & PERM_TRANSFER) && !group_owned && can_transfer); } } if(valid_everyone_perms) { // Move if(everyone_mask_on & PERM_MOVE) { childSetValue("checkbox allow everyone move",TRUE); childSetTentative("checkbox allow everyone move",false); } else if(everyone_mask_off & PERM_MOVE) { childSetValue("checkbox allow everyone move",FALSE); childSetTentative("checkbox allow everyone move",false); } else { childSetValue("checkbox allow everyone move",TRUE); childSetTentative("checkbox allow everyone move",true); } // Copy == everyone can't copy if(everyone_mask_on & PERM_COPY) { childSetValue("checkbox allow everyone copy",TRUE); childSetTentative("checkbox allow everyone copy",!can_copy || !can_transfer); } else if(everyone_mask_off & PERM_COPY) { childSetValue("checkbox allow everyone copy",FALSE); childSetTentative("checkbox allow everyone copy",false); } else { childSetValue("checkbox allow everyone copy",TRUE); childSetTentative("checkbox allow everyone copy",true); } } if(valid_next_perms) { // Modify == next owner canot modify if(next_owner_mask_on & PERM_MODIFY) { childSetValue("checkbox next owner can modify",TRUE); childSetTentative("checkbox next owner can modify",false); } else if(next_owner_mask_off & PERM_MODIFY) { childSetValue("checkbox next owner can modify",FALSE); childSetTentative("checkbox next owner can modify",false); } else { childSetValue("checkbox next owner can modify",TRUE); childSetTentative("checkbox next owner can modify",true); } // Copy == next owner cannot copy if(next_owner_mask_on & PERM_COPY) { childSetValue("checkbox next owner can copy",TRUE); childSetTentative("checkbox next owner can copy",!can_copy); } else if(next_owner_mask_off & PERM_COPY) { childSetValue("checkbox next owner can copy",FALSE); childSetTentative("checkbox next owner can copy",FALSE); } else { childSetValue("checkbox next owner can copy",TRUE); childSetTentative("checkbox next owner can copy",TRUE); } // Transfer == next owner cannot transfer if(next_owner_mask_on & PERM_TRANSFER) { childSetValue("checkbox next owner can transfer",TRUE); childSetTentative("checkbox next owner can transfer",!can_transfer); } else if(next_owner_mask_off & PERM_TRANSFER) { childSetValue("checkbox next owner can transfer",FALSE); childSetTentative("checkbox next owner can transfer",FALSE); } else { childSetValue("checkbox next owner can transfer",TRUE); childSetTentative("checkbox next owner can transfer",TRUE); } } // reflect sale information LLSaleInfo sale_info; BOOL valid_sale_info = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info); LLSaleInfo::EForSale sale_type = sale_info.getSaleType(); LLRadioGroup* RadioSaleType = getChild<LLRadioGroup>("sale type"); if(RadioSaleType) { if (valid_sale_info) { RadioSaleType->setSelectedIndex((S32)sale_type - 1); RadioSaleType->setTentative(FALSE); // unfortunately this doesn't do anything at the moment. } else { // default option is sell copy, determined to be safest RadioSaleType->setSelectedIndex((S32)LLSaleInfo::FS_COPY - 1); RadioSaleType->setTentative(TRUE); // unfortunately this doesn't do anything at the moment. } } childSetValue("checkbox for sale", num_for_sale != 0); // HACK: There are some old objects in world that are set for sale, // but are no-transfer. We need to let users turn for-sale off, but only // if for-sale is set. bool cannot_actually_sell = !can_transfer || (!can_copy && sale_type == LLSaleInfo::FS_COPY); if (num_for_sale && has_change_sale_ability && cannot_actually_sell) { childSetEnabled("checkbox for sale", true); } // Check search status of objects BOOL all_volume = LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME ); bool include_in_search; bool all_include_in_search = LLSelectMgr::getInstance()->selectionGetIncludeInSearch(&include_in_search); childSetEnabled("search_check", has_change_sale_ability && all_volume); childSetValue("search_check", include_in_search); childSetTentative("search_check", ! all_include_in_search); // Click action (touch, sit, buy) U8 click_action = 0; if (LLSelectMgr::getInstance()->selectionGetClickAction(&click_action)) { LLComboBox* ComboClickAction = getChild<LLComboBox>("clickaction"); if(ComboClickAction) { ComboClickAction->setCurrentByIndex((S32)click_action); } } childSetEnabled("label click action",is_perm_modify && is_nonpermanent_enforced && all_volume); childSetEnabled("clickaction",is_perm_modify && is_nonpermanent_enforced && all_volume); }
void LLPanelScriptLimitsAttachment::setAttachmentDetails(LLSD content) { LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list"); if(!list) { return; } S32 number_attachments = content["attachments"].size(); for(int i = 0; i < number_attachments; i++) { std::string humanReadableLocation = ""; if(content["attachments"][i].has("location")) { std::string actualLocation = content["attachments"][i]["location"]; humanReadableLocation = LLTrans::getString(actualLocation.c_str()); } S32 number_objects = content["attachments"][i]["objects"].size(); for(int j = 0; j < number_objects; j++) { LLUUID task_id = content["attachments"][i]["objects"][j]["id"].asUUID(); S32 size = 0; if(content["attachments"][i]["objects"][j]["resources"].has("memory")) { size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB; } S32 urls = 0; if(content["attachments"][i]["objects"][j]["resources"].has("urls")) { urls = content["attachments"][i]["objects"][j]["resources"]["urls"].asInteger(); } std::string name = content["attachments"][i]["objects"][j]["name"].asString(); LLSD element; element["id"] = task_id; element["columns"][0]["column"] = "size"; element["columns"][0]["value"] = llformat("%d", size); element["columns"][0]["font"] = "SANSSERIF"; element["columns"][1]["column"] = "urls"; element["columns"][1]["value"] = llformat("%d", urls); element["columns"][1]["font"] = "SANSSERIF"; element["columns"][2]["column"] = "name"; element["columns"][2]["value"] = name; element["columns"][2]["font"] = "SANSSERIF"; element["columns"][3]["column"] = "location"; element["columns"][3]["value"] = humanReadableLocation; element["columns"][3]["font"] = "SANSSERIF"; list->addElement(element); } } setAttachmentSummary(content); getChild<LLUICtrl>("loading_text")->setValue(LLSD(std::string(""))); LLButton* btn = getChild<LLButton>("refresh_list_btn"); if(btn) { btn->setEnabled(true); } }