diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/lltexturectrl.cpp | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lltexturectrl.cpp | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/linden/indra/newview/lltexturectrl.cpp b/linden/indra/newview/lltexturectrl.cpp index ec8d91c..acf4a10 100644 --- a/linden/indra/newview/lltexturectrl.cpp +++ b/linden/indra/newview/lltexturectrl.cpp | |||
@@ -64,7 +64,7 @@ | |||
64 | #include "llviewerobject.h" | 64 | #include "llviewerobject.h" |
65 | #include "llviewercontrol.h" | 65 | #include "llviewercontrol.h" |
66 | #include "llglheaders.h" | 66 | #include "llglheaders.h" |
67 | #include "llvieweruictrlfactory.h" | 67 | #include "lluictrlfactory.h" |
68 | 68 | ||
69 | 69 | ||
70 | static const S32 CLOSE_BTN_WIDTH = 100; | 70 | static const S32 CLOSE_BTN_WIDTH = 100; |
@@ -119,7 +119,7 @@ public: | |||
119 | EAcceptance *accept, | 119 | EAcceptance *accept, |
120 | LLString& tooltip_msg); | 120 | LLString& tooltip_msg); |
121 | virtual void draw(); | 121 | virtual void draw(); |
122 | virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent); | 122 | virtual BOOL handleKeyHere(KEY key, MASK mask); |
123 | 123 | ||
124 | // LLFloater overrides | 124 | // LLFloater overrides |
125 | virtual void onClose(bool app_quitting); | 125 | virtual void onClose(bool app_quitting); |
@@ -214,11 +214,11 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( | |||
214 | mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), | 214 | mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), |
215 | mContextConeOpacity(0.f) | 215 | mContextConeOpacity(0.f) |
216 | { | 216 | { |
217 | gUICtrlFactory->buildFloater(this,"floater_texture_ctrl.xml"); | 217 | LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml"); |
218 | 218 | ||
219 | mTentativeLabel = LLUICtrlFactory::getTextBoxByName(this,"Multiple"); | 219 | mTentativeLabel = getChild<LLTextBox>("Multiple"); |
220 | 220 | ||
221 | mResolutionLabel = LLUICtrlFactory::getTextBoxByName(this,"unknown"); | 221 | mResolutionLabel = getChild<LLTextBox>("unknown"); |
222 | 222 | ||
223 | 223 | ||
224 | childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this); | 224 | childSetAction("Default",LLFloaterTexturePicker::onBtnSetToDefault,this); |
@@ -229,10 +229,10 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( | |||
229 | childSetCommitCallback("show_folders_check", onShowFolders, this); | 229 | childSetCommitCallback("show_folders_check", onShowFolders, this); |
230 | childSetVisible("show_folders_check", FALSE); | 230 | childSetVisible("show_folders_check", FALSE); |
231 | 231 | ||
232 | mSearchEdit = (LLSearchEditor*)getCtrlByNameAndType("inventory search editor", WIDGET_TYPE_SEARCH_EDITOR); | 232 | mSearchEdit = getChild<LLSearchEditor>("inventory search editor"); |
233 | mSearchEdit->setSearchCallback(onSearchEdit, this); | 233 | mSearchEdit->setSearchCallback(onSearchEdit, this); |
234 | 234 | ||
235 | mInventoryPanel = (LLInventoryPanel*)this->getCtrlByNameAndType("inventory panel", WIDGET_TYPE_INVENTORY_PANEL); | 235 | mInventoryPanel = getChild<LLInventoryPanel>("inventory panel"); |
236 | 236 | ||
237 | if(mInventoryPanel) | 237 | if(mInventoryPanel) |
238 | { | 238 | { |
@@ -332,9 +332,9 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b) | |||
332 | 332 | ||
333 | void LLFloaterTexturePicker::stopUsingPipette() | 333 | void LLFloaterTexturePicker::stopUsingPipette() |
334 | { | 334 | { |
335 | if (gToolMgr && gToolMgr->getCurrentTool() == gToolPipette) | 335 | if (LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()) |
336 | { | 336 | { |
337 | gToolMgr->clearTransientTool(); | 337 | LLToolMgr::getInstance()->clearTransientTool(); |
338 | } | 338 | } |
339 | } | 339 | } |
340 | 340 | ||
@@ -407,15 +407,15 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( | |||
407 | return handled; | 407 | return handled; |
408 | } | 408 | } |
409 | 409 | ||
410 | BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent) | 410 | BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask) |
411 | { | 411 | { |
412 | LLFolderView* root_folder = mInventoryPanel->getRootFolder(); | 412 | LLFolderView* root_folder = mInventoryPanel->getRootFolder(); |
413 | 413 | ||
414 | if (root_folder && mSearchEdit) | 414 | if (root_folder && mSearchEdit) |
415 | { | 415 | { |
416 | if (!called_from_parent && mSearchEdit->hasFocus() && | 416 | if (mSearchEdit->hasFocus() |
417 | (key == KEY_RETURN || key == KEY_DOWN) && | 417 | && (key == KEY_RETURN || key == KEY_DOWN) |
418 | mask == MASK_NONE) | 418 | && mask == MASK_NONE) |
419 | { | 419 | { |
420 | if (!root_folder->getCurSelectedItem()) | 420 | if (!root_folder->getCurSelectedItem()) |
421 | { | 421 | { |
@@ -442,7 +442,7 @@ BOOL LLFloaterTexturePicker::handleKeyHere(KEY key, MASK mask, BOOL called_from_ | |||
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | return LLFloater::handleKeyHere(key, mask, called_from_parent); | 445 | return LLFloater::handleKeyHere(key, mask); |
446 | } | 446 | } |
447 | 447 | ||
448 | // virtual | 448 | // virtual |
@@ -533,14 +533,14 @@ void LLFloaterTexturePicker::draw() | |||
533 | // if we're inactive, gray out "apply immediate" checkbox | 533 | // if we're inactive, gray out "apply immediate" checkbox |
534 | childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected); | 534 | childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected); |
535 | childSetEnabled("Select", mActive); | 535 | childSetEnabled("Select", mActive); |
536 | childSetEnabled("Pipette", gToolMgr != NULL && mActive); | 536 | childSetEnabled("Pipette", mActive); |
537 | childSetValue("Pipette", gToolMgr && gToolMgr->getCurrentTool() == gToolPipette); | 537 | childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); |
538 | 538 | ||
539 | //RN: reset search bar to reflect actual search query (all caps, for example) | 539 | //RN: reset search bar to reflect actual search query (all caps, for example) |
540 | mSearchEdit->setText(mInventoryPanel->getFilterSubString()); | 540 | mSearchEdit->setText(mInventoryPanel->getFilterSubString()); |
541 | 541 | ||
542 | //BOOL allow_copy = FALSE; | 542 | //BOOL allow_copy = FALSE; |
543 | if( getVisible() && mOwner) | 543 | if( mOwner ) |
544 | { | 544 | { |
545 | mTexturep = NULL; | 545 | mTexturep = NULL; |
546 | if(mImageAssetID.notNull()) | 546 | if(mImageAssetID.notNull()) |
@@ -739,18 +739,18 @@ void LLFloaterTexturePicker::onBtnPipette( void* userdata ) | |||
739 | { | 739 | { |
740 | LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; | 740 | LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata; |
741 | 741 | ||
742 | if ( self && gToolMgr) | 742 | if ( self) |
743 | { | 743 | { |
744 | BOOL pipette_active = self->childGetValue("Pipette").asBoolean(); | 744 | BOOL pipette_active = self->childGetValue("Pipette").asBoolean(); |
745 | pipette_active = !pipette_active; | 745 | pipette_active = !pipette_active; |
746 | if (pipette_active) | 746 | if (pipette_active) |
747 | { | 747 | { |
748 | gToolPipette->setSelectCallback(onTextureSelect, self); | 748 | LLToolPipette::getInstance()->setSelectCallback(onTextureSelect, self); |
749 | gToolMgr->setTransientTool(gToolPipette); | 749 | LLToolMgr::getInstance()->setTransientTool(LLToolPipette::getInstance()); |
750 | } | 750 | } |
751 | else | 751 | else |
752 | { | 752 | { |
753 | gToolMgr->clearTransientTool(); | 753 | LLToolMgr::getInstance()->clearTransientTool(); |
754 | } | 754 | } |
755 | } | 755 | } |
756 | 756 | ||
@@ -859,7 +859,7 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *da | |||
859 | LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE); | 859 | LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE); |
860 | if (self && inventory_item_id.notNull()) | 860 | if (self && inventory_item_id.notNull()) |
861 | { | 861 | { |
862 | gToolPipette->setResult(TRUE, ""); | 862 | LLToolPipette::getInstance()->setResult(TRUE, ""); |
863 | self->setImageID(te.getID()); | 863 | self->setImageID(te.getID()); |
864 | 864 | ||
865 | self->mNoCopyTextureSelected = FALSE; | 865 | self->mNoCopyTextureSelected = FALSE; |
@@ -875,13 +875,15 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *da | |||
875 | } | 875 | } |
876 | else | 876 | else |
877 | { | 877 | { |
878 | gToolPipette->setResult(FALSE, "You do not have a copy this \nof texture in your inventory"); | 878 | LLToolPipette::getInstance()->setResult(FALSE, "You do not have a copy this \nof texture in your inventory"); |
879 | } | 879 | } |
880 | } | 880 | } |
881 | 881 | ||
882 | /////////////////////////////////////////////////////////////////////// | 882 | /////////////////////////////////////////////////////////////////////// |
883 | // LLTextureCtrl | 883 | // LLTextureCtrl |
884 | 884 | ||
885 | static LLRegisterWidget<LLTextureCtrl> r("texture_picker"); | ||
886 | |||
885 | LLTextureCtrl::LLTextureCtrl( | 887 | LLTextureCtrl::LLTextureCtrl( |
886 | const std::string& name, | 888 | const std::string& name, |
887 | const LLRect &rect, | 889 | const LLRect &rect, |
@@ -933,6 +935,7 @@ LLTextureCtrl::LLTextureCtrl( | |||
933 | LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0); | 935 | LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0); |
934 | border_rect.mBottom += BTN_HEIGHT_SMALL; | 936 | border_rect.mBottom += BTN_HEIGHT_SMALL; |
935 | mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); | 937 | mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); |
938 | mBorder->setFollowsAll(); | ||
936 | addChild(mBorder); | 939 | addChild(mBorder); |
937 | 940 | ||
938 | setEnabled(TRUE); // for the tooltip | 941 | setEnabled(TRUE); // for the tooltip |
@@ -1276,50 +1279,47 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, | |||
1276 | 1279 | ||
1277 | void LLTextureCtrl::draw() | 1280 | void LLTextureCtrl::draw() |
1278 | { | 1281 | { |
1279 | if( getVisible() ) | 1282 | mBorder->setKeyboardFocusHighlight(hasFocus()); |
1280 | { | ||
1281 | mBorder->setKeyboardFocusHighlight(hasFocus()); | ||
1282 | 1283 | ||
1283 | if (mImageAssetID.isNull() || !mValid) | 1284 | if (mImageAssetID.isNull() || !mValid) |
1284 | { | 1285 | { |
1285 | mTexturep = NULL; | 1286 | mTexturep = NULL; |
1286 | } | 1287 | } |
1287 | else | 1288 | else |
1288 | { | 1289 | { |
1289 | mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); | 1290 | mTexturep = gImageList.getImage(mImageAssetID, MIPMAP_YES, IMMEDIATE_NO); |
1290 | mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); | 1291 | mTexturep->setBoostLevel(LLViewerImage::BOOST_PREVIEW); |
1291 | } | 1292 | } |
1292 | 1293 | ||
1293 | // Border | 1294 | // Border |
1294 | LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); | 1295 | LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); |
1295 | gl_rect_2d( border, mBorderColor, FALSE ); | 1296 | gl_rect_2d( border, mBorderColor, FALSE ); |
1296 | 1297 | ||
1297 | // Interior | 1298 | // Interior |
1298 | LLRect interior = border; | 1299 | LLRect interior = border; |
1299 | interior.stretch( -1 ); | 1300 | interior.stretch( -1 ); |
1300 | 1301 | ||
1301 | if( mTexturep ) | 1302 | if( mTexturep ) |
1303 | { | ||
1304 | if( mTexturep->getComponents() == 4 ) | ||
1302 | { | 1305 | { |
1303 | if( mTexturep->getComponents() == 4 ) | 1306 | gl_rect_2d_checkerboard( interior ); |
1304 | { | ||
1305 | gl_rect_2d_checkerboard( interior ); | ||
1306 | } | ||
1307 | |||
1308 | gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); | ||
1309 | mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); | ||
1310 | } | 1307 | } |
1311 | else | 1308 | |
1312 | { | 1309 | gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); |
1313 | gl_rect_2d( interior, LLColor4::grey, TRUE ); | 1310 | mTexturep->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); |
1311 | } | ||
1312 | else | ||
1313 | { | ||
1314 | gl_rect_2d( interior, LLColor4::grey, TRUE ); | ||
1314 | 1315 | ||
1315 | // Draw X | 1316 | // Draw X |
1316 | gl_draw_x( interior, LLColor4::black ); | 1317 | gl_draw_x( interior, LLColor4::black ); |
1317 | } | 1318 | } |
1318 | 1319 | ||
1319 | mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); | 1320 | mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); |
1320 | 1321 | ||
1321 | LLUICtrl::draw(); | 1322 | LLUICtrl::draw(); |
1322 | } | ||
1323 | } | 1323 | } |
1324 | 1324 | ||
1325 | BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) | 1325 | BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item) |
@@ -1370,14 +1370,14 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) | |||
1370 | return TRUE; | 1370 | return TRUE; |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) | 1373 | BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char) |
1374 | { | 1374 | { |
1375 | if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char ) | 1375 | if( ' ' == uni_char ) |
1376 | { | 1376 | { |
1377 | showPicker(TRUE); | 1377 | showPicker(TRUE); |
1378 | return TRUE; | 1378 | return TRUE; |
1379 | } | 1379 | } |
1380 | return LLUICtrl::handleUnicodeCharHere(uni_char, called_from_parent); | 1380 | return LLUICtrl::handleUnicodeCharHere(uni_char); |
1381 | } | 1381 | } |
1382 | 1382 | ||
1383 | void LLTextureCtrl::setValue( const LLSD& value ) | 1383 | void LLTextureCtrl::setValue( const LLSD& value ) |