diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llcolorswatch.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llfloatercolorpicker.cpp | 14 | ||||
-rwxr-xr-x | indra/newview/llfloatercolorpicker.h | 7 |
3 files changed, 19 insertions, 4 deletions
diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index a03178adf6..80d810d159 100755 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -292,7 +292,7 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op ) subject->mColor.mV[VALPHA] ); // keep current alpha subject->mColor = updatedColor; subject->setControlValue(updatedColor.getValue()); - + pickerp->setRevertOnCancel(TRUE); if (pick_op == COLOR_CANCEL && subject->mOnCancelCallback) { subject->mOnCancelCallback( subject, LLSD()); diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index 535cb368bd..ec2c9740af 100755 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -173,6 +173,7 @@ void LLFloaterColorPicker::showUI () openFloater(getKey()); setVisible ( TRUE ); setFocus ( TRUE ); + setRevertOnCancel(FALSE); // HACK: if system color picker is required - close the SL one we made and use default system dialog if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) ) @@ -390,7 +391,10 @@ void LLFloaterColorPicker::onClickCancel ( void* data ) if ( self ) { - self->cancelSelection (); + if(self->getRevertOnCancel()) + { + self->cancelSelection (); + } self->closeFloater(); } } @@ -447,8 +451,7 @@ void LLFloaterColorPicker::onImmediateCheck( LLUICtrl* ctrl, void* data) if (self) { gSavedSettings.setBOOL("ApplyColorImmediately", self->mApplyImmediateCheck->get()); - - if (self->mApplyImmediateCheck->get()) + if (self->mApplyImmediateCheck->get() && self->isColorChanged()) { LLColorSwatchCtrl::onColorChanged ( self->getSwatch (), LLColorSwatchCtrl::COLOR_CHANGE ); } @@ -473,6 +476,11 @@ F32 LLFloaterColorPicker::getSwatchTransparency() return getTransparencyType() == TT_ACTIVE ? 1.f : LLFloater::getCurrentTransparency(); } +BOOL LLFloaterColorPicker::isColorChanged() +{ + return ((getOrigR() != getCurR()) || (getOrigG() != getCurG()) || (getOrigB() != getCurB())); +} + ////////////////////////////////////////////////////////////////////////////// // void LLFloaterColorPicker::draw() diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h index 8c16ebdf03..16974a872e 100755 --- a/indra/newview/llfloatercolorpicker.h +++ b/indra/newview/llfloatercolorpicker.h @@ -104,6 +104,11 @@ class LLFloaterColorPicker void setMouseDownInSwatch (BOOL mouse_down_in_swatch); BOOL getMouseDownInSwatch () { return mMouseDownInSwatch; } + void setRevertOnCancel (BOOL revertOnCancel) { mRevertOnCancel = revertOnCancel; }; + BOOL getRevertOnCancel () { return mRevertOnCancel; } + + BOOL isColorChanged (); + // called when text entries (RGB/HSL etc.) are changed by user void onTextEntryChanged ( LLUICtrl* ctrl ); @@ -144,6 +149,8 @@ class LLFloaterColorPicker BOOL mMouseDownInHueRegion; BOOL mMouseDownInSwatch; + BOOL mRevertOnCancel; + const S32 mRGBViewerImageLeft; const S32 mRGBViewerImageTop; const S32 mRGBViewerImageWidth; |