triage#166 Select 'No Description' when clicking on a text field
Default value should be selected for replacementmaster
parent
7947ce3559
commit
a902138de1
|
|
@ -263,7 +263,9 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
|
|||
mShowEmojiHelper(p.show_emoji_helper),
|
||||
mEnableTooltipPaste(p.enable_tooltip_paste),
|
||||
mPassDelete(FALSE),
|
||||
mKeepSelectionOnReturn(false)
|
||||
mKeepSelectionOnReturn(false),
|
||||
mSelectAllOnFocusReceived(false),
|
||||
mSelectedOnFocusReceived(false)
|
||||
{
|
||||
mSourceID.generate();
|
||||
|
||||
|
|
@ -385,6 +387,7 @@ void LLTextEditor::selectNext(const std::string& search_text_in, BOOL case_insen
|
|||
setCursorPos(loc);
|
||||
|
||||
mIsSelecting = TRUE;
|
||||
mSelectedOnFocusReceived = false;
|
||||
mSelectionEnd = mCursorPos;
|
||||
mSelectionStart = llmin((S32)getLength(), (S32)(mCursorPos + search_text.size()));
|
||||
}
|
||||
|
|
@ -664,6 +667,13 @@ BOOL LLTextEditor::canSelectAll() const
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLTextEditor::deselect()
|
||||
{
|
||||
LLTextBase::deselect();
|
||||
mSelectedOnFocusReceived = false;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLTextEditor::selectAll()
|
||||
{
|
||||
|
|
@ -681,6 +691,11 @@ void LLTextEditor::selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_p
|
|||
endSelection();
|
||||
}
|
||||
|
||||
void LLTextEditor::setSelectAllOnFocusReceived(bool b)
|
||||
{
|
||||
mSelectAllOnFocusReceived = b;
|
||||
}
|
||||
|
||||
void LLTextEditor::insertEmoji(llwchar emoji)
|
||||
{
|
||||
LL_INFOS() << "LLTextEditor::insertEmoji(" << wchar_utf8_preview(emoji) << ")" << LL_ENDL;
|
||||
|
|
@ -758,8 +773,16 @@ BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
|
|||
// Delay cursor flashing
|
||||
resetCursorBlink();
|
||||
|
||||
mSelectedOnFocusReceived = false;
|
||||
if (handled && !gFocusMgr.getMouseCapture())
|
||||
{
|
||||
if (!mask && mSelectAllOnFocusReceived)
|
||||
{
|
||||
mIsSelecting = false;
|
||||
mSelectionStart = getLength();
|
||||
mSelectionEnd = 0;
|
||||
mSelectedOnFocusReceived = true;
|
||||
}
|
||||
gFocusMgr.setMouseCapture( this );
|
||||
}
|
||||
return handled;
|
||||
|
|
@ -2113,6 +2136,11 @@ void LLTextEditor::focusLostHelper()
|
|||
gEditMenuHandler = NULL;
|
||||
}
|
||||
|
||||
if (mSelectedOnFocusReceived)
|
||||
{
|
||||
deselect();
|
||||
}
|
||||
|
||||
if (mCommitOnFocusLost)
|
||||
{
|
||||
onCommit();
|
||||
|
|
|
|||
|
|
@ -142,8 +142,10 @@ public:
|
|||
virtual BOOL canDoDelete() const;
|
||||
virtual void selectAll();
|
||||
virtual BOOL canSelectAll() const;
|
||||
virtual void deselect();
|
||||
|
||||
void selectByCursorPosition(S32 prev_cursor_pos, S32 next_cursor_pos);
|
||||
void setSelectAllOnFocusReceived(bool b);
|
||||
|
||||
virtual bool canLoadOrSaveToFile();
|
||||
|
||||
|
|
@ -331,6 +333,8 @@ private:
|
|||
bool mEnableTooltipPaste;
|
||||
bool mPassDelete;
|
||||
bool mKeepSelectionOnReturn; // disabling of removing selected text after pressing of Enter
|
||||
bool mSelectAllOnFocusReceived;
|
||||
bool mSelectedOnFocusReceived;
|
||||
|
||||
LLUUID mSourceID;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@
|
|||
#include "llviewerregion.h"
|
||||
|
||||
|
||||
const char* const DEFAULT_DESC = "(No Description)";
|
||||
|
||||
class PropertiesChangedCallback : public LLInventoryCallback
|
||||
{
|
||||
public:
|
||||
|
|
@ -128,6 +130,7 @@ LLSidepanelItemInfo::LLSidepanelItemInfo(const LLPanel::Params& p)
|
|||
, mUpdatePendingId(-1)
|
||||
, mIsDirty(false) /*Not ready*/
|
||||
, mParentFloater(NULL)
|
||||
, mLabelItemDesc(NULL)
|
||||
{
|
||||
gInventory.addObserver(this);
|
||||
gIdleCallbacks.addFunction(&LLSidepanelItemInfo::onIdle, (void*)this);
|
||||
|
|
@ -158,10 +161,11 @@ BOOL LLSidepanelItemInfo::postBuild()
|
|||
mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon");
|
||||
mLabelOwnerName = getChild<LLTextBox>("LabelOwnerName");
|
||||
mLabelCreatorName = getChild<LLTextBox>("LabelCreatorName");
|
||||
mLabelItemDesc = getChild<LLTextEditor>("LabelItemDesc");
|
||||
|
||||
getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
|
||||
getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this));
|
||||
getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
|
||||
mLabelItemDesc->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
|
||||
// Thumnail edition
|
||||
mChangeThumbnailBtn->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onEditThumbnail, this));
|
||||
// acquired date
|
||||
|
|
@ -342,10 +346,14 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
|
|||
getChildView("LabelItemName")->setEnabled(is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards
|
||||
getChild<LLUICtrl>("LabelItemName")->setValue(item->getName());
|
||||
getChildView("LabelItemDescTitle")->setEnabled(TRUE);
|
||||
getChildView("LabelItemDesc")->setEnabled(is_modifiable);
|
||||
getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription());
|
||||
getChild<LLUICtrl>("item_thumbnail")->setValue(item->getThumbnailUUID());
|
||||
|
||||
// Asset upload substitutes empty description with a (No Description) placeholder
|
||||
std::string desc = item->getDescription();
|
||||
mLabelItemDesc->setSelectAllOnFocusReceived(desc == DEFAULT_DESC);
|
||||
mLabelItemDesc->setValue(desc);
|
||||
mLabelItemDesc->setEnabled(is_modifiable);
|
||||
|
||||
LLUIImagePtr icon_img = LLInventoryIcon::getIcon(item->getType(), item->getInventoryType(), item->getFlags(), FALSE);
|
||||
mItemTypeIcon->setImage(icon_img);
|
||||
|
||||
|
|
@ -927,17 +935,22 @@ void LLSidepanelItemInfo::onCommitDescription()
|
|||
LLViewerInventoryItem* item = findItem();
|
||||
if(!item) return;
|
||||
|
||||
LLTextEditor* labelItemDesc = getChild<LLTextEditor>("LabelItemDesc");
|
||||
if(!labelItemDesc)
|
||||
if(!mLabelItemDesc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if((item->getDescription() != labelItemDesc->getText()) &&
|
||||
(gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)))
|
||||
if (!gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::string old_desc = item->getDescription();
|
||||
std::string new_desc = mLabelItemDesc->getText();
|
||||
if(old_desc != new_desc)
|
||||
{
|
||||
mLabelItemDesc->setSelectAllOnFocusReceived(false);
|
||||
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
|
||||
|
||||
new_item->setDescription(labelItemDesc->getText());
|
||||
new_item->setDescription(new_desc);
|
||||
onCommitChanges(new_item);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class LLObjectInventoryObserver;
|
|||
class LLViewerObject;
|
||||
class LLPermissions;
|
||||
class LLTextBox;
|
||||
class LLTextEditor;
|
||||
|
||||
class LLSidepanelItemInfo : public LLPanel, public LLInventoryObserver
|
||||
{
|
||||
|
|
@ -105,6 +106,7 @@ private:
|
|||
LLIconCtrl* mItemTypeIcon;
|
||||
LLTextBox* mLabelOwnerName;
|
||||
LLTextBox* mLabelCreatorName;
|
||||
LLTextEditor* mLabelItemDesc;
|
||||
|
||||
//
|
||||
// UI Elements
|
||||
|
|
|
|||
|
|
@ -1,421 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<floater
|
||||
legacy_header_height="18"
|
||||
height="340"
|
||||
layout="topleft"
|
||||
name="item properties"
|
||||
help_topic="item_properties"
|
||||
save_rect="true"
|
||||
title="INVENTORY ITEM PROPERTIES"
|
||||
width="350">
|
||||
<floater.string
|
||||
name="unknown">
|
||||
(unknown)
|
||||
</floater.string>
|
||||
<floater.string
|
||||
name="public">
|
||||
(public)
|
||||
</floater.string>
|
||||
<floater.string
|
||||
name="you_can">
|
||||
You can:
|
||||
</floater.string>
|
||||
<floater.string
|
||||
name="owner_can">
|
||||
Owner can:
|
||||
</floater.string>
|
||||
<floater.string
|
||||
name="acquiredDate">
|
||||
[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
|
||||
</floater.string>
|
||||
<icon
|
||||
follows="top|right"
|
||||
height="18"
|
||||
image_name="Lock"
|
||||
layout="topleft"
|
||||
left="276"
|
||||
mouse_opaque="true"
|
||||
name="IconLocked"
|
||||
top="4"
|
||||
width="18" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="LabelItemNameTitle"
|
||||
top="25"
|
||||
width="78">
|
||||
Name:
|
||||
</text>
|
||||
<line_editor
|
||||
border_style="line"
|
||||
border_thickness="1"
|
||||
follows="left|top|right"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left_delta="78"
|
||||
max_length_bytes="63"
|
||||
name="LabelItemName"
|
||||
top_delta="0"
|
||||
width="252" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="LabelItemDescTitle"
|
||||
top="45"
|
||||
width="78">
|
||||
Description:
|
||||
</text>
|
||||
<line_editor
|
||||
border_style="line"
|
||||
border_thickness="1"
|
||||
follows="left|top|right"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left_delta="78"
|
||||
max_length_bytes="127"
|
||||
name="LabelItemDesc"
|
||||
top_delta="0"
|
||||
width="252" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="LabelCreatorTitle"
|
||||
top="65"
|
||||
width="78">
|
||||
Creator:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left_delta="78"
|
||||
name="LabelCreatorName"
|
||||
top_delta="0"
|
||||
translate="false"
|
||||
use_ellipses="true"
|
||||
width="170">
|
||||
TestString PleaseIgnore
|
||||
</text>
|
||||
<button
|
||||
follows="top|right"
|
||||
height="16"
|
||||
label="Profile..."
|
||||
layout="topleft"
|
||||
left_delta="174"
|
||||
name="BtnCreator"
|
||||
top_delta="0"
|
||||
width="78" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="LabelOwnerTitle"
|
||||
top="85"
|
||||
width="78">
|
||||
Owner:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left_delta="78"
|
||||
name="LabelOwnerName"
|
||||
top_delta="0"
|
||||
translate="false"
|
||||
use_ellipses="true"
|
||||
width="170">
|
||||
TestString PleaseIgnore
|
||||
</text>
|
||||
<button
|
||||
follows="top|right"
|
||||
height="16"
|
||||
label="Profile..."
|
||||
layout="topleft"
|
||||
left_delta="174"
|
||||
name="BtnOwner"
|
||||
top_delta="0"
|
||||
width="78" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="LabelAcquiredTitle"
|
||||
top="105"
|
||||
width="78">
|
||||
Acquired:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left_delta="78"
|
||||
name="LabelAcquiredDate"
|
||||
top_delta="0"
|
||||
width="252">
|
||||
Wed May 24 12:50:46 2006
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="OwnerLabel"
|
||||
top="125"
|
||||
width="78">
|
||||
You:
|
||||
</text>
|
||||
<check_box
|
||||
height="16"
|
||||
label="Edit"
|
||||
layout="topleft"
|
||||
left_pad="5"
|
||||
name="CheckOwnerModify"
|
||||
top_delta="0"
|
||||
width="78" />
|
||||
<check_box
|
||||
height="16"
|
||||
label="Copy"
|
||||
layout="topleft"
|
||||
left_delta="0"
|
||||
name="CheckOwnerCopy"
|
||||
top_pad="5"
|
||||
width="88" />
|
||||
<check_box
|
||||
height="16"
|
||||
label="Resell"
|
||||
layout="topleft"
|
||||
left_delta="0"
|
||||
name="CheckOwnerTransfer"
|
||||
top_pad="5"
|
||||
width="106" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="AnyoneLabel"
|
||||
top_pad="5"
|
||||
width="78">
|
||||
Anyone:
|
||||
</text>
|
||||
<check_box
|
||||
height="16"
|
||||
label="Copy"
|
||||
layout="topleft"
|
||||
left_pad="5"
|
||||
name="CheckEveryoneCopy"
|
||||
top_delta="0"
|
||||
width="130" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="GroupLabel"
|
||||
top_pad="5"
|
||||
width="78">
|
||||
Group:
|
||||
</text>
|
||||
<check_box
|
||||
height="16"
|
||||
label="Share"
|
||||
layout="topleft"
|
||||
left_pad="5"
|
||||
name="CheckShareWithGroup"
|
||||
top_delta="5"
|
||||
width="106" />
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="25"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="NextOwnerLabel"
|
||||
top_pad="5"
|
||||
width="78"
|
||||
word_wrap="true">
|
||||
Next owner:
|
||||
</text>
|
||||
<check_box
|
||||
height="16"
|
||||
label="Edit"
|
||||
layout="topleft"
|
||||
left_pad="5"
|
||||
name="CheckNextOwnerModify"
|
||||
top_delta="0"
|
||||
width="78" />
|
||||
<check_box
|
||||
height="16"
|
||||
label="Copy"
|
||||
layout="topleft"
|
||||
left_delta="0"
|
||||
name="CheckNextOwnerCopy"
|
||||
top_pad="5"
|
||||
width="88" />
|
||||
<check_box
|
||||
height="16"
|
||||
label="Resell"
|
||||
layout="topleft"
|
||||
left_delta="0"
|
||||
name="CheckNextOwnerTransfer"
|
||||
top_pad="5"
|
||||
width="106" />
|
||||
<check_box
|
||||
height="16"
|
||||
label="For Sale"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="CheckPurchase"
|
||||
top_pad="5"
|
||||
width="78" />
|
||||
<combo_box
|
||||
height="19"
|
||||
left_pad="5"
|
||||
layout="topleft"
|
||||
follows="left|top"
|
||||
name="ComboBoxSaleType"
|
||||
width="110">
|
||||
<combo_box.item
|
||||
name="Copy"
|
||||
label="Copy"
|
||||
value="2" />
|
||||
<combo_box.item
|
||||
name="Contents"
|
||||
label="Contents"
|
||||
value="3" />
|
||||
<combo_box.item
|
||||
name="Original"
|
||||
label="Original"
|
||||
value="1" />
|
||||
</combo_box>
|
||||
<spinner
|
||||
follows="left|top"
|
||||
decimal_digits="0"
|
||||
increment="1"
|
||||
name="Edit Cost"
|
||||
label="Price:"
|
||||
label_width="100"
|
||||
left="10"
|
||||
width="192"
|
||||
min_val="1"
|
||||
height="19"
|
||||
max_val="999999999"
|
||||
top_pad="5"/>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
height="15"
|
||||
follows="left|top"
|
||||
layout="topleft"
|
||||
left_delta="82"
|
||||
name="CurrencySymbol"
|
||||
top_delta="1"
|
||||
width="18">
|
||||
L$
|
||||
</text>
|
||||
|
||||
<!--line_editor
|
||||
border_style="line"
|
||||
border_thickness="1"
|
||||
follows="left|top|right"
|
||||
height="16"
|
||||
layout="topleft"
|
||||
left_pad="5"
|
||||
max_length_bytes="25"
|
||||
name="EditPrice"
|
||||
top_delta="0"
|
||||
width="242" /-->
|
||||
|
||||
<!--text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="BaseMaskDebug"
|
||||
top="155"
|
||||
width="330">
|
||||
B:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left_delta="60"
|
||||
name="OwnerMaskDebug"
|
||||
top_delta="0"
|
||||
width="270">
|
||||
O:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left_delta="60"
|
||||
name="GroupMaskDebug"
|
||||
top_delta="0"
|
||||
width="210">
|
||||
G:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left_delta="60"
|
||||
name="EveryoneMaskDebug"
|
||||
top_delta="0"
|
||||
width="150">
|
||||
E:
|
||||
</text>
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
follows="left|top"
|
||||
height="10"
|
||||
layout="topleft"
|
||||
left_delta="60"
|
||||
name="NextMaskDebug"
|
||||
top_delta="0"
|
||||
width="90">
|
||||
N:
|
||||
</text-->
|
||||
|
||||
</floater>
|
||||
Loading…
Reference in New Issue