Automated merge with ssh://hg.lindenlab.com/richard/viewer-experience-fui

meow-7.2.2
Richard Nelson 2011-10-13 10:52:14 -07:00
commit b3f2339cd7
10 changed files with 74 additions and 148 deletions

View File

@ -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

View File

@ -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()
{

View File

@ -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>

View File

@ -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 );
}

View File

@ -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"

View File

@ -4028,6 +4028,17 @@
<key>Value</key>
<string>http://viewer-help.secondlife.com/[LANGUAGE]/[CHANNEL]/[VERSION]/[TOPIC][DEBUG_MODE]</string>
</map>
<key>HowToHelpURL</key>
<map>
<key>Comment</key>
<string>URL for How To help content</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>http://common-flash-secondlife-com.s3.amazonaws.com/viewer/v2.6/agni/howto/index.html</string>
</map>
<key>HomeSidePanelURL</key>
<map>
<key>Comment</key>

View File

@ -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
}

View File

@ -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();

View File

@ -144,4 +144,3 @@ std::string LLViewerHelp::getTopicFromFocus()
return defaultTopic();
}

View File

@ -3113,6 +3113,11 @@ void handle_avatar_eject(const LLSD& avatar_id)
}
}
bool my_profile_visible()
{
return LLAvatarActions::profileVisible(gAgent.getID());
}
bool enable_freeze_eject(const LLSD& avatar_id)
{
// Use avatar_id if available, otherwise default to right-click avatar
@ -4516,6 +4521,13 @@ bool tools_visible_take_object()
return !is_selection_buy_not_take();
}
bool enable_how_to_visible(const LLSD& param)
{
LLFloaterWebContent::Params p;
p.target = "__help_how_to";
return LLFloaterReg::instanceVisible(param, p);
}
class LLToolsEnableBuyOrTake : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -6879,6 +6891,11 @@ class LLToggleHowTo : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
LLFloaterWebContent::Params p;
p.url = gSavedSettings.getString("HowToHelpURL");
p.target = "__help_how_to";
LLFloaterReg::toggleInstanceOrBringToFront(userdata, p);
return true;
}
};
@ -8047,6 +8064,7 @@ void initialize_menus()
// Help menu
// most items use the ShowFloater method
view_listener_t::addMenu(new LLToggleHowTo(), "Help.ToggleHowTo");
enable.add("Help.HowToVisible", boost::bind(&enable_how_to_visible, _2));
// Advanced menu
view_listener_t::addMenu(new LLAdvancedToggleConsole(), "Advanced.ToggleConsole");
@ -8240,7 +8258,7 @@ void initialize_menus()
enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile");
enable.add("Avatar.IsMyProfileOpen", boost::bind(&LLAvatarActions::profileVisible, gAgent.getID()));
enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible));
view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));