summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorLars Næsbye Christensen <lars@naesbye.dk>2024-03-05 02:46:06 +0100
committerAndrey Lihatskiy <alihatskiy@productengine.com>2024-03-05 15:29:25 +0200
commit62922699eb2cd7fb7589592ebc437d6b2249c15e (patch)
treeb6a6a9cf1dcf93a783c489d63b9d46a79944244b /indra/newview
parentf8530b3d490342d0185a8d07e8718a4417a40212 (diff)
deleted unused code
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llbreastmotion.cpp395
-rw-r--r--indra/newview/llbreastmotion.h154
-rw-r--r--indra/newview/lldensityctrl.cpp225
-rw-r--r--indra/newview/lldensityctrl.h104
-rw-r--r--indra/newview/llface.inl160
-rw-r--r--indra/newview/llfloatereditsky.cpp699
-rw-r--r--indra/newview/llfloatereditwater.cpp526
-rw-r--r--indra/newview/llimpanel.cpp978
-rw-r--r--indra/newview/llimpanel.h212
-rw-r--r--indra/newview/llinventoryclipboard.cpp110
-rw-r--r--indra/newview/llinventoryclipboard.h86
11 files changed, 0 insertions, 3649 deletions
diff --git a/indra/newview/llbreastmotion.cpp b/indra/newview/llbreastmotion.cpp
deleted file mode 100644
index 3a88bab3b3..0000000000
--- a/indra/newview/llbreastmotion.cpp
+++ /dev/null
@@ -1,395 +0,0 @@
-/**
- * @file llbreastmotion.cpp
- * @brief Implementation of LLBreastMotion class.
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-//-----------------------------------------------------------------------------
-// Header Files
-//-----------------------------------------------------------------------------
-#include "llviewerprecompiledheaders.h"
-#include "linden_common.h"
-
-#include "m3math.h"
-#include "v3dmath.h"
-
-#include "llbreastmotion.h"
-#include "llcharacter.h"
-#include "llviewercontrol.h"
-#include "llviewervisualparam.h"
-#include "llvoavatarself.h"
-
-#define MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION 0.f;
-
-#define N_PARAMS 2
-
-// User-set params
-static const std::string breast_param_names_user[N_PARAMS] =
-{
- "Breast_Female_Cleavage_Driver",
- "Breast_Gravity_Driver"
-};
-
-// Params driven by this algorithm
-static const std::string breast_param_names_driven[N_PARAMS] =
-{
- "Breast_Female_Cleavage",
- "Breast_Gravity"
-};
-
-
-
-LLBreastMotion::LLBreastMotion(const LLUUID &id) :
- LLMotion(id),
- mCharacter(NULL)
-{
- mName = "breast_motion";
- mChestState = new LLJointState;
-
- mBreastMassParam = (F32)1.0;
- mBreastDragParam = LLVector3((F32)0.1, (F32)0.1, (F32)0.1);
- mBreastSmoothingParam = (U32)2;
- mBreastGravityParam = (F32)0.0;
-
- mBreastSpringParam = LLVector3((F32)3.0, (F32)0.0, (F32)3.0);
- mBreastGainParam = LLVector3((F32)50.0, (F32)0.0, (F32)50.0);
- mBreastDampingParam = LLVector3((F32)0.3, (F32)0.0, (F32)0.3);
- mBreastMaxVelocityParam = LLVector3((F32)10.0, (F32)0.0, (F32)10.0);
-
- mBreastParamsUser[0] = mBreastParamsUser[1] = mBreastParamsUser[2] = NULL;
- mBreastParamsDriven[0] = mBreastParamsDriven[1] = mBreastParamsDriven[2] = NULL;
-
- mCharLastPosition_world_pt = LLVector3(0,0,0);
- mCharLastVelocity_local_vec = LLVector3(0,0,0);
- mCharLastAcceleration_local_vec = LLVector3(0,0,0);
- mBreastLastPosition_local_pt = LLVector3(0,0,0);
- mBreastLastUpdatePosition_local_pt = LLVector3(0,0,0);
- mBreastVelocity_local_vec = LLVector3(0,0,0);
-}
-
-LLBreastMotion::~LLBreastMotion()
-{
-}
-
-BOOL LLBreastMotion::onActivate()
-{
- return TRUE;
-}
-
-void LLBreastMotion::onDeactivate()
-{
-}
-
-LLMotion::LLMotionInitStatus LLBreastMotion::onInitialize(LLCharacter *character)
-{
- mCharacter = character;
-
- if (!mChestState->setJoint(character->getJoint("mChest")))
- {
- return STATUS_FAILURE;
- }
-
- mChestState->setUsage(LLJointState::ROT);
- addJointState( mChestState );
-
- for (U32 i=0; i < N_PARAMS; i++)
- {
- mBreastParamsUser[i] = NULL;
- mBreastParamsDriven[i] = NULL;
- mBreastParamsMin[i] = 0;
- mBreastParamsMax[i] = 0;
- if (breast_param_names_user[i] != "" && breast_param_names_driven[i] != "")
- {
- mBreastParamsUser[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_user[i].c_str());
- mBreastParamsDriven[i] = (LLViewerVisualParam*)mCharacter->getVisualParam(breast_param_names_driven[i].c_str());
- if (mBreastParamsDriven[i])
- {
- mBreastParamsMin[i] = mBreastParamsDriven[i]->getMinWeight();
- mBreastParamsMax[i] = mBreastParamsDriven[i]->getMaxWeight();
- }
- }
- }
-
- mTimer.reset();
- return STATUS_SUCCESS;
-}
-
-F32 LLBreastMotion::getMinPixelArea()
-{
- return MIN_REQUIRED_PIXEL_AREA_BREAST_MOTION;
-}
-
-
-F32 LLBreastMotion::calculateTimeDelta()
-{
- const F32 time = mTimer.getElapsedTimeF32();
- const F32 time_delta = time - mLastTime;
- mLastTime = time;
- return time_delta;
-}
-
-// Local space means "parameter space".
-LLVector3 LLBreastMotion::toLocal(const LLVector3 &world_vector)
-{
- LLVector3 local_vec(0,0,0);
-
- LLJoint *chest_joint = mChestState->getJoint();
- const LLQuaternion world_rot = chest_joint->getWorldRotation();
-
- // Cleavage
- LLVector3 breast_dir_world_vec = LLVector3(-1,0,0) * world_rot; // -1 b/c cleavage param changes opposite to direction
- breast_dir_world_vec.normalize();
- local_vec[0] = world_vector * breast_dir_world_vec;
-
- // Up-Down Bounce
- LLVector3 breast_up_dir_world_vec = LLVector3(0,0,1) * world_rot;
- breast_up_dir_world_vec.normalize();
- local_vec[1] = world_vector * breast_up_dir_world_vec;
-
- return local_vec;
-}
-
-LLVector3 LLBreastMotion::calculateVelocity_local(const F32 time_delta)
-{
- LLJoint *chest_joint = mChestState->getJoint();
- const LLVector3 world_pos_pt = chest_joint->getWorldPosition();
- const LLQuaternion world_rot = chest_joint->getWorldRotation();
- const LLVector3 last_world_pos_pt = mCharLastPosition_world_pt;
- const LLVector3 char_velocity_world_vec = (world_pos_pt-last_world_pos_pt) / time_delta;
- const LLVector3 char_velocity_local_vec = toLocal(char_velocity_world_vec);
-
- return char_velocity_local_vec;
-}
-
-LLVector3 LLBreastMotion::calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
- const F32 time_delta)
-{
- LLVector3 char_acceleration_local_vec = new_char_velocity_local_vec - mCharLastVelocity_local_vec;
-
- char_acceleration_local_vec =
- char_acceleration_local_vec * 1.0/mBreastSmoothingParam +
- mCharLastAcceleration_local_vec * (mBreastSmoothingParam-1.0)/mBreastSmoothingParam;
-
- mCharLastAcceleration_local_vec = char_acceleration_local_vec;
-
- return char_acceleration_local_vec;
-}
-
-BOOL LLBreastMotion::onUpdate(F32 time, U8* joint_mask)
-{
- // Skip if disabled globally.
- if (!gSavedSettings.getBOOL("AvatarPhysics"))
- {
- return TRUE;
- }
-
- // Higher LOD is better. This controls the granularity
- // and frequency of updates for the motions.
- const F32 lod_factor = LLVOAvatar::sPhysicsLODFactor;
- if (lod_factor == 0)
- {
- return TRUE;
- }
-
- if (mCharacter->getSex() != SEX_FEMALE) return TRUE;
- const F32 time_delta = calculateTimeDelta();
- if (time_delta < .01 || time_delta > 10.0) return TRUE;
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Get all parameters and settings
- //
-
- mBreastMassParam = mCharacter->getVisualParamWeight("Breast_Physics_Mass");
- mBreastSmoothingParam = (U32)(mCharacter->getVisualParamWeight("Breast_Physics_Smoothing"));
- mBreastGravityParam = mCharacter->getVisualParamWeight("Breast_Physics_Gravity");
-
- mBreastSpringParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Spring");
- mBreastGainParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Gain");
- mBreastDampingParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Damping");
- mBreastMaxVelocityParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Max_Velocity");
- mBreastDragParam[0] = mCharacter->getVisualParamWeight("Breast_Physics_Side_Drag");
-
- mBreastSpringParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Spring");
- mBreastGainParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Gain");
- mBreastDampingParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Damping");
- mBreastMaxVelocityParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Max_Velocity");
- mBreastDragParam[1] = mCharacter->getVisualParamWeight("Breast_Physics_UpDown_Drag");
-
-
- // Get the current morph parameters.
- LLVector3 breast_user_local_pt(0,0,0);
- for (U32 i=0; i < N_PARAMS; i++)
- {
- if (mBreastParamsUser[i] != NULL)
- {
- breast_user_local_pt[i] = mBreastParamsUser[i]->getWeight();
- }
- }
-
- LLVector3 breast_current_local_pt = mBreastLastPosition_local_pt;
-
- //
- // End parameters and settings
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate velocity and acceleration in parameter space.
- //
-
- const LLVector3 char_velocity_local_vec = calculateVelocity_local(time_delta);
- const LLVector3 char_acceleration_local_vec = calculateAcceleration_local(char_velocity_local_vec, time_delta);
- mCharLastVelocity_local_vec = char_velocity_local_vec;
-
- LLJoint *chest_joint = mChestState->getJoint();
- mCharLastPosition_world_pt = chest_joint->getWorldPosition();
-
- //
- // End velocity and acceleration
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate the total force
- //
-
- // Spring force is a restoring force towards the original user-set breast position.
- // F = kx
- const LLVector3 spring_length_local = breast_current_local_pt-breast_user_local_pt;
- LLVector3 force_spring_local_vec = -spring_length_local; force_spring_local_vec *= mBreastSpringParam;
-
- // Acceleration is the force that comes from the change in velocity of the torso.
- // F = ma + mg
- LLVector3 force_accel_local_vec = char_acceleration_local_vec * mBreastMassParam;
- const LLVector3 force_gravity_local_vec = toLocal(LLVector3(0,0,1))* mBreastGravityParam * mBreastMassParam;
- force_accel_local_vec += force_gravity_local_vec;
- force_accel_local_vec *= mBreastGainParam;
-
- // Damping is a restoring force that opposes the current velocity.
- // F = -kv
- LLVector3 force_damping_local_vec = -mBreastDampingParam;
- force_damping_local_vec *= mBreastVelocity_local_vec;
-
- // Drag is a force imparted by velocity, intuitively it is similar to wind resistance.
- // F = .5v*v
- LLVector3 force_drag_local_vec = .5*char_velocity_local_vec;
- force_drag_local_vec *= char_velocity_local_vec;
- force_drag_local_vec *= mBreastDragParam[0];
-
- LLVector3 force_net_local_vec =
- force_accel_local_vec +
- force_gravity_local_vec +
- force_spring_local_vec +
- force_damping_local_vec +
- force_drag_local_vec;
-
- //
- // End total force
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Calculate new params
- //
-
- // Calculate the new acceleration based on the net force.
- // a = F/m
- LLVector3 acceleration_local_vec = force_net_local_vec / mBreastMassParam;
- mBreastVelocity_local_vec += acceleration_local_vec;
- mBreastVelocity_local_vec.clamp(-mBreastMaxVelocityParam*100.0, mBreastMaxVelocityParam*100.0);
-
- // Temporary debugging setting to cause all avatars to move, for profiling purposes.
- if (gSavedSettings.getBOOL("AvatarPhysicsTest"))
- {
- mBreastVelocity_local_vec[0] = sin(mTimer.getElapsedTimeF32()*4.0)*5.0;
- mBreastVelocity_local_vec[1] = sin(mTimer.getElapsedTimeF32()*3.0)*5.0;
- }
- // Calculate the new parameters and clamp them to the min/max ranges.
- LLVector3 new_local_pt = breast_current_local_pt + mBreastVelocity_local_vec*time_delta;
- new_local_pt.clamp(mBreastParamsMin,mBreastParamsMax);
-
- // Set the new parameters.
- for (U32 i=0; i < 3; i++)
- {
- // If the param is disabled, just set the param to the user value.
- if (mBreastMaxVelocityParam[i] == 0)
- {
- new_local_pt[i] = breast_user_local_pt[i];
- }
- if (mBreastParamsDriven[i])
- {
- mCharacter->setVisualParamWeight(mBreastParamsDriven[i],
- new_local_pt[i]);
- }
- }
-
- mBreastLastPosition_local_pt = new_local_pt;
-
- //
- // End calculate new params
- ////////////////////////////////////////////////////////////////////////////////
-
-
- ////////////////////////////////////////////////////////////////////////////////
- // Conditionally update the visual params
- //
-
- // Updating the visual params (i.e. what the user sees) is fairly expensive.
- // So only update if the params have changed enough, and also take into account
- // the graphics LOD settings.
-
- // For non-self, if the avatar is small enough visually, then don't update.
- const BOOL is_self = (dynamic_cast<LLVOAvatarSelf *>(this) != NULL);
- if (!is_self)
- {
- const F32 area_for_max_settings = 0.0;
- const F32 area_for_min_settings = 1400.0;
-
- const F32 area_for_this_setting = area_for_max_settings + (area_for_min_settings-area_for_max_settings)*(1.0-lod_factor);
- const F32 pixel_area = fsqrtf(mCharacter->getPixelArea());
- if (pixel_area < area_for_this_setting)
- {
- return TRUE;
- }
- }
-
- // If the parameter hasn't changed enough, then don't update.
- LLVector3 position_diff = mBreastLastUpdatePosition_local_pt-new_local_pt;
- for (U32 i=0; i < 3; i++)
- {
- const F32 min_delta = (1.0-lod_factor)*(mBreastParamsMax[i]-mBreastParamsMin[i])/2.0;
- if (llabs(position_diff[i]) > min_delta)
- {
- mCharacter->updateVisualParams();
- mBreastLastUpdatePosition_local_pt = new_local_pt;
- return TRUE;
- }
- }
-
- //
- // End update visual params
- ////////////////////////////////////////////////////////////////////////////////
-
- return TRUE;
-}
diff --git a/indra/newview/llbreastmotion.h b/indra/newview/llbreastmotion.h
deleted file mode 100644
index d099257a33..0000000000
--- a/indra/newview/llbreastmotion.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * @file llbreastmotion.h
- * @brief Implementation of LLBreastMotion class.
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLBREASTMOTION_H
-#define LL_LLBREASTMOTION_H
-
-//-----------------------------------------------------------------------------
-// Header files
-//-----------------------------------------------------------------------------
-#include "llmotion.h"
-#include "llframetimer.h"
-
-#define BREAST_MOTION_FADEIN_TIME 1.0f
-#define BREAST_MOTION_FADEOUT_TIME 1.0f
-
-class LLViewerVisualParam;
-
-//-----------------------------------------------------------------------------
-// class LLBreastMotion
-//-----------------------------------------------------------------------------
-class LLBreastMotion :
- public LLMotion
-{
-public:
- // Constructor
- LLBreastMotion(const LLUUID &id);
-
- // Destructor
- virtual ~LLBreastMotion();
-
-public:
- //-------------------------------------------------------------------------
- // functions to support MotionController and MotionRegistry
- //-------------------------------------------------------------------------
-
- // static constructor
- // all subclasses must implement such a function and register it
- static LLMotion *create(const LLUUID &id) { return new LLBreastMotion(id); }
-
-public:
- //-------------------------------------------------------------------------
- // animation callbacks to be implemented by subclasses
- //-------------------------------------------------------------------------
-
- // motions must specify whether or not they loop
- virtual bool getLoop() { return true; }
-
- // motions must report their total duration
- virtual F32 getDuration() { return 0.0; }
-
- // motions must report their "ease in" duration
- virtual F32 getEaseInDuration() { return BREAST_MOTION_FADEIN_TIME; }
-
- // motions must report their "ease out" duration.
- virtual F32 getEaseOutDuration() { return BREAST_MOTION_FADEOUT_TIME; }
-
- // called to determine when a motion should be activated/deactivated based on avatar pixel coverage
- virtual F32 getMinPixelArea();
-
- // motions must report their priority
- virtual LLJoint::JointPriority getPriority() { return LLJoint::MEDIUM_PRIORITY; }
-
- virtual LLMotionBlendType getBlendType() { return ADDITIVE_BLEND; }
-
- // run-time (post constructor) initialization,
- // called after parameters have been set
- // must return true to indicate success and be available for activation
- virtual LLMotionInitStatus onInitialize(LLCharacter *character);
-
- // called when a motion is activated
- // must return TRUE to indicate success, or else
- // it will be deactivated
- virtual bool onActivate();
-
- // called per time step
- // must return TRUE while it is active, and
- // must return FALSE when the motion is completed.
- virtual bool onUpdate(F32 time, U8* joint_mask);
-
- // called when a motion is deactivated
- virtual void onDeactivate();
-
-protected:
- LLVector3 toLocal(const LLVector3 &world_vector);
- LLVector3 calculateVelocity_local(const F32 time_delta);
- LLVector3 calculateAcceleration_local(const LLVector3 &new_char_velocity_local_vec,
- const F32 time_delta);
- F32 calculateTimeDelta();
-private:
- //-------------------------------------------------------------------------
- // joint states to be animated
- //-------------------------------------------------------------------------
- LLPointer<LLJointState> mChestState;
- LLCharacter* mCharacter;
-
-
- //-------------------------------------------------------------------------
- // miscellaneous parameters
- //-------------------------------------------------------------------------
- LLViewerVisualParam *mBreastParamsUser[3];
- LLViewerVisualParam *mBreastParamsDriven[3];
- LLVector3 mBreastParamsMin;
- LLVector3 mBreastParamsMax;
-
- LLVector3 mCharLastPosition_world_pt; // Last position of the avatar
- LLVector3 mCharLastVelocity_local_vec; // How fast the character is moving
- LLVector3 mCharLastAcceleration_local_vec; // Change in character velocity
-
- LLVector3 mBreastLastPosition_local_pt; // Last parameters for breast
- LLVector3 mBreastVelocity_local_vec; // How fast the breast params are moving
- LLVector3 mBreastLastUpdatePosition_local_pt; // Last parameters when visual update was sent
-
-
- F32 mBreastMassParam;
- F32 mBreastGravityParam;
- U32 mBreastSmoothingParam;
-
- LLVector3 mBreastSpringParam;
- LLVector3 mBreastDampingParam;
- LLVector3 mBreastGainParam;
- LLVector3 mBreastMaxVelocityParam;
- LLVector3 mBreastDragParam;
-
- LLFrameTimer mTimer;
- F32 mLastTime;
-
- U32 mFileTicks;
-};
-
-#endif // LL_LLBREASTMOTION_H
-
diff --git a/indra/newview/lldensityctrl.cpp b/indra/newview/lldensityctrl.cpp
deleted file mode 100644
index 298a309e7c..0000000000
--- a/indra/newview/lldensityctrl.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/**
-* @file lldensityctrl.cpp
-* @brief Control for specifying density over a height range for sky settings.
-*
-* $LicenseInfo:firstyear=2011&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2011, 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.
-*
-* 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.
-*
-* 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
-*
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
-* $/LicenseInfo$
-*/
-
-#include "llviewerprecompiledheaders.h"
-
-#include "lldensityctrl.h"
-
-#include "llslider.h"
-#include "llsliderctrl.h"
-#include "llsettingssky.h"
-
-static LLDefaultChildRegistry::Register<LLDensityCtrl> register_density_control("densityctrl");
-
-const std::string LLDensityCtrl::DENSITY_RAYLEIGH("density_rayleigh");
-const std::string LLDensityCtrl::DENSITY_MIE("density_mie");
-const std::string LLDensityCtrl::DENSITY_ABSORPTION("density_absorption");
-
-namespace
-{
- const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL("level_exponential");
- const std::string FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE("exponential_scale");
- const std::string FIELD_SKY_DENSITY_PROFILE_LINEAR("level_linear");
- const std::string FIELD_SKY_DENSITY_PROFILE_CONSTANT("level_constant");
- const std::string FIELD_SKY_DENSITY_MAX_ALTITUDE("max_altitude");
- const std::string FIELD_SKY_DENSITY_ANISO_FACTOR("aniso_factor");
- const std::string FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL("aniso_factor_label");
-}
-
-const std::string& LLDensityCtrl::NameForDensityProfileType(DensityProfileType t)
-{
- switch (t)
- {
- case Rayleigh: return DENSITY_RAYLEIGH;
- case Mie: return DENSITY_MIE;
- case Absorption: return DENSITY_ABSORPTION;
- default:
- break;
- }
-
- llassert(false);
- return DENSITY_RAYLEIGH;
-}
-
-LLDensityCtrl::Params::Params()
-: image_density_feedback("image_density_feedback")
-, lbl_exponential("label_exponential")
-, lbl_exponential_scale("label_exponential_scale")
-, lbl_linear("label_linear")
-, lbl_constant("label_constant")
-, lbl_max_altitude("label_max_altitude")
-, lbl_aniso_factor("label_aniso_factor")
-, profile_type(LLDensityCtrl::Rayleigh)
-{
-}
-
-LLDensityCtrl::LLDensityCtrl(const Params& params)
-: mProfileType(params.profile_type)
-, mImgDensityFeedback(params.image_density_feedback)
-{
-
-}
-
-LLSD LLDensityCtrl::getProfileConfig()
-{
- LLSD config;
- switch (mProfileType)
- {
- case Rayleigh: return mSkySettings->getRayleighConfigs();
- case Mie: return mSkySettings->getMieConfigs();
- case Absorption: return mSkySettings->getAbsorptionConfigs();
- default:
- break;
- }
- llassert(false);
- return config;
-}
-
-BOOL LLDensityCtrl::postBuild()
-{
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialChanged(); });
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onExponentialScaleFactorChanged(); });
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onLinearChanged(); });
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onConstantChanged(); });
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMaxAltitudeChanged(); });
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAnisoFactorChanged(); });
-
- if (mProfileType != Mie)
- {
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR_LABEL)->setValue(false);
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setVisible(false);
- }
-
- return TRUE;
-}
-
-void LLDensityCtrl::setEnabled(BOOL enabled)
-{
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setEnabled(enabled);
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setEnabled(enabled);
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setEnabled(enabled);
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setEnabled(enabled);
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setEnabled(enabled);
-
- if (mProfileType == Mie)
- {
- getChild<LLUICtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setEnabled(enabled);
- }
-}
-
-void LLDensityCtrl::refresh()
-{
- if (!mSkySettings)
- {
- setAllChildrenEnabled(FALSE);
- setEnabled(FALSE);
- return;
- }
-
- setEnabled(TRUE);
- setAllChildrenEnabled(TRUE);
-
- LLSD config = getProfileConfig();
-
- getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM]);
- getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR]);
- getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM]);
- getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM]);
- getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->setValue(config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH]);
-
- if (mProfileType == Mie)
- {
- getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->setValue(config[LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR]);
- }
-}
-
-void LLDensityCtrl::updateProfile()
-{
- F32 exponential_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL)->getValueF32();
- F32 exponential_scale = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_EXPONENTIAL_SCALE)->getValueF32();
- F32 linear_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_LINEAR)->getValueF32();
- F32 constant_term = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_PROFILE_CONSTANT)->getValueF32();
- F32 max_alt = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MAX_ALTITUDE)->getValueF32();
- F32 aniso_factor = 0.0f;
-
- if (mProfileType == Mie)
- {
- aniso_factor = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ANISO_FACTOR)->getValueF32();
- }
-
- LLSD profile = LLSettingsSky::createSingleLayerDensityProfile(max_alt, exponential_term, exponential_scale, linear_term, constant_term, aniso_factor);
-
- switch (mProfileType)
- {
- case Rayleigh: mSkySettings->setRayleighConfigs(profile); break;
- case Mie: mSkySettings->setMieConfigs(profile); break;
- case Absorption: mSkySettings->setAbsorptionConfigs(profile); break;
- default:
- break;
- }
-}
-
-void LLDensityCtrl::onExponentialChanged()
-{
- updateProfile();
- updatePreview();
-}
-
-void LLDensityCtrl::onExponentialScaleFactorChanged()
-{
- updateProfile();
- updatePreview();
-}
-
-void LLDensityCtrl::onLinearChanged()
-{
- updateProfile();
- updatePreview();
-}
-
-void LLDensityCtrl::onConstantChanged()
-{
- updateProfile();
- updatePreview();
-}
-
-void LLDensityCtrl::onMaxAltitudeChanged()
-{
- updateProfile();
- updatePreview();
-}
-
-void LLDensityCtrl::onAnisoFactorChanged()
-{
- updateProfile();
-}
-
-void LLDensityCtrl::updatePreview()
-{
- // AdvancedAtmospherics TODO
- // Generate image according to current density profile
-}
-
diff --git a/indra/newview/lldensityctrl.h b/indra/newview/lldensityctrl.h
deleted file mode 100644
index 789022803c..0000000000
--- a/indra/newview/lldensityctrl.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
-* @file lldensityctrl.h
-* @brief Control for specifying density over a height range for sky settings.
-*
-* $LicenseInfo:firstyear=2011&license=viewerlgpl$
-* Second Life Viewer Source Code
-* Copyright (C) 2011, 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.
-*
-* 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.
-*
-* 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
-*
-* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
-* $/LicenseInfo$
-*/
-
-#ifndef LLDENSITY_CTRL_H
-#define LLDENSITY_CTRL_H
-
-#include "lluictrl.h"
-#include "llsettingssky.h"
-#include "lltextbox.h"
-#include "llsliderctrl.h"
-
-class LLDensityCtrl : public LLUICtrl
-{
-public:
- static const std::string DENSITY_RAYLEIGH;
- static const std::string DENSITY_MIE;
- static const std::string DENSITY_ABSORPTION;
-
- // Type of density profile this tab is updating
- enum DensityProfileType
- {
- Rayleigh,
- Mie,
- Absorption
- };
-
- static const std::string& NameForDensityProfileType(DensityProfileType t);
-
- struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
- {
- Optional<LLTextBox::Params> lbl_exponential,
- lbl_exponential_scale,
- lbl_linear,
- lbl_constant,
- lbl_max_altitude,
- lbl_aniso_factor;
-
- Optional<LLSliderCtrl::Params> exponential_slider,
- exponential_scale_slider,
- linear_slider,
- constant_slider,
- aniso_factor_slider;
-
- Optional<LLUIImage*> image_density_feedback;
-
- DensityProfileType profile_type;
- Params();
- };
-
- virtual BOOL postBuild() override;
- virtual void setEnabled(BOOL enabled) override;
-
- void setProfileType(DensityProfileType t) { mProfileType = t; }
-
- void refresh();
- void updateProfile();
-
- LLSettingsSky::ptr_t getSky() const { return mSkySettings; }
- void setSky(const LLSettingsSky::ptr_t &sky) { mSkySettings = sky; refresh(); }
-
-protected:
- friend class LLUICtrlFactory;
- LLDensityCtrl(const Params&);
-
- LLSD getProfileConfig();
- void updatePreview();
-
-private:
- void onExponentialChanged();
- void onExponentialScaleFactorChanged();
- void onLinearChanged();
- void onConstantChanged();
- void onMaxAltitudeChanged();
- void onAnisoFactorChanged();
-
- DensityProfileType mProfileType = Rayleigh;
- LLUIImage* mImgDensityFeedback = nullptr;
- LLSettingsSky::ptr_t mSkySettings;
-};
-
-#endif LLDENSITY_CTRL_H
diff --git a/indra/newview/llface.inl b/indra/newview/llface.inl
deleted file mode 100644
index c37b77d2cd..0000000000
--- a/indra/newview/llface.inl
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * @file llface.inl
- * @brief Inline functions for LLFace
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLFACE_INL
-#define LL_LLFACE_INL
-
-#include "llglheaders.h"
-#include "llrender.h"
-
-inline BOOL LLFace::getDirty() const
-{
- return (mGeneration != mDrawPoolp->mGeneration);
-}
-
-inline void LLFace::clearDirty()
-{
- mGeneration = mDrawPoolp->mGeneration;
-}
-
-inline const LLTextureEntry* LLFace::getTextureEntry() const
-{
- return mVObjp->getTE(mTEOffset);
-}
-
-inline LLDrawPool* LLFace::getPool() const
-{
- return mDrawPoolp;
-}
-
-inline S32 LLFace::getStride() const
-{
- return mDrawPoolp->getStride();
-}
-
-inline LLDrawable* LLFace::getDrawable() const
-{
- return mDrawablep;
-}
-
-inline LLViewerObject* LLFace::getViewerObject() const
-{
- return mVObjp;
-}
-
-inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors)
-{
- if (!mGeomCount)
- {
- return -1;
- }
- LLColor4U *colorp = NULL;
- if (isState(BACKLIST))
- {
- if (!mBackupMem)
- {
- printDebugInfo();
- LL_ERRS() << "No backup memory for face" << LL_ENDL;
- }
- colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride()));
- colors = colorp;
- return 0;
- }
- else
- {
- llassert(mGeomIndex >= 0);
- if (!mDrawPoolp->getColorStrider(colors, mGeomIndex))
- {
- printDebugInfo();
- LL_ERRS() << "No color pointer for a color strider!" << LL_ENDL;
- }
- mDrawPoolp->setDirtyColors();
- return mGeomIndex;
- }
-}
-
-inline S32 LLFace::getTexCoords (LLStrider<LLVector2> &texCoords, S32 pass )
-{
- if (!mGeomCount)
- {
- return -1;
- }
- if (isState(BACKLIST))
- {
- if (!mBackupMem)
- {
- printDebugInfo();
- LL_ERRS() << "No backup memory for face" << LL_ENDL;
- }
- texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]);
- texCoords.setStride( mDrawPoolp->getStride());
- return 0;
- }
- else
- {
- llassert(mGeomIndex >= 0);
- mDrawPoolp->getTexCoordStrider(texCoords, mGeomIndex, pass );
- mDrawPoolp->setDirty();
- return mGeomIndex;
- }
-}
-
-inline S32 LLFace::getIndices (U32* &indicesp)
-{
- if (isState(BACKLIST))
- {
- indicesp = (U32*)mBackupMem;
- return 0;
- }
- else
- {
- indicesp = mDrawPoolp->getIndices(mIndicesIndex);
- llassert(mGeomIndex >= 0);
- return mGeomIndex;
- }
-}
-
-inline const U32* LLFace::getRawIndices() const
-{
- llassert(!isState(BACKLIST));
-
- return &mDrawPoolp->mIndices[mIndicesIndex];
-}
-
-
-inline void LLFace::bindTexture(S32 stage) const
-{
- if (mTexture)
- {
- mTexture->bindTexture(stage);
- }
- else
- {
- LLImageGL::unbindTexture(stage, GL_TEXTURE_2D);
- }
-}
-
-#endif
diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp
deleted file mode 100644
index 2d5e86869d..0000000000
--- a/indra/newview/llfloatereditsky.cpp
+++ /dev/null
@@ -1,699 +0,0 @@
-/**
- * @file llfloatereditsky.cpp
- * @brief Floater to create or edit a sky preset
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llfloatereditsky.h"
-
-#include <boost/make_shared.hpp>
-
-// libs
-#include "llbutton.h"
-#include "llcheckboxctrl.h"
-#include "llcombobox.h"
-#include "llmultisliderctrl.h"
-#include "llnotifications.h"
-#include "llnotificationsutil.h"
-#include "llsliderctrl.h"
-#include "lltabcontainer.h"
-#include "lltimectrl.h"
-#include "lljoystickbutton.h"
-
-// newview
-#include "llagent.h"
-#include "llcolorswatch.h"
-#include "llregioninfomodel.h"
-#include "llviewerregion.h"
-
-#include "v3colorutil.h"
-#include "llenvironment.h"
-#include "llenvadapters.h"
-
-namespace
-{
- const F32 WL_SUN_AMBIENT_SLIDER_SCALE(3.0f);
- const F32 WL_BLUE_HORIZON_DENSITY_SCALE(2.0f);
- const F32 WL_CLOUD_SLIDER_SCALE(1.0f);
-}
-
-
-static F32 time24_to_sun_pos(F32 time24)
-{
- F32 sun_pos = fmodf((time24 - 6) / 24.0f, 1.0f);
- if (sun_pos < 0) ++sun_pos;
- return sun_pos;
-}
-
-LLFloaterEditSky::LLFloaterEditSky(const LLSD &key):
- LLFloater(key),
- mSkyPresetNameEditor(NULL),
- mSkyPresetCombo(NULL),
- mMakeDefaultCheckBox(NULL),
- mSaveButton(NULL),
- mSkyAdapter()
-{
-}
-
-// virtual
-BOOL LLFloaterEditSky::postBuild()
-{
- mSkyPresetNameEditor = getChild<LLLineEditor>("sky_preset_name");
- mSkyPresetCombo = getChild<LLComboBox>("sky_preset_combo");
- mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
- mSaveButton = getChild<LLButton>("save");
- mSkyAdapter = boost::make_shared<LLSkySettingsAdapter>();
-
- LLEnvironment::instance().setSkyListChange(boost::bind(&LLFloaterEditSky::onSkyPresetListChange, this));
-
- initCallbacks();
-
-// // Create the sun position scrubber on the slider.
-// getChild<LLMultiSliderCtrl>("WLSunPos")->addSlider(12.f);
-
- return TRUE;
-}
-
-// virtual
-void LLFloaterEditSky::onOpen(const LLSD& key)
-{
- bool new_preset = isNewPreset();
- std::string param = key.asString();
- std::string floater_title = getString(std::string("title_") + param);
- std::string hint = getString(std::string("hint_" + param));
-
- // Update floater title.
- setTitle(floater_title);
-
- // Update the hint at the top.
- getChild<LLUICtrl>("hint")->setValue(hint);
-
- // Hide the hint to the right of the combo if we're invoked to create a new preset.
- getChildView("note")->setVisible(!new_preset);
-
- // Switch between the sky presets combobox and preset name input field.
- mSkyPresetCombo->setVisible(!new_preset);
- mSkyPresetNameEditor->setVisible(new_preset);
-
- reset();
-}
-
-// virtual
-void LLFloaterEditSky::onClose(bool app_quitting)
-{
- if (!app_quitting) // there's no point to change environment if we're quitting
- {
- LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
- LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
- }
-}
-
-// virtual
-void LLFloaterEditSky::draw()
-{
- syncControls();
- LLFloater::draw();
-}
-
-void LLFloaterEditSky::initCallbacks(void)
-{
- // *TODO: warn user if a region environment update comes while we're editing a region sky preset.
-
- mSkyPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this), NULL);
- mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditSky::onSkyPresetSelected, this));
- mSkyPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditSky::onSkyPresetNameEdited, this));
-
- mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnSave, this));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditSky::onBtnCancel, this));
-
- // Connect to region info updates.
- LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditSky::onRegionInfoUpdate, this));
-
- // sunlight
- getChild<LLUICtrl>("WLSunlight")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mSunlight));
-
- // glow
- getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowRMoved, this, _1, &mSkyAdapter->mGlow));
- getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterEditSky::onGlowBMoved, this, _1, &mSkyAdapter->mGlow));
-
- // time of day
-// getChild<LLUICtrl>("WLSunPos")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm)); // multi-slider
-// getChild<LLTimeCtrl>("WLDayTime")->setCommitCallback(boost::bind(&LLFloaterEditSky::onTimeChanged, this)); // time ctrl
-// getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunMoved, this, _1, &mSkyAdapter->mLightnorm));
- getChild<LLJoystickQuaternion>("WLSunRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onSunRotationChanged, this));
- getChild<LLJoystickQuaternion>("WLMoonRotation")->setCommitCallback(boost::bind(&LLFloaterEditSky::onMoonRotationChanged, this));
-
- // Clouds
-
- // Cloud Color
- getChild<LLUICtrl>("WLCloudColor")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlMoved, this, _1, &mSkyAdapter->mCloudColor));
-
- // Cloud
- getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudMain));
- getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudMain));
- getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudMain));
-
- // Cloud Detail
- getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlRMoved, this, _1, &mSkyAdapter->mCloudDetail));
- getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlGMoved, this, _1, &mSkyAdapter->mCloudDetail));
- getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterEditSky::onColorControlBMoved, this, _1, &mSkyAdapter->mCloudDetail));
-
- // Cloud extras
- getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudCoverage));
- getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mCloudScale));
- getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollXMoved, this, _1));
- getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterEditSky::onCloudScrollYMoved, this, _1));
-
-
- // Dome
- getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterEditSky::onFloatControlMoved, this, _1, &mSkyAdapter->mWLGamma));
- getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterEditSky::onStarAlphaMoved, this, _1));
-}
-
-//=================================================================================================
-
-void LLFloaterEditSky::syncControls()
-{
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- mEditSettings = psky;
-
- std::string name = psky->getName();
-
- mSkyPresetNameEditor->setText(name);
- mSkyPresetCombo->setValue(name);
-
- // Lighting
-
- // sunlight
- mSkyAdapter->mSunlight.setColor3( psky->getSunlightColor() );
- setColorSwatch("WLSunlight", mSkyAdapter->mSunlight, WL_SUN_AMBIENT_SLIDER_SCALE);
-
- // glow
- mSkyAdapter->mGlow.setColor3( psky->getGlow() );
- childSetValue("WLGlowR", 2 - mSkyAdapter->mGlow.getRed() / 20.0f);
- childSetValue("WLGlowB", -mSkyAdapter->mGlow.getBlue() / 5.0f);
-
-// LLSettingsSky::azimalt_t azal = psky->getSunRotationAzAl();
-//
-// F32 time24 = sun_pos_to_time24(azal.second / F_TWO_PI);
-// getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
-// getChild<LLTimeCtrl>("WLDayTime")->setTime24(time24);
-// childSetValue("WLEastAngle", azal.first / F_TWO_PI);
- getChild<LLJoystickQuaternion>("WLSunRotation")->setRotation(psky->getSunRotation());
- getChild<LLJoystickQuaternion>("WLMoonRotation")->setRotation(psky->getMoonRotation());
-
- // Clouds
-
- // Cloud Color
- mSkyAdapter->mCloudColor.setColor3( psky->getCloudColor() );
- setColorSwatch("WLCloudColor", mSkyAdapter->mCloudColor, WL_CLOUD_SLIDER_SCALE);
-
- // Cloud
- mSkyAdapter->mCloudMain.setColor3( psky->getCloudPosDensity1() );
- childSetValue("WLCloudX", mSkyAdapter->mCloudMain.getRed());
- childSetValue("WLCloudY", mSkyAdapter->mCloudMain.getGreen());
- childSetValue("WLCloudDensity", mSkyAdapter->mCloudMain.getBlue());
-
- // Cloud Detail
- mSkyAdapter->mCloudDetail.setColor3( psky->getCloudPosDensity2() );
- childSetValue("WLCloudDetailX", mSkyAdapter->mCloudDetail.getRed());
- childSetValue("WLCloudDetailY", mSkyAdapter->mCloudDetail.getGreen());
- childSetValue("WLCloudDetailDensity", mSkyAdapter->mCloudDetail.getBlue());
-
- // Cloud extras
- mSkyAdapter->mCloudCoverage = psky->getCloudShadow();
- mSkyAdapter->mCloudScale = psky->getCloudScale();
- childSetValue("WLCloudCoverage", (F32) mSkyAdapter->mCloudCoverage);
- childSetValue("WLCloudScale", (F32) mSkyAdapter->mCloudScale);
-
- // cloud scrolling
- LLVector2 scroll_rate = psky->getCloudScrollRate();
-
- // LAPRAS: These should go away...
- childDisable("WLCloudLockX");
- childDisable("WLCloudLockY");
-
- // disable if locked, enable if not
- childEnable("WLCloudScrollX");
- childEnable("WLCloudScrollY");
-
- // *HACK cloud scrolling is off my an additive of 10
- childSetValue("WLCloudScrollX", scroll_rate[0] - 10.0f);
- childSetValue("WLCloudScrollY", scroll_rate[1] - 10.0f);
-
- // Tweak extras
-
- mSkyAdapter->mWLGamma = psky->getGamma();
- childSetValue("WLGamma", (F32) mSkyAdapter->mWLGamma);
-
- childSetValue("WLStarAlpha", psky->getStarBrightness());
-}
-
-void LLFloaterEditSky::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k)
-{
- // Set the value, dividing it by <k> first.
- LLColor4 color = from_ctrl.getColor4();
- getChild<LLColorSwatchCtrl>(name)->set(color / k);
-}
-
-// color control callbacks
-void LLFloaterEditSky::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
-{
- LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
- LLColor4 color_vec(swatch->get().mV);
-
- // Multiply RGB values by the appropriate factor.
- F32 k = WL_CLOUD_SLIDER_SCALE;
- if (color_ctrl->getIsSunOrAmbientColor())
- {
- k = WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- else if (color_ctrl->getIsBlueHorizonOrDensity())
- {
- k = WL_BLUE_HORIZON_DENSITY_SCALE;
- }
-
- color_vec *= k; // intensity isn't affected by the multiplication
-
- // Set intensity to maximum of the RGB values.
- color_vec.mV[3] = color_max(color_vec);
-
- // Apply the new RGBI value.
- color_ctrl->setColor4(color_vec);
- color_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditSky::onColorControlRMoved(LLUICtrl* ctrl, void* userdata)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
-
- F32 red_value = sldr_ctrl->getValueF32();
- F32 k = 1.0f;
-
- if (color_ctrl->getIsSunOrAmbientColor())
- {
- k = WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- if (color_ctrl->getIsBlueHorizonOrDensity())
- {
- k = WL_BLUE_HORIZON_DENSITY_SCALE;
- }
- color_ctrl->setRed(red_value * k);
-
- adjustIntensity(color_ctrl, red_value, k);
- color_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditSky::onColorControlGMoved(LLUICtrl* ctrl, void* userdata)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
-
- F32 green_value = sldr_ctrl->getValueF32();
- F32 k = 1.0f;
-
- if (color_ctrl->getIsSunOrAmbientColor())
- {
- k = WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- if (color_ctrl->getIsBlueHorizonOrDensity())
- {
- k = WL_BLUE_HORIZON_DENSITY_SCALE;
- }
- color_ctrl->setGreen(green_value * k);
-
- adjustIntensity(color_ctrl, green_value, k);
- color_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditSky::onColorControlBMoved(LLUICtrl* ctrl, void* userdata)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
-
- F32 blue_value = sldr_ctrl->getValueF32();
- F32 k = 1.0f;
-
- if (color_ctrl->getIsSunOrAmbientColor())
- {
- k = WL_SUN_AMBIENT_SLIDER_SCALE;
- }
- if (color_ctrl->getIsBlueHorizonOrDensity())
- {
- k = WL_BLUE_HORIZON_DENSITY_SCALE;
- }
- color_ctrl->setBlue(blue_value * k);
-
- adjustIntensity(color_ctrl, blue_value, k);
- color_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditSky::adjustIntensity(WLColorControl *ctrl, F32 val, F32 scale)
-{
- if (ctrl->getHasSliderName())
- {
- LLColor4 color = ctrl->getColor4();
- F32 i = color_max(color) / scale;
- ctrl->setIntensity(i);
- std::string name = ctrl->getSliderName();
- name.append("I");
-
- childSetValue(name, i);
- }
-}
-
-
-/// GLOW SPECIFIC CODE
-void LLFloaterEditSky::onGlowRMoved(LLUICtrl* ctrl, void* userdata)
-{
-
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
-
- // scaled by 20
- color_ctrl->setRed((2 - sldr_ctrl->getValueF32()) * 20);
-
- color_ctrl->update(mEditSettings);
-}
-
-/// \NOTE that we want NEGATIVE (-) B
-void LLFloaterEditSky::onGlowBMoved(LLUICtrl* ctrl, void* userdata)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
-
- /// \NOTE that we want NEGATIVE (-) B and NOT by 20 as 20 is too big
- color_ctrl->setBlue(-sldr_ctrl->getValueF32() * 5);
-
- color_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditSky::onFloatControlMoved(LLUICtrl* ctrl, void* userdata)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- WLFloatControl * floatControl = static_cast<WLFloatControl *>(userdata);
-
- floatControl->setValue(sldr_ctrl->getValueF32() / floatControl->getMult());
-
- floatControl->update(mEditSettings);
-}
-
-
-// Lighting callbacks
-
-// time of day
-void LLFloaterEditSky::onSunMoved(LLUICtrl* ctrl, void* userdata)
-{
- LLMultiSliderCtrl* sun_msldr = getChild<LLMultiSliderCtrl>("WLSunPos");
- LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle");
- LLTimeCtrl* time_ctrl = getChild<LLTimeCtrl>("WLDayTime");
- WLColorControl* color_ctrl = static_cast<WLColorControl *>(userdata);
-
- F32 time24 = sun_msldr->getCurSliderValue();
- time_ctrl->setTime24(time24); // sync the time ctrl with the new sun position
-
- // get the two angles
- F32 azimuth = F_TWO_PI * east_sldr->getValueF32();
- F32 altitude = F_TWO_PI * time24_to_sun_pos(time24);
- mEditSettings->setSunRotation(azimuth, altitude);
- mEditSettings->setMoonRotation(azimuth + F_PI, -altitude);
-
- LLVector4 sunnorm( mEditSettings->getSunDirection(), 1.f );
-
- color_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditSky::onTimeChanged()
-{
- F32 time24 = getChild<LLTimeCtrl>("WLDayTime")->getTime24();
- getChild<LLMultiSliderCtrl>("WLSunPos")->setCurSliderValue(time24, TRUE);
- onSunMoved(getChild<LLUICtrl>("WLSunPos"), &(mSkyAdapter->mLightnorm));
-}
-
-void LLFloaterEditSky::onSunRotationChanged()
-{
- LLJoystickQuaternion* sun_spinner = getChild<LLJoystickQuaternion>("WLSunRotation");
- LLQuaternion sunrot(sun_spinner->getRotation());
-
- mEditSettings->setSunRotation(sunrot);
-}
-
-void LLFloaterEditSky::onMoonRotationChanged()
-{
- LLJoystickQuaternion* moon_spinner = getChild<LLJoystickQuaternion>("WLMoonRotation");
- LLQuaternion moonrot(moon_spinner->getRotation());
-
- mEditSettings->setMoonRotation(moonrot);
-}
-
-void LLFloaterEditSky::onStarAlphaMoved(LLUICtrl* ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- mEditSettings->setStarBrightness(sldr_ctrl->getValueF32());
-}
-
-// Clouds
-void LLFloaterEditSky::onCloudScrollXMoved(LLUICtrl* ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
- // *HACK all cloud scrolling is off by an additive of 10.
- mEditSettings->setCloudScrollRateX(sldr_ctrl->getValueF32() + 10.0f);
-}
-
-void LLFloaterEditSky::onCloudScrollYMoved(LLUICtrl* ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- // *HACK all cloud scrolling is off by an additive of 10.
- mEditSettings->setCloudScrollRateY(sldr_ctrl->getValueF32() + 10.0f);
-}
-
-//=================================================================================================
-
-void LLFloaterEditSky::reset()
-{
- if (isNewPreset())
- {
- mSkyPresetNameEditor->setValue(LLSD());
- mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
- }
- else
- {
- refreshSkyPresetsList();
-
- // Disable controls until a sky preset to edit is selected.
- enableEditing(false);
- }
-}
-
-bool LLFloaterEditSky::isNewPreset() const
-{
- return mKey.asString() == "new";
-}
-
-void LLFloaterEditSky::refreshSkyPresetsList()
-{
- mSkyPresetCombo->removeall();
-
- LLEnvironment::list_name_id_t list = LLEnvironment::instance().getSkyList();
-
- for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it)
- {
- mSkyPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
- }
-
- mSkyPresetCombo->setLabel(getString("combo_label"));
-}
-
-void LLFloaterEditSky::enableEditing(bool enable)
-{
- // Enable/disable the tab and their contents.
- LLTabContainer* tab_container = getChild<LLTabContainer>("WindLight Tabs");
- tab_container->setEnabled(enable);
- for (S32 i = 0; i < tab_container->getTabCount(); ++i)
- {
- tab_container->enableTabButton(i, enable);
- tab_container->getPanelByIndex(i)->setCtrlsEnabled(enable);
- }
-
- // Enable/disable saving.
- mSaveButton->setEnabled(enable);
- mMakeDefaultCheckBox->setEnabled(enable);
-}
-
-void LLFloaterEditSky::saveRegionSky()
-{
-#if 0
- LLWLParamKey key(getSelectedSkyPreset());
- llassert(key.scope == LLEnvKey::SCOPE_REGION);
-
- LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL;
- LLWLParamManager& wl_mgr = LLWLParamManager::instance();
- wl_mgr.mCurParams.mName = key.name;
- wl_mgr.setParamSet(key, wl_mgr.mCurParams);
-
- // *TODO: save to cached region settings.
- LL_WARNS("Windlight") << "Saving region sky is not fully implemented yet" << LL_ENDL;
-#endif
-}
-
-std::string LLFloaterEditSky::getSelectedPresetName() const
-{
- std::string name;
- if (mSkyPresetNameEditor->getVisible())
- {
- name = mSkyPresetNameEditor->getText();
- }
- else
- {
- LLSD combo_val = mSkyPresetCombo->getValue();
- name = combo_val[0].asString();
- }
-
- return name;
-}
-
-void LLFloaterEditSky::onSkyPresetNameEdited()
-{
- std::string name = mSkyPresetNameEditor->getText();
- LLSettingsWater::ptr_t psky = LLEnvironment::instance().getCurrentWater();
-
- psky->setName(name);
-}
-
-void LLFloaterEditSky::onSkyPresetSelected()
-{
- std::string name;
-
- name = getSelectedPresetName();
-
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().findSkyByName(name);
-
- if (!psky)
- {
- LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL;
- enableEditing(false);
- return;
- }
-
- psky = psky->buildClone();
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, psky);
- mEditSettings = psky;
-
- syncControls();
- enableEditing(true);
-
-}
-
-bool LLFloaterEditSky::onSaveAnswer(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- // If they choose save, do it. Otherwise, don't do anything
- if (option == 0)
- {
- onSaveConfirmed();
- }
-
- return false;
-}
-
-void LLFloaterEditSky::onSaveConfirmed()
-{
- // Save currently displayed water params to the selected preset.
- std::string name = mEditSettings->getName();
-
- LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
-
- LLEnvironment::instance().addSky(mEditSettings);
-
- // Change preference if requested.
- if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
- {
- LL_DEBUGS("Windlight") << name << " is now the new preferred sky preset" << LL_ENDL;
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
- }
-
- closeFloater();
-}
-
-void LLFloaterEditSky::onBtnSave()
-{
- LLEnvironment::instance().addSky(mEditSettings);
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
-
- closeFloater();
-}
-
-void LLFloaterEditSky::onBtnCancel()
-{
- closeFloater();
-}
-
-void LLFloaterEditSky::onSkyPresetListChange()
-{
- refreshSkyPresetsList();
-}
-
-void LLFloaterEditSky::onRegionSettingsChange()
-{
-#if 0
- // If creating a new sky, don't bother.
- if (isNewPreset())
- {
- return;
- }
-
- if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION) // if editing a region sky
- {
- // reset the floater to its initial state
- reset();
-
- // *TODO: Notify user?
- }
- else // editing a local sky
- {
- refreshSkyPresetsList();
- }
-#endif
-}
-
-void LLFloaterEditSky::onRegionInfoUpdate()
-{
-#if 0
- bool can_edit = true;
-
- // If we've selected a region sky preset for editing.
- if (getSelectedSkyPreset().scope == LLEnvKey::SCOPE_REGION)
- {
- // check whether we have the access
- can_edit = LLEnvManagerNew::canEditRegionSettings();
- }
-
- enableEditing(can_edit);
-#endif
-}
diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp
deleted file mode 100644
index c44ae7faca..0000000000
--- a/indra/newview/llfloatereditwater.cpp
+++ /dev/null
@@ -1,526 +0,0 @@
-/**
- * @file llfloatereditwater.cpp
- * @brief Floater to create or edit a water preset
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llfloatereditwater.h"
-
-#include <boost/make_shared.hpp>
-
-// libs
-#include "llbutton.h"
-#include "llcheckboxctrl.h"
-#include "llcolorswatch.h"
-#include "llcombobox.h"
-//#include "llnotifications.h"
-#include "llnotificationsutil.h"
-#include "llsliderctrl.h"
-#include "lltexturectrl.h"
-
-// newview
-#include "llagent.h"
-#include "llregioninfomodel.h"
-#include "llviewerregion.h"
-
-#include "llenvironment.h"
-#include "llsettingswater.h"
-#include "llenvadapters.h"
-
-#include "v3colorutil.h"
-
-#undef max // Fixes a Windows compiler error
-
-LLFloaterEditWater::LLFloaterEditWater(const LLSD &key):
- LLFloater(key),
- mWaterPresetNameEditor(NULL),
- mWaterPresetCombo(NULL),
- mMakeDefaultCheckBox(NULL),
- mSaveButton(NULL),
- mWaterAdapter()
-{
-}
-
-// virtual
-BOOL LLFloaterEditWater::postBuild()
-{
- mWaterPresetNameEditor = getChild<LLLineEditor>("water_preset_name");
- mWaterPresetCombo = getChild<LLComboBox>("water_preset_combo");
- mMakeDefaultCheckBox = getChild<LLCheckBoxCtrl>("make_default_cb");
- mSaveButton = getChild<LLButton>("save");
-
- mWaterAdapter = boost::make_shared<LLWatterSettingsAdapter>();
-
- LLEnvironment::instance().setWaterListChange(boost::bind(&LLFloaterEditWater::onWaterPresetListChange, this));
-
- initCallbacks();
- refreshWaterPresetsList();
- syncControls();
-
- return TRUE;
-}
-
-// virtual
-void LLFloaterEditWater::onOpen(const LLSD& key)
-{
- bool new_preset = isNewPreset();
- std::string param = key.asString();
- std::string floater_title = getString(std::string("title_") + param);
- std::string hint = getString(std::string("hint_" + param));
-
- // Update floater title.
- setTitle(floater_title);
-
- // Update the hint at the top.
- getChild<LLUICtrl>("hint")->setValue(hint);
-
- // Hide the hint to the right of the combo if we're invoked to create a new preset.
- getChildView("note")->setVisible(!new_preset);
-
- // Switch between the water presets combobox and preset name input field.
- mWaterPresetCombo->setVisible(!new_preset);
- mWaterPresetNameEditor->setVisible(new_preset);
-
- reset();
-}
-
-// virtual
-void LLFloaterEditWater::onClose(bool app_quitting)
-{
- if (!app_quitting) // there's no point to change environment if we're quitting
- {
- LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT);
- LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
- }
-}
-
-// virtual
-void LLFloaterEditWater::draw()
-{
- syncControls();
- LLFloater::draw();
-}
-
-void LLFloaterEditWater::initCallbacks(void)
-{
- mWaterPresetNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this), NULL);
- mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterEditWater::onWaterPresetSelected, this));
- mWaterPresetCombo->setTextEntryCallback(boost::bind(&LLFloaterEditWater::onWaterPresetNameEdited, this));
-
- mSaveButton->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnSave, this));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterEditWater::onBtnCancel, this));
-
- // Connect to region info updates.
- LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditWater::onRegionInfoUpdate, this));
-
- //-------------------------------------------------------------------------
-
- getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterEditWater::onColorControlMoved, this, _1, &mWaterAdapter->mFogColor));
-
- // fog density
- getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterEditWater::onExpFloatControlMoved, this, _1, &mWaterAdapter->mFogDensity));
- getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mUnderWaterFogMod));
-
- // blue density
- getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlXMoved, this, _1, &mWaterAdapter->mNormalScale));
- getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlYMoved, this, _1, &mWaterAdapter->mNormalScale));
- getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector3ControlZMoved, this, _1, &mWaterAdapter->mNormalScale));
-
- // fresnel
- getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelScale));
- getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mFresnelOffset));
-
- // scale above/below
- getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleAbove));
- getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mScaleBelow));
-
- // blur mult
- getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterEditWater::onFloatControlMoved, this, _1, &mWaterAdapter->mBlurMultiplier));
-
- // wave direction
- getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave1Dir));
- getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave1Dir));
- getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlXMoved, this, _1, &mWaterAdapter->mWave2Dir));
- getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterEditWater::onVector2ControlYMoved, this, _1, &mWaterAdapter->mWave2Dir));
-
- LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("WaterNormalMap");
- texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL);
- texture_ctrl->setCommitCallback(boost::bind(&LLFloaterEditWater::onNormalMapPicked, this, _1));
-}
-
-//=============================================================================
-
-void LLFloaterEditWater::syncControls()
-{
- // *TODO: Eliminate slow getChild() calls.
-
- LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
- mEditSettings = pwater;
-
- std::string name = pwater->getName();
- mWaterPresetNameEditor->setText(name);
- mWaterPresetCombo->setValue(name);
-
- //getChild<LLUICtrl>("WaterGlow")->setValue(col.mV[3]);
- getChild<LLColorSwatchCtrl>("WaterFogColor")->set(LLColor4(pwater->getWaterFogColor()));
-
- // fog and wavelets
- mWaterAdapter->mFogDensity = pwater->getWaterFogDensity();
- getChild<LLUICtrl>("WaterFogDensity")->setValue(mWaterAdapter->mFogDensity.getExp());
-
- mWaterAdapter->mUnderWaterFogMod = pwater->getFogMod();
- getChild<LLUICtrl>("WaterUnderWaterFogMod")->setValue(static_cast<F32>(mWaterAdapter->mUnderWaterFogMod));
-
- mWaterAdapter->mNormalScale = pwater->getNormalScale();
- getChild<LLUICtrl>("WaterNormalScaleX")->setValue(mWaterAdapter->mNormalScale.getX());
- getChild<LLUICtrl>("WaterNormalScaleY")->setValue(mWaterAdapter->mNormalScale.getY());
- getChild<LLUICtrl>("WaterNormalScaleZ")->setValue(mWaterAdapter->mNormalScale.getZ());
-
- // Fresnel
- mWaterAdapter->mFresnelScale = pwater->getFresnelScale();
- getChild<LLUICtrl>("WaterFresnelScale")->setValue(static_cast<F32>(mWaterAdapter->mFresnelScale));
- mWaterAdapter->mFresnelOffset = pwater->getFresnelOffset();
- getChild<LLUICtrl>("WaterFresnelOffset")->setValue(static_cast<F32>(mWaterAdapter->mFresnelOffset));
-
- // Scale Above/Below
- mWaterAdapter->mScaleAbove = pwater->getScaleAbove();
- getChild<LLUICtrl>("WaterScaleAbove")->setValue(static_cast<F32>(mWaterAdapter->mScaleAbove));
- mWaterAdapter->mScaleBelow = pwater->getScaleBelow();
- getChild<LLUICtrl>("WaterScaleBelow")->setValue(static_cast<F32>(mWaterAdapter->mScaleBelow));
-
- // blur mult
- mWaterAdapter->mBlurMultiplier = pwater->getBlurMultiplier();
- getChild<LLUICtrl>("WaterBlurMult")->setValue(static_cast<F32>(mWaterAdapter->mBlurMultiplier));
-
- // wave directions
- mWaterAdapter->mWave1Dir = pwater->getWave1Dir();
- getChild<LLUICtrl>("WaterWave1DirX")->setValue(mWaterAdapter->mWave1Dir.getU());
- getChild<LLUICtrl>("WaterWave1DirY")->setValue(mWaterAdapter->mWave1Dir.getV());
-
- mWaterAdapter->mWave2Dir = pwater->getWave2Dir();
- getChild<LLUICtrl>("WaterWave2DirX")->setValue(mWaterAdapter->mWave2Dir.getU());
- getChild<LLUICtrl>("WaterWave2DirY")->setValue(mWaterAdapter->mWave2Dir.getV());
-
- LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
- textCtrl->setImageAssetID(pwater->getNormalMapID());
-}
-
-
-// vector control callbacks
-void LLFloaterEditWater::onVector3ControlXMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- vector_ctrl->setX( sldr_ctrl->getValueF32() );
- vector_ctrl->update(mEditSettings);
-}
-
-// vector control callbacks
-void LLFloaterEditWater::onVector3ControlYMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- vector_ctrl->setY(sldr_ctrl->getValueF32());
- vector_ctrl->update(mEditSettings);
-}
-
-// vector control callbacks
-void LLFloaterEditWater::onVector3ControlZMoved(LLUICtrl* ctrl, WLVect3Control* vector_ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- vector_ctrl->setZ(sldr_ctrl->getValueF32());
- vector_ctrl->update(mEditSettings);
-}
-
-
-// vector control callbacks
-void LLFloaterEditWater::onVector2ControlXMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- vector_ctrl->setU(sldr_ctrl->getValueF32());
- vector_ctrl->update(mEditSettings);
-}
-
-// vector control callbacks
-void LLFloaterEditWater::onVector2ControlYMoved(LLUICtrl* ctrl, WLVect2Control* vector_ctrl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- vector_ctrl->setV(sldr_ctrl->getValueF32());
- vector_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditWater::onFloatControlMoved(LLUICtrl* ctrl, WLFloatControl* floatControl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- floatControl->setValue(sldr_ctrl->getValueF32());
- floatControl->update(mEditSettings);
-}
-
-void LLFloaterEditWater::onExpFloatControlMoved(LLUICtrl* ctrl, WLXFloatControl* expFloatControl)
-{
- LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(ctrl);
-
- expFloatControl->setExp(sldr_ctrl->getValueF32());
- expFloatControl->update(mEditSettings);
-}
-
-void LLFloaterEditWater::onColorControlMoved(LLUICtrl* ctrl, WLColorControl* color_ctrl)
-{
- LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
- color_ctrl->setColor4( swatch->get() );
- color_ctrl->update(mEditSettings);
-}
-
-void LLFloaterEditWater::onNormalMapPicked(LLUICtrl* ctrl)
-{
- LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl);
- LLUUID textID = textCtrl->getImageAssetID();
- mEditSettings->setNormalMapID(textID);
-}
-
-//=============================================================================
-
-void LLFloaterEditWater::reset()
-{
- if (isNewPreset())
- {
- mWaterPresetNameEditor->setValue(LLSD());
- mSaveButton->setEnabled(FALSE); // will be enabled as soon as users enters a name
- }
- else
- {
- refreshWaterPresetsList();
-
- // Disable controls until a water preset to edit is selected.
- enableEditing(false);
- }
-}
-
-bool LLFloaterEditWater::isNewPreset() const
-{
- return mKey.asString() == "new";
-}
-
-void LLFloaterEditWater::refreshWaterPresetsList()
-{
- mWaterPresetCombo->removeall();
-
- LLEnvironment::list_name_id_t list = LLEnvironment::instance().getWaterList();
-
- for (LLEnvironment::list_name_id_t::iterator it = list.begin(); it != list.end(); ++it)
- {
- mWaterPresetCombo->add((*it).first, llsd::array((*it).first, (*it).second));
- }
-
- mWaterPresetCombo->setLabel(getString("combo_label"));
-}
-
-void LLFloaterEditWater::enableEditing(bool enable)
-{
- // Enable/disable water controls.
- getChild<LLPanel>("panel_water_preset")->setCtrlsEnabled(enable);
-
- // Enable/disable saving.
- mSaveButton->setEnabled(enable);
- mMakeDefaultCheckBox->setEnabled(enable);
-}
-
-void LLFloaterEditWater::saveRegionWater()
-{
-#if 0
- llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water
-
- LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL;
-
- //LLWaterParamSet region_water = water_mgr.mCurParams;
-
- // *TODO: save to cached region settings.
- LL_WARNS("Windlight") << "Saving region water is not fully implemented yet" << LL_ENDL;
-#endif
-}
-
-#if 0
-std::string LLFloaterEditWater::getCurrentPresetName() const
-{
- std::string name;
- LLEnvKey::EScope scope;
- getSelectedPreset(name, scope);
- return name;
-}
-#endif
-
-#if 0
-LLEnvKey::EScope LLFloaterEditWater::getCurrentScope() const
-{
- std::string name;
- LLEnvKey::EScope scope;
- getSelectedPreset(name, scope);
- return scope;
-}
-#endif
-
-std::string LLFloaterEditWater::getSelectedPresetName() const
-{
- std::string name;
- if (mWaterPresetNameEditor->getVisible())
- {
- name = mWaterPresetNameEditor->getText();
- }
- else
- {
- LLSD combo_val = mWaterPresetCombo->getValue();
- name = combo_val[0].asString();
- }
-
- return name;
-}
-
-void LLFloaterEditWater::onWaterPresetNameEdited()
-{
- std::string name = mWaterPresetNameEditor->getText();
- LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
-
- pwater->setName(name);
-#if 0
- // Disable saving a water preset having empty name.
- mSaveButton->setEnabled(!getCurrentPresetName().empty());
-#endif
-}
-
-void LLFloaterEditWater::onWaterPresetSelected()
-{
- std::string name;
-
- name = getSelectedPresetName();
-
- LLSettingsWater::ptr_t pwater = LLEnvironment::instance().findWaterByName(name);
-
- if (!pwater)
- {
- LL_WARNS("WATEREDIT") << "Could not find water preset" << LL_ENDL;
- enableEditing(false);
- return;
- }
-
- pwater = pwater->buildClone();
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, pwater);
- mEditSettings = pwater;
-
- syncControls();
- enableEditing(true);
-}
-
-bool LLFloaterEditWater::onSaveAnswer(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- // If they choose save, do it. Otherwise, don't do anything
- if (option == 0)
- {
- onSaveConfirmed();
- }
-
- return false;
-}
-
-void LLFloaterEditWater::onSaveConfirmed()
-{
- // Save currently displayed water params to the selected preset.
- std::string name = mEditSettings->getName();
-
- LL_DEBUGS("Windlight") << "Saving sky preset " << name << LL_ENDL;
-
- LLEnvironment::instance().addWater(mEditSettings);
-
- // Change preference if requested.
- if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue())
- {
- LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL;
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
- }
-
- closeFloater();
-}
-
-void LLFloaterEditWater::onBtnSave()
-{
- LLEnvironment::instance().addWater(mEditSettings);
- LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, mEditSettings);
-
- closeFloater();
-}
-
-void LLFloaterEditWater::onBtnCancel()
-{
- closeFloater();
-}
-
-void LLFloaterEditWater::onWaterPresetListChange()
-{
- refreshWaterPresetsList();
-}
-
-void LLFloaterEditWater::onRegionSettingsChange()
-{
-#if 0
- // If creating a new preset, don't bother.
- if (isNewPreset())
- {
- return;
- }
-
- if (getCurrentScope() == LLEnvKey::SCOPE_REGION) // if editing region water
- {
- // reset the floater to its initial state
- reset();
-
- // *TODO: Notify user?
- }
- else // editing a local preset
- {
- refreshWaterPresetsList();
- }
-#endif
-}
-
-void LLFloaterEditWater::onRegionInfoUpdate()
-{
-#if 0
- bool can_edit = true;
-
- // If we've selected the region water for editing.
- if (getCurrentScope() == LLEnvKey::SCOPE_REGION)
- {
- // check whether we have the access
- can_edit = LLEnvManagerNew::canEditRegionSettings();
- }
-
- enableEditing(can_edit);
-#endif
-}
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
deleted file mode 100644
index c194dc05b0..0000000000
--- a/indra/newview/llimpanel.cpp
+++ /dev/null
@@ -1,978 +0,0 @@
-/**
- * @file llimpanel.cpp
- * @brief LLIMPanel class definition
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llimpanel.h"
-
-#include "indra_constants.h"
-#include "llfloaterreg.h"
-#include "llfocusmgr.h"
-#include "llfontgl.h"
-#include "llrect.h"
-#include "llerror.h"
-#include "llmultifloater.h"
-#include "llstring.h"
-#include "message.h"
-#include "lltextbox.h"
-
-#include "llagent.h"
-#include "llbutton.h"
-#include "llcallingcard.h"
-#include "llchannelmanager.h"
-#include "llchat.h"
-#include "llchiclet.h"
-#include "llconsole.h"
-#include "llgroupactions.h"
-#include "llfloater.h"
-#include "llfloateractivespeakers.h"
-#include "llavataractions.h"
-#include "llinventory.h"
-#include "llinventorymodel.h"
-#include "llfloaterinventory.h"
-#include "lliconctrl.h"
-#include "llkeyboard.h"
-#include "lllineeditor.h"
-#include "llpanelimcontrolpanel.h"
-#include "llrecentpeople.h"
-#include "llresmgr.h"
-#include "lltooldraganddrop.h"
-#include "lltrans.h"
-#include "lltabcontainer.h"
-#include "llviewertexteditor.h"
-#include "llviewermessage.h"
-#include "llviewerstats.h"
-#include "llviewercontrol.h"
-#include "lluictrlfactory.h"
-#include "llviewerwindow.h"
-#include "llvoicechannel.h"
-#include "lllogchat.h"
-#include "llweb.h"
-#include "llhttpclient.h"
-#include "llmutelist.h"
-#include "llstylemap.h"
-#include "llappviewer.h"
-
-//
-// Constants
-//
-const S32 LINE_HEIGHT = 16;
-const S32 MIN_WIDTH = 200;
-const S32 MIN_HEIGHT = 130;
-
-//
-// Statics
-//
-//
-static std::string sTitleString = "Instant Message with [NAME]";
-static std::string sTypingStartString = "[NAME]: ...";
-static std::string sSessionStartString = "Starting session with [NAME] please wait.";
-
-
-//
-// LLFloaterIMPanel
-//
-
-LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label,
- const LLUUID& session_id,
- const LLUUID& other_participant_id,
- const std::vector<LLUUID>& ids,
- EInstantMessage dialog)
-: LLFloater(session_id),
- mInputEditor(NULL),
- mHistoryEditor(NULL),
- mSessionUUID(session_id),
- mSessionLabel(session_label),
- mSessionInitialized(FALSE),
- mSessionStartMsgPos(0),
- mOtherParticipantUUID(other_participant_id),
- mDialog(dialog),
- mSessionInitialTargetIDs(ids),
- mTyping(FALSE),
- mOtherTyping(FALSE),
- mTypingLineStartIndex(0),
- mSentTypingState(TRUE),
- mNumUnreadMessages(0),
- mShowSpeakersOnConnect(TRUE),
- mTextIMPossible(TRUE),
- mProfileButtonEnabled(TRUE),
- mCallBackEnabled(TRUE),
- mSpeakerPanel(NULL),
- mFirstKeystrokeTimer(),
- mLastKeystrokeTimer()
-{
- std::string xml_filename;
- switch(mDialog)
- {
- case IM_SESSION_GROUP_START:
- mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
- xml_filename = "floater_instant_message_group.xml";
- break;
- case IM_SESSION_INVITE:
- mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
- if (gAgent.isInGroup(mSessionUUID))
- {
- xml_filename = "floater_instant_message_group.xml";
- }
- else // must be invite to ad hoc IM
- {
- xml_filename = "floater_instant_message_ad_hoc.xml";
- }
- break;
- case IM_SESSION_P2P_INVITE:
- xml_filename = "floater_instant_message.xml";
- break;
- case IM_SESSION_CONFERENCE_START:
- mFactoryMap["active_speakers_panel"] = LLCallbackMap(createSpeakersPanel, this);
- xml_filename = "floater_instant_message_ad_hoc.xml";
- break;
- // just received text from another user
- case IM_NOTHING_SPECIAL:
-
- xml_filename = "floater_instant_message.xml";
-
- mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionUUID);
- mProfileButtonEnabled = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID);
- mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID);
- break;
- default:
- LL_WARNS() << "Unknown session type" << LL_ENDL;
- xml_filename = "floater_instant_message.xml";
- break;
- }
-
- LLUICtrlFactory::getInstance()->buildFloater(this, xml_filename, NULL);
-
- setTitle(mSessionLabel);
- mInputEditor->setMaxTextLength(DB_IM_MSG_STR_LEN);
- // enable line history support for instant message bar
- mInputEditor->setEnableLineHistory(TRUE);
-
- //*TODO we probably need the same "awaiting message" thing in LLFloaterIMSession
- LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionUUID);
- if (!im_session)
- {
- llerror("im session with id " + mSessionUUID.asString() + " does not exist!", 0);
- return;
- }
-
- mSessionInitialized = im_session->mSessionInitialized;
- if (!mSessionInitialized)
- {
- //locally echo a little "starting session" message
- LLUIString session_start = sSessionStartString;
-
- session_start.setArg("[NAME]", getTitle());
- mSessionStartMsgPos =
- mHistoryEditor->getWText().length();
-
- addHistoryLine(
- session_start,
- LLUIColorTable::instance().getColor("SystemChatColor"),
- false);
- }
-}
-
-
-LLFloaterIMPanel::~LLFloaterIMPanel()
-{
- //delete focus lost callback
- mFocusCallbackConnection.disconnect();
-}
-
-BOOL LLFloaterIMPanel::postBuild()
-{
- setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2));
-
- mInputEditor = getChild<LLLineEditor>("chat_editor");
- mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
- mFocusCallbackConnection = mInputEditor->setFocusLostCallback( boost::bind(onInputEditorFocusLost, _1, this));
- mInputEditor->setKeystrokeCallback( onInputEditorKeystroke, this );
- mInputEditor->setCommitCallback( onCommitChat, this );
- mInputEditor->setCommitOnFocusLost( FALSE );
- mInputEditor->setRevertOnEsc( FALSE );
- mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
-
- childSetAction("profile_callee_btn", onClickProfile, this);
- childSetAction("group_info_btn", onClickGroupInfo, this);
-
- childSetAction("start_call_btn", onClickStartCall, this);
- childSetAction("end_call_btn", onClickEndCall, this);
- childSetAction("send_btn", onClickSend, this);
- childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this);
-
- childSetAction("moderator_kick_speaker", onKickSpeaker, this);
- //LLButton* close_btn = getChild<LLButton>("close_btn");
- //close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this);
-
- mHistoryEditor = getChild<LLViewerTextEditor>("im_history");
-
- if ( IM_SESSION_GROUP_START == mDialog )
- {
- childSetEnabled("profile_btn", FALSE);
- }
-
- if(!mProfileButtonEnabled)
- {
- childSetEnabled("profile_callee_btn", FALSE);
- }
-
- sTitleString = getString("title_string");
- sTypingStartString = getString("typing_start_string");
- sSessionStartString = getString("session_start_string");
-
- if (mSpeakerPanel)
- {
- mSpeakerPanel->refreshSpeakers();
- }
-
- if (mDialog == IM_NOTHING_SPECIAL)
- {
- childSetAction("mute_btn", onClickMuteVoice, this);
- childSetCommitCallback("speaker_volume", onVolumeChange, this);
- }
-
- setDefaultBtn("send_btn");
- return TRUE;
-}
-
-void* LLFloaterIMPanel::createSpeakersPanel(void* data)
-{
- LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)data;
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(floaterp->mSessionUUID);
- floaterp->mSpeakerPanel = new LLPanelActiveSpeakers(speaker_mgr, TRUE);
- return floaterp->mSpeakerPanel;
-}
-
-//static
-void LLFloaterIMPanel::onClickMuteVoice(void* user_data)
-{
- LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
- if (floaterp)
- {
- BOOL is_muted = LLMuteList::getInstance()->isMuted(floaterp->mOtherParticipantUUID, LLMute::flagVoiceChat);
-
- LLMute mute(floaterp->mOtherParticipantUUID, floaterp->getTitle(), LLMute::AGENT);
- if (!is_muted)
- {
- LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat);
- }
- else
- {
- LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat);
- }
- }
-}
-
-//static
-void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
-{
- LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
- if (floaterp)
- {
- LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
- }
-}
-
-
-// virtual
-void LLFloaterIMPanel::draw()
-{
- LLViewerRegion* region = gAgent.getRegion();
-
- BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
- && mSessionInitialized
- && LLVoiceClient::getInstance()->voiceEnabled()
- && mCallBackEnabled;
-
- // hide/show start call and end call buttons
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
- if (!voice_channel)
- return;
-
- childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
- childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
- childSetEnabled("start_call_btn", enable_connect);
- childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
-
- LLPointer<LLSpeaker> self_speaker;
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
- if (speaker_mgr)
- {
- self_speaker = speaker_mgr->findSpeaker(gAgent.getID());
- }
- if(!mTextIMPossible)
- {
- mInputEditor->setEnabled(FALSE);
- mInputEditor->setLabel(getString("unavailable_text_label"));
- }
- else if (self_speaker.notNull() && self_speaker->mModeratorMutedText)
- {
- mInputEditor->setEnabled(FALSE);
- mInputEditor->setLabel(getString("muted_text_label"));
- }
- else
- {
- mInputEditor->setEnabled(TRUE);
- mInputEditor->setLabel(getString("default_text_label"));
- }
-
- // show speakers window when voice first connects
- if (mShowSpeakersOnConnect && voice_channel->isActive())
- {
- childSetVisible("active_speakers_panel", TRUE);
- mShowSpeakersOnConnect = FALSE;
- }
- childSetValue("toggle_active_speakers_btn", childIsVisible("active_speakers_panel"));
-
- if (mTyping)
- {
- // Time out if user hasn't typed for a while.
- if (mLastKeystrokeTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS)
- {
- setTyping(FALSE);
- }
-
- // If we are typing, and it's been a little while, send the
- // typing indicator
- if (!mSentTypingState
- && mFirstKeystrokeTimer.getElapsedTimeF32() > 1.f)
- {
- sendTypingState(TRUE);
- mSentTypingState = TRUE;
- }
- }
-
- // use embedded panel if available
- if (mSpeakerPanel)
- {
- if (mSpeakerPanel->getVisible())
- {
- mSpeakerPanel->refreshSpeakers();
- }
- }
- else
- {
- // refresh volume and mute checkbox
- childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
- childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
-
- childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
- childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
- }
- LLFloater::draw();
-}
-
-class LLSessionInviteResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(LLSessionInviteResponder);
-public:
- LLSessionInviteResponder(const LLUUID& session_id)
- {
- mSessionID = session_id;
- }
-
-protected:
- void httpFailure()
- {
- LL_WARNS() << "Error inviting all agents to session " << dumpResponse() << LL_ENDL;
- //throw something back to the viewer here?
- }
-
-private:
- LLUUID mSessionID;
-};
-
-BOOL LLFloaterIMPanel::inviteToSession(const std::vector<LLUUID>& ids)
-{
- LLViewerRegion* region = gAgent.getRegion();
- if (!region)
- {
- return FALSE;
- }
-
- S32 count = ids.size();
-
- if( isInviteAllowed() && (count > 0) )
- {
- LL_INFOS() << "LLFloaterIMPanel::inviteToSession() - inviting participants" << LL_ENDL;
-
- std::string url = region->getCapability("ChatSessionRequest");
-
- LLSD data;
-
- data["params"] = LLSD::emptyArray();
- for (int i = 0; i < count; i++)
- {
- data["params"].append(ids[i]);
- }
-
- data["method"] = "invite";
- data["session-id"] = mSessionUUID;
- LLHTTPClient::post(
- url,
- data,
- new LLSessionInviteResponder(
- mSessionUUID));
- }
- else
- {
- LL_INFOS() << "LLFloaterIMPanel::inviteToSession -"
- << " no need to invite agents for "
- << mDialog << LL_ENDL;
- // successful add, because everyone that needed to get added
- // was added.
- }
-
- return TRUE;
-}
-
-void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4& color, bool log_to_file, const LLUUID& source, const std::string& name)
-{
- // start tab flashing when receiving im for background session from user
- if (source != LLUUID::null)
- {
- LLMultiFloater* hostp = getHost();
- if( !isInVisibleChain()
- && hostp
- && source != gAgent.getID())
- {
- hostp->setFloaterFlashing(this, TRUE);
- }
- }
-
- // Now we're adding the actual line of text, so erase the
- // "Foo is typing..." text segment, and the optional timestamp
- // if it was present. JC
- removeTypingIndicator(NULL);
-
- // Actually add the line
- std::string timestring;
- bool prepend_newline = true;
- if (gSavedSettings.getBOOL("IMShowTimestamps"))
- {
- timestring = mHistoryEditor->appendTime(prepend_newline);
- prepend_newline = false;
- }
-
- std::string separator_string(": ");
-
- // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile.
- if (!name.empty()) // If name exists, then add it to the front of the message.
- {
- // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
- if (name == SYSTEM_FROM)
- {
- mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyle::Params().color(color));
- }
- else
- {
- // Convert the name to a hotlink and add to message.
- mHistoryEditor->appendText(name + separator_string, prepend_newline, LLStyleMap::instance().lookupAgent(source));
- }
- prepend_newline = false;
- }
- mHistoryEditor->appendText(utf8msg, prepend_newline, LLStyle::Params().color(color));
- mHistoryEditor->blockUndo();
-
- if (!isInVisibleChain())
- {
- mNumUnreadMessages++;
- }
-}
-
-
-void LLFloaterIMPanel::setInputFocus( BOOL b )
-{
- mInputEditor->setFocus( b );
-}
-
-
-void LLFloaterIMPanel::selectAll()
-{
- mInputEditor->selectAll();
-}
-
-
-void LLFloaterIMPanel::selectNone()
-{
- mInputEditor->deselect();
-}
-
-BOOL LLFloaterIMPanel::handleKeyHere( KEY key, MASK mask )
-{
- BOOL handled = FALSE;
- if( KEY_RETURN == key && mask == MASK_NONE)
- {
- sendMsg();
- handled = TRUE;
- }
- else if ( KEY_ESCAPE == key )
- {
- handled = TRUE;
- gFocusMgr.setKeyboardFocus(NULL);
- }
-
- // May need to call base class LLPanel::handleKeyHere if not handled
- // in order to tab between buttons. JNC 1.2.2002
- return handled;
-}
-
-BOOL LLFloaterIMPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg)
-{
-
- if (mDialog == IM_NOTHING_SPECIAL)
- {
- LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionUUID, drop,
- cargo_type, cargo_data, accept);
- }
-
- // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites
- else if (isInviteAllowed())
- {
- *accept = ACCEPT_NO;
-
- if (cargo_type == DAD_CALLINGCARD)
- {
- if (dropCallingCard((LLInventoryItem*)cargo_data, drop))
- {
- *accept = ACCEPT_YES_MULTI;
- }
- }
- else if (cargo_type == DAD_CATEGORY)
- {
- if (dropCategory((LLInventoryCategory*)cargo_data, drop))
- {
- *accept = ACCEPT_YES_MULTI;
- }
- }
- }
- return TRUE;
-}
-
-BOOL LLFloaterIMPanel::dropCallingCard(LLInventoryItem* item, BOOL drop)
-{
- BOOL rv = isInviteAllowed();
- if(rv && item && item->getCreatorUUID().notNull())
- {
- if(drop)
- {
- std::vector<LLUUID> ids;
- ids.push_back(item->getCreatorUUID());
- inviteToSession(ids);
- }
- }
- else
- {
- // set to false if creator uuid is null.
- rv = FALSE;
- }
- return rv;
-}
-
-BOOL LLFloaterIMPanel::dropCategory(LLInventoryCategory* category, BOOL drop)
-{
- BOOL rv = isInviteAllowed();
- if(rv && category)
- {
- LLInventoryModel::cat_array_t cats;
- LLInventoryModel::item_array_t items;
- LLUniqueBuddyCollector buddies;
- gInventory.collectDescendentsIf(category->getUUID(),
- cats,
- items,
- LLInventoryModel::EXCLUDE_TRASH,
- buddies);
- S32 count = items.count();
- if(count == 0)
- {
- rv = FALSE;
- }
- else if(drop)
- {
- std::vector<LLUUID> ids;
- ids.reserve(count);
- for(S32 i = 0; i < count; ++i)
- {
- ids.push_back(items.get(i)->getCreatorUUID());
- }
- inviteToSession(ids);
- }
- }
- return rv;
-}
-
-BOOL LLFloaterIMPanel::isInviteAllowed() const
-{
-
- return ( (IM_SESSION_CONFERENCE_START == mDialog)
- || (IM_SESSION_INVITE == mDialog) );
-}
-
-
-// static
-void LLFloaterIMPanel::onTabClick(void* userdata)
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- self->setInputFocus(TRUE);
-}
-
-
-// static
-void LLFloaterIMPanel::onClickProfile( void* userdata )
-{
- // Bring up the Profile window
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
-
- if (self->getOtherParticipantID().notNull())
- {
- LLAvatarActions::showProfile(self->getOtherParticipantID());
- }
-}
-
-// static
-void LLFloaterIMPanel::onClickGroupInfo( void* userdata )
-{
- // Bring up the Profile window
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
-
- LLGroupActions::show(self->mSessionUUID);
-
-}
-
-// static
-void LLFloaterIMPanel::onClickClose( void* userdata )
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- if(self)
- {
- self->closeFloater();
- }
-}
-
-// static
-void LLFloaterIMPanel::onClickStartCall(void* userdata)
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
-
- gIMMgr->startCall(self->mSessionUUID);
-}
-
-// static
-void LLFloaterIMPanel::onClickEndCall(void* userdata)
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
-
- gIMMgr->endCall(self->mSessionUUID);
-}
-
-// static
-void LLFloaterIMPanel::onClickSend(void* userdata)
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
- self->sendMsg();
-}
-
-// static
-void LLFloaterIMPanel::onClickToggleActiveSpeakers(void* userdata)
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
-
- self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel"));
-}
-
-// static
-void LLFloaterIMPanel::onCommitChat(LLUICtrl* caller, void* userdata)
-{
- LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
- self->sendMsg();
-}
-
-// static
-void LLFloaterIMPanel::onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata )
-{
- LLFloaterIMPanel* self= (LLFloaterIMPanel*) userdata;
- self->mHistoryEditor->setCursorAndScrollToEnd();
-}
-
-// static
-void LLFloaterIMPanel::onInputEditorFocusLost(LLFocusableElement* caller, void* userdata)
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
- self->setTyping(FALSE);
-}
-
-// static
-void LLFloaterIMPanel::onInputEditorKeystroke(LLLineEditor* caller, void* userdata)
-{
- LLFloaterIMPanel* self = (LLFloaterIMPanel*)userdata;
- std::string text = self->mInputEditor->getText();
- if (!text.empty())
- {
- self->setTyping(TRUE);
- }
- else
- {
- // Deleting all text counts as stopping typing.
- self->setTyping(FALSE);
- }
-}
-
-// virtual
-void LLFloaterIMPanel::onClose(bool app_quitting)
-{
- setTyping(FALSE);
-
- gIMMgr->leaveSession(mSessionUUID);
-
- // *HACK hide the voice floater
- LLFloaterReg::hideInstance("voice_call", mSessionUUID);
-}
-
-void LLFloaterIMPanel::onVisibilityChange(const LLSD& new_visibility)
-{
- if (new_visibility.asBoolean())
- {
- mNumUnreadMessages = 0;
- }
-
- LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionUUID);
- if (voice_channel && voice_channel->getState() == LLVoiceChannel::STATE_CONNECTED)
- {
- if (new_visibility.asBoolean())
- LLFloaterReg::showInstance("voice_call", mSessionUUID);
- else
- LLFloaterReg::hideInstance("voice_call", mSessionUUID);
- }
-}
-
-void LLFloaterIMPanel::sendMsg()
-{
- if (!gAgent.isGodlike()
- && (mDialog == IM_NOTHING_SPECIAL)
- && mOtherParticipantUUID.isNull())
- {
- LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL;
- return;
- }
-
- if (mInputEditor)
- {
- LLWString text = mInputEditor->getConvertedText();
- if(!text.empty())
- {
- // store sent line in history, duplicates will get filtered
- if (mInputEditor) mInputEditor->updateHistory();
- // Truncate and convert to UTF8 for transport
- std::string utf8_text = wstring_to_utf8str(text);
- utf8_text = utf8str_truncate(utf8_text, MAX_MSG_BUF_SIZE - 1);
-
- if ( mSessionInitialized )
- {
- LLIMModel::sendMessage(utf8_text,
- mSessionUUID,
- mOtherParticipantUUID,
- mDialog);
-
- }
- else
- {
- //queue up the message to send once the session is
- //initialized
- mQueuedMsgsForInit.append(utf8_text);
- }
- }
-
- LLViewerStats::getInstance()->incStat(LLViewerStats::ST_IM_COUNT);
-
- mInputEditor->setText(LLStringUtil::null);
- }
-
- // Don't need to actually send the typing stop message, the other
- // client will infer it from receiving the message.
- mTyping = FALSE;
- mSentTypingState = TRUE;
-}
-
-void LLFloaterIMPanel::processSessionUpdate(const LLSD& session_update)
-{
- if (
- session_update.has("moderated_mode") &&
- session_update["moderated_mode"].has("voice") )
- {
- BOOL voice_moderated = session_update["moderated_mode"]["voice"];
-
- if (voice_moderated)
- {
- setTitle(mSessionLabel + std::string(" ") + getString("moderated_chat_label"));
- }
- else
- {
- setTitle(mSessionLabel);
- }
-
-
- //update the speakers dropdown too, if it's available
- if (mSpeakerPanel)
- {
- mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated);
- }
- }
-}
-
-void LLFloaterIMPanel::sessionInitReplyReceived(const LLUUID& session_id)
-{
- mSessionUUID = session_id;
- mSessionInitialized = TRUE;
-
- //we assume the history editor hasn't moved at all since
- //we added the starting session message
- //so, we count how many characters to remove
- S32 chars_to_remove = mHistoryEditor->getWText().length() -
- mSessionStartMsgPos;
- mHistoryEditor->removeTextFromEnd(chars_to_remove);
-
- //and now, send the queued msg
- LLSD::array_iterator iter;
- for ( iter = mQueuedMsgsForInit.beginArray();
- iter != mQueuedMsgsForInit.endArray();
- ++iter)
- {
- LLIMModel::sendMessage(
- iter->asString(),
- mSessionUUID,
- mOtherParticipantUUID,
- mDialog);
- }
-}
-
-void LLFloaterIMPanel::setTyping(BOOL typing)
-{
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
- if (typing)
- {
- // Every time you type something, reset this timer
- mLastKeystrokeTimer.reset();
-
- if (!mTyping)
- {
- // You just started typing.
- mFirstKeystrokeTimer.reset();
-
- // Will send typing state after a short delay.
- mSentTypingState = FALSE;
- }
-
- if (speaker_mgr)
- speaker_mgr->setSpeakerTyping(gAgent.getID(), TRUE);
- }
- else
- {
- if (mTyping)
- {
- // you just stopped typing, send state immediately
- sendTypingState(FALSE);
- mSentTypingState = TRUE;
- }
- if (speaker_mgr)
- speaker_mgr->setSpeakerTyping(gAgent.getID(), FALSE);
- }
-
- mTyping = typing;
-}
-
-void LLFloaterIMPanel::sendTypingState(BOOL typing)
-{
- // Don't want to send typing indicators to multiple people, potentially too
- // much network traffic. Only send in person-to-person IMs.
- if (mDialog != IM_NOTHING_SPECIAL) return;
-
- LLIMModel::instance().sendTypingState(mSessionUUID, mOtherParticipantUUID, typing);
-}
-
-
-void LLFloaterIMPanel::processIMTyping(const LLIMInfo* im_info, BOOL typing)
-{
- if (typing)
- {
- // other user started typing
- addTypingIndicator(im_info->mName);
- }
- else
- {
- // other user stopped typing
- removeTypingIndicator(im_info);
- }
-}
-
-
-void LLFloaterIMPanel::addTypingIndicator(const std::string &name)
-{
- // we may have lost a "stop-typing" packet, don't add it twice
- if (!mOtherTyping)
- {
- mTypingLineStartIndex = mHistoryEditor->getWText().length();
- LLUIString typing_start = sTypingStartString;
- typing_start.setArg("[NAME]", name);
- addHistoryLine(typing_start, LLUIColorTable::instance().getColor("SystemChatColor"), false);
- mOtherTypingName = name;
- mOtherTyping = TRUE;
- }
- // MBW -- XXX -- merge from release broke this (argument to this function changed from an LLIMInfo to a name)
- // Richard will fix.
-// mSpeakers->setSpeakerTyping(im_info->mFromID, TRUE);
-}
-
-
-void LLFloaterIMPanel::removeTypingIndicator(const LLIMInfo* im_info)
-{
- if (mOtherTyping)
- {
- // Must do this first, otherwise addHistoryLine calls us again.
- mOtherTyping = FALSE;
-
- S32 chars_to_remove = mHistoryEditor->getWText().length() - mTypingLineStartIndex;
- mHistoryEditor->removeTextFromEnd(chars_to_remove);
- if (im_info)
- {
- LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(mSessionUUID);
- if (speaker_mgr)
- {
- speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE);
- }
- }
- }
-}
-
-//static
-void LLFloaterIMPanel::onKickSpeaker(void* user_data)
-{
-
-}
diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h
deleted file mode 100644
index c5930b56f7..0000000000
--- a/indra/newview/llimpanel.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * @file llimpanel.h
- * @brief LLIMPanel class definition
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_IMPANEL_H
-#define LL_IMPANEL_H
-
-#include "lldockablefloater.h"
-#include "lllogchat.h"
-#include "lluuid.h"
-#include "lldarray.h"
-#include "llinstantmessage.h"
-#include "llvoiceclient.h"
-#include "llstyle.h"
-
-class LLLineEditor;
-class LLViewerTextEditor;
-class LLInventoryItem;
-class LLInventoryCategory;
-class LLIMSpeakerMgr;
-class LLPanelActiveSpeakers;
-class LLPanelChatControlPanel;
-
-class LLFloaterIMPanel : public LLFloater
-{
-public:
-
- // The session id is the id of the session this is for. The target
- // refers to the user (or group) that where this session serves as
- // the default. For example, if you open a session though a
- // calling card, a new session id will be generated, but the
- // target_id will be the agent referenced by the calling card.
- LLFloaterIMPanel(const std::string& session_label,
- const LLUUID& session_id,
- const LLUUID& target_id,
- const std::vector<LLUUID>& ids,
- EInstantMessage dialog);
- virtual ~LLFloaterIMPanel();
-
- /*virtual*/ BOOL postBuild();
-
- // Check typing timeout timer.
- /*virtual*/ void draw();
-
- /*virtual*/ void onClose(bool app_quitting);
- void onVisibilityChange(const LLSD& new_visibility);
-
- // add target ids to the session.
- // Return TRUE if successful, otherwise FALSE.
- BOOL inviteToSession(const std::vector<LLUUID>& agent_ids);
-
- void addHistoryLine(const std::string &utf8msg,
- const LLColor4& color = LLColor4::white,
- bool log_to_file = true,
- const LLUUID& source = LLUUID::null,
- const std::string& name = LLStringUtil::null);
-
- void setInputFocus( BOOL b );
-
- void selectAll();
- void selectNone();
-
- S32 getNumUnreadMessages() { return mNumUnreadMessages; }
-
- BOOL handleKeyHere(KEY key, MASK mask);
- BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
- BOOL drop, EDragAndDropType cargo_type,
- void *cargo_data, EAcceptance *accept,
- std::string& tooltip_msg);
-
- static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
- static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
- static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
- static void onCommitChat(LLUICtrl* caller, void* userdata);
- static void onTabClick( void* userdata );
-
- static void onClickProfile( void* userdata );
- static void onClickGroupInfo( void* userdata );
- static void onClickClose( void* userdata );
- static void onClickStartCall( void* userdata );
- static void onClickEndCall( void* userdata );
- static void onClickSend( void* userdata );
- static void onClickToggleActiveSpeakers( void* userdata );
- static void* createSpeakersPanel(void* data);
- static void onKickSpeaker(void* user_data);
-
- //callbacks for P2P muting and volume control
- static void onClickMuteVoice(void* user_data);
- static void onVolumeChange(LLUICtrl* source, void* user_data);
-
- const LLUUID& getSessionID() const { return mSessionUUID; }
- const LLUUID& getOtherParticipantID() const { return mOtherParticipantUUID; }
- void processSessionUpdate(const LLSD& update);
- EInstantMessage getDialogType() const { return mDialog; }
- void setDialogType(EInstantMessage dialog) { mDialog = dialog; }
-
- void sessionInitReplyReceived(const LLUUID& im_session_id);
-
- // Handle other participant in the session typing.
- void processIMTyping(const LLIMInfo* im_info, BOOL typing);
-
-private:
- // Called by UI methods.
- void sendMsg();
-
- // for adding agents via the UI. Return TRUE if possible, do it if
- BOOL dropCallingCard(LLInventoryItem* item, BOOL drop);
- BOOL dropCategory(LLInventoryCategory* category, BOOL drop);
-
- // test if local agent can add agents.
- BOOL isInviteAllowed() const;
-
- // Called whenever the user starts or stops typing.
- // Sends the typing state to the other user if necessary.
- void setTyping(BOOL typing);
-
- // Add the "User is typing..." indicator.
- void addTypingIndicator(const std::string &name);
-
- // Remove the "User is typing..." indicator.
- void removeTypingIndicator(const LLIMInfo* im_info);
-
- void sendTypingState(BOOL typing);
-
-private:
- LLLineEditor* mInputEditor;
- LLViewerTextEditor* mHistoryEditor;
-
- // The value of the mSessionUUID depends on how the IM session was started:
- // one-on-one ==> random id
- // group ==> group_id
- // inventory folder ==> folder item_id
- // 911 ==> Gaurdian_Angel_Group_ID ^ gAgent.getID()
- LLUUID mSessionUUID;
-
- std::string mSessionLabel;
-
- BOOL mSessionInitialized;
- LLSD mQueuedMsgsForInit;
-
- // The value mOtherParticipantUUID depends on how the IM session was started:
- // one-on-one = recipient's id
- // group ==> group_id
- // inventory folder ==> first target id in list
- // 911 ==> sender
- LLUUID mOtherParticipantUUID;
- std::vector<LLUUID> mSessionInitialTargetIDs;
-
- EInstantMessage mDialog;
-
- // Are you currently typing?
- BOOL mTyping;
-
- // Is other user currently typing?
- BOOL mOtherTyping;
-
- // name of other user who is currently typing
- std::string mOtherTypingName;
-
- // Where does the "User is typing..." line start?
- S32 mTypingLineStartIndex;
- // Where does the "Starting session..." line start?
- S32 mSessionStartMsgPos;
-
- S32 mNumUnreadMessages;
-
- BOOL mSentTypingState;
-
- BOOL mShowSpeakersOnConnect;
-
- BOOL mTextIMPossible;
- BOOL mProfileButtonEnabled;
- BOOL mCallBackEnabled;
-
- LLPanelActiveSpeakers* mSpeakerPanel;
-
- // Optimization: Don't send "User is typing..." until the
- // user has actually been typing for a little while. Prevents
- // extra IMs for brief "lol" type utterences.
- LLFrameTimer mFirstKeystrokeTimer;
-
- // Timer to detect when user has stopped typing.
- LLFrameTimer mLastKeystrokeTimer;
-
- boost::signals2::connection mFocusCallbackConnection;
-
- void disableWhileSessionStarting();
-};
-
-#endif // LL_IMPANEL_H
diff --git a/indra/newview/llinventoryclipboard.cpp b/indra/newview/llinventoryclipboard.cpp
deleted file mode 100644
index 53da34f448..0000000000
--- a/indra/newview/llinventoryclipboard.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * @file llinventoryclipboard.cpp
- * @brief LLInventoryClipboard class implementation
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llinventoryclipboard.h"
-
-
-LLInventoryClipboard LLInventoryClipboard::sInstance;
-
-///----------------------------------------------------------------------------
-/// Local function declarations, constants, enums, and typedefs
-///----------------------------------------------------------------------------
-
-
-///----------------------------------------------------------------------------
-/// Class LLInventoryClipboard
-///----------------------------------------------------------------------------
-
-LLInventoryClipboard::LLInventoryClipboard()
-: mCutMode(false)
-{
-}
-
-LLInventoryClipboard::~LLInventoryClipboard()
-{
- reset();
-}
-
-void LLInventoryClipboard::add(const LLUUID& object)
-{
- mObjects.put(object);
-}
-
-// this stores a single inventory object
-void LLInventoryClipboard::store(const LLUUID& object)
-{
- reset();
- mObjects.put(object);
-}
-
-void LLInventoryClipboard::store(const LLDynamicArray<LLUUID>& inv_objects)
-{
- reset();
- S32 count = inv_objects.count();
- for(S32 i = 0; i < count; i++)
- {
- mObjects.put(inv_objects[i]);
- }
-}
-
-void LLInventoryClipboard::cut(const LLUUID& object)
-{
- if(!mCutMode && !mObjects.empty())
- {
- //looks like there are some stored items, reset clipboard state
- reset();
- }
- mCutMode = true;
- add(object);
-}
-void LLInventoryClipboard::retrieve(LLDynamicArray<LLUUID>& inv_objects) const
-{
- inv_objects.reset();
- S32 count = mObjects.count();
- for(S32 i = 0; i < count; i++)
- {
- inv_objects.put(mObjects[i]);
- }
-}
-
-void LLInventoryClipboard::reset()
-{
- mObjects.reset();
- mCutMode = false;
-}
-
-// returns true if the clipboard has something pasteable in it.
-BOOL LLInventoryClipboard::hasContents() const
-{
- return (mObjects.count() > 0);
-}
-
-
-///----------------------------------------------------------------------------
-/// Local function definitions
-///----------------------------------------------------------------------------
diff --git a/indra/newview/llinventoryclipboard.h b/indra/newview/llinventoryclipboard.h
deleted file mode 100644
index b9f1451e5c..0000000000
--- a/indra/newview/llinventoryclipboard.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * @file llinventoryclipboard.h
- * @brief LLInventoryClipboard class header file
- *
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * 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.
- *
- * 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.
- *
- * 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
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLINVENTORYCLIPBOARD_H
-#define LL_LLINVENTORYCLIPBOARD_H
-
-#include "lldarray.h"
-#include "lluuid.h"
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryClipboard
-//
-// This class is used to cut/copy/paste inventory items around the
-// world. This class is accessed through a singleton (only one
-// inventory clipboard for now) which can be referenced using the
-// instance() method.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLInventoryClipboard
-{
-public:
- // calling this before main() is undefined
- static LLInventoryClipboard& instance() { return sInstance; }
-
- // this method adds to the current list.
- void add(const LLUUID& object);
-
- // this stores a single inventory object
- void store(const LLUUID& object);
-
- // this method stores an array of objects
- void store(const LLDynamicArray<LLUUID>& inventory_objects);
-
- void cut(const LLUUID& object);
- // this method gets the objects in the clipboard by copying them
- // into the array provided.
- void retrieve(LLDynamicArray<LLUUID>& inventory_objects) const;
-
- // this method empties out the clipboard
- void reset();
-
- // returns true if the clipboard has something pasteable in it.
- BOOL hasContents() const;
- bool isCutMode() const { return mCutMode; }
-
-protected:
- static LLInventoryClipboard sInstance;
-
- LLDynamicArray<LLUUID> mObjects;
- bool mCutMode;
-
-public:
- // please don't actually call these
- LLInventoryClipboard();
- ~LLInventoryClipboard();
-private:
- // please don't implement these
- LLInventoryClipboard(const LLInventoryClipboard&);
- LLInventoryClipboard& operator=(const LLInventoryClipboard&);
-};
-
-
-#endif // LL_LLINVENTORYCLIPBOARD_H