aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterbuildoptions.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-04-13 23:15:19 -0700
committerMcCabe Maxsted2010-04-13 23:17:03 -0700
commita6e45f15b8634db39facc852501c53ab36e2ed3f (patch)
tree489f9a2c008287c315f3a4481167769800f1bce1 /linden/indra/newview/llfloaterbuildoptions.cpp
parentSave custom prim defaults on a per-account basis rather than globally (diff)
downloadmeta-impy-a6e45f15b8634db39facc852501c53ab36e2ed3f.zip
meta-impy-a6e45f15b8634db39facc852501c53ab36e2ed3f.tar.gz
meta-impy-a6e45f15b8634db39facc852501c53ab36e2ed3f.tar.bz2
meta-impy-a6e45f15b8634db39facc852501c53ab36e2ed3f.tar.xz
Changed advanced build options to per-account settings, added OK, Apply, Cancel, Clear Item, and Reset to Default buttons
Diffstat (limited to 'linden/indra/newview/llfloaterbuildoptions.cpp')
-rw-r--r--linden/indra/newview/llfloaterbuildoptions.cpp279
1 files changed, 241 insertions, 38 deletions
diff --git a/linden/indra/newview/llfloaterbuildoptions.cpp b/linden/indra/newview/llfloaterbuildoptions.cpp
index 6c59a4e..372b1df 100644
--- a/linden/indra/newview/llfloaterbuildoptions.cpp
+++ b/linden/indra/newview/llfloaterbuildoptions.cpp
@@ -4,7 +4,8 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$ 5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2002-2009, Linden Research, Inc. 7 * Copyright (c) 2002-2009, Linden Research, Inc.,
8 * 2010, McCabe Maxsted
8 * 9 *
9 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -38,7 +39,6 @@
38#include "llviewerprecompiledheaders.h" 39#include "llviewerprecompiledheaders.h"
39 40
40#include "llfloaterbuildoptions.h" 41#include "llfloaterbuildoptions.h"
41#include "lluictrlfactory.h"
42 42
43// library includes 43// library includes
44#include "llfontgl.h" 44#include "llfontgl.h"
@@ -47,8 +47,10 @@
47#include "llspinctrl.h" 47#include "llspinctrl.h"
48#include "llsliderctrl.h" 48#include "llsliderctrl.h"
49#include "lltexturectrl.h" 49#include "lltexturectrl.h"
50#include "lluictrlfactory.h"
50 51
51// newview includes 52// newview includes
53#include "llcolorswatch.h"
52#include "llinventorymodel.h" 54#include "llinventorymodel.h"
53#include "llresmgr.h" 55#include "llresmgr.h"
54#include "llstartup.h" // not really necessary here, but just in case 56#include "llstartup.h" // not really necessary here, but just in case
@@ -60,13 +62,15 @@
60// Globals 62// Globals
61// 63//
62LLFloaterBuildOptions *LLFloaterBuildOptions::sInstance = NULL; 64LLFloaterBuildOptions *LLFloaterBuildOptions::sInstance = NULL;
63InvDropTarget * LLFloaterBuildOptions::mBuildObjectDropTarget; 65InvDropTarget * LLFloaterBuildOptions::sBuildObjectDropTarget;
64 66
65// 67//
66// Methods 68// Methods
67// 69//
68LLFloaterBuildOptions::LLFloaterBuildOptions( ) 70LLFloaterBuildOptions::LLFloaterBuildOptions()
69: LLFloater(std::string("build options floater")) 71: LLFloater(std::string("build options floater")),
72mBuildItemUUID(NULL),
73mBuildTextureUUID(NULL)
70{ 74{
71 sInstance = this; 75 sInstance = this;
72} 76}
@@ -74,53 +78,72 @@ LLFloaterBuildOptions::LLFloaterBuildOptions( )
74LLFloaterBuildOptions::~LLFloaterBuildOptions() 78LLFloaterBuildOptions::~LLFloaterBuildOptions()
75{ 79{
76 sInstance = NULL; 80 sInstance = NULL;
77 delete mBuildObjectDropTarget; 81 delete sBuildObjectDropTarget;
78 mBuildObjectDropTarget = NULL; 82 sBuildObjectDropTarget = NULL;
79} 83}
80 84
81BOOL LLFloaterBuildOptions::postBuild() 85BOOL LLFloaterBuildOptions::postBuild()
82{ 86{
87 childSetAction("btn_ok", onClickOK, this);
88 childSetAction("btn_apply", onClickApply, this);
89 childSetAction("btn_cancel", onClickCancel, this);
90 childSetAction("btn_clear", onClickClear, this);
91 childSetAction("btn_reset", onClickReset, this);
92
83 getChild<LLComboBox>("material")->setSimple(gSavedPerAccountSettings.getString("BuildPrefs_Material")); 93 getChild<LLComboBox>("material")->setSimple(gSavedPerAccountSettings.getString("BuildPrefs_Material"));
84 getChild<LLComboBox>("combobox shininess")->setSimple(gSavedPerAccountSettings.getString("BuildPrefs_Shiny")); 94 getChild<LLComboBox>("combobox shininess")->setSimple(gSavedPerAccountSettings.getString("BuildPrefs_Shiny"));
85 95
96 childSetValue("BuildPrefsActualRoot_toggle", gSavedPerAccountSettings.getBOOL("BuildPrefs_ActualRoot") );
97 childSetValue("PivotPercToggle", gSavedPerAccountSettings.getBOOL("BuildPrefs_PivotIsPercent") );
98 childSetValue("FBToggle", gSavedPerAccountSettings.getBOOL("BuildPrefs_FullBright") );
99 childSetValue("BuildPrefsEmbedItem", gSavedPerAccountSettings.getBOOL("BuildPrefs_EmbedItem") );
100 childSetValue("PhysicalToggle", gSavedPerAccountSettings.getBOOL("BuildPrefs_Physical") );
101 childSetValue("TemporaryToggle", gSavedPerAccountSettings.getBOOL("BuildPrefs_Temporary") );
102 childSetValue("PhantomToggle", gSavedPerAccountSettings.getBOOL("BuildPrefs_Phantom") );
103
104 childSetValue("Z pos", gSavedPerAccountSettings.getF32("BuildPrefs_PivotZ") );
105 childSetValue("Y pos", gSavedPerAccountSettings.getF32("BuildPrefs_PivotY") );
106 childSetValue("X pos", gSavedPerAccountSettings.getF32("BuildPrefs_PivotX") );
107 childSetValue("glow", gSavedPerAccountSettings.getF32("BuildPrefs_Glow") );
108 childSetValue("alpha", gSavedPerAccountSettings.getF32("BuildPrefs_Alpha") );
109 childSetValue("Z size", gSavedPerAccountSettings.getF32("BuildPrefs_Zsize") );
110 childSetValue("Y size", gSavedPerAccountSettings.getF32("BuildPrefs_Ysize") );
111 childSetValue("X size", gSavedPerAccountSettings.getF32("BuildPrefs_Xsize") );
112
113 getChild<LLColorSwatchCtrl>("colorswatch")->set(gSavedPerAccountSettings.getColor4("BuildPrefs_Color"), TRUE );
114 getChild<LLTextureCtrl>("texture control")->setImageAssetID(LLUUID(gSavedPerAccountSettings.getString("BuildPrefs_Texture")));
115
116 childSetValue("BuildPrefsRenderHighlight_toggle", gSavedSettings.getBOOL("RenderHighlightSelections") );
117 childSetValue("grouplandrez", gSavedSettings.getBOOL("RezWithLandGroup") );
118 childSetValue("GridSubUnit", gSavedSettings.getBOOL("GridSubUnit") );
119 childSetValue("GridCrossSection", gSavedSettings.getBOOL("GridCrossSections") );
120
121 childSetValue("GridResolution", gSavedSettings.getF32("GridResolution") );
122 childSetValue("GridDrawSize", gSavedSettings.getF32("GridDrawSize") );
123 childSetValue("GridOpacity", gSavedSettings.getF32("GridOpacity") );
124
86 getChild<LLComboBox>("material")->setCommitCallback(onComboBoxCommit); 125 getChild<LLComboBox>("material")->setCommitCallback(onComboBoxCommit);
87 getChild<LLComboBox>("combobox shininess")->setCommitCallback(onComboBoxCommit); 126 getChild<LLComboBox>("combobox shininess")->setCommitCallback(onComboBoxCommit);
88 127
89 getChild<LLTextureCtrl>("texture control")->setDefaultImageAssetID(LLUUID("89556747-24cb-43ed-920b-47caed15465f")); 128 getChild<LLTextureCtrl>("texture control")->setDefaultImageAssetID(LLUUID("89556747-24cb-43ed-920b-47caed15465f"));
90 getChild<LLTextureCtrl>("texture control")->setCommitCallback(onTexturePickerCommit); 129 getChild<LLTextureCtrl>("texture control")->setCommitCallback(onTexturePickerCommit);
130 getChild<LLTextureCtrl>("texture control")->setCallbackUserData(this);
91 131
92 LLView *target_view = getChild<LLView>("build_item_add_disp_rect"); 132 LLView *target_view = getChild<LLView>("build_item_add_disp_rect");
93 if (target_view) 133 if (target_view)
94 { 134 {
95 if (mBuildObjectDropTarget) 135 if (sBuildObjectDropTarget)
96 { 136 {
97 delete mBuildObjectDropTarget; 137 delete sBuildObjectDropTarget;
98 } 138 }
99 mBuildObjectDropTarget = new InvDropTarget("build drop target", target_view->getRect(),BuildAutoResponseItemDrop); 139 sBuildObjectDropTarget = new InvDropTarget("build drop target", target_view->getRect(),BuildAutoResponseItemDrop);
100 addChild(mBuildObjectDropTarget); 140 addChild(sBuildObjectDropTarget);
101 } 141 }
102 142
103 if (LLStartUp::getStartupState() == STATE_STARTED) 143 mBuildItemUUID = (LLUUID)gSavedPerAccountSettings.getString("BuildPrefs_Item");
104 { 144 mBuildTextureUUID = (LLUUID)gSavedPerAccountSettings.getString("BuildPrefs_Texture");
105 LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("BuildPrefs_Item"); 145
106 LLViewerInventoryItem* item = gInventory.getItem(itemid); 146 refreshItem(); // Refresh the item UI bits after everything's loaded -- MC
107 if (item)
108 {
109 childSetValue("build_item_add_disp_rect_txt", "Currently set to: "+item->getName());
110 }
111 else if (itemid.isNull())
112 {
113 childSetValue("build_item_add_disp_rect_txt", "Currently not set");
114 }
115 else
116 {
117 childSetValue("build_item_add_disp_rect_txt", "Currently set to a item not on this account");
118 }
119 }
120 else
121 {
122 childSetValue("build_item_add_disp_rect_txt", "Not logged in");
123 }
124 147
125 return TRUE; 148 return TRUE;
126} 149}
@@ -152,27 +175,207 @@ BOOL LLFloaterBuildOptions::visible(void*)
152 return (sInstance != NULL); 175 return (sInstance != NULL);
153} 176}
154 177
178// static
155void LLFloaterBuildOptions::BuildAutoResponseItemDrop(LLViewerInventoryItem* item) 179void LLFloaterBuildOptions::BuildAutoResponseItemDrop(LLViewerInventoryItem* item)
156{ 180{
157 gSavedPerAccountSettings.setString("BuildPrefs_Item", item->getUUID().asString()); 181 LLFloaterBuildOptions::getInstance()->setItem(item->getUUID());
158 LLFloaterBuildOptions::getInstance()->childSetValue("build_item_add_disp_rect_txt", "Currently set to: "+item->getName()); 182 LLFloaterBuildOptions::getInstance()->refreshItem();
183 /*LLFloaterBuildOptions::getInstance()->childSetValue("build_item_add_disp_rect_txt", "Currently set to: "+item->getName());
184 gSavedPerAccountSettings.setString("BuildPrefs_Item", item->getUUID().asString());*/
159} 185}
160 186
187// static
161void LLFloaterBuildOptions::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) 188void LLFloaterBuildOptions::onComboBoxCommit(LLUICtrl* ctrl, void* userdata)
162{ 189{
163
164 LLComboBox* box = (LLComboBox*)ctrl; 190 LLComboBox* box = (LLComboBox*)ctrl;
165 if(box) 191 if(box)
166 { 192 {
167 gSavedSettings.setString(box->getControlName(), box->getValue().asString()); 193 gSavedPerAccountSettings.setString(box->getControlName(), box->getValue().asString());
168 } 194 }
169} 195}
170 196
197// static
171void LLFloaterBuildOptions::onTexturePickerCommit(LLUICtrl* ctrl, void* userdata) 198void LLFloaterBuildOptions::onTexturePickerCommit(LLUICtrl* ctrl, void* userdata)
172{ 199{
200 LLFloaterBuildOptions* self = (LLFloaterBuildOptions*)userdata;
201
173 LLTextureCtrl* image_ctrl = (LLTextureCtrl*)ctrl; 202 LLTextureCtrl* image_ctrl = (LLTextureCtrl*)ctrl;
174 if(image_ctrl) 203 if(image_ctrl)
175 { 204 {
176 gSavedPerAccountSettings.setString("BuildPrefs_Texture", image_ctrl->getImageAssetID().asString()); 205 self->setTexture(image_ctrl->getImageAssetID());
206 /*gSavedPerAccountSettings.setString("BuildPrefs_Texture", image_ctrl->getImageAssetID().asString());*/
207 }
208}
209
210// static
211void LLFloaterBuildOptions::onClickOK(void* userdata)
212{
213 LLFloaterBuildOptions* self = (LLFloaterBuildOptions*)userdata;
214 self->apply();
215 self->close();
216}
217
218// static
219void LLFloaterBuildOptions::onClickApply(void* userdata)
220{
221 LLFloaterBuildOptions* self = (LLFloaterBuildOptions*)userdata;
222 self->apply();
223}
224
225// static
226void LLFloaterBuildOptions::onClickCancel(void* userdata)
227{
228 LLFloaterBuildOptions* self = (LLFloaterBuildOptions*)userdata;
229 self->cancel();
230}
231
232// static
233void LLFloaterBuildOptions::onClickClear(void* userdata)
234{
235 // Clear the inventory item
236 LLFloaterBuildOptions* self = (LLFloaterBuildOptions*)userdata;
237 //gSavedPerAccountSettings.setString("BuildPrefs_Item", LLUUID::null);
238 //gSavedPerAccountSettings.getControl("BuildPrefs_Item")->resetToDefault(false);
239
240 self->setItem(LLUUID::null);
241 self->refreshItem();
242}
243
244// static
245void LLFloaterBuildOptions::onClickReset(void* userdata)
246{
247 // Reset to defaults
248 LLFloaterBuildOptions* self = (LLFloaterBuildOptions*)userdata;
249 self->reset();
250 self->refresh();
251}
252
253void LLFloaterBuildOptions::apply()
254{
255 gSavedPerAccountSettings.setBOOL("BuildPrefs_ActualRoot", childGetValue("BuildPrefsActualRoot_toggle").asBoolean() );
256 gSavedPerAccountSettings.setBOOL("BuildPrefs_PivotIsPercent", childGetValue("PivotPercToggle").asBoolean() );
257 gSavedPerAccountSettings.setBOOL("BuildPrefs_FullBright", childGetValue("FBToggle").asBoolean() );
258 gSavedPerAccountSettings.setBOOL("BuildPrefs_EmbedItem", childGetValue("BuildPrefsEmbedItem").asBoolean() );
259 gSavedPerAccountSettings.setBOOL("BuildPrefs_Physical", childGetValue("PhysicalToggle").asBoolean() );
260 gSavedPerAccountSettings.setBOOL("BuildPrefs_Temporary", childGetValue("TemporaryToggle").asBoolean() );
261 gSavedPerAccountSettings.setBOOL("BuildPrefs_Phantom", childGetValue("PhantomToggle").asBoolean() );
262
263 gSavedPerAccountSettings.setF32("BuildPrefs_PivotZ", childGetValue("Z pos").asReal() );
264 gSavedPerAccountSettings.setF32("BuildPrefs_PivotY", childGetValue("Y pos").asReal() );
265 gSavedPerAccountSettings.setF32("BuildPrefs_PivotX", childGetValue("X pos").asReal() );
266 gSavedPerAccountSettings.setF32("BuildPrefs_Glow", childGetValue("glow").asReal() );
267 gSavedPerAccountSettings.setF32("BuildPrefs_Alpha", childGetValue("alpha").asReal() );
268 gSavedPerAccountSettings.setF32("BuildPrefs_Zsize", childGetValue("Z size").asReal() );
269 gSavedPerAccountSettings.setF32("BuildPrefs_Ysize", childGetValue("Y size").asReal() );
270 gSavedPerAccountSettings.setF32("BuildPrefs_Xsize", childGetValue("X size").asReal() );
271
272 gSavedPerAccountSettings.setString("BuildPrefs_Shiny", getChild<LLComboBox>("combobox shininess")->getValue().asString() );
273 gSavedPerAccountSettings.setString("BuildPrefs_Material", getChild<LLComboBox>("material")->getValue().asString() );
274
275 gSavedPerAccountSettings.setColor4("BuildPrefs_Color", getChild<LLColorSwatchCtrl>("colorswatch")->get());
276
277 if (mBuildItemUUID != LLSD(gSavedPerAccountSettings.getString("BuildPrefs_Item")) )
278 {
279 gSavedPerAccountSettings.setString("BuildPrefs_Item", mBuildItemUUID.asString() );
280 }
281
282 if (mBuildTextureUUID != LLSD(gSavedPerAccountSettings.getString("BuildPrefs_Texture")) )
283 {
284 gSavedPerAccountSettings.setString("BuildPrefs_Texture", mBuildTextureUUID.asString() );
285 }
286
287 gSavedSettings.setBOOL("RenderHighlightSelections", childGetValue("BuildPrefsRenderHighlight_toggle").asBoolean() );
288 gSavedSettings.setBOOL("RezWithLandGroup", childGetValue("grouplandrez").asBoolean() );
289 gSavedSettings.setBOOL("GridSubUnit", childGetValue("GridSubUnit").asBoolean() );
290 gSavedSettings.setBOOL("GridCrossSections", childGetValue("GridCrossSection").asBoolean() );
291
292 gSavedSettings.setF32("GridResolution", childGetValue("GridResolution").asReal() );
293 gSavedSettings.setF32("GridDrawSize", childGetValue("GridDrawSize").asReal() );
294 gSavedSettings.setF32("GridOpacity", childGetValue("GridOpacity").asReal() );
295}
296
297void LLFloaterBuildOptions::cancel()
298{
299 close();
300}
301
302void LLFloaterBuildOptions::reset()
303{
304 getChild<LLComboBox>("material")->setSimple(gSavedPerAccountSettings.getControl("BuildPrefs_Material")->getDefault().asString() );
305 getChild<LLComboBox>("combobox shininess")->setSimple(gSavedPerAccountSettings.getControl("BuildPrefs_Shiny")->getDefault().asString() );
306
307 childSetValue("BuildPrefsActualRoot_toggle", gSavedPerAccountSettings.getControl("BuildPrefs_ActualRoot")->getDefault() );
308 childSetValue("PivotPercToggle", gSavedPerAccountSettings.getControl("BuildPrefs_PivotIsPercent")->getDefault() );
309 childSetValue("FBToggle", gSavedPerAccountSettings.getControl("BuildPrefs_FullBright")->getDefault() );
310 childSetValue("BuildPrefsEmbedItem", gSavedPerAccountSettings.getControl("BuildPrefs_EmbedItem")->getDefault() );
311 childSetValue("PhysicalToggle", gSavedPerAccountSettings.getControl("BuildPrefs_Physical")->getDefault() );
312 childSetValue("TemporaryToggle", gSavedPerAccountSettings.getControl("BuildPrefs_Temporary")->getDefault() );
313 childSetValue("PhantomToggle", gSavedPerAccountSettings.getControl("BuildPrefs_Phantom")->getDefault() );
314
315 childSetValue("Z pos", gSavedPerAccountSettings.getControl("BuildPrefs_PivotZ")->getDefault() );
316 childSetValue("Y pos", gSavedPerAccountSettings.getControl("BuildPrefs_PivotY")->getDefault() );
317 childSetValue("X pos", gSavedPerAccountSettings.getControl("BuildPrefs_PivotX")->getDefault() );
318 childSetValue("glow", gSavedPerAccountSettings.getControl("BuildPrefs_Glow")->getDefault() );
319 childSetValue("alpha", gSavedPerAccountSettings.getControl("BuildPrefs_Alpha")->getDefault() );
320 childSetValue("Z size", gSavedPerAccountSettings.getControl("BuildPrefs_Zsize")->getDefault() );
321 childSetValue("Y size", gSavedPerAccountSettings.getControl("BuildPrefs_Ysize")->getDefault() );
322 childSetValue("X size", gSavedPerAccountSettings.getControl("BuildPrefs_Xsize")->getDefault() );
323
324 getChild<LLColorSwatchCtrl>("colorswatch")->set(gSavedPerAccountSettings.getControl("BuildPrefs_Color")->getDefault(), TRUE);
325 getChild<LLTextureCtrl>("texture control")->setImageAssetID(LLUUID(gSavedPerAccountSettings.getControl("BuildPrefs_Texture")->getDefault()) );
326
327 mBuildItemUUID = (LLUUID)gSavedPerAccountSettings.getControl("BuildPrefs_Item")->getDefault();
328 mBuildTextureUUID = (LLUUID)gSavedPerAccountSettings.getControl("BuildPrefs_Texture")->getDefault();
329
330 childSetValue("BuildPrefsRenderHighlight_toggle", gSavedSettings.getControl("RenderHighlightSelections")->getDefault() );
331 childSetValue("grouplandrez", gSavedSettings.getControl("RezWithLandGroup")->getDefault() );
332 childSetValue("GridSubUnit", gSavedSettings.getControl("GridSubUnit")->getDefault() );
333 childSetValue("GridCrossSection", gSavedSettings.getControl("GridCrossSections")->getDefault() );
334
335 childSetValue("GridResolution", gSavedSettings.getControl("GridResolution")->getDefault() );
336 childSetValue("GridDrawSize", gSavedSettings.getControl("GridDrawSize")->getDefault() );
337 childSetValue("GridOpacity", gSavedSettings.getControl("GridOpacity")->getDefault() );
338}
339
340void LLFloaterBuildOptions::refresh()
341{
342
343}
344
345void LLFloaterBuildOptions::setItem(const LLUUID& item)
346{
347 mBuildItemUUID = item;
348}
349
350void LLFloaterBuildOptions::setTexture(const LLUUID& texture)
351{
352 mBuildTextureUUID = texture;
353}
354
355void LLFloaterBuildOptions::refreshItem()
356{
357 if (LLStartUp::getStartupState() == STATE_STARTED)
358 {
359 if (mBuildItemUUID.isNull())
360 {
361 childSetValue("build_item_add_disp_rect_txt", "Currently not set");
362 }
363 else
364 {
365 LLViewerInventoryItem* item = gInventory.getItem(mBuildItemUUID);
366 if (item)
367 {
368 childSetValue("build_item_add_disp_rect_txt", "Currently set to: "+item->getName());
369 }
370
371 else
372 {
373 childSetValue("build_item_add_disp_rect_txt", "Currently set to a item not on this account");
374 }
375 }
376 }
377 else
378 {
379 childSetValue("build_item_add_disp_rect_txt", "Not logged in");
177 } 380 }
178} 381}