diff options
| author | Richard Nelson <richard@lindenlab.com> | 2011-10-13 10:49:53 -0700 | 
|---|---|---|
| committer | Richard Nelson <richard@lindenlab.com> | 2011-10-13 10:49:53 -0700 | 
| commit | 63e4fdfc6498ad8a0af92e89759ae4fdb7035af6 (patch) | |
| tree | 0054ddb35ec72494e73e8601e0e4e3159f690b16 | |
| parent | 87c321512a24527e2e4deddc6bb5db6dda5ca9b8 (diff) | |
cleaned up floater reg, removed extraneous functions
| -rw-r--r-- | indra/llui/llbutton.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/llfloaterreg.cpp | 96 | ||||
| -rw-r--r-- | indra/llui/llfloaterreg.h | 9 | ||||
| -rw-r--r-- | indra/llui/llui.cpp | 35 | ||||
| -rw-r--r-- | indra/newview/app_settings/commands.xml | 45 | ||||
| -rw-r--r-- | indra/newview/llpanelpeople.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 1 | 
7 files changed, 44 insertions, 146 deletions
| diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index f40d99c024..3572d18860 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1189,7 +1189,7 @@ void LLButton::setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)  	// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)  	button->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name));  	// Set the clicked callback to toggle the floater -	button->setClickedCallback(boost::bind(&LLFloaterReg::toggleFloaterInstance, sdname)); +	button->setClickedCallback(boost::bind(&LLFloaterReg::toggleInstance, sdname, LLSD()));  }  // static diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index a148f5a32e..0edfc8da2d 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -436,57 +436,8 @@ void LLFloaterReg::registerControlVariables()  	}  } -// Callbacks - -// static -// Call once (i.e use for init callbacks) -void LLFloaterReg::initUICtrlToFloaterVisibilityControl(LLUICtrl* ctrl, const LLSD& sdname) -{ -	// Get the visibility control name for the floater -	std::string vis_control_name = LLFloaterReg::declareVisibilityControl(sdname.asString()); -	// Set the control value to the floater visibility control (Sets the value as well) -	ctrl->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name)); -} - -// callback args may use "floatername.key" format -static void parse_name_key(std::string& name, LLSD& key) -{ -	std::string instname = name; -	std::size_t dotpos = instname.find("."); -	if (dotpos != std::string::npos) -	{ -		name = instname.substr(0, dotpos); -		key = LLSD(instname.substr(dotpos+1, std::string::npos)); -	} -} - -//static -void LLFloaterReg::showFloaterInstance(const LLSD& sdname) -{ -	LLSD key; -	std::string name = sdname.asString(); -	parse_name_key(name, key); -	showInstance(name, key, TRUE); -} -//static -void LLFloaterReg::hideFloaterInstance(const LLSD& sdname) -{ -	LLSD key; -	std::string name = sdname.asString(); -	parse_name_key(name, key); -	hideInstance(name, key); -}  //static -void LLFloaterReg::toggleFloaterInstance(const LLSD& sdname) -{ -	LLSD key; -	std::string name = sdname.asString(); -	parse_name_key(name, key); -	toggleInstance(name, key); -} - -//static -void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) +void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& key)  {  	//  	// Floaters controlled by the toolbar behave a bit differently from others. @@ -501,11 +452,7 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname)  	// * Else the target floater is open, close it.  	//  -	// First parse the parameter -	LLSD key;  	std::string name = sdname.asString(); -	parse_name_key(name, key); -  	LLFloater* instance = getInstance(name, key);   	if (!instance) @@ -532,47 +479,6 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname)  	}  } -//static -bool LLFloaterReg::floaterInstanceOpen(const LLSD& sdname) -{ -	LLSD key; -	std::string name = sdname.asString(); -	parse_name_key(name, key); - -	bool visible_or_minimized = instanceVisible(name, key); - -	if (!visible_or_minimized) -	{ -		LLFloater* instance = findInstance(name, key);  - -		if (instance != NULL) -		{ -			visible_or_minimized = LLFloater::isMinimized(instance); -		} -	} - -	return visible_or_minimized; -} - -//static -bool LLFloaterReg::floaterInstanceVisible(const LLSD& sdname) -{ -	LLSD key; -	std::string name = sdname.asString(); -	parse_name_key(name, key); -	return instanceVisible(name, key); -} - -//static -bool LLFloaterReg::floaterInstanceMinimized(const LLSD& sdname) -{ -	LLSD key; -	std::string name = sdname.asString(); -	parse_name_key(name, key); -	LLFloater* instance = findInstance(name, key);  -	return LLFloater::isShown(instance); -} -  // static  U32 LLFloaterReg::getVisibleFloaterInstanceCount()  { diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index 817fe2e8c6..534cf8b40a 100644 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -124,14 +124,7 @@ public:  	static void registerControlVariables();  	// Callback wrappers -	static void initUICtrlToFloaterVisibilityControl(LLUICtrl* ctrl, const LLSD& sdname); -	static void showFloaterInstance(const LLSD& sdname); -	static void hideFloaterInstance(const LLSD& sdname); -	static void toggleFloaterInstance(const LLSD& sdname); -	static void toggleToolbarFloaterInstance(const LLSD& sdname); -	static bool floaterInstanceOpen(const LLSD& sdname); -	static bool floaterInstanceVisible(const LLSD& sdname); -	static bool floaterInstanceMinimized(const LLSD& sdname); +	static void toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& key = LLSD());  	// Typed find / get / show  	template <class T> diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 9c0253f074..79ad99a770 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -89,7 +89,7 @@ std::list<std::string> gUntranslated;  /*static*/ LLUI::remove_popup_t	LLUI::sRemovePopupFunc;  /*static*/ LLUI::clear_popups_t	LLUI::sClearPopupsFunc; -// register filtereditor here +// register filter editor here  static LLDefaultChildRegistry::Register<LLFilterEditor> register_filter_editor("filter_editor");  static LLDefaultChildRegistry::Register<LLFlyoutButton> register_flyout_button("flyout_button");  static LLDefaultChildRegistry::Register<LLSearchEditor> register_search_editor("search_editor"); @@ -106,7 +106,7 @@ void make_ui_sound(const char* namep)  	std::string name = ll_safe_string(namep);  	if (!LLUI::sSettingGroups["config"]->controlExists(name))  	{ -		llwarns << "tried to make ui sound for unknown sound name: " << name << llendl;	 +		llwarns << "tried to make UI sound for unknown sound name: " << name << llendl;	  	}  	else  	{ @@ -117,12 +117,12 @@ void make_ui_sound(const char* namep)  			{  				if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))  				{ -					llinfos << "ui sound name: " << name << " triggered but silent (null uuid)" << llendl;	 +					llinfos << "UI sound name: " << name << " triggered but silent (null uuid)" << llendl;	  				}				  			}  			else  			{ -				llwarns << "ui sound named: " << name << " does not translate to a valid uuid" << llendl;	 +				llwarns << "UI sound named: " << name << " does not translate to a valid uuid" << llendl;	  			}  		} @@ -130,7 +130,7 @@ void make_ui_sound(const char* namep)  		{  			if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))  			{ -				llinfos << "ui sound name: " << name << llendl;	 +				llinfos << "UI sound name: " << name << llendl;	  			}  			LLUI::sAudioCallback(uuid);  		} @@ -474,7 +474,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex  		return;  	} -	// add in offset of current image to current ui translation +	// add in offset of current image to current UI translation  	const LLVector3 ui_scale = gGL.getUIScale();  	const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); @@ -1616,17 +1616,16 @@ void LLUI::initClass(const settings_map_t& settings,  	LLUICtrl::CommitCallbackRegistry::Registrar& reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar(); -	// Callbacks for associating controls with floater visibilty: -	reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleFloaterInstance, _2)); -	reg.add("Floater.ToolbarToggle", boost::bind(&LLFloaterReg::toggleToolbarFloaterInstance, _2)); -	reg.add("Floater.Show", boost::bind(&LLFloaterReg::showFloaterInstance, _2)); -	reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideFloaterInstance, _2)); -	reg.add("Floater.InitToVisibilityControl", boost::bind(&LLFloaterReg::initUICtrlToFloaterVisibilityControl, _1, _2)); +	// Callbacks for associating controls with floater visibility: +	reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleInstance, _2, LLSD())); +	reg.add("Floater.ToggleOrBringToFront", boost::bind(&LLFloaterReg::toggleInstanceOrBringToFront, _2, LLSD())); +	reg.add("Floater.Show", boost::bind(&LLFloaterReg::showInstance, _2, LLSD(), FALSE)); +	reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideInstance, _2, LLSD()));  	// Button initialization callback for toggle buttons  	reg.add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2)); -	// Button initialization callback for toggle buttons on dockale floaters +	// Button initialization callback for toggle buttons on dockable floaters  	reg.add("Button.SetDockableFloaterToggle", boost::bind(&LLButton::setDockableFloaterToggle, _1, _2));  	// Display the help topic for the current context @@ -1635,9 +1634,9 @@ void LLUI::initClass(const settings_map_t& settings,  	// Currently unused, but kept for reference:  	reg.add("Button.ToggleFloater", boost::bind(&LLButton::toggleFloaterAndSetToggleState, _1, _2)); -	// Used by menus along with Floater.Toggle to display visibility as a checkmark -	LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::floaterInstanceVisible, _2)); -	LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.IsOpen", boost::bind(&LLFloaterReg::floaterInstanceOpen, _2)); +	// Used by menus along with Floater.Toggle to display visibility as a check-mark +	LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::instanceVisible, _2, LLSD())); +	LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.IsOpen", boost::bind(&LLFloaterReg::instanceVisible, _2, LLSD()));  	// Parse the master list of commands  	LLCommandManager::load(); @@ -2034,12 +2033,12 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)  								CURSOR_HEIGHT + MOUSE_CURSOR_PADDING * 2);  	S32 local_x, local_y; -	// convert screen coordinates to tooltipview-local coordinates +	// convert screen coordinates to tooltip view-local coordinates  	parent->screenPointToLocal(spawn_x, spawn_y, &local_x, &local_y);  	// Start at spawn position (using left/top)  	view->setOrigin( local_x, local_y - view->getRect().getHeight()); -	// Make sure we're onscreen and not overlapping the mouse +	// Make sure we're on-screen and not overlapping the mouse  	view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect, FALSE );  } diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 3625ce5088..e4aaca1bd0 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -5,7 +5,7 @@             icon="Command_AboutLand_Icon"             label_ref="Command_AboutLand_Label"             tooltip_ref="Command_AboutLand_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="about_land"             is_running_function="Floater.IsOpen"             is_running_parameters="about_land" @@ -15,7 +15,7 @@             icon="Command_Appearance_Icon"             label_ref="Command_Appearance_Label"             tooltip_ref="Command_Appearance_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="appearance"             is_running_function="Floater.IsOpen"             is_running_parameters="appearance" @@ -25,7 +25,7 @@             icon="Command_Avatar_Icon"             label_ref="Command_Avatar_Label"             tooltip_ref="Command_Avatar_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="avatar"             is_running_function="Floater.IsOpen"             is_running_parameters="avatar" @@ -35,7 +35,7 @@             icon="Command_Build_Icon"             label_ref="Command_Build_Label"             tooltip_ref="Command_Build_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="build"             is_enabled_function="Agent.IsActionAllowed"             is_enabled_parameters="build" @@ -47,7 +47,7 @@             icon="Command_Chat_Icon"             label_ref="Command_Chat_Label"             tooltip_ref="Command_Chat_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="chat_bar"             is_running_function="Floater.IsOpen"             is_running_parameters="chat_bar" @@ -57,7 +57,7 @@             icon="Command_Compass_Icon"             label_ref="Command_Compass_Label"             tooltip_ref="Command_Compass_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="compass"             is_running_function="Floater.IsOpen"             is_running_parameters="compass" @@ -67,7 +67,7 @@             icon="Command_Destinations_Icon"             label_ref="Command_Destinations_Label"             tooltip_ref="Command_Destinations_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="destinations"             is_running_function="Floater.IsOpen"             is_running_parameters="destinations" @@ -77,7 +77,7 @@             icon="Command_Gestures_Icon"             label_ref="Command_Gestures_Label"             tooltip_ref="Command_Gestures_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="gestures"             is_running_function="Floater.IsOpen"             is_running_parameters="gestures" @@ -87,8 +87,7 @@             icon="Command_HowTo_Icon"             label_ref="Command_HowTo_Label"             tooltip_ref="Command_HowTo_Tooltip" -           execute_function="Floater.ToolbarToggle" -           execute_parameters="help_browser" +           execute_function="Help.ToggleHowTo"             is_running_function="Floater.IsOpen"             is_running_parameters="help_browser"             /> @@ -97,7 +96,7 @@             icon="Command_Inventory_Icon"             label_ref="Command_Inventory_Label"             tooltip_ref="Command_Inventory_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="my_inventory"             is_running_function="Floater.IsOpen"             is_running_parameters="my_inventory" @@ -107,7 +106,7 @@             icon="Command_Map_Icon"             label_ref="Command_Map_Label"             tooltip_ref="Command_Map_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="world_map"             is_running_function="Floater.IsOpen"             is_running_parameters="world_map" @@ -117,7 +116,7 @@             icon="Command_Marketplace_Icon"             label_ref="Command_Marketplace_Label"             tooltip_ref="Command_Marketplace_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="marketplace"             is_running_function="Floater.IsOpen"             is_running_parameters="marketplace" @@ -127,7 +126,7 @@             icon="Command_MiniMap_Icon"             label_ref="Command_MiniMap_Label"             tooltip_ref="Command_MiniMap_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="mini_map"             is_running_function="Floater.IsOpen"             is_running_parameters="mini_map" @@ -137,7 +136,7 @@             icon="Command_Move_Icon"             label_ref="Command_Move_Label"             tooltip_ref="Command_Move_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="moveview"             is_running_function="Floater.IsOpen"             is_running_parameters="moveview" @@ -147,7 +146,7 @@             icon="Command_People_Icon"             label_ref="Command_People_Label"             tooltip_ref="Command_People_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="people"             is_running_function="Floater.IsOpen"             is_running_parameters="people" @@ -157,7 +156,7 @@             icon="Command_Picks_Icon"             label_ref="Command_Picks_Label"             tooltip_ref="Command_Picks_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="picks"             is_running_function="Floater.IsOpen"             is_running_parameters="picks" @@ -167,7 +166,7 @@             icon="Command_Places_Icon"             label_ref="Command_Places_Label"             tooltip_ref="Command_Places_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="places"             is_running_function="Floater.IsOpen"             is_running_parameters="places" @@ -177,7 +176,7 @@             icon="Command_Preferences_Icon"             label_ref="Command_Preferences_Label"             tooltip_ref="Command_Preferences_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="preferences"             is_running_function="Floater.IsOpen"             is_running_parameters="preferences" @@ -195,7 +194,7 @@             icon="Command_Search_Icon"             label_ref="Command_Search_Label"             tooltip_ref="Command_Search_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="search"             is_running_function="Floater.IsOpen"             is_running_parameters="search" @@ -205,7 +204,7 @@             icon="Command_Snapshot_Icon"             label_ref="Command_Snapshot_Label"             tooltip_ref="Command_Snapshot_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="snapshot"             is_running_function="Floater.IsOpen"             is_running_parameters="snapshot" @@ -229,7 +228,7 @@             icon="Command_View_Icon"             label_ref="Command_View_Label"             tooltip_ref="Command_View_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="camera"             is_running_function="Floater.IsOpen"             is_running_parameters="camera" @@ -239,7 +238,7 @@             icon="Command_Voice_Icon"             label_ref="Command_Voice_Label"             tooltip_ref="Command_Voice_Tooltip" -           execute_function="Floater.ToolbarToggle" +           execute_function="Floater.ToggleOrBringToFront"             execute_parameters="voice_controls"             is_running_function="Floater.IsOpen"             is_running_parameters="voice_controls" diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 80c431f481..d5e289e6e6 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1451,7 +1451,7 @@ bool LLPanelPeople::notifyChildren(const LLSD& info)  			container->onOpen(LLSD().with(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));  		}  		else -			LLFloaterReg::hideFloaterInstance("people"); +			LLFloaterReg::hideInstance("people");  		return true; // this notification is only supposed to be handled by task panels  	} diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 3463eec5d8..b5ed8b04bc 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -289,6 +289,7 @@ void LLViewerFloaterReg::registerFloaters()  	LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);  	LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);  	LLFloaterReg::add("profile", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);	 +	LLFloaterReg::add("how_to", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);	  	LLFloaterUIPreviewUtil::registerFloater(); | 
