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/llfloatercolorpicker.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/llfloatercolorpicker.cpp')
-rw-r--r-- | linden/indra/newview/llfloatercolorpicker.cpp | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/linden/indra/newview/llfloatercolorpicker.cpp b/linden/indra/newview/llfloatercolorpicker.cpp index 3787590..260db21 100644 --- a/linden/indra/newview/llfloatercolorpicker.cpp +++ b/linden/indra/newview/llfloatercolorpicker.cpp | |||
@@ -39,6 +39,7 @@ | |||
39 | #include "llfontgl.h" | 39 | #include "llfontgl.h" |
40 | #include "llsys.h" | 40 | #include "llsys.h" |
41 | #include "llgl.h" | 41 | #include "llgl.h" |
42 | #include "llglimmediate.h" | ||
42 | #include "v3dmath.h" | 43 | #include "v3dmath.h" |
43 | #include "lldir.h" | 44 | #include "lldir.h" |
44 | #include "llui.h" | 45 | #include "llui.h" |
@@ -544,40 +545,40 @@ void LLFloaterColorPicker::draw() | |||
544 | { | 545 | { |
545 | LLGLSNoTexture no_texture; | 546 | LLGLSNoTexture no_texture; |
546 | LLGLEnable(GL_CULL_FACE); | 547 | LLGLEnable(GL_CULL_FACE); |
547 | glBegin(GL_QUADS); | 548 | gGL.begin(GL_QUADS); |
548 | { | 549 | { |
549 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 550 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
550 | glVertex2i(swatch_rect.mLeft, swatch_rect.mTop); | 551 | gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); |
551 | glVertex2i(swatch_rect.mRight, swatch_rect.mTop); | 552 | gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); |
552 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 553 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
553 | glVertex2i(local_rect.mRight, local_rect.mTop); | 554 | gGL.vertex2i(local_rect.mRight, local_rect.mTop); |
554 | glVertex2i(local_rect.mLeft, local_rect.mTop); | 555 | gGL.vertex2i(local_rect.mLeft, local_rect.mTop); |
555 | 556 | ||
556 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 557 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
557 | glVertex2i(local_rect.mLeft, local_rect.mTop); | 558 | gGL.vertex2i(local_rect.mLeft, local_rect.mTop); |
558 | glVertex2i(local_rect.mLeft, local_rect.mBottom); | 559 | gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); |
559 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 560 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
560 | glVertex2i(swatch_rect.mLeft, swatch_rect.mBottom); | 561 | gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); |
561 | glVertex2i(swatch_rect.mLeft, swatch_rect.mTop); | 562 | gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mTop); |
562 | 563 | ||
563 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 564 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
564 | glVertex2i(local_rect.mRight, local_rect.mBottom); | 565 | gGL.vertex2i(local_rect.mRight, local_rect.mBottom); |
565 | glVertex2i(local_rect.mRight, local_rect.mTop); | 566 | gGL.vertex2i(local_rect.mRight, local_rect.mTop); |
566 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 567 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
567 | glVertex2i(swatch_rect.mRight, swatch_rect.mTop); | 568 | gGL.vertex2i(swatch_rect.mRight, swatch_rect.mTop); |
568 | glVertex2i(swatch_rect.mRight, swatch_rect.mBottom); | 569 | gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); |
569 | 570 | ||
570 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); | 571 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); |
571 | glVertex2i(local_rect.mLeft, local_rect.mBottom); | 572 | gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); |
572 | glVertex2i(local_rect.mRight, local_rect.mBottom); | 573 | gGL.vertex2i(local_rect.mRight, local_rect.mBottom); |
573 | glColor4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); | 574 | gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); |
574 | glVertex2i(swatch_rect.mRight, swatch_rect.mBottom); | 575 | gGL.vertex2i(swatch_rect.mRight, swatch_rect.mBottom); |
575 | glVertex2i(swatch_rect.mLeft, swatch_rect.mBottom); | 576 | gGL.vertex2i(swatch_rect.mLeft, swatch_rect.mBottom); |
576 | } | 577 | } |
577 | glEnd(); | 578 | gGL.end(); |
578 | } | 579 | } |
579 | 580 | ||
580 | if (gFocusMgr.childHasMouseCapture(mDragHandle)) | 581 | if (gFocusMgr.childHasMouseCapture(getDragHandle())) |
581 | { | 582 | { |
582 | mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); | 583 | mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); |
583 | } | 584 | } |
@@ -672,9 +673,9 @@ void LLFloaterColorPicker::draw() | |||
672 | 673 | ||
673 | ////////////////////////////////////////////////////////////////////////////// | 674 | ////////////////////////////////////////////////////////////////////////////// |
674 | // find a complimentary color to the one passed in that can be used to highlight | 675 | // find a complimentary color to the one passed in that can be used to highlight |
675 | LLColor4& | 676 | const LLColor4& |
676 | LLFloaterColorPicker:: | 677 | LLFloaterColorPicker:: |
677 | getComplimentaryColor ( LLColor4& backgroundColor ) | 678 | getComplimentaryColor ( const LLColor4& backgroundColor ) |
678 | { | 679 | { |
679 | // going to base calculation on luminance | 680 | // going to base calculation on luminance |
680 | F32 hVal, sVal, lVal; | 681 | F32 hVal, sVal, lVal; |
@@ -902,104 +903,103 @@ BOOL | |||
902 | LLFloaterColorPicker:: | 903 | LLFloaterColorPicker:: |
903 | handleMouseDown ( S32 x, S32 y, MASK mask ) | 904 | handleMouseDown ( S32 x, S32 y, MASK mask ) |
904 | { | 905 | { |
905 | // if this window is in the foreground | 906 | BOOL ret = LLFloater::handleMouseDown ( x, y, mask ); |
906 | if ( mForeground ) | 907 | |
907 | { | ||
908 | // make it the frontmost | 908 | // make it the frontmost |
909 | gFloaterView->bringToFront(this); | 909 | gFloaterView->bringToFront(this); |
910 | 910 | ||
911 | // rect containing RGB area | 911 | // rect containing RGB area |
912 | LLRect rgbAreaRect ( mRGBViewerImageLeft, | 912 | LLRect rgbAreaRect ( mRGBViewerImageLeft, |
913 | mRGBViewerImageTop, | 913 | mRGBViewerImageTop, |
914 | mRGBViewerImageLeft + mRGBViewerImageWidth, | 914 | mRGBViewerImageLeft + mRGBViewerImageWidth, |
915 | mRGBViewerImageTop - mRGBViewerImageHeight ); | 915 | mRGBViewerImageTop - mRGBViewerImageHeight ); |
916 | 916 | ||
917 | if ( rgbAreaRect.pointInRect ( x, y ) ) | 917 | if ( rgbAreaRect.pointInRect ( x, y ) ) |
918 | { | 918 | { |
919 | gViewerWindow->setMouseCapture(this); | 919 | gViewerWindow->setMouseCapture(this); |
920 | // mouse button down | 920 | // mouse button down |
921 | setMouseDownInHueRegion ( TRUE ); | 921 | setMouseDownInHueRegion ( TRUE ); |
922 | 922 | ||
923 | // update all values based on initial click | 923 | // update all values based on initial click |
924 | updateRgbHslFromPoint ( x, y ); | 924 | updateRgbHslFromPoint ( x, y ); |
925 | 925 | ||
926 | // required by base class | 926 | // required by base class |
927 | return TRUE; | 927 | return TRUE; |
928 | } | 928 | } |
929 | 929 | ||
930 | // rect containing RGB area | 930 | // rect containing RGB area |
931 | LLRect lumAreaRect ( mLumRegionLeft, | 931 | LLRect lumAreaRect ( mLumRegionLeft, |
932 | mLumRegionTop, | 932 | mLumRegionTop, |
933 | mLumRegionLeft + mLumRegionWidth + mLumMarkerSize, | 933 | mLumRegionLeft + mLumRegionWidth + mLumMarkerSize, |
934 | mLumRegionTop - mLumRegionHeight ); | 934 | mLumRegionTop - mLumRegionHeight ); |
935 | 935 | ||
936 | if ( lumAreaRect.pointInRect ( x, y ) ) | 936 | if ( lumAreaRect.pointInRect ( x, y ) ) |
937 | { | 937 | { |
938 | gViewerWindow->setMouseCapture(this); | 938 | gViewerWindow->setMouseCapture(this); |
939 | // mouse button down | 939 | // mouse button down |
940 | setMouseDownInLumRegion ( TRUE ); | 940 | setMouseDownInLumRegion ( TRUE ); |
941 | 941 | ||
942 | // required by base class | 942 | // required by base class |
943 | return TRUE; | 943 | return TRUE; |
944 | } | 944 | } |
945 | 945 | ||
946 | // rect containing swatch area | 946 | // rect containing swatch area |
947 | LLRect swatchRect ( mSwatchRegionLeft, | 947 | LLRect swatchRect ( mSwatchRegionLeft, |
948 | mSwatchRegionTop, | 948 | mSwatchRegionTop, |
949 | mSwatchRegionLeft + mSwatchRegionWidth, | 949 | mSwatchRegionLeft + mSwatchRegionWidth, |
950 | mSwatchRegionTop - mSwatchRegionHeight ); | 950 | mSwatchRegionTop - mSwatchRegionHeight ); |
951 | 951 | ||
952 | setMouseDownInSwatch( FALSE ); | 952 | setMouseDownInSwatch( FALSE ); |
953 | if ( swatchRect.pointInRect ( x, y ) ) | 953 | if ( swatchRect.pointInRect ( x, y ) ) |
954 | { | 954 | { |
955 | setMouseDownInSwatch( TRUE ); | 955 | setMouseDownInSwatch( TRUE ); |
956 | 956 | ||
957 | // required - dont drag windows here. | 957 | // required - dont drag windows here. |
958 | return TRUE; | 958 | return TRUE; |
959 | } | 959 | } |
960 | 960 | ||
961 | // rect containing palette area | 961 | // rect containing palette area |
962 | LLRect paletteRect ( mPaletteRegionLeft, | 962 | LLRect paletteRect ( mPaletteRegionLeft, |
963 | mPaletteRegionTop, | 963 | mPaletteRegionTop, |
964 | mPaletteRegionLeft + mPaletteRegionWidth, | 964 | mPaletteRegionLeft + mPaletteRegionWidth, |
965 | mPaletteRegionTop - mPaletteRegionHeight ); | 965 | mPaletteRegionTop - mPaletteRegionHeight ); |
966 | 966 | ||
967 | if ( paletteRect.pointInRect ( x, y ) ) | 967 | if ( paletteRect.pointInRect ( x, y ) ) |
968 | { | ||
969 | // release keyboard focus so we can change text values | ||
970 | if (gFocusMgr.childHasKeyboardFocus(this)) | ||
968 | { | 971 | { |
969 | // release keyboard focus so we can change text values | 972 | mSelectBtn->setFocus(TRUE); |
970 | if (gFocusMgr.childHasKeyboardFocus(this)) | 973 | } |
971 | { | ||
972 | mSelectBtn->setFocus(TRUE); | ||
973 | } | ||
974 | |||
975 | // calculate which palette index we selected | ||
976 | S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth; | ||
977 | S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight; | ||
978 | 974 | ||
979 | U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c; | 975 | // calculate which palette index we selected |
976 | S32 c = ( ( x - mPaletteRegionLeft ) * numPaletteColumns ) / mPaletteRegionWidth; | ||
977 | S32 r = ( ( y - ( mPaletteRegionTop - mPaletteRegionHeight ) ) * numPaletteRows ) / mPaletteRegionHeight; | ||
980 | 978 | ||
981 | if ( index <= mPalette.size () ) | 979 | U32 index = ( numPaletteRows - r - 1 ) * numPaletteColumns + c; |
982 | { | ||
983 | LLColor4 selected = *mPalette [ index ]; | ||
984 | 980 | ||
985 | setCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] ); | 981 | if ( index <= mPalette.size () ) |
982 | { | ||
983 | LLColor4 selected = *mPalette [ index ]; | ||
986 | 984 | ||
987 | if (mApplyImmediateCheck->get()) | 985 | setCurRgb ( selected [ 0 ], selected [ 1 ], selected [ 2 ] ); |
988 | { | ||
989 | LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); | ||
990 | } | ||
991 | 986 | ||
992 | // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion | 987 | if (mApplyImmediateCheck->get()) |
993 | enableTextCallbacks ( FALSE ); | 988 | { |
994 | updateTextEntry (); | 989 | LLColorSwatchCtrl::onColorChanged ( getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); |
995 | enableTextCallbacks ( TRUE ); | ||
996 | } | 990 | } |
997 | 991 | ||
998 | return TRUE; | 992 | // HACK: turn off the call back wilst we update the text or we recurse ourselves into oblivion |
993 | enableTextCallbacks ( FALSE ); | ||
994 | updateTextEntry (); | ||
995 | enableTextCallbacks ( TRUE ); | ||
999 | } | 996 | } |
997 | |||
998 | return TRUE; | ||
1000 | } | 999 | } |
1000 | |||
1001 | // dispatch to base class for the rest of things | 1001 | // dispatch to base class for the rest of things |
1002 | return LLFloater::handleMouseDown ( x, y, mask ); | 1002 | return ret; |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | ////////////////////////////////////////////////////////////////////////////// | 1005 | ////////////////////////////////////////////////////////////////////////////// |
@@ -1163,7 +1163,7 @@ void | |||
1163 | LLFloaterColorPicker:: | 1163 | LLFloaterColorPicker:: |
1164 | cancelSelection () | 1164 | cancelSelection () |
1165 | { | 1165 | { |
1166 | // restore the previous colour selection | 1166 | // restore the previous color selection |
1167 | setCurRgb ( getOrigR (), getOrigG (), getOrigB () ); | 1167 | setCurRgb ( getOrigR (), getOrigG (), getOrigB () ); |
1168 | 1168 | ||
1169 | // we're going away and when we do and the entry widgets lose focus, they do bad things so turn them off | 1169 | // we're going away and when we do and the entry widgets lose focus, they do bad things so turn them off |