summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatercolorpicker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatercolorpicker.cpp')
-rw-r--r--indra/newview/llfloatercolorpicker.cpp108
1 files changed, 55 insertions, 53 deletions
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index ba91277c79..dd86c0f2b3 100644
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -68,12 +68,12 @@
//
//////////////////////////////////////////////////////////////////////////////
-LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
+LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, bool show_apply_immediate )
: LLFloater(LLSD()),
mComponents ( 3 ),
- mMouseDownInLumRegion ( FALSE ),
- mMouseDownInHueRegion ( FALSE ),
- mMouseDownInSwatch ( FALSE ),
+ mMouseDownInLumRegion ( false ),
+ mMouseDownInHueRegion ( false ),
+ mMouseDownInSwatch ( false ),
// *TODO: Specify this in XML
mRGBViewerImageLeft ( 140 ),
mRGBViewerImageTop ( 356 ),
@@ -99,7 +99,7 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show
mPaletteRegionWidth ( mLumRegionLeft + mLumRegionWidth - 10 ),
mPaletteRegionHeight ( 40 ),
mSwatch ( swatch ),
- mActive ( TRUE ),
+ mActive ( true ),
mCanApplyImmediately ( show_apply_immediate ),
mContextConeOpacity ( 0.f ),
mContextConeInAlpha ( 0.f ),
@@ -113,8 +113,8 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show
if (!mCanApplyImmediately)
{
- mApplyImmediateCheck->setEnabled(FALSE);
- mApplyImmediateCheck->set(FALSE);
+ mApplyImmediateCheck->setEnabled(false);
+ mApplyImmediateCheck->set(false);
}
mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha");
@@ -135,6 +135,8 @@ void LLFloaterColorPicker::createUI ()
// create RGB type area (not really RGB but it's got R,G & B in it.,..
LLPointer<LLImageRaw> raw = new LLImageRaw ( mRGBViewerImageWidth, mRGBViewerImageHeight, mComponents );
+ LLImageDataLock lock(raw);
+
U8* bits = raw->getData();
S32 linesize = mRGBViewerImageWidth * mComponents;
for ( S32 y = 0; y < mRGBViewerImageHeight; ++y )
@@ -155,7 +157,7 @@ void LLFloaterColorPicker::createUI ()
* ( bits + x + y * linesize + 2 ) = ( U8 )( bVal * 255.0f );
}
}
- mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, FALSE );
+ mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, false );
gGL.getTexUnit(0)->bind(mRGBImage);
mRGBImage->setAddressMode(LLTexUnit::TAM_CLAMP);
@@ -171,15 +173,15 @@ void LLFloaterColorPicker::createUI ()
void LLFloaterColorPicker::showUI ()
{
openFloater(getKey());
- setVisible ( TRUE );
- setFocus ( TRUE );
+ setVisible ( true );
+ setFocus ( true );
// HACK: if system color picker is required - close the SL one we made and use default system dialog
if ( gSavedSettings.getBOOL ( "UseDefaultColorPicker" ) )
{
LLColorSwatchCtrl* swatch = getSwatch ();
- setVisible ( FALSE );
+ setVisible ( false );
// code that will get switched in for default system color picker
if ( swatch )
@@ -209,14 +211,14 @@ void LLFloaterColorPicker::showUI ()
//////////////////////////////////////////////////////////////////////////////
// called after the dialog is rendered
-BOOL LLFloaterColorPicker::postBuild()
+bool LLFloaterColorPicker::postBuild()
{
mCancelBtn = getChild<LLButton>( "cancel_btn" );
mCancelBtn->setClickedCallback ( onClickCancel, this );
mSelectBtn = getChild<LLButton>( "select_btn");
mSelectBtn->setClickedCallback ( onClickSelect, this );
- mSelectBtn->setFocus ( TRUE );
+ mSelectBtn->setFocus ( true );
mPipetteBtn = getChild<LLButton>("color_pipette" );
@@ -237,7 +239,7 @@ BOOL LLFloaterColorPicker::postBuild()
LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterColorPicker::onColorSelect, this, _1));
- return TRUE;
+ return true;
}
//////////////////////////////////////////////////////////////////////////////
@@ -423,7 +425,7 @@ void LLFloaterColorPicker::onClickSelect ( void* data )
void LLFloaterColorPicker::onClickPipette( )
{
- BOOL pipette_active = mPipetteBtn->getToggleState();
+ bool pipette_active = mPipetteBtn->getToggleState();
pipette_active = !pipette_active;
if (pipette_active)
{
@@ -470,8 +472,8 @@ void LLFloaterColorPicker::onColorSelect( const LLTextureEntry& te )
void LLFloaterColorPicker::onMouseCaptureLost()
{
- setMouseDownInHueRegion(FALSE);
- setMouseDownInLumRegion(FALSE);
+ setMouseDownInHueRegion(false);
+ setMouseDownInLumRegion(false);
}
F32 LLFloaterColorPicker::getSwatchTransparency()
@@ -480,7 +482,7 @@ F32 LLFloaterColorPicker::getSwatchTransparency()
return getTransparencyType() == TT_ACTIVE ? 1.f : LLFloater::getCurrentTransparency();
}
-BOOL LLFloaterColorPicker::isColorChanged()
+bool LLFloaterColorPicker::isColorChanged()
{
return ((getOrigR() != getCurR()) || (getOrigG() != getCurG()) || (getOrigB() != getCurB()));
}
@@ -525,7 +527,7 @@ void LLFloaterColorPicker::draw()
mRGBViewerImageLeft + mRGBViewerImageWidth + 1,
mRGBViewerImageTop,
LLColor4 ( 0.0f, 0.0f, 0.0f, alpha ),
- FALSE );
+ false );
// draw luminance slider
for ( S32 y = 0; y < mLumRegionHeight; ++y )
@@ -547,7 +549,7 @@ void LLFloaterColorPicker::draw()
gl_triangle_2d ( startX, startY,
startX + mLumMarkerSize, startY - mLumMarkerSize,
startX + mLumMarkerSize, startY + mLumMarkerSize,
- LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), TRUE );
+ LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), true );
// draw luminance slider outline
gl_rect_2d ( mLumRegionLeft,
@@ -555,7 +557,7 @@ void LLFloaterColorPicker::draw()
mLumRegionLeft + mLumRegionWidth + 1,
mLumRegionTop,
LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
- FALSE );
+ false );
// draw selected color swatch
gl_rect_2d ( mSwatchRegionLeft,
@@ -563,7 +565,7 @@ void LLFloaterColorPicker::draw()
mSwatchRegionLeft + mSwatchRegionWidth,
mSwatchRegionTop,
LLColor4 ( getCurR (), getCurG (), getCurB (), alpha ),
- TRUE );
+ true );
// draw selected color swatch outline
gl_rect_2d ( mSwatchRegionLeft,
@@ -571,7 +573,7 @@ void LLFloaterColorPicker::draw()
mSwatchRegionLeft + mSwatchRegionWidth + 1,
mSwatchRegionTop,
LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
- FALSE );
+ false );
// color palette code is a little more involved so break it out into its' own method
drawPalette ();
@@ -639,8 +641,8 @@ void LLFloaterColorPicker::drawPalette ()
// draw palette entry color
if ( mPalette [ curEntry ] )
{
- gl_rect_2d ( x1 + 2, y1 - 2, x2 - 2, y2 + 2, *mPalette [ curEntry++ ] % alpha, TRUE );
- gl_rect_2d ( x1 + 1, y1 - 1, x2 - 1, y2 + 1, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), FALSE );
+ gl_rect_2d ( x1 + 2, y1 - 2, x2 - 2, y2 + 2, *mPalette [ curEntry++ ] % alpha, true );
+ gl_rect_2d ( x1 + 1, y1 - 1, x2 - 1, y2 + 1, LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), false );
}
}
}
@@ -744,7 +746,7 @@ void LLFloaterColorPicker::onTextEntryChanged ( LLUICtrl* ctrl )
//////////////////////////////////////////////////////////////////////////////
//
-BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
+bool LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
{
if ( xPosIn >= mRGBViewerImageLeft &&
xPosIn <= mRGBViewerImageLeft + mRGBViewerImageWidth &&
@@ -757,7 +759,7 @@ BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
getCurL () );
// indicate a value changed
- return TRUE;
+ return true;
}
else
if ( xPosIn >= mLumRegionLeft &&
@@ -772,15 +774,15 @@ BOOL LLFloaterColorPicker::updateRgbHslFromPoint ( S32 xPosIn, S32 yPosIn )
( ( F32 )yPosIn - ( ( F32 )mRGBViewerImageTop - ( F32 )mRGBViewerImageHeight ) ) / ( F32 )mRGBViewerImageHeight );
// indicate a value changed
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
//////////////////////////////////////////////////////////////////////////////
//
-BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
+bool LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
{
// make it the frontmost
gFloaterView->bringToFront(this);
@@ -795,13 +797,13 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
{
gFocusMgr.setMouseCapture(this);
// mouse button down
- setMouseDownInHueRegion ( TRUE );
+ setMouseDownInHueRegion ( true );
// update all values based on initial click
updateRgbHslFromPoint ( x, y );
// required by base class
- return TRUE;
+ return true;
}
// rect containing RGB area
@@ -814,10 +816,10 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
{
gFocusMgr.setMouseCapture(this);
// mouse button down
- setMouseDownInLumRegion ( TRUE );
+ setMouseDownInLumRegion ( true );
// required by base class
- return TRUE;
+ return true;
}
// rect containing swatch area
@@ -826,13 +828,13 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
mSwatchRegionLeft + mSwatchRegionWidth,
mSwatchRegionTop - mSwatchRegionHeight );
- setMouseDownInSwatch( FALSE );
+ setMouseDownInSwatch( false );
if ( swatchRect.pointInRect ( x, y ) )
{
- setMouseDownInSwatch( TRUE );
+ setMouseDownInSwatch( true );
// required - dont drag windows here.
- return TRUE;
+ return true;
}
// rect containing palette area
@@ -846,7 +848,7 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
// release keyboard focus so we can change text values
if (gFocusMgr.childHasKeyboardFocus(this))
{
- mSelectBtn->setFocus(TRUE);
+ mSelectBtn->setFocus(true);
}
// calculate which palette index we selected
@@ -869,7 +871,7 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
updateTextEntry ();
}
- return TRUE;
+ return true;
}
// dispatch to base class for the rest of things
@@ -879,7 +881,7 @@ BOOL LLFloaterColorPicker::handleMouseDown ( S32 x, S32 y, MASK mask )
//////////////////////////////////////////////////////////////////////////////
//
-BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask )
+bool LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask )
{
// if we're the front most window
if ( isFrontmost () )
@@ -899,7 +901,7 @@ BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask )
clamped_y = llclamp(y, mLumRegionTop - mLumRegionHeight, mLumRegionTop);
}
- // update the stored RGB/HSL values using the mouse position - returns TRUE if RGB was updated
+ // update the stored RGB/HSL values using the mouse position - returns true if RGB was updated
if ( updateRgbHslFromPoint ( clamped_x, clamped_y ) )
{
// update text entry fields
@@ -937,7 +939,7 @@ BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask )
highlightEntry = xOffset + yOffset * numPaletteColumns;
}
- return TRUE;
+ return true;
}
}
@@ -947,7 +949,7 @@ BOOL LLFloaterColorPicker::handleHover ( S32 x, S32 y, MASK mask )
//////////////////////////////////////////////////////////////////////////////
// reverts state once mouse button is released
-BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask )
+bool LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask )
{
getWindow()->setCursor ( UI_CURSOR_ARROW );
@@ -1005,8 +1007,8 @@ BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask )
}
// mouse button not down anymore
- setMouseDownInHueRegion ( FALSE );
- setMouseDownInLumRegion ( FALSE );
+ setMouseDownInHueRegion ( false );
+ setMouseDownInLumRegion ( false );
// mouse button not down in color swatch anymore
mMouseDownInSwatch = false;
@@ -1031,10 +1033,10 @@ void LLFloaterColorPicker::cancelSelection ()
LLColorSwatchCtrl::onColorChanged( getSwatch(), LLColorSwatchCtrl::COLOR_CANCEL );
// hide picker dialog
- this->setVisible ( FALSE );
+ this->setVisible ( false );
}
-void LLFloaterColorPicker::setMouseDownInHueRegion ( BOOL mouse_down_in_region )
+void LLFloaterColorPicker::setMouseDownInHueRegion ( bool mouse_down_in_region )
{
mMouseDownInHueRegion = mouse_down_in_region;
if (mouse_down_in_region)
@@ -1042,12 +1044,12 @@ void LLFloaterColorPicker::setMouseDownInHueRegion ( BOOL mouse_down_in_region )
if (gFocusMgr.childHasKeyboardFocus(this))
{
// get focus out of spinners so that they can update freely
- mSelectBtn->setFocus(TRUE);
+ mSelectBtn->setFocus(true);
}
}
}
-void LLFloaterColorPicker::setMouseDownInLumRegion ( BOOL mouse_down_in_region )
+void LLFloaterColorPicker::setMouseDownInLumRegion ( bool mouse_down_in_region )
{
mMouseDownInLumRegion = mouse_down_in_region;
if (mouse_down_in_region)
@@ -1055,12 +1057,12 @@ void LLFloaterColorPicker::setMouseDownInLumRegion ( BOOL mouse_down_in_region )
if (gFocusMgr.childHasKeyboardFocus(this))
{
// get focus out of spinners so that they can update freely
- mSelectBtn->setFocus(TRUE);
+ mSelectBtn->setFocus(true);
}
}
}
-void LLFloaterColorPicker::setMouseDownInSwatch (BOOL mouse_down_in_swatch)
+void LLFloaterColorPicker::setMouseDownInSwatch (bool mouse_down_in_swatch)
{
mMouseDownInSwatch = mouse_down_in_swatch;
if (mouse_down_in_swatch)
@@ -1068,12 +1070,12 @@ void LLFloaterColorPicker::setMouseDownInSwatch (BOOL mouse_down_in_swatch)
if (gFocusMgr.childHasKeyboardFocus(this))
{
// get focus out of spinners so that they can update freely
- mSelectBtn->setFocus(TRUE);
+ mSelectBtn->setFocus(true);
}
}
}
-void LLFloaterColorPicker::setActive(BOOL active)
+void LLFloaterColorPicker::setActive(bool active)
{
// shut down pipette tool if active
if (!active && mPipetteBtn->getToggleState())