diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/lltexturectrl.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/lltexturectrl.cpp')
-rw-r--r-- | linden/indra/newview/lltexturectrl.cpp | 108 |
1 files changed, 55 insertions, 53 deletions
diff --git a/linden/indra/newview/lltexturectrl.cpp b/linden/indra/newview/lltexturectrl.cpp index 0314f7c..2ca9f99 100644 --- a/linden/indra/newview/lltexturectrl.cpp +++ b/linden/indra/newview/lltexturectrl.cpp | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include "lltexturectrl.h" | 35 | #include "lltexturectrl.h" |
36 | 36 | ||
37 | #include "llglimmediate.h" | ||
37 | #include "llagent.h" | 38 | #include "llagent.h" |
38 | #include "llviewerimagelist.h" | 39 | #include "llviewerimagelist.h" |
39 | #include "llcheckboxctrl.h" | 40 | #include "llcheckboxctrl.h" |
@@ -462,7 +463,7 @@ BOOL LLFloaterTexturePicker::postBuild() | |||
462 | 463 | ||
463 | if (!mLabel.empty()) | 464 | if (!mLabel.empty()) |
464 | { | 465 | { |
465 | std::string pick = childGetText("pick title"); | 466 | std::string pick = getString("pick title"); |
466 | 467 | ||
467 | setTitle(pick + mLabel); | 468 | setTitle(pick + mLabel); |
468 | } | 469 | } |
@@ -483,42 +484,42 @@ void LLFloaterTexturePicker::draw() | |||
483 | { | 484 | { |
484 | LLGLSNoTexture no_texture; | 485 | LLGLSNoTexture no_texture; |
485 | LLGLEnable(GL_CULL_FACE); | 486 | LLGLEnable(GL_CULL_FACE); |
486 | glBegin(GL_QUADS); | 487 | gGL.begin(GL_QUADS); |
487 | { | 488 | { |
488 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 489 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
489 | glVertex2i(owner_rect.mLeft, owner_rect.mTop); | 490 | gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); |
490 | glVertex2i(owner_rect.mRight, owner_rect.mTop); | 491 | gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); |
491 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 492 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
492 | glVertex2i(local_rect.mRight, local_rect.mTop); | 493 | gGL.vertex2i(local_rect.mRight, local_rect.mTop); |
493 | glVertex2i(local_rect.mLeft, local_rect.mTop); | 494 | gGL.vertex2i(local_rect.mLeft, local_rect.mTop); |
494 | 495 | ||
495 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 496 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
496 | glVertex2i(local_rect.mLeft, local_rect.mTop); | 497 | gGL.vertex2i(local_rect.mLeft, local_rect.mTop); |
497 | glVertex2i(local_rect.mLeft, local_rect.mBottom); | 498 | gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); |
498 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 499 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
499 | glVertex2i(owner_rect.mLeft, owner_rect.mBottom); | 500 | gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); |
500 | glVertex2i(owner_rect.mLeft, owner_rect.mTop); | 501 | gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); |
501 | 502 | ||
502 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 503 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
503 | glVertex2i(local_rect.mRight, local_rect.mBottom); | 504 | gGL.vertex2i(local_rect.mRight, local_rect.mBottom); |
504 | glVertex2i(local_rect.mRight, local_rect.mTop); | 505 | gGL.vertex2i(local_rect.mRight, local_rect.mTop); |
505 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 506 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
506 | glVertex2i(owner_rect.mRight, owner_rect.mTop); | 507 | gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); |
507 | glVertex2i(owner_rect.mRight, owner_rect.mBottom); | 508 | gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); |
508 | 509 | ||
509 | 510 | ||
510 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 511 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
511 | glVertex2i(local_rect.mLeft, local_rect.mBottom); | 512 | gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); |
512 | glVertex2i(local_rect.mRight, local_rect.mBottom); | 513 | gGL.vertex2i(local_rect.mRight, local_rect.mBottom); |
513 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 514 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
514 | glVertex2i(owner_rect.mRight, owner_rect.mBottom); | 515 | gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); |
515 | glVertex2i(owner_rect.mLeft, owner_rect.mBottom); | 516 | gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); |
516 | } | 517 | } |
517 | glEnd(); | 518 | gGL.end(); |
518 | } | 519 | } |
519 | } | 520 | } |
520 | 521 | ||
521 | if (gFocusMgr.childHasMouseCapture(mDragHandle)) | 522 | if (gFocusMgr.childHasMouseCapture(getDragHandle())) |
522 | { | 523 | { |
523 | mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); | 524 | mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); |
524 | } | 525 | } |
@@ -566,9 +567,9 @@ void LLFloaterTexturePicker::draw() | |||
566 | 567 | ||
567 | // Border | 568 | // Border |
568 | LLRect border( BORDER_PAD, | 569 | LLRect border( BORDER_PAD, |
569 | mRect.getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD, | 570 | getRect().getHeight() - LLFLOATER_HEADER_SIZE - BORDER_PAD, |
570 | ((TEX_PICKER_MIN_WIDTH / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD, | 571 | ((TEX_PICKER_MIN_WIDTH / 2) - TEXTURE_INVENTORY_PADDING - HPAD) - BORDER_PAD, |
571 | BORDER_PAD + FOOTER_HEIGHT + (mRect.getHeight() - TEX_PICKER_MIN_HEIGHT)); | 572 | BORDER_PAD + FOOTER_HEIGHT + (getRect().getHeight() - TEX_PICKER_MIN_HEIGHT)); |
572 | gl_rect_2d( border, LLColor4::black, FALSE ); | 573 | gl_rect_2d( border, LLColor4::black, FALSE ); |
573 | 574 | ||
574 | 575 | ||
@@ -908,13 +909,13 @@ LLTextureCtrl::LLTextureCtrl( | |||
908 | mDirty( FALSE ) | 909 | mDirty( FALSE ) |
909 | { | 910 | { |
910 | mCaption = new LLTextBox( label, | 911 | mCaption = new LLTextBox( label, |
911 | LLRect( 0, BTN_HEIGHT_SMALL, mRect.getWidth(), 0 ), | 912 | LLRect( 0, BTN_HEIGHT_SMALL, getRect().getWidth(), 0 ), |
912 | NULL, | 913 | label, |
913 | LLFontGL::sSansSerifSmall ); | 914 | LLFontGL::sSansSerifSmall ); |
914 | mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); | 915 | mCaption->setFollows( FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM ); |
915 | addChild( mCaption ); | 916 | addChild( mCaption ); |
916 | 917 | ||
917 | S32 image_top = mRect.getHeight(); | 918 | S32 image_top = getRect().getHeight(); |
918 | S32 image_bottom = BTN_HEIGHT_SMALL; | 919 | S32 image_bottom = BTN_HEIGHT_SMALL; |
919 | S32 image_middle = (image_top + image_bottom) / 2; | 920 | S32 image_middle = (image_top + image_bottom) / 2; |
920 | S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight()); | 921 | S32 line_height = llround(LLFontGL::sSansSerifSmall->getLineHeight()); |
@@ -922,14 +923,14 @@ LLTextureCtrl::LLTextureCtrl( | |||
922 | mTentativeLabel = new LLTextBox( "Multiple", | 923 | mTentativeLabel = new LLTextBox( "Multiple", |
923 | LLRect( | 924 | LLRect( |
924 | 0, image_middle + line_height / 2, | 925 | 0, image_middle + line_height / 2, |
925 | mRect.getWidth(), image_middle - line_height / 2 ), | 926 | getRect().getWidth(), image_middle - line_height / 2 ), |
926 | NULL, | 927 | "Multiple", |
927 | LLFontGL::sSansSerifSmall ); | 928 | LLFontGL::sSansSerifSmall ); |
928 | mTentativeLabel->setHAlign( LLFontGL::HCENTER ); | 929 | mTentativeLabel->setHAlign( LLFontGL::HCENTER ); |
929 | mTentativeLabel->setFollowsAll(); | 930 | mTentativeLabel->setFollowsAll(); |
930 | addChild( mTentativeLabel ); | 931 | addChild( mTentativeLabel ); |
931 | 932 | ||
932 | LLRect border_rect(0, mRect.getHeight(), mRect.getWidth(), 0); | 933 | LLRect border_rect(0, getRect().getHeight(), getRect().getWidth(), 0); |
933 | border_rect.mBottom += BTN_HEIGHT_SMALL; | 934 | border_rect.mBottom += BTN_HEIGHT_SMALL; |
934 | mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); | 935 | mBorder = new LLViewBorder("border", border_rect, LLViewBorder::BEVEL_IN); |
935 | addChild(mBorder); | 936 | addChild(mBorder); |
@@ -1013,7 +1014,7 @@ void LLTextureCtrl::setCaption(const LLString& caption) | |||
1013 | void LLTextureCtrl::setCanApplyImmediately(BOOL b) | 1014 | void LLTextureCtrl::setCanApplyImmediately(BOOL b) |
1014 | { | 1015 | { |
1015 | mCanApplyImmediately = b; | 1016 | mCanApplyImmediately = b; |
1016 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); | 1017 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); |
1017 | if( floaterp ) | 1018 | if( floaterp ) |
1018 | { | 1019 | { |
1019 | floaterp->setCanApplyImmediately(b); | 1020 | floaterp->setCanApplyImmediately(b); |
@@ -1031,7 +1032,7 @@ void LLTextureCtrl::setVisible( BOOL visible ) | |||
1031 | 1032 | ||
1032 | void LLTextureCtrl::setEnabled( BOOL enabled ) | 1033 | void LLTextureCtrl::setEnabled( BOOL enabled ) |
1033 | { | 1034 | { |
1034 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); | 1035 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); |
1035 | if( enabled ) | 1036 | if( enabled ) |
1036 | { | 1037 | { |
1037 | LLString tooltip; | 1038 | LLString tooltip; |
@@ -1061,7 +1062,7 @@ void LLTextureCtrl::setValid(BOOL valid ) | |||
1061 | mValid = valid; | 1062 | mValid = valid; |
1062 | if (!valid) | 1063 | if (!valid) |
1063 | { | 1064 | { |
1064 | LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); | 1065 | LLFloaterTexturePicker* pickerp = (LLFloaterTexturePicker*)mFloaterHandle.get(); |
1065 | if (pickerp) | 1066 | if (pickerp) |
1066 | { | 1067 | { |
1067 | pickerp->setActive(FALSE); | 1068 | pickerp->setActive(FALSE); |
@@ -1096,7 +1097,7 @@ void LLTextureCtrl::setLabel(const LLString& label) | |||
1096 | 1097 | ||
1097 | void LLTextureCtrl::showPicker(BOOL take_focus) | 1098 | void LLTextureCtrl::showPicker(BOOL take_focus) |
1098 | { | 1099 | { |
1099 | LLFloater* floaterp = LLFloater::getFloaterByHandle(mFloaterHandle); | 1100 | LLFloater* floaterp = mFloaterHandle.get(); |
1100 | 1101 | ||
1101 | // Show the dialog | 1102 | // Show the dialog |
1102 | if( floaterp ) | 1103 | if( floaterp ) |
@@ -1134,7 +1135,7 @@ void LLTextureCtrl::showPicker(BOOL take_focus) | |||
1134 | 1135 | ||
1135 | void LLTextureCtrl::closeFloater() | 1136 | void LLTextureCtrl::closeFloater() |
1136 | { | 1137 | { |
1137 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); | 1138 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); |
1138 | if( floaterp ) | 1139 | if( floaterp ) |
1139 | { | 1140 | { |
1140 | floaterp->setOwner(NULL); | 1141 | floaterp->setOwner(NULL); |
@@ -1180,7 +1181,7 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) | |||
1180 | 1181 | ||
1181 | void LLTextureCtrl::onFloaterClose() | 1182 | void LLTextureCtrl::onFloaterClose() |
1182 | { | 1183 | { |
1183 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); | 1184 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); |
1184 | 1185 | ||
1185 | if (floaterp) | 1186 | if (floaterp) |
1186 | { | 1187 | { |
@@ -1193,9 +1194,9 @@ void LLTextureCtrl::onFloaterClose() | |||
1193 | 1194 | ||
1194 | void LLTextureCtrl::onFloaterCommit(ETexturePickOp op) | 1195 | void LLTextureCtrl::onFloaterCommit(ETexturePickOp op) |
1195 | { | 1196 | { |
1196 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); | 1197 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); |
1197 | 1198 | ||
1198 | if( floaterp && mEnabled) | 1199 | if( floaterp && getEnabled()) |
1199 | { | 1200 | { |
1200 | mDirty = (op != TEXTURE_CANCEL); | 1201 | mDirty = (op != TEXTURE_CANCEL); |
1201 | if( floaterp->isDirty() ) | 1202 | if( floaterp->isDirty() ) |
@@ -1227,7 +1228,7 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id ) | |||
1227 | { | 1228 | { |
1228 | mImageItemID.setNull(); | 1229 | mImageItemID.setNull(); |
1229 | mImageAssetID = asset_id; | 1230 | mImageAssetID = asset_id; |
1230 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)LLFloater::getFloaterByHandle(mFloaterHandle); | 1231 | LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); |
1231 | if( floaterp && getEnabled() ) | 1232 | if( floaterp && getEnabled() ) |
1232 | { | 1233 | { |
1233 | floaterp->setImageID( asset_id ); | 1234 | floaterp->setImageID( asset_id ); |
@@ -1247,7 +1248,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, | |||
1247 | // returns true, then the cast was valid, and we can perform | 1248 | // returns true, then the cast was valid, and we can perform |
1248 | // the third test without problems. | 1249 | // the third test without problems. |
1249 | LLInventoryItem* item = (LLInventoryItem*)cargo_data; | 1250 | LLInventoryItem* item = (LLInventoryItem*)cargo_data; |
1250 | if (mEnabled && (cargo_type == DAD_TEXTURE) && allowDrop(item)) | 1251 | if (getEnabled() && (cargo_type == DAD_TEXTURE) && allowDrop(item)) |
1251 | { | 1252 | { |
1252 | if (drop) | 1253 | if (drop) |
1253 | { | 1254 | { |
@@ -1290,7 +1291,7 @@ void LLTextureCtrl::draw() | |||
1290 | } | 1291 | } |
1291 | 1292 | ||
1292 | // Border | 1293 | // Border |
1293 | LLRect border( 0, mRect.getHeight(), mRect.getWidth(), BTN_HEIGHT_SMALL ); | 1294 | LLRect border( 0, getRect().getHeight(), getRect().getWidth(), BTN_HEIGHT_SMALL ); |
1294 | gl_rect_2d( border, mBorderColor, FALSE ); | 1295 | gl_rect_2d( border, mBorderColor, FALSE ); |
1295 | 1296 | ||
1296 | // Interior | 1297 | // Interior |
@@ -1315,7 +1316,7 @@ void LLTextureCtrl::draw() | |||
1315 | gl_draw_x( interior, LLColor4::black ); | 1316 | gl_draw_x( interior, LLColor4::black ); |
1316 | } | 1317 | } |
1317 | 1318 | ||
1318 | mTentativeLabel->setVisible( !mTexturep.isNull() && mTentative ); | 1319 | mTentativeLabel->setVisible( !mTexturep.isNull() && getTentative() ); |
1319 | 1320 | ||
1320 | LLUICtrl::draw(); | 1321 | LLUICtrl::draw(); |
1321 | } | 1322 | } |
@@ -1371,7 +1372,7 @@ BOOL LLTextureCtrl::doDrop(LLInventoryItem* item) | |||
1371 | 1372 | ||
1372 | BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) | 1373 | BOOL LLTextureCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) |
1373 | { | 1374 | { |
1374 | if( getVisible() && mEnabled && !called_from_parent && ' ' == uni_char ) | 1375 | if( getVisible() && getEnabled() && !called_from_parent && ' ' == uni_char ) |
1375 | { | 1376 | { |
1376 | showPicker(TRUE); | 1377 | showPicker(TRUE); |
1377 | return TRUE; | 1378 | return TRUE; |
@@ -1450,3 +1451,4 @@ BOOL LLToolTexEyedropper::handleHover(S32 x, S32 y, MASK mask) | |||
1450 | } | 1451 | } |
1451 | 1452 | ||
1452 | 1453 | ||
1454 | |||