From 412e29ed9d62e975a5290c6008558a739b88065d Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 21 Sep 2011 17:25:38 -0700 Subject: EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars EXP-1232 FIX -- Create class to load and hold all of the command meta data associated with FUI toolbar actions * Added basic commands.xml file to define FUI-related toolbar actions. For now a basic "avatar" and "places" button are defined. * Added basic command manager to parse and hold strings that define potential toolbar command actions. * Broke out a separate floater function as a placeholder for the 3-state toolbar floater toggling. * LLUI::initClass now parses the new commands.xml file Reviewed by Richard. --- indra/llui/llfloaterreg.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/llui/llfloaterreg.cpp') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index fc7dcfcc4e..bc740dde17 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -452,6 +452,17 @@ void LLFloaterReg::toggleFloaterInstance(const LLSD& sdname) toggleInstance(name, key); } +//static +void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) +{ + // Do some extra logic here for 3-state toolbar floater toggling madness :) + + LLSD key; + std::string name = sdname.asString(); + parse_name_key(name, key); + toggleInstance(name, key); +} + //static bool LLFloaterReg::floaterInstanceVisible(const LLSD& sdname) { -- cgit v1.2.3 From 896ea6f81eaf409aae22158816226f09a459ca34 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 29 Sep 2011 14:42:30 -0700 Subject: EXP-1278 FIX -- Implement 3-way toolbar button functionality Toolbar buttons now affect their floaters as indicated in the FUI_Button_states wiki page -- https://wiki.lindenlab.com/wiki/FUI_Button_states --- indra/llui/llfloaterreg.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'indra/llui/llfloaterreg.cpp') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index bc740dde17..8a0513f246 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -455,12 +455,42 @@ void LLFloaterReg::toggleFloaterInstance(const LLSD& sdname) //static void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) { - // Do some extra logic here for 3-state toolbar floater toggling madness :) - + // + // Floaters controlled by the toolbar behave a bit differently from others. + // Namely they have 3-4 states as defined in the design wiki page here: + // https://wiki.lindenlab.com/wiki/FUI_Button_states + // + // The basic idea is this: + // * If the target floater is minimized, this button press will un-minimize it. + // * Else if the target floater is closed open it. + // * Else if the target floater does not have focus, give it focus. + // * Also, if it is not on top, bring it forward when focus is given. + // * Else the target floater is open, close it. + // + + // First parse the parameter LLSD key; std::string name = sdname.asString(); parse_name_key(name, key); - toggleInstance(name, key); + + LLFloater* instance = findInstance(name, key); + + if (LLFloater::isMinimized(instance)) + { + instance->setMinimized(FALSE); + } + else if (!LLFloater::isShown(instance)) + { + showInstance(name, key, TRUE); + } + else if (!instance->hasFocus()) + { + instance->setFocus(TRUE); + } + else + { + instance->closeFloater(); + } } //static -- cgit v1.2.3 From 6fe4815217a11a36aa2e2b1d8b040eff007bb631 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 30 Sep 2011 15:26:48 -0700 Subject: Updated FUI floater toggle function to handle closing windows that are initialized with chrome. --- indra/llui/llfloaterreg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llfloaterreg.cpp') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 8a0513f246..27e96856b3 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -483,7 +483,7 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) { showInstance(name, key, TRUE); } - else if (!instance->hasFocus()) + else if (!instance->hasFocus() && !instance->getIsChrome()) { instance->setFocus(TRUE); } -- cgit v1.2.3 From 93e3c8e4a51dd60c202bc2e3f11b9ae850b2b6c8 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 5 Oct 2011 16:28:40 -0700 Subject: EXP-1280 FIX -- Minimized floaters associated with toolbar buttons should change the state of their parent button * Toolbar buttons now display green when its corresponding floater is open or minimized. * Made changes to buttons so flash time and rate is configurable * Removed unused "highlight_color" attribute from LLButton * Implemented "isVisible" function for toolbar button floaters. It returns true when the floater is visible or minimized. * Toolbar floater unminimize now also puts focus to the floater * All commands now specify their "is_running_function" for toolbar button state * ButtonFlashCount and ButtonFlashRate have been moved to button.xml settings and are now configurable on the button. Toolbar buttons are set to never flash and this functionality is used to show which buttons have windows open. * All toybox buttons show hover glow even when disabled Reviewed by Richard. --- indra/llui/llfloaterreg.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'indra/llui/llfloaterreg.cpp') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 27e96856b3..d0ae9413a3 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -478,6 +478,7 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) if (LLFloater::isMinimized(instance)) { instance->setMinimized(FALSE); + instance->setFocus(TRUE); } else if (!LLFloater::isShown(instance)) { @@ -493,6 +494,28 @@ 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) { -- cgit v1.2.3 From ec23ec68ea8835e4155e083ec5570245b0aef1ec Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 10 Oct 2011 19:17:38 -0700 Subject: EXP-1310 FIX Profile button should open Web Profile floater removed unused LLWeb functions for opening non-web media moved logic inside floaters and away from auxiliary functions --- indra/llui/llfloaterreg.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llui/llfloaterreg.cpp') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index d0ae9413a3..ae06eb74ac 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -110,7 +110,11 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) int index = list.size(); res = build_func(key); - + if (!res) + { + llwarns << "Failed to build floater type: '" << name << "'." << llendl; + return NULL; + } bool success = res->buildFromFile(xui_file, NULL); if (!success) { -- cgit v1.2.3 From f9e900f5ac9002f5ef3b44b02ac300971288e89b Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 11 Oct 2011 17:36:23 -0700 Subject: * New floater positioning code. Better than what's checked in but not great. * Floater updates for positioning and to revert some earlier string changes. --- indra/llui/llfloaterreg.cpp | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'indra/llui/llfloaterreg.cpp') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index ae06eb74ac..058223abbd 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -107,7 +107,6 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; - int index = list.size(); res = build_func(key); if (!res) @@ -121,27 +120,18 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) llwarns << "Failed to build floater type: '" << name << "'." << llendl; return NULL; } - + // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe if (res->mKey.isUndefined()) { - res->mKey = key; + res->mKey = key; } res->setInstanceName(name); res->applySavedVariables(); // Can't apply rect and dock state until setting instance name - if (res->mAutoTile && !res->getHost() && index > 0) - { - LLFloater* last_floater = getLastFloaterInGroup(groupname); - if (last_floater) - { - res->stackWith(*last_floater); - gFloaterView->adjustToFitScreen(res, true); - } - } - else - { - gFloaterView->adjustToFitScreen(res, false); - } + + // apply list.size() and possibly stackWith(getLastFloaterInGroup(groupname)) + gFloaterView->adjustToFitScreen(res, false); + list.push_back(res); } } @@ -477,16 +467,21 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname) std::string name = sdname.asString(); parse_name_key(name, key); - LLFloater* instance = findInstance(name, key); + LLFloater* instance = getInstance(name, key); - if (LLFloater::isMinimized(instance)) + if (!instance) + { + lldebugs << "Unable to get instance of floater '" << name << "'" << llendl; + } + else if (instance->isMinimized()) { instance->setMinimized(FALSE); instance->setFocus(TRUE); } - else if (!LLFloater::isShown(instance)) + else if (!instance->isShown()) { - showInstance(name, key, TRUE); + instance->openFloater(key); + instance->setFocus(TRUE); } else if (!instance->hasFocus() && !instance->getIsChrome()) { -- cgit v1.2.3 From 309ebb84a8cf93e03e2594525aa128b3002040bf Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 12 Oct 2011 17:43:47 -0700 Subject: * Floater positioning now based on position of other cascading windows currently open. --- indra/llui/llfloaterreg.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 4 deletions(-) (limited to 'indra/llui/llfloaterreg.cpp') diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index 058223abbd..a148f5a32e 100644 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -59,19 +59,57 @@ void LLFloaterReg::add(const std::string& name, const std::string& filename, con //static LLFloater* LLFloaterReg::getLastFloaterInGroup(const std::string& name) { - LLRect rect; const std::string& groupname = sGroupMap[name]; if (!groupname.empty()) { instance_list_t& list = sInstanceMap[groupname]; if (!list.empty()) { - return list.back(); + for (instance_list_t::reverse_iterator iter = list.rbegin(); iter != list.rend(); ++iter) + { + LLFloater* inst = *iter; + + if (inst->getVisible() && !inst->isMinimized()) + { + return inst; + } + } } } return NULL; } +LLFloater* LLFloaterReg::getLastFloaterCascading() +{ + LLRect candidate_rect; + candidate_rect.mTop = 100000; + LLFloater* candidate_floater = NULL; + + std::map::const_iterator it = sGroupMap.begin(), it_end = sGroupMap.end(); + for( ; it != it_end; ++it) + { + const std::string& group_name = it->second; + + instance_list_t& instances = sInstanceMap[group_name]; + + for (instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); ++iter) + { + LLFloater* inst = *iter; + + if (inst->getVisible() && inst->isPositioning(LLFloaterEnums::OPEN_POSITIONING_CASCADING)) + { + if (candidate_rect.mTop > inst->getRect().mTop) + { + candidate_floater = inst; + candidate_rect = inst->getRect(); + } + } + } + } + + return candidate_floater; +} + //static LLFloater* LLFloaterReg::findInstance(const std::string& name, const LLSD& key) { @@ -127,9 +165,10 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) res->mKey = key; } res->setInstanceName(name); - res->applySavedVariables(); // Can't apply rect and dock state until setting instance name - // apply list.size() and possibly stackWith(getLastFloaterInGroup(groupname)) + LLFloater *last_floater = (list.empty() ? NULL : list.back()); + res->applyControlsAndPosition(last_floater); + gFloaterView->adjustToFitScreen(res, false); list.push_back(res); @@ -533,3 +572,29 @@ bool LLFloaterReg::floaterInstanceMinimized(const LLSD& sdname) LLFloater* instance = findInstance(name, key); return LLFloater::isShown(instance); } + +// static +U32 LLFloaterReg::getVisibleFloaterInstanceCount() +{ + U32 count = 0; + + std::map::const_iterator it = sGroupMap.begin(), it_end = sGroupMap.end(); + for( ; it != it_end; ++it) + { + const std::string& group_name = it->second; + + instance_list_t& instances = sInstanceMap[group_name]; + + for (instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); ++iter) + { + LLFloater* inst = *iter; + + if (inst->getVisible() && !inst->isMinimized()) + { + count++; + } + } + } + + return count; +} -- cgit v1.2.3 From 63e4fdfc6498ad8a0af92e89759ae4fdb7035af6 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Thu, 13 Oct 2011 10:49:53 -0700 Subject: cleaned up floater reg, removed extraneous functions --- indra/llui/llfloaterreg.cpp | 96 +-------------------------------------------- 1 file changed, 1 insertion(+), 95 deletions(-) (limited to 'indra/llui/llfloaterreg.cpp') 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() { -- cgit v1.2.3