summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturectrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltexturectrl.cpp')
-rw-r--r--indra/newview/lltexturectrl.cpp298
1 files changed, 158 insertions, 140 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 2773f538cc..c51e90e632 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -148,12 +148,12 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
LLUUID image_asset_id,
LLUUID default_image_asset_id,
LLUUID blank_image_asset_id,
- BOOL tentative,
- BOOL allow_no_texture,
+ bool tentative,
+ bool allow_no_texture,
const std::string& label,
PermissionMask immediate_filter_perm_mask,
PermissionMask dnd_filter_perm_mask,
- BOOL can_apply_immediately,
+ bool can_apply_immediately,
LLUIImagePtr fallback_image,
EPickInventoryType pick_type)
: LLFloater(LLSD()),
@@ -168,12 +168,12 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mLabel(label),
mTentativeLabel(NULL),
mResolutionLabel(NULL),
- mActive( TRUE ),
+ mActive( true ),
mFilterEdit(NULL),
mImmediateFilterPermMask(immediate_filter_perm_mask),
mDnDFilterPermMask(dnd_filter_perm_mask),
mContextConeOpacity(0.f),
- mSelectedItemPinned( FALSE ),
+ mSelectedItemPinned( false ),
mCanApply(true),
mCanPreview(true),
mLimitsSet(false),
@@ -184,13 +184,14 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mOnFloaterCloseCallback(NULL),
mSetImageAssetIDCallback(NULL),
mOnUpdateImageStatsCallback(NULL),
- mBakeTextureEnabled(FALSE),
+ mBakeTextureEnabled(false),
mLocalTextureEnabled(false),
- mInventoryPickType(pick_type)
+ mInventoryPickType(pick_type),
+ mSelectionSource(PICKER_UNKNOWN)
{
mCanApplyImmediately = can_apply_immediately;
buildFromFile("floater_texture_ctrl.xml");
- setCanMinimize(FALSE);
+ setCanMinimize(false);
}
LLFloaterTexturePicker::~LLFloaterTexturePicker()
@@ -201,9 +202,10 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti
{
if( ((mImageAssetID != image_id) || mTentative) && mActive)
{
- mNoCopyTextureSelected = FALSE;
+ mNoCopyTextureSelected = false;
mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
mImageAssetID = image_id;
+ mSelectionSource = PICKER_UNKNOWN;
if (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(mImageAssetID))
{
@@ -212,6 +214,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti
mModeSelector->selectByValue(2);
onModeSelect(0,this);
}
+ mSelectionSource = PICKER_BAKE;
}
else
{
@@ -243,7 +246,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti
}
if (item_id.isNull())
{
- item_id = findItemID(mImageAssetID, FALSE);
+ item_id = findItemID(mImageAssetID, false);
}
if (item_id.isNull())
{
@@ -255,9 +258,10 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
// no copy texture
- getChild<LLUICtrl>("apply_immediate_check")->setValue(FALSE);
- mNoCopyTextureSelected = TRUE;
+ getChild<LLUICtrl>("apply_immediate_check")->setValue(false);
+ mNoCopyTextureSelected = true;
}
+ mSelectionSource = PICKER_INVENTORY;
}
if (set_selection)
@@ -277,9 +281,10 @@ void LLFloaterTexturePicker::setImageIDFromItem(const LLInventoryItem* itemp, bo
asset_id = BLANK_MATERIAL_ASSET_ID;
}
setImageID(asset_id, set_selection);
+ mSelectionSource = PICKER_INVENTORY;
}
-void LLFloaterTexturePicker::setActive( BOOL active )
+void LLFloaterTexturePicker::setActive( bool active )
{
if (!active && getChild<LLUICtrl>("Pipette")->getValue().asBoolean())
{
@@ -288,7 +293,7 @@ void LLFloaterTexturePicker::setActive( BOOL active )
mActive = active;
}
-void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b)
+void LLFloaterTexturePicker::setCanApplyImmediately(bool b)
{
mCanApplyImmediately = b;
@@ -416,14 +421,14 @@ bool LLFloaterTexturePicker::updateImageStats()
}
// virtual
-BOOL LLFloaterTexturePicker::handleDragAndDrop(
+bool LLFloaterTexturePicker::handleDragAndDrop(
S32 x, S32 y, MASK mask,
- BOOL drop,
+ bool drop,
EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept,
std::string& tooltip_msg)
{
- BOOL handled = FALSE;
+ bool handled = false;
bool is_mesh = cargo_type == DAD_MESH;
bool is_texture = cargo_type == DAD_TEXTURE;
@@ -447,9 +452,9 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
{
LLInventoryItem *item = (LLInventoryItem *)cargo_data;
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ bool copy = item->getPermissions().allowCopyBy(gAgent.getID());
+ bool mod = item->getPermissions().allowModifyBy(gAgent.getID());
+ bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
gAgent.getID());
PermissionMask item_perm_mask = 0;
@@ -478,13 +483,13 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
*accept = ACCEPT_NO;
}
- handled = TRUE;
+ handled = true;
LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << LL_ENDL;
return handled;
}
-BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask)
+bool LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask)
{
LLFolderView* root_folder = mInventoryPanel->getRootFolder();
@@ -499,23 +504,23 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask)
LLFolderViewItem* itemp = mInventoryPanel->getItemByID(gInventory.getRootFolderID());
if (itemp)
{
- root_folder->setSelection(itemp, FALSE, FALSE);
+ root_folder->setSelection(itemp, false, false);
}
}
root_folder->scrollToShowSelection();
// move focus to inventory proper
- mInventoryPanel->setFocus(TRUE);
+ mInventoryPanel->setFocus(true);
// treat this as a user selection of the first filtered result
commitIfImmediateSet();
- return TRUE;
+ return true;
}
if (mInventoryPanel->hasFocus() && key == KEY_UP)
{
- mFilterEdit->focusFirstItem(TRUE);
+ mFilterEdit->focusFirstItem(true);
}
}
@@ -546,7 +551,7 @@ void LLFloaterTexturePicker::onClose(bool app_quitting)
}
// virtual
-BOOL LLFloaterTexturePicker::postBuild()
+bool LLFloaterTexturePicker::postBuild()
{
LLFloater::postBuild();
@@ -561,6 +566,7 @@ BOOL LLFloaterTexturePicker::postBuild()
mResolutionLabel = getChild<LLTextBox>("size_lbl");
mResolutionWarning = getChild<LLTextBox>("over_limit_lbl");
+ mPreviewWidget = getChild<LLView>("preview_widget");
mDefaultBtn = getChild<LLButton>("Default");
mNoneBtn = getChild<LLButton>("None");
@@ -599,7 +605,7 @@ BOOL LLFloaterTexturePicker::postBuild()
// Disable auto selecting first filtered item because it takes away
// selection from the item set by LLTextureCtrl owning this floater.
- mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE);
+ mInventoryPanel->getRootFolder()->setAutoSelectOverride(true);
// Commented out to scroll to currently selected texture. See EXT-5403.
// // store this filter as the default one
@@ -613,7 +619,7 @@ BOOL LLFloaterTexturePicker::postBuild()
if(!mImageAssetID.isNull() || mInventoryPickType == PICK_MATERIAL)
{
- mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
+ mInventoryPanel->setSelection(findItemID(mImageAssetID, false), TAKE_FOCUS_NO);
}
}
@@ -625,7 +631,7 @@ BOOL LLFloaterTexturePicker::postBuild()
mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit, this);
refreshLocalList();
- mNoCopyTextureSelected = FALSE;
+ mNoCopyTextureSelected = false;
getChild<LLUICtrl>("apply_immediate_check")->setValue(mCanApplyImmediately && gSavedSettings.getBOOL("TextureLivePreview"));
childSetCommitCallback("apply_immediate_check", onApplyImmediateCheck, this);
@@ -635,14 +641,14 @@ BOOL LLFloaterTexturePicker::postBuild()
childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
- mSavedFolderState.setApply(FALSE);
+ mSavedFolderState.setApply(false);
LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1));
getChild<LLComboBox>("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this);
- setBakeTextureEnabled(TRUE);
- return TRUE;
+ setBakeTextureEnabled(mInventoryPickType != PICK_MATERIAL);
+ return true;
}
// virtual
@@ -656,12 +662,11 @@ void LLFloaterTexturePicker::draw()
bool valid_dims = updateImageStats();
// if we're inactive, gray out "apply immediate" checkbox
- getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
mSelectBtn->setEnabled(mActive && mCanApply && valid_dims);
mPipetteBtn->setEnabled(mActive);
mPipetteBtn->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
- //BOOL allow_copy = FALSE;
+ //bool allow_copy = false;
if( mOwner )
{
mTexturep = NULL;
@@ -719,7 +724,7 @@ void LLFloaterTexturePicker::draw()
if (mTentativeLabel)
{
- mTentativeLabel->setVisible( FALSE );
+ mTentativeLabel->setVisible( false );
}
mDefaultBtn->setEnabled(mImageAssetID != mDefaultImageAssetID || mTentative);
@@ -734,8 +739,8 @@ void LLFloaterTexturePicker::draw()
}
// Border
- LLRect border = getChildView("preview_widget")->getRect();
- gl_rect_2d( border, LLColor4::black, FALSE );
+ LLRect border = mPreviewWidget->getRect();
+ gl_rect_2d( border, LLColor4::black, false );
// Interior
@@ -770,7 +775,7 @@ void LLFloaterTexturePicker::draw()
}
else
{
- gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
+ gl_rect_2d( interior, LLColor4::grey % alpha, true );
// Draw X
gl_draw_x(interior, LLColor4::black );
@@ -779,7 +784,7 @@ void LLFloaterTexturePicker::draw()
// Draw Tentative Label over the image
if( mTentative && !mViewModel->isDirty() )
{
- mTentativeLabel->setVisible( TRUE );
+ mTentativeLabel->setVisible( true );
drawChild(mTentativeLabel);
}
@@ -795,19 +800,19 @@ void LLFloaterTexturePicker::draw()
// After inventory panel filter is applied we have to update
// constraint rect for the selected item because of folder view
- // AutoSelectOverride set to TRUE. We force PinningSelectedItem
- // flag to FALSE state and setting filter "dirty" to update
+ // AutoSelectOverride set to true. We force PinningSelectedItem
+ // flag to false state and setting filter "dirty" to update
// scroll container to show selected item (see LLFolderView::doIdle()).
if (!is_filter_active && !mSelectedItemPinned)
{
folder_view->setPinningSelectedItem(mSelectedItemPinned);
folder_view->getViewModelItem()->dirtyFilter();
- mSelectedItemPinned = TRUE;
+ mSelectedItemPinned = true;
}
}
}
-const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL copyable_only, BOOL ignore_library)
+const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library)
{
if (asset_id.isNull())
{
@@ -893,10 +898,15 @@ void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op)
{
return;
}
+
LLUUID asset_id = mImageAssetID;
LLUUID inventory_id;
LLUUID tracking_id;
- LLPickerSource mode = (LLPickerSource)mModeSelector->getValue().asInteger();
+ LLPickerSource mode = mSelectionSource;
+ if (mode == PICKER_UNKNOWN)
+ {
+ mode = (LLPickerSource)mModeSelector->getValue().asInteger();
+ }
switch (mode)
{
@@ -922,11 +932,13 @@ void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op)
}
else
{
+ // Item's asset id changed?
mode = PICKER_UNKNOWN; // source of id unknown
}
}
else
{
+ // Item could have been removed from inventory
mode = PICKER_UNKNOWN; // source of id unknown
}
break;
@@ -950,6 +962,7 @@ void LLFloaterTexturePicker::commitCallback(LLTextureCtrl::ETexturePickOp op)
}
else
{
+ // List could have been emptied, with local image still selected
asset_id = mImageAssetID;
mode = PICKER_UNKNOWN; // source of id unknown
}
@@ -1003,18 +1016,6 @@ void LLFloaterTexturePicker::onBtnNone(void* userdata)
self->commitIfImmediateSet();
}
-/*
-// static
-void LLFloaterTexturePicker::onBtnRevert(void* userdata)
-{
- LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- self->setImageID( self->mOriginalImageAssetID );
- // TODO: Change this to tell the owner to cancel. It needs to be
- // smart enough to restore multi-texture selections.
- self->mOwner->onFloaterCommit();
- self->mViewModel->resetDirty();
-}*/
-
// static
void LLFloaterTexturePicker::onBtnCancel(void* userdata)
{
@@ -1032,8 +1033,11 @@ void LLFloaterTexturePicker::onBtnCancel(void* userdata)
void LLFloaterTexturePicker::onBtnSelect(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- if (self->mOnFloaterCommitCallback)
+ if (self->mViewModel->isDirty() && self->mOnFloaterCommitCallback)
{
+ // If nothing changed, don't commit.
+ // ex: can overwrite multiple original textures with a single one.
+ // or resubmit something thus overriding some other source of change
self->commitCallback(LLTextureCtrl::TEXTURE_SELECT);
}
self->closeFloater();
@@ -1041,7 +1045,7 @@ void LLFloaterTexturePicker::onBtnSelect(void* userdata)
void LLFloaterTexturePicker::onBtnPipette()
{
- BOOL pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean();
+ bool pipette_active = getChild<LLUICtrl>("Pipette")->getValue().asBoolean();
pipette_active = !pipette_active;
if (pipette_active)
{
@@ -1053,13 +1057,13 @@ void LLFloaterTexturePicker::onBtnPipette()
}
}
-void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
+void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, bool user_action)
{
if (items.size())
{
LLFolderViewItem* first_item = items.front();
LLInventoryItem* itemp = gInventory.getItem(static_cast<LLFolderViewModelItemInventory*>(first_item->getViewModelItem())->getUUID());
- mNoCopyTextureSelected = FALSE;
+ mNoCopyTextureSelected = false;
if (itemp)
{
if (!mTextureSelectedCallback.empty())
@@ -1068,10 +1072,20 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem
}
if (!itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
- mNoCopyTextureSelected = TRUE;
+ mNoCopyTextureSelected = true;
}
+ bool was_dirty = mViewModel->isDirty();
setImageIDFromItem(itemp, false);
- mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
+ if (user_action)
+ {
+ mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
+ setTentative( false );
+ }
+ else if (!was_dirty)
+ {
+ // setImageIDFromItem could have dropped the flag
+ mViewModel->resetDirty();
+ }
if(!mPreviewSettingChanged)
{
@@ -1132,7 +1146,7 @@ void LLFloaterTexturePicker::onBtnRemove(void* userdata)
LLScrollListItem* list_item = *iter;
if (list_item)
{
- LLSD data = self->mLocalScrollCtrl->getFirstSelected()->getValue();
+ LLSD data = list_item->getValue();
LLUUID tracking_id = data["id"];
S32 asset_type = data["type"].asInteger();
@@ -1218,6 +1232,8 @@ void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl* ctrl, void* userdata)
inworld_id = LLLocalBitmapMgr::getInstance()->getWorldID(tracking_id);
}
+ self->mSelectionSource = PICKER_LOCAL;
+
if (self->mSetImageAssetIDCallback)
{
self->mSetImageAssetIDCallback(inworld_id);
@@ -1315,6 +1331,7 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data
// only commit intentional selections, not implicit ones
self->commitIfImmediateSet();
}
+ self->mSelectionSource = PICKER_BAKE;
}
void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply, bool inworld_image)
@@ -1350,7 +1367,7 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string )
return;
}
- mSavedFolderState.setApply(TRUE);
+ mSavedFolderState.setApply(true);
mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
// add folder with current item to list of previously opened folders
LLOpenFoldersWithSelection opener;
@@ -1363,7 +1380,7 @@ void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string )
// first letter in search term, save existing folder open state
if (!mInventoryPanel->getFilter().isNotDefault())
{
- mSavedFolderState.setApply(FALSE);
+ mSavedFolderState.setApply(false);
mInventoryPanel->getRootFolder()->applyFunctorRecursively(mSavedFolderState);
}
}
@@ -1375,19 +1392,19 @@ void LLFloaterTexturePicker::changeMode()
{
int index = mModeSelector->getValue().asInteger();
- mDefaultBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
- mBlankBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
- mNoneBtn->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
- mFilterEdit->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
- mInventoryPanel->setVisible(index == PICKER_INVENTORY ? TRUE : FALSE);
+ mDefaultBtn->setVisible(index == PICKER_INVENTORY);
+ mBlankBtn->setVisible(index == PICKER_INVENTORY);
+ mNoneBtn->setVisible(index == PICKER_INVENTORY);
+ mFilterEdit->setVisible(index == PICKER_INVENTORY);
+ mInventoryPanel->setVisible(index == PICKER_INVENTORY);
- getChild<LLButton>("l_add_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
- getChild<LLButton>("l_rem_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
- getChild<LLButton>("l_upl_btn")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
- getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == PICKER_LOCAL ? TRUE : FALSE);
+ getChild<LLButton>("l_add_btn")->setVisible(index == PICKER_LOCAL);
+ getChild<LLButton>("l_rem_btn")->setVisible(index == PICKER_LOCAL);
+ getChild<LLButton>("l_upl_btn")->setVisible(index == PICKER_LOCAL);
+ getChild<LLScrollListCtrl>("l_name_list")->setVisible(index == PICKER_LOCAL);
- getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE ? TRUE : FALSE);
- getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(FALSE);// index == 2 ? TRUE : FALSE);
+ getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(index == PICKER_BAKE);
+ getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(false);// index == 2);
bool pipette_visible = (index == PICKER_INVENTORY)
&& (mInventoryPickType != PICK_MATERIAL);
@@ -1445,7 +1462,7 @@ void LLFloaterTexturePicker::changeMode()
val = 10;
}
- getChild<LLComboBox>("l_bake_use_texture_combo_box")->setSelectedByValue(val, TRUE);
+ getChild<LLComboBox>("l_bake_use_texture_combo_box")->setSelectedByValue(val, true);
}
}
@@ -1491,7 +1508,7 @@ void LLFloaterTexturePicker::refreshInventoryFilter()
mInventoryPanel->setFilterTypes(filter_types);
}
-void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
+void LLFloaterTexturePicker::setLocalTextureEnabled(bool enabled)
{
mLocalTextureEnabled = enabled;
mModeSelector->setEnabledByValue(1, enabled);
@@ -1502,9 +1519,9 @@ void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
}
}
-void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled)
+void LLFloaterTexturePicker::setBakeTextureEnabled(bool enabled)
{
- BOOL changed = (enabled != mBakeTextureEnabled);
+ bool changed = (enabled != mBakeTextureEnabled);
mBakeTextureEnabled = enabled;
mModeSelector->setEnabledByValue(2, enabled);
@@ -1558,7 +1575,7 @@ void LLFloaterTexturePicker::setInventoryPickType(EPickInventoryType type)
// refresh selection
if (!mImageAssetID.isNull() || mInventoryPickType == PICK_MATERIAL)
{
- mInventoryPanel->setSelection(findItemID(mImageAssetID, FALSE), TAKE_FOCUS_NO);
+ mInventoryPanel->setSelection(findItemID(mImageAssetID, false), TAKE_FOCUS_NO);
}
}
@@ -1612,10 +1629,10 @@ void LLFloaterTexturePicker::onPickerCallback(const std::vector<std::string>& fi
void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
{
- LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
+ LLUUID inventory_item_id = findItemID(te.getID(), true);
if (inventory_item_id.notNull())
{
- LLToolPipette::getInstance()->setResult(TRUE, "");
+ LLToolPipette::getInstance()->setResult(true, "");
if (mInventoryPickType == PICK_MATERIAL)
{
// tes have no data about material ids
@@ -1628,20 +1645,21 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
setImageID(te.getID());
}
- mNoCopyTextureSelected = FALSE;
+ mNoCopyTextureSelected = false;
LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
// no copy texture
- mNoCopyTextureSelected = TRUE;
+ mNoCopyTextureSelected = true;
}
+ mSelectionSource = PICKER_INVENTORY;
commitIfImmediateSet();
}
else
{
- LLToolPipette::getInstance()->setResult(FALSE, LLTrans::getString("InventoryNoTexture"));
+ LLToolPipette::getInstance()->setResult(false, LLTrans::getString("InventoryNoTexture"));
}
}
@@ -1659,12 +1677,12 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mOnSelectCallback(NULL),
mBorderColor( p.border_color() ),
mAllowNoTexture( p.allow_no_texture ),
- mAllowLocalTexture( TRUE ),
+ mAllowLocalTexture( true ),
mImmediateFilterPermMask( PERM_NONE ),
- mCanApplyImmediately( FALSE ),
- mNeedsRawImageData( FALSE ),
- mValid( TRUE ),
- mShowLoadingPlaceholder( TRUE ),
+ mCanApplyImmediately( false ),
+ mNeedsRawImageData( false ),
+ mValid( true ),
+ mShowLoadingPlaceholder( true ),
mOpenTexPreview(false),
mBakeTextureEnabled(true),
mInventoryPickType(p.pick_type),
@@ -1725,7 +1743,7 @@ LLTextureCtrl::~LLTextureCtrl()
closeDependentFloater();
}
-void LLTextureCtrl::setShowLoadingPlaceholder(BOOL showLoadingPlaceholder)
+void LLTextureCtrl::setShowLoadingPlaceholder(bool showLoadingPlaceholder)
{
mShowLoadingPlaceholder = showLoadingPlaceholder;
}
@@ -1735,7 +1753,7 @@ void LLTextureCtrl::setCaption(const std::string& caption)
mCaption->setText( caption );
}
-void LLTextureCtrl::setCanApplyImmediately(BOOL b)
+void LLTextureCtrl::setCanApplyImmediately(bool b)
{
mCanApplyImmediately = b;
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
@@ -1771,7 +1789,7 @@ void LLTextureCtrl::setFilterPermissionMasks(PermissionMask mask)
setDnDFilterPermMask(mask);
}
-void LLTextureCtrl::onVisibilityChange(BOOL new_visibility)
+void LLTextureCtrl::onVisibilityChange(bool new_visibility)
{
if (!new_visibility)
{
@@ -1784,7 +1802,7 @@ void LLTextureCtrl::onVisibilityChange(BOOL new_visibility)
}
}
-void LLTextureCtrl::setVisible( BOOL visible )
+void LLTextureCtrl::setVisible(bool visible )
{
if( !visible )
{
@@ -1793,7 +1811,7 @@ void LLTextureCtrl::setVisible( BOOL visible )
LLUICtrl::setVisible( visible );
}
-void LLTextureCtrl::setEnabled( BOOL enabled )
+void LLTextureCtrl::setEnabled( bool enabled )
{
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if( floaterp )
@@ -1819,7 +1837,7 @@ void LLTextureCtrl::setEnabled( BOOL enabled )
LLView::setEnabled( enabled );
}
-void LLTextureCtrl::setValid(BOOL valid )
+void LLTextureCtrl::setValid(bool valid )
{
mValid = valid;
if (!valid)
@@ -1827,7 +1845,7 @@ void LLTextureCtrl::setValid(BOOL valid )
LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if (pickerp)
{
- pickerp->setActive(FALSE);
+ pickerp->setActive(false);
}
}
}
@@ -1845,7 +1863,7 @@ void LLTextureCtrl::setLabel(const std::string& label)
mCaption->setText(label);
}
-void LLTextureCtrl::showPicker(BOOL take_focus)
+void LLTextureCtrl::showPicker(bool take_focus)
{
// show hourglass cursor when loading inventory window
// because inventory construction is slooow
@@ -1889,7 +1907,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1));
texture_floaterp->setLocalTextureEnabled(mAllowLocalTexture);
- texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled);
+ texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled && mInventoryPickType != PICK_MATERIAL);
}
LLFloater* root_floater = gFloaterView->getParentFloater(this);
@@ -1900,7 +1918,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
if (take_focus)
{
- floaterp->setFocus(TRUE);
+ floaterp->setFocus(true);
}
}
@@ -1911,7 +1929,7 @@ void LLTextureCtrl::closeDependentFloater()
if( floaterp && floaterp->isInVisibleChain())
{
floaterp->setOwner(NULL);
- floaterp->setVisible(FALSE);
+ floaterp->setVisible(false);
floaterp->closeFloater();
}
}
@@ -1930,22 +1948,22 @@ public:
}
};
-BOOL LLTextureCtrl::handleHover(S32 x, S32 y, MASK mask)
+bool LLTextureCtrl::handleHover(S32 x, S32 y, MASK mask)
{
getWindow()->setCursor(mBorder->parentPointInView(x,y) ? UI_CURSOR_HAND : UI_CURSOR_ARROW);
- return TRUE;
+ return true;
}
-BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
+bool LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLUICtrl::handleMouseDown( x, y , mask );
+ bool handled = LLUICtrl::handleMouseDown( x, y , mask );
if (!handled && mBorder->parentPointInView(x, y))
{
if (!mOpenTexPreview)
{
- showPicker(FALSE);
+ showPicker(false);
if (mInventoryPickType == PICK_MATERIAL)
{
//grab materials first...
@@ -1961,7 +1979,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
LLInventoryModelBackgroundFetch::instance().start();
}
- handled = TRUE;
+ handled = true;
}
else
{
@@ -2016,7 +2034,7 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, co
if(floaterp->isDirty() || asset_id.notNull()) // mModelView->setDirty does not work.
{
- setTentative( FALSE );
+ setTentative( false );
switch(source)
{
@@ -2037,7 +2055,7 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLPickerSource source, co
break;
case PICKER_UNKNOWN:
default:
- mImageItemID = floaterp->findItemID(asset_id, FALSE);
+ mImageItemID = floaterp->findItemID(asset_id, false);
mImageAssetID = asset_id;
mLocalTrackingID.setNull();
break;
@@ -2077,7 +2095,7 @@ void LLTextureCtrl::setOnTextureSelectedCallback(texture_selected_callback cb)
}
}
-void LLTextureCtrl::setAllowLocalTexture(BOOL b)
+void LLTextureCtrl::setAllowLocalTexture(bool b)
{
mAllowLocalTexture = b;
LLFloaterTexturePicker* picker_floater = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
@@ -2123,7 +2141,7 @@ void LLTextureCtrl::setBakeTextureEnabled(bool enabled)
LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get();
if (floaterp)
{
- floaterp->setBakeTextureEnabled(enabled);
+ floaterp->setBakeTextureEnabled(enabled && mInventoryPickType != PICK_MATERIAL);
}
}
@@ -2137,12 +2155,12 @@ void LLTextureCtrl::setInventoryPickType(EPickInventoryType type)
}
}
-BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
+bool LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
+ bool drop, EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept,
std::string& tooltip_msg)
{
- BOOL handled = FALSE;
+ bool handled = false;
// this downcast may be invalid - but if the second test below
// returns true, then the cast was valid, and we can perform
@@ -2178,7 +2196,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
// This removes the 'Multiple' overlay, since
// there is now only one texture selected.
- setTentative( FALSE );
+ setTentative( false );
onCommit();
}
}
@@ -2190,7 +2208,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask,
*accept = ACCEPT_NO;
}
- handled = TRUE;
+ handled = true;
LL_DEBUGS("UserInput") << "dragAndDrop handled by LLTextureCtrl " << getName() << LL_ENDL;
return handled;
@@ -2254,7 +2272,7 @@ void LLTextureCtrl::draw()
}
else
{
- mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, true, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
mTexturep->forceToSaveRawImage(0);
@@ -2271,7 +2289,7 @@ void LLTextureCtrl::draw()
// Border
LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL );
- gl_rect_2d( border, mBorderColor.get(), FALSE );
+ gl_rect_2d( border, mBorderColor.get(), false );
// Interior
LLRect interior = border;
@@ -2295,7 +2313,7 @@ void LLTextureCtrl::draw()
}
else
{
- gl_rect_2d( interior, LLColor4::grey % alpha, TRUE );
+ gl_rect_2d( interior, LLColor4::grey % alpha, true );
// Draw X
gl_draw_x( interior, LLColor4::black );
@@ -2307,8 +2325,8 @@ void LLTextureCtrl::draw()
// Using the discard level, do not show the string if the texture is almost but not
// fully loaded.
if (mTexturep.notNull() &&
- (!mTexturep->isFullyLoaded()) &&
- (mShowLoadingPlaceholder == TRUE))
+ !mTexturep->isFullyLoaded() &&
+ mShowLoadingPlaceholder)
{
U32 v_offset = 25;
LLFontGL* font = LLFontGL::getFontSansSerif();
@@ -2319,8 +2337,8 @@ void LLTextureCtrl::draw()
font->renderUTF8(
mLoadingPlaceholderString,
0,
- llfloor(interior.mLeft+3),
- llfloor(interior.mTop-v_offset),
+ (interior.mLeft+3),
+ (interior.mTop-v_offset),
LLColor4::white,
LLFontGL::LEFT,
LLFontGL::BASELINE,
@@ -2336,17 +2354,17 @@ void LLTextureCtrl::draw()
v_offset += 12;
tdesc = llformat(" PK : %d%%", U32(mTexturep->getDownloadProgress()*100.0));
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+ font->renderUTF8(tdesc, 0, interior.mLeft+3, interior.mTop-v_offset,
LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
v_offset += 12;
tdesc = llformat(" LVL: %d", mTexturep->getDiscardLevel());
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+ font->renderUTF8(tdesc, 0, interior.mLeft+3, interior.mTop-v_offset,
LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
v_offset += 12;
tdesc = llformat(" ID : %s...", (mImageAssetID.asString().substr(0,7)).c_str());
- font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
+ font->renderUTF8(tdesc, 0, interior.mLeft+3, interior.mTop-v_offset,
LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
}
}
@@ -2354,11 +2372,11 @@ void LLTextureCtrl::draw()
LLUICtrl::draw();
}
-BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg)
+bool LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type, std::string& tooltip_msg)
{
- BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
- BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
- BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ bool copy = item->getPermissions().allowCopyBy(gAgent.getID());
+ bool mod = item->getPermissions().allowModifyBy(gAgent.getID());
+ bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
gAgent.getID());
PermissionMask item_perm_mask = 0;
@@ -2375,7 +2393,7 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type
}
else
{
- return TRUE;
+ return true;
}
}
else
@@ -2386,16 +2404,16 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item, EDragAndDropType cargo_type
{
tooltip_msg.assign(LLTrans::getString("TooltipTextureRestrictedDrop"));
}
- return FALSE;
+ return false;
}
}
-BOOL LLTextureCtrl::doDrop(LLInventoryItem* item)
+bool LLTextureCtrl::doDrop(LLInventoryItem* item)
{
// call the callback if it exists.
if(mDropCallback)
{
- // if it returns TRUE, we return TRUE, and therefore the
+ // if it returns true, we return true, and therefore the
// commit is called above.
return mDropCallback(this, item);
}
@@ -2411,15 +2429,15 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item)
setImageAssetID(asset_id);
mImageItemID = item->getUUID();
- return TRUE;
+ return true;
}
-BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char)
+bool LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char)
{
if( ' ' == uni_char )
{
- showPicker(TRUE);
- return TRUE;
+ showPicker(true);
+ return true;
}
return LLUICtrl::handleUnicodeCharHere(uni_char);
}