diff options
| author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-05-31 16:57:39 +0300 | 
|---|---|---|
| committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-05-31 16:57:39 +0300 | 
| commit | 4b8c269d9495718207e58c22c991894aa375e497 (patch) | |
| tree | 759d6a7bc1e5ea1a77b630b3ce59aadd2549e07a | |
| parent | 39eb49c5f400f5e99750f48cc4b02ffa56537403 (diff) | |
| parent | aac23d2d1e4c0c92b31bff377633da7d2b305a1a (diff) | |
merge; fixed gcc build
--HG--
branch : product-engine
| -rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 43 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitedit.h | 6 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitsinventory.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llpaneloutfitsinventory.h | 4 | ||||
| -rw-r--r-- | indra/newview/llsaveoutfitcombobtn.cpp | 97 | ||||
| -rw-r--r-- | indra/newview/llsaveoutfitcombobtn.h | 60 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_save_outfit.xml | 4 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfits_inventory.xml | 33 | 
9 files changed, 198 insertions, 62 deletions
| diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 50d1491523..9ba44e787b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -379,6 +379,7 @@ set(viewer_SOURCE_FILES      llregionposition.cpp      llremoteparcelrequest.cpp      llsavedsettingsglue.cpp +    llsaveoutfitcombobtn.cpp      llscreenchannel.cpp      llscriptfloater.cpp      llscrollingpanelparam.cpp @@ -894,6 +895,7 @@ set(viewer_HEADER_FILES      llresourcedata.h      llrootview.h      llsavedsettingsglue.h +    llsaveoutfitcombobtn.h      llscreenchannel.h      llscriptfloater.h      llscrollingpanelparam.h diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 2fe0201496..c1dfd7d13b 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -61,6 +61,7 @@  #include "llinventorymodelbackgroundfetch.h"  #include "llpaneloutfitsinventory.h"  #include "lluiconstants.h" +#include "llsaveoutfitcombobtn.h"  #include "llscrolllistctrl.h"  #include "lltextbox.h"  #include "lluictrlfactory.h" @@ -76,7 +77,6 @@ const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);  const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);  const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK; -static const std::string SAVE_BTN("save_btn");  static const std::string REVERT_BTN("revert_btn");  class LLCOFObserver : public LLInventoryObserver @@ -308,14 +308,6 @@ BOOL LLPanelOutfitEdit::postBuild()  	childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance())); -	childSetAction(SAVE_BTN, boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); -	childSetAction("save_flyout_btn", boost::bind(&LLPanelOutfitEdit::showSaveMenu, this)); - -	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; -	save_registar.add("Outfit.Save.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, false)); -	save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); -	mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); -  	mWearableListMaskCollector = new LLFindNonLinksByMask(ALL_ITEMS_MASK);  	mWearableListTypeCollector = new LLFindWearablesOfType(LLWearableType::WT_NONE); @@ -323,6 +315,7 @@ BOOL LLPanelOutfitEdit::postBuild()  	mWearableItemsList = getChild<LLInventoryItemsList>("filtered_wearables_list");  	mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, mWearableListMaskCollector); +	mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));  	return TRUE;  } @@ -386,33 +379,6 @@ void LLPanelOutfitEdit::showFilteredFolderWearablesPanel()  	mFolderViewBtn->setToggleState(TRUE);  } -void LLPanelOutfitEdit::saveOutfit(bool as_new) -{ -	if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) -	{ -		// we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved. -		// If updateBaseOutfit fails, ask for an outfit name anyways -		return; -	} - -	LLPanelOutfitsInventory* panel_outfits_inventory = LLPanelOutfitsInventory::findInstance(); -	if (panel_outfits_inventory) -	{ -		panel_outfits_inventory->onSave(); -	} - -	//*TODO how to get to know when base outfit is updated or new outfit is created? -} - -void LLPanelOutfitEdit::showSaveMenu() -{ -	S32 x, y; -	LLUI::getMousePositionLocal(this, &x, &y); - -	mSaveMenu->updateParent(LLMenuGL::sMenuContainer); -	LLMenuGL::showPopup(this, mSaveMenu, x, y); -} -  void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl)  {  	LLComboBox* type_filter = dynamic_cast<LLComboBox*>(ctrl); @@ -710,10 +676,10 @@ void LLPanelOutfitEdit::updateVerbs()  	bool outfit_is_dirty = LLAppearanceMgr::getInstance()->isOutfitDirty();  	bool has_baseoutfit = LLAppearanceMgr::getInstance()->getBaseOutfitUUID().notNull(); -	childSetEnabled(SAVE_BTN, outfit_is_dirty); +	mSaveComboBtn->setSaveBtnEnabled(outfit_is_dirty);  	childSetEnabled(REVERT_BTN, outfit_is_dirty && has_baseoutfit); -	mSaveMenu->setItemEnabled("save_outfit", outfit_is_dirty); +	mSaveComboBtn->setMenuItemEnabled("save_outfit", outfit_is_dirty);  	mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing")); @@ -762,6 +728,7 @@ void LLPanelOutfitEdit::showFilteredWearableItemsList(LLWearableType::EType type  	mWearableListTypeCollector->setType(type);  	mWearableListManager->setFilterCollector(mWearableListTypeCollector);  	mAddWearablesPanel->setVisible(TRUE); +	showFilteredWearablesPanel();  }  // EOF diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index dbfeb2c375..c0ee6c5fcb 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -61,6 +61,7 @@ class LLFilteredWearableListManager;  class LLMenuGL;  class LLFindNonLinksByMask;  class LLFindWearablesOfType; +class LLSaveOutfitComboBtn;  class LLPanelOutfitEdit : public LLPanel  { @@ -95,8 +96,6 @@ public:  	void showWearablesFilter();  	void showFilteredWearablesPanel();  	void showFilteredFolderWearablesPanel(); -	void saveOutfit(bool as_new = false); -	void showSaveMenu();  	void onTypeFilterChanged(LLUICtrl* ctrl);  	void onSearchEdit(const std::string& string); @@ -145,7 +144,6 @@ private:  	LLButton*			mEditWearableBtn;  	LLButton*			mFolderViewBtn;  	LLButton*			mListViewBtn; -	LLToggleableMenu*	mSaveMenu;  	LLPanel*			mAddWearablesPanel;  	LLFindNonLinksByMask*  mWearableListMaskCollector; @@ -163,6 +161,8 @@ private:  	LLCOFWearables*		mCOFWearables;  	LLMenuGL*			mGearMenu;  	bool				mInitialized; +	std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn; +  };  #endif // LL_LLPANELOUTFITEDIT_H diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index a7e8f497d9..21f69d3470 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -50,6 +50,7 @@  #include "llmodaldialog.h"  #include "llnotificationsutil.h"  #include "lloutfitslist.h" +#include "llsaveoutfitcombobtn.h"  #include "llsidepanelappearance.h"  #include "llsidetray.h"  #include "lltabcontainer.h" @@ -101,6 +102,8 @@ BOOL LLPanelOutfitsInventory::postBuild()  		LLInventoryModelBackgroundFetch::instance().start(outfits_cat);  	} +	mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this, true)); +  	return TRUE;  } @@ -373,7 +376,6 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()  	mListCommands->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::onGearButtonClick, this));  	mListCommands->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this)); -	mListCommands->childSetAction("make_outfit_btn", boost::bind(&LLPanelOutfitsInventory::onAddButtonClick, this));  	mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));  	LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>("trash_btn"); @@ -396,7 +398,7 @@ void LLPanelOutfitsInventory::updateListCommands()  	mListCommands->childSetEnabled("trash_btn", trash_enabled);  	mListCommands->childSetEnabled("wear_btn", wear_enabled);  	mListCommands->childSetVisible("wear_btn", wear_enabled); -	mListCommands->childSetEnabled("make_outfit_btn", make_outfit_enabled); +	mSaveComboBtn->setSaveBtnEnabled(make_outfit_enabled);  }  void LLPanelOutfitsInventory::onGearButtonClick() @@ -404,11 +406,6 @@ void LLPanelOutfitsInventory::onGearButtonClick()  	showActionMenu(mMenuGearDefault,"options_gear_btn");  } -void LLPanelOutfitsInventory::onAddButtonClick() -{ -	onSave(); -} -  void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)  {  	if (menu) diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index a0fe91cd80..7bdd37c16c 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -46,6 +46,7 @@ class LLButton;  class LLMenuGL;  class LLSidepanelAppearance;  class LLTabContainer; +class LLSaveOutfitComboBtn;  class LLPanelOutfitsInventory : public LLPanel  { @@ -86,7 +87,7 @@ private:  	LLSaveFolderState*		mSavedFolderState;  	LLTabContainer*			mAppearanceTabs;  	std::string 			mFilterSubString; - +	std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;  public:  	//////////////////////////////////////////////////////////////////////////////////  	// tab panels @@ -117,7 +118,6 @@ protected:  	void updateListCommands();  	void onGearButtonClick();  	void onWearButtonClick(); -	void onAddButtonClick();  	void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);  	void onTrashButtonClick();  	void onClipboardAction(const LLSD& userdata); diff --git a/indra/newview/llsaveoutfitcombobtn.cpp b/indra/newview/llsaveoutfitcombobtn.cpp new file mode 100644 index 0000000000..85197853de --- /dev/null +++ b/indra/newview/llsaveoutfitcombobtn.cpp @@ -0,0 +1,97 @@ +/**  + * @file llsaveoutfitcombobtn.cpp + * @brief Represents outfit save/save as combo button. + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + *  + * Copyright (c) 2010, Linden Research, Inc. + *  + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab.  Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + *  + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + *  + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + *  + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llappearancemgr.h" +#include "llpaneloutfitsinventory.h" +#include "llsaveoutfitcombobtn.h" +#include "llviewermenu.h" + +static const std::string SAVE_BTN("save_btn"); +static const std::string SAVE_FLYOUT_BTN("save_flyout_btn"); + +LLSaveOutfitComboBtn::LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAction): +	mParent(parent), mSaveAsDefaultAction(saveAsDefaultAction) +{ +	// register action mapping before creating menu +	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar; +	save_registar.add("Outfit.Save.Action", boost::bind( +			&LLSaveOutfitComboBtn::saveOutfit, this, false)); +	save_registar.add("Outfit.SaveAs.Action", boost::bind( +			&LLSaveOutfitComboBtn::saveOutfit, this, true)); + +	mParent->childSetAction(SAVE_BTN, boost::bind(&LLSaveOutfitComboBtn::saveOutfit, this, mSaveAsDefaultAction)); +	mParent->childSetAction(SAVE_FLYOUT_BTN, boost::bind(&LLSaveOutfitComboBtn::showSaveMenu, this)); + +	mSaveMenu.reset(LLUICtrlFactory::getInstance()->createFromFile< +			LLToggleableMenu> ("menu_save_outfit.xml", gMenuHolder, +			LLViewerMenuHolderGL::child_registry_t::instance())); +} + +void LLSaveOutfitComboBtn::showSaveMenu() +{ +	S32 x, y; +	LLUI::getMousePositionLocal(mParent, &x, &y); + +	mSaveMenu->updateParent(LLMenuGL::sMenuContainer); +	LLMenuGL::showPopup(mParent, mSaveMenu.get(), x, y); +} + +void LLSaveOutfitComboBtn::saveOutfit(bool as_new) +{ +	if (!as_new && LLAppearanceMgr::getInstance()->updateBaseOutfit()) +	{ +		// we don't need to ask for an outfit name, and updateBaseOutfit() successfully saved. +		// If updateBaseOutfit fails, ask for an outfit name anyways +		return; +	} + +	LLPanelOutfitsInventory* panel_outfits_inventory = +			LLPanelOutfitsInventory::findInstance(); +	if (panel_outfits_inventory) +	{ +		panel_outfits_inventory->onSave(); +	} + +	//*TODO how to get to know when base outfit is updated or new outfit is created? +} + +void LLSaveOutfitComboBtn::setMenuItemEnabled(const std::string& item, bool enabled) +{ +	mSaveMenu->setItemEnabled("save_outfit", enabled); +} + +void LLSaveOutfitComboBtn::setSaveBtnEnabled(bool enabled) +{ +	mParent->childSetEnabled(SAVE_BTN, enabled); +} diff --git a/indra/newview/llsaveoutfitcombobtn.h b/indra/newview/llsaveoutfitcombobtn.h new file mode 100644 index 0000000000..d505c4bebe --- /dev/null +++ b/indra/newview/llsaveoutfitcombobtn.h @@ -0,0 +1,60 @@ +/**  + * @file llsaveoutfitcombobtn.h + * @brief Represents outfit save/save as combo button. + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + *  + * Copyright (c) 2010, Linden Research, Inc. + *  + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab.  Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + *  + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + *  + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + *  + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLSAVEOUTFITCOMBOBTN_H +#define LL_LLSAVEOUTFITCOMBOBTN_H + +class LLButton; + +#include "lltoggleablemenu.h" + +/** + * Represents outfit Save/Save As combo button. + */ +class LLSaveOutfitComboBtn +{ +	LOG_CLASS(LLSaveOutfitComboBtn); +public: +	LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAction = false); + +	void showSaveMenu(); +	void saveOutfit(bool as_new = false); +	void setMenuItemEnabled(const std::string& item, bool enabled); +	void setSaveBtnEnabled(bool enabled); + +private: +	bool mSaveAsDefaultAction; +	LLPanel* mParent; +	std::auto_ptr<LLToggleableMenu>	mSaveMenu; +}; + +#endif // LL_LLSAVEOUTFITCOMBOBTN_H diff --git a/indra/newview/skins/default/xui/en/menu_save_outfit.xml b/indra/newview/skins/default/xui/en/menu_save_outfit.xml index a8778df7f6..6285bf7417 100644 --- a/indra/newview/skins/default/xui/en/menu_save_outfit.xml +++ b/indra/newview/skins/default/xui/en/menu_save_outfit.xml @@ -14,9 +14,9 @@          </menu_item_call>      <menu_item_call        name="save_as_new_outfit"  -     label="Save As New"> +     label="Save As">          <menu_item_call.on_click  -         function="Outfit.SaveAsNew.Action" +         function="Outfit.SaveAs.Action"           userdata="" />      </menu_item_call>  </toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml index 9e59651bd1..13e1f5ba5c 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml @@ -93,17 +93,30 @@           left_pad="1"           name="trash_btn"           tool_tip="Remove selected item" -         width="31"/> -	 <button -	  follows="bottom|left" -		height="23"  -      label="Save Outfit"  -      layout="topleft" -      name="make_outfit_btn" -      tool_tip="Save appearance as an outfit" +         width="31"/>          +     <button +       follows="bottom|left" +       height="23" +       label="Save As" +       left="0"          +       layout="topleft" +       name="save_btn"         top_pad="6" -       left="0" -      width="153" /> +       width="155" /> +     <button +       follows="bottom|left" +       height="23" +       name="save_flyout_btn" +       label="" +       layout="topleft" +       left_pad="-20" +       tab_stop="false" +       image_selected="SegmentedBtn_Right_Selected_Press" +       image_unselected="SegmentedBtn_Right_Off" +       image_pressed="SegmentedBtn_Right_Press" +       image_pressed_selected="SegmentedBtn_Right_Selected_Press" +       image_overlay="Arrow_Small_Up" +       width="20"/>       <button        follows="bottom|left|right"         height="23"  | 
