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.cpp71
1 files changed, 31 insertions, 40 deletions
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index 4964f04556..69f1774ff8 100644
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -2,31 +2,25 @@
* @file llfloatercolorpicker.cpp
* @brief Generic system color picker
*
- * $LicenseInfo:firstyear=2004&license=viewergpl$
- *
- * Copyright (c) 2004-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -56,7 +50,6 @@
#include "llpointer.h"
#include "llimage.h"
#include "llmousehandler.h"
-#include "llimagegl.h"
#include "llglheaders.h"
#include "llcheckboxctrl.h"
#include "lltextbox.h"
@@ -80,7 +73,7 @@ const F32 CONTEXT_FADE_TIME = 0.08f;
//////////////////////////////////////////////////////////////////////////////
LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
- : LLFloater(),
+ : LLFloater(LLSD()),
mComponents ( 3 ),
mMouseDownInLumRegion ( FALSE ),
mMouseDownInHueRegion ( FALSE ),
@@ -114,6 +107,8 @@ LLFloaterColorPicker::LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show
mCanApplyImmediately ( show_apply_immediate ),
mContextConeOpacity ( 0.f )
{
+ buildFromFile ( "floater_color_picker.xml");
+
// create user interface for this picker
createUI ();
@@ -134,10 +129,6 @@ LLFloaterColorPicker::~LLFloaterColorPicker()
//
void LLFloaterColorPicker::createUI ()
{
- // build the majority of the gui using the factory builder
- LLUICtrlFactory::getInstance()->buildFloater ( this, "floater_color_picker.xml" );
- setVisible ( FALSE );
-
// create RGB type area (not really RGB but it's got R,G & B in it.,..
LLPointer<LLImageRaw> raw = new LLImageRaw ( mRGBViewerImageWidth, mRGBViewerImageHeight, mComponents );
@@ -161,7 +152,7 @@ void LLFloaterColorPicker::createUI ()
* ( bits + x + y * linesize + 2 ) = ( U8 )( bVal * 255.0f );
}
}
- mRGBImage = new LLImageGL ( (LLImageRaw*)raw, FALSE );
+ mRGBImage = LLViewerTextureManager::getLocalTexture( (LLImageRaw*)raw, FALSE );
gGL.getTexUnit(0)->bind(mRGBImage);
mRGBImage->setAddressMode(LLTexUnit::TAM_CLAMP);
@@ -173,7 +164,7 @@ void LLFloaterColorPicker::createUI ()
// argh!
const std::string s ( codec.str () );
- mPalette.push_back ( new LLColor4 ( gSavedSkinSettings.getColor4 ( s ) ) );
+ mPalette.push_back ( new LLColor4 ( LLUIColorTable::instance().getColor ( s ) ) );
}
}
@@ -563,7 +554,7 @@ void LLFloaterColorPicker::draw()
// create rgb area outline
gl_rect_2d ( mRGBViewerImageLeft,
mRGBViewerImageTop - mRGBViewerImageHeight,
- mRGBViewerImageLeft + mRGBViewerImageWidth,
+ mRGBViewerImageLeft + mRGBViewerImageWidth + 1,
mRGBViewerImageTop,
LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
FALSE );
@@ -588,12 +579,12 @@ void LLFloaterColorPicker::draw()
gl_triangle_2d ( startX, startY,
startX + mLumMarkerSize, startY - mLumMarkerSize,
startX + mLumMarkerSize, startY + mLumMarkerSize,
- LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ), TRUE );
+ LLColor4 ( 0.75f, 0.75f, 0.75f, 1.0f ), TRUE );
// draw luminance slider outline
gl_rect_2d ( mLumRegionLeft,
mLumRegionTop - mLumRegionHeight,
- mLumRegionLeft + mLumRegionWidth,
+ mLumRegionLeft + mLumRegionWidth + 1,
mLumRegionTop,
LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
FALSE );
@@ -609,7 +600,7 @@ void LLFloaterColorPicker::draw()
// draw selected color swatch outline
gl_rect_2d ( mSwatchRegionLeft,
mSwatchRegionTop - mSwatchRegionHeight,
- mSwatchRegionLeft + mSwatchRegionWidth,
+ mSwatchRegionLeft + mSwatchRegionWidth + 1,
mSwatchRegionTop,
LLColor4 ( 0.0f, 0.0f, 0.0f, 1.0f ),
FALSE );
@@ -694,12 +685,12 @@ void LLFloaterColorPicker::drawPalette ()
void LLFloaterColorPicker::updateTextEntry ()
{
// set values in spinners
- childSetValue("rspin", ( getCurR () * 255.0f ) );
- childSetValue("gspin", ( getCurG () * 255.0f ) );
- childSetValue("bspin", ( getCurB () * 255.0f ) );
- childSetValue("hspin", ( getCurH () * 360.0f ) );
- childSetValue("sspin", ( getCurS () * 100.0f ) );
- childSetValue("lspin", ( getCurL () * 100.0f ) );
+ getChild<LLUICtrl>("rspin")->setValue(( getCurR () * 255.0f ) );
+ getChild<LLUICtrl>("gspin")->setValue(( getCurG () * 255.0f ) );
+ getChild<LLUICtrl>("bspin")->setValue(( getCurB () * 255.0f ) );
+ getChild<LLUICtrl>("hspin")->setValue(( getCurH () * 360.0f ) );
+ getChild<LLUICtrl>("sspin")->setValue(( getCurS () * 100.0f ) );
+ getChild<LLUICtrl>("lspin")->setValue(( getCurL () * 100.0f ) );
}
//////////////////////////////////////////////////////////////////////////////
@@ -1017,7 +1008,7 @@ BOOL LLFloaterColorPicker::handleMouseUp ( S32 x, S32 y, MASK mask )
std::ostringstream codec;
codec << "ColorPaletteEntry" << std::setfill ( '0' ) << std::setw ( 2 ) << curEntry + 1;
const std::string s ( codec.str () );
- gSavedSkinSettings.setColor4( s, *mPalette [ curEntry ] );
+ LLUIColorTable::instance().setColor(s, *mPalette [ curEntry ] );
}
}