PageRenderTime 28ms CodeModel.GetById 18ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llpaneleditwearable.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 175 lines | 100 code | 34 blank | 41 comment | 0 complexity | ac881ed8f81975b2937e58e0d18c4641 MD5 | raw file
  1/** 
  2 * @file llpaneleditwearable.h
  3 * @brief A LLPanel dedicated to the editing of wearables.
  4 *
  5 * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLPANELEDITWEARABLE_H
 28#define LL_LLPANELEDITWEARABLE_H
 29
 30#include "llpanel.h"
 31#include "llscrollingpanellist.h"
 32#include "llmodaldialog.h"
 33#include "llvoavatardefines.h"
 34#include "llwearabletype.h"
 35
 36class LLAccordionCtrl;
 37class LLCheckBoxCtrl;
 38class LLWearable;
 39class LLTextBox;
 40class LLViewerInventoryItem;
 41class LLViewerVisualParam;
 42class LLVisualParamHint;
 43class LLViewerJointMesh;
 44class LLAccordionCtrlTab;
 45class LLJoint;
 46class LLLineEditor;
 47
 48class LLPanelEditWearable : public LLPanel
 49{
 50public:
 51	LLPanelEditWearable( );
 52	virtual ~LLPanelEditWearable();
 53
 54	/*virtual*/ BOOL 		postBuild();
 55	/*virtual*/ BOOL		isDirty() const;	// LLUICtrl
 56	/*virtual*/ void		draw();	
 57
 58	// changes camera angle to default for selected subpart
 59	void				changeCamera(U8 subpart);
 60
 61	LLWearable* 		getWearable() { return mWearablePtr; }
 62	void				setWearable(LLWearable *wearable, BOOL disable_camera_switch = FALSE);
 63
 64	void				saveChanges(bool force_save_as = false);
 65	void				revertChanges();
 66
 67	void				showDefaultSubpart();
 68	void				onTabExpandedCollapsed(const LLSD& param, U8 index);
 69
 70	void 				updateScrollingPanelList();
 71
 72	static void			onRevertButtonClicked(void* userdata);
 73	void				onCommitSexChange();
 74	void				onSaveAsButtonClicked();
 75	void				saveAsCallback(const LLSD& notification, const LLSD& response);
 76
 77	virtual void		setVisible(BOOL visible);
 78
 79
 80private:
 81	typedef std::map<F32, LLViewerVisualParam*> value_map_t;
 82
 83	void				showWearable(LLWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE);
 84	void				updateScrollingPanelUI();
 85	LLPanel*			getPanel(LLWearableType::EType type);
 86	void				getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
 87	void				buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab, LLJoint* jointp);
 88	// update bottom bar buttons ("Save", "Revert", etc)
 89	void				updateVerbs();
 90
 91	void				onColorSwatchCommit(const LLUICtrl*);
 92	void				onTexturePickerCommit(const LLUICtrl*);
 93	void				updatePanelPickerControls(LLWearableType::EType type);
 94	void				toggleTypeSpecificControls(LLWearableType::EType type);
 95	void				updateTypeSpecificControls(LLWearableType::EType type);
 96
 97	//alpha mask checkboxes
 98	void configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name);
 99	void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te);
100	void updateAlphaCheckboxes();
101	void initPreviousAlphaTextures();
102	void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te);
103
104	// callback for HeightUnits parameter.
105	bool changeHeightUnits(const LLSD& new_value);
106
107	// updates current metric and replacemet metric label text
108	void updateMetricLayout(BOOL new_value);
109
110	// updates avatar height label
111	void updateAvatarHeightLabel();
112
113	void onWearablePanelVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl);
114
115	void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel);
116
117	// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
118	LLWearable *mWearablePtr;
119	LLViewerInventoryItem* mWearableItem;
120
121	// these are constant no matter what wearable we're editing
122	LLButton *mBtnRevert;
123	LLButton *mBtnBack;
124	std::string mBackBtnLabel;
125
126	LLTextBox *mPanelTitle;
127	LLTextBox *mDescTitle;
128	LLTextBox *mTxtAvatarHeight;
129
130
131	// localized and parametrized strings that used to build avatar_height_label
132	std::string mMeters;
133	std::string mFeet;
134	std::string mHeigth;
135	LLUIString  mHeigthValue;
136	LLUIString  mReplacementMetricUrl;
137
138	// color for mHeigth string
139	LLUIColor mAvatarHeigthLabelColor;
140	// color for mHeigthValue string
141	LLUIColor mAvatarHeigthValueLabelColor;
142
143	// This text editor reference will change each time we edit a new wearable - 
144	// it will be grabbed from the currently visible panel
145	LLLineEditor *mNameEditor;
146
147	// The following panels will be shown/hidden based on what wearable we're editing
148	// body parts
149	LLPanel *mPanelShape;
150	LLPanel *mPanelSkin;
151	LLPanel *mPanelEyes;
152	LLPanel *mPanelHair;
153
154	//clothes
155	LLPanel *mPanelShirt;
156	LLPanel *mPanelPants;
157	LLPanel *mPanelShoes;
158	LLPanel *mPanelSocks;
159	LLPanel *mPanelJacket;
160	LLPanel *mPanelGloves;
161	LLPanel *mPanelUndershirt;
162	LLPanel *mPanelUnderpants;
163	LLPanel *mPanelSkirt;
164	LLPanel *mPanelAlpha;
165	LLPanel *mPanelTattoo;
166	LLPanel *mPanelPhysics;
167
168	typedef std::map<std::string, LLVOAvatarDefines::ETextureIndex> string_texture_index_map_t;
169	string_texture_index_map_t mAlphaCheckbox2Index;
170
171	typedef std::map<LLVOAvatarDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
172	s32_uuid_map_t mPreviousAlphaTexture;
173};
174
175#endif