From 9ec432034dc3c45d7ce763eb02dae4cc7f6b8da8 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sun, 21 Jun 2009 08:04:56 +0000 Subject: merge -r 122421-124917 viewer-2.0.0-2 -> viewer-2.0.0-3 ignore-dead-branch --- indra/llui/llpanel.cpp | 1219 ++++++++++-------------------------------------- 1 file changed, 250 insertions(+), 969 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 28780c7adb..ad5cdca5cc 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -54,74 +54,49 @@ #include "lluictrlfactory.h" #include "llviewborder.h" #include "llbutton.h" +#include "lltabcontainer.h" -// LLLayoutStack -#include "llresizebar.h" -#include "llcriticaldamp.h" +static LLDefaultWidgetRegistry::Register r1("panel", &LLPanel::fromXML); -const S32 RESIZE_BAR_OVERLAP = 1; -const S32 RESIZE_BAR_HEIGHT = 3; - -static LLRegisterWidget r1("panel"); - -void LLPanel::init() +LLPanel::Params::Params() +: has_border("border", false), + bg_opaque_color("bg_opaque_color"), + bg_alpha_color("bg_alpha_color"), + background_visible("background_visible", false), + background_opaque("background_opaque", false), + min_width("min_width", 100), + min_height("min_height", 100), + strings("string"), + filename("filename"), + class_name("class") { - // mRectControl - mBgColorAlpha = LLUI::sColorsGroup->getColor( "DefaultBackgroundColor" ); - mBgColorOpaque = LLUI::sColorsGroup->getColor( "FocusBackgroundColor" ); - mDefaultBtnHighlight = LLUI::sColorsGroup->getColor( "DefaultHighlightLight" ); - mBgVisible = FALSE; - mBgOpaque = FALSE; - mBorder = NULL; - mDefaultBtn = NULL; - setIsChrome(FALSE); //is this a decorator to a live window or a form? - mLastTabGroup = 0; - - mPanelHandle.bind(this); - setTabStop(FALSE); + name = "panel"; + addSynonym(background_visible, "bg_visible"); + addSynonym(has_border, "border_visible"); + addSynonym(label, "title"); } -LLPanel::LLPanel() -: mRectControl() -{ - init(); - setName(std::string("panel")); -} -LLPanel::LLPanel(const std::string& name) -: LLUICtrl(name, LLRect(0, 0, 0, 0), TRUE, NULL, NULL), - mRectControl() +LLPanel::LLPanel(const LLPanel::Params& p) +: LLUICtrl(p), + mBgColorAlpha(p.bg_alpha_color().get()), + mBgColorOpaque(p.bg_opaque_color().get()), + mBgVisible(p.background_visible), + mBgOpaque(p.background_opaque), + mDefaultBtn(NULL), + mBorder(NULL), + mLabel(p.label), + mCommitCallbackRegistrar(false), + mEnableCallbackRegistrar(false) { - init(); -} + setIsChrome(FALSE); - -LLPanel::LLPanel(const std::string& name, const LLRect& rect, BOOL bordered) -: LLUICtrl(name, rect, TRUE, NULL, NULL), - mRectControl() -{ - init(); - if (bordered) + if (p.has_border) { - addBorder(); + addBorder(p.border); } -} - - -LLPanel::LLPanel(const std::string& name, const std::string& rect_control, BOOL bordered) -: LLUICtrl(name, LLUI::sConfigGroup->getRect(rect_control), TRUE, NULL, NULL), - mRectControl( rect_control ) -{ - init(); - if (bordered) - { - addBorder(); - } -} - -LLPanel::~LLPanel() -{ - storeRectControl(); + + mPanelHandle.bind(this); } // virtual @@ -130,27 +105,23 @@ BOOL LLPanel::isPanel() const return TRUE; } -// virtual -BOOL LLPanel::postBuild() -{ - return TRUE; -} - -void LLPanel::addBorder(LLViewBorder::EBevel border_bevel, - LLViewBorder::EStyle border_style, S32 border_thickness) +void LLPanel::addBorder(LLViewBorder::Params p) { removeBorder(); - mBorder = new LLViewBorder( std::string("panel border"), - LLRect(0, getRect().getHeight(), getRect().getWidth(), 0), - border_bevel, border_style, border_thickness ); - mBorder->setSaveToXML(false); + p.rect = getLocalRect(); + + mBorder = LLUICtrlFactory::create(p); addChild( mBorder ); } void LLPanel::removeBorder() { - delete mBorder; - mBorder = NULL; + if (mBorder) + { + removeChild(mBorder); + delete mBorder; + mBorder = NULL; + } } @@ -258,20 +229,6 @@ void LLPanel::setDefaultBtn(const std::string& id) } } -void LLPanel::addCtrl( LLUICtrl* ctrl, S32 tab_group) -{ - mLastTabGroup = tab_group; - - LLView::addCtrl(ctrl, tab_group); -} - -void LLPanel::addCtrlAtEnd( LLUICtrl* ctrl, S32 tab_group) -{ - mLastTabGroup = tab_group; - - LLView::addCtrlAtEnd(ctrl, tab_group); -} - BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; @@ -308,29 +265,26 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) } } } - - // If we have a default button, click it when - // return is pressed, unless current focus is a return-capturing button - // in which case *that* button will handle the return key - LLButton* focused_button = dynamic_cast(cur_focus); - if (cur_focus && !(focused_button && focused_button->getCommitOnReturn())) + + // If RETURN was pressed and something has focus, call onCommit() + if (!handled && cur_focus && key == KEY_RETURN && mask == MASK_NONE) { - // RETURN key means hit default button in this case - if (key == KEY_RETURN && mask == MASK_NONE - && mDefaultBtn != NULL - && mDefaultBtn->getVisible() - && mDefaultBtn->getEnabled()) + LLButton* focused_button = dynamic_cast(cur_focus); + if (focused_button && focused_button->getCommitOnReturn()) + { + // current focus is a return-capturing button, + // let *that* button handle the return key + handled = FALSE; + } + else if (mDefaultBtn && mDefaultBtn->getVisible() && mDefaultBtn->getEnabled()) { + // If we have a default button, click it when return is pressed mDefaultBtn->onCommit(); handled = TRUE; } - } - - if (key == KEY_RETURN && mask == MASK_NONE) - { - // set keyboard focus to self to trigger commitOnFocusLost behavior on current ctrl - if (cur_focus && cur_focus->acceptsTextInput()) + else if (cur_focus->acceptsTextInput()) { + // call onCommit for text input handling control cur_focus->onCommit(); handled = TRUE; } @@ -364,12 +318,10 @@ void LLPanel::setFocus(BOOL b) { if (!gFocusMgr.childHasKeyboardFocus(this)) { - //refresh(); - if (!focusFirstItem()) - { - LLUICtrl::setFocus(TRUE); - } - onFocusReceived(); + // give ourselves focus preemptively, to avoid infinite loop + LLUICtrl::setFocus(TRUE); + // then try to pass to first valid child + focusFirstItem(); } } else @@ -399,191 +351,194 @@ void LLPanel::setBorderVisible(BOOL b) } } -// virtual -LLXMLNodePtr LLPanel::getXML(bool save_children) const -{ - LLXMLNodePtr node = LLView::getXML(); - - if (mBorder && mBorder->getVisible()) - { - node->createChild("border", TRUE)->setBoolValue(TRUE); - } +LLFastTimer::DeclareTimer FTM_PANEL_CONSTRUCTION("Panel Construction"); - if (!mRectControl.empty()) - { - node->createChild("rect_control", TRUE)->setStringValue(mRectControl); - } +LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_node) +{ + std::string name("panel"); + node->getAttributeString("name", name); - if (!mLabel.empty()) - { - node->createChild("label", TRUE)->setStringValue(mLabel); - } + std::string class_attr; + node->getAttributeString("class", class_attr); - if (save_children) + LLPanel* panelp = NULL; + { - LLView::child_list_const_reverse_iter_t rit; - for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit) + LLFastTimer timer(FTM_PANEL_CONSTRUCTION); + + if(!class_attr.empty()) { - LLView* childp = *rit; - - if (childp->getSaveToXML()) + panelp = LLRegisterPanelClass::instance().createPanelClass(class_attr); + if (!panelp) { - LLXMLNodePtr xml_node = childp->getXML(); - - node->addChild(xml_node); + llwarns << "Panel class \"" << class_attr << "\" not registered." << llendl; } } - } - return node; -} - -LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory) -{ - std::string name("panel"); - node->getAttributeString("name", name); + if (!panelp) + { + panelp = LLUICtrlFactory::getInstance()->createFactoryPanel(name); + } - LLPanel* panelp = factory->createFactoryPanel(name); - // Fall back on a default panel, if there was no special factory. - if (!panelp) - { - LLRect rect; - createRect(node, rect, parent, LLRect()); - // create a new panel without a border, by default - panelp = new LLPanel(name, rect, FALSE); - panelp->initPanelXML(node, parent, factory); - // preserve panel's width and height, but override the location - const LLRect& panelrect = panelp->getRect(); - S32 w = panelrect.getWidth(); - S32 h = panelrect.getHeight(); - rect.setLeftTopAndSize(rect.mLeft, rect.mTop, w, h); - panelp->setRect(rect); } - else + // factory panels may have registered their own factory maps + if (!panelp->getFactoryMap().empty()) { - panelp->initPanelXML(node, parent, factory); + LLUICtrlFactory::instance().pushFactoryFunctions(&panelp->getFactoryMap()); + } + // for local registry callbacks; define in constructor, referenced in XUI or postBuild + panelp->mCommitCallbackRegistrar.pushScope(); + panelp->mEnableCallbackRegistrar.pushScope(); + + panelp->initPanelXML(node, parent, output_node); + + panelp->mCommitCallbackRegistrar.popScope(); + panelp->mEnableCallbackRegistrar.popScope(); + + if (panelp && !panelp->getFactoryMap().empty()) + { + LLUICtrlFactory::instance().popFactoryFunctions(); } return panelp; } -BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) +void LLPanel::initFromParams(const LLPanel::Params& p) { - std::string name = getName(); - node->getAttributeString("name", name); - setName(name); + // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible + LLUICtrl::initFromParams(p); - setPanelParameters(node, parent); - - initChildrenXML(node, factory); + for (LLInitParam::ParamIterator::const_iterator it = p.strings().begin(); + it != p.strings().end(); + ++it) + { + mUIStrings[it->name] = it->text; + } - std::string xml_filename; - node->getAttributeString("filename", xml_filename); + setName(p.name()); + setLabel(p.label()); - BOOL didPost; + setShape(p.rect); + parseFollowsFlags(p); - if (!xml_filename.empty()) + setEnabled(p.enabled); + setVisible(p.visible); + setToolTip(p.tool_tip()); + setSaveToXML(p.serializable); + + mHoverCursor = getCursorFromString(p.hover_cursor); + + if (p.has_border) { - didPost = factory->buildPanel(this, xml_filename, NULL); - - LLRect new_rect = getRect(); - // override rectangle with embedding parameters as provided - createRect(node, new_rect, parent); - setOrigin(new_rect.mLeft, new_rect.mBottom); - reshape(new_rect.getWidth(), new_rect.getHeight()); - // optionally override follows flags from including nodes - parseFollowsFlags(node); + addBorder(p.border); } - else + // let constructors set this value if not provided + if (p.use_bounding_rect.isProvided()) { - didPost = FALSE; + setUseBoundingRect(p.use_bounding_rect); } + setDefaultTabGroup(p.default_tab_group); + setMouseOpaque(p.mouse_opaque); + + setBackgroundVisible(p.background_visible); + setBackgroundOpaque(p.background_opaque); + setBackgroundColor(p.bg_opaque_color().get()); + setTransparentColor(p.bg_alpha_color().get()); - if (!didPost) - { - postBuild(); - didPost = TRUE; - } - - return didPost; } -void LLPanel::initChildrenXML(LLXMLNodePtr node, LLUICtrlFactory* factory) +static LLFastTimer::DeclareTimer FTM_PANEL_SETUP("Panel Setup"); +static LLFastTimer::DeclareTimer FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference"); +static LLFastTimer::DeclareTimer FTM_PANEL_POSTBUILD("Panel PostBuild"); + +BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) { - LLXMLNodePtr child; - for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) + const LLPanel::Params& default_params(LLUICtrlFactory::getDefaultParams()); + Params params(default_params); + { - // look for string declarations for programmatic text - if (child->hasName("string")) + LLFastTimer timer(FTM_PANEL_SETUP); + + LLXMLNodePtr referenced_xml; + std::string xml_filename; + node->getAttributeString("filename", xml_filename); + + if (!xml_filename.empty()) { - std::string string_name; - child->getAttributeString("name", string_name); - if (!string_name.empty()) + LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD); + if (output_node) { - mUIStrings[string_name] = child->getTextContents(); + //if we are exporting, we want to export the current xml + //not the referenced xml + LLXUIParser::instance().readXUI(node, params); + Params output_params(params); + setupParamsForExport(output_params, parent); + output_node->setName(node->getName()->mString); + LLXUIParser::instance().writeXUI( + output_node, output_params, &default_params); + return TRUE; } - } - else - { - factory->createWidget(this, child); - } - } -} + + if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml)) + { + llwarns << "Couldn't parse panel from: " << xml_filename << llendl; -void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent) -{ - /////// Rect, follows, tool_tip, enabled, visible attributes /////// - initFromXML(node, parent); + return FALSE; + } - /////// Border attributes /////// - BOOL border = mBorder != NULL; - node->getAttributeBOOL("border", border); - if (border) - { - LLViewBorder::EBevel bevel_style = LLViewBorder::BEVEL_OUT; - LLViewBorder::getBevelFromAttribute(node, bevel_style); + LLXUIParser::instance().readXUI(referenced_xml, params); - LLViewBorder::EStyle border_style = LLViewBorder::STYLE_LINE; - std::string border_string; - node->getAttributeString("border_style", border_string); - LLStringUtil::toLower(border_string); + // add children using dimensions from referenced xml for consistent layout + setShape(params.rect); + LLUICtrlFactory::createChildren(this, referenced_xml); + } + + LLXUIParser::instance().readXUI(node, params); - if (border_string == "texture") + if (output_node) { - border_style = LLViewBorder::STYLE_TEXTURE; + Params output_params(params); + setupParamsForExport(output_params, parent); + output_node->setName(node->getName()->mString); + LLXUIParser::instance().writeXUI( + output_node, output_params, &default_params); + } + + setupParams(params, parent); + { + LLFastTimer timer(FTM_PANEL_CONSTRUCTION); + initFromParams(params); } - S32 border_thickness = LLPANEL_BORDER_WIDTH; - node->getAttributeS32("border_thickness", border_thickness); + // add children + LLUICtrlFactory::createChildren(this, node, output_node); - addBorder(bevel_style, border_style, border_thickness); - } - else - { - removeBorder(); + // Connect to parent after children are built, because tab containers + // do a reshape() on their child panels, which requires that the children + // be built/added. JC + if (parent) + { + S32 tab_group = params.tab_group.isProvided() ? params.tab_group() : -1; + parent->addChild(this, tab_group); + } + + { + LLFastTimer timer(FTM_PANEL_POSTBUILD); + postBuild(); + } } + return TRUE; +} - /////// Background attributes /////// - BOOL background_visible = mBgVisible; - node->getAttributeBOOL("background_visible", background_visible); - setBackgroundVisible(background_visible); - - BOOL background_opaque = mBgOpaque; - node->getAttributeBOOL("background_opaque", background_opaque); - setBackgroundOpaque(background_opaque); - - LLColor4 color; - color = mBgColorOpaque; - LLUICtrlFactory::getAttributeColor(node,"bg_opaque_color", color); - setBackgroundColor(color); - - color = mBgColorAlpha; - LLUICtrlFactory::getAttributeColor(node,"bg_alpha_color", color); - setTransparentColor(color); - - std::string label = getLabel(); - node->getAttributeString("label", label); - setLabel(label); +const widget_registry_t& LLPanel::getChildRegistry() const +{ + // use default widget registry + return LLDefaultWidgetRegistry::instance(); +} + +bool LLPanel::hasString(const std::string& name) +{ + return mUIStrings.find(name) != mUIStrings.end(); } std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const @@ -597,9 +552,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form return formatted_string.getString(); } std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate - // *TODO: once the QAR-369 ui-cleanup work on settings is in we need to change the following line to be - //if(LLUI::sConfigGroup->getBOOL("QAMode")) - if(LLUI::sQAMode) + if(LLUI::sSettingGroups["config"]->getBOOL("QAMode")) { llerrs << err_str << llendl; } @@ -618,7 +571,7 @@ std::string LLPanel::getString(const std::string& name) const return found_it->second; } std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate - if(LLUI::sQAMode) + if(LLUI::sSettingGroups["config"]->getBOOL("QAMode")) { llerrs << err_str << llendl; } @@ -632,7 +585,7 @@ std::string LLPanel::getString(const std::string& name) const void LLPanel::childSetVisible(const std::string& id, bool visible) { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { child->setVisible(visible); @@ -641,7 +594,7 @@ void LLPanel::childSetVisible(const std::string& id, bool visible) bool LLPanel::childIsVisible(const std::string& id) const { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { return (bool)child->getVisible(); @@ -651,7 +604,7 @@ bool LLPanel::childIsVisible(const std::string& id) const void LLPanel::childSetEnabled(const std::string& id, bool enabled) { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { child->setEnabled(enabled); @@ -660,7 +613,7 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled) void LLPanel::childSetTentative(const std::string& id, bool tentative) { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { child->setTentative(tentative); @@ -669,7 +622,7 @@ void LLPanel::childSetTentative(const std::string& id, bool tentative) bool LLPanel::childIsEnabled(const std::string& id) const { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { return (bool)child->getEnabled(); @@ -680,7 +633,7 @@ bool LLPanel::childIsEnabled(const std::string& id) const void LLPanel::childSetToolTip(const std::string& id, const std::string& msg) { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { child->setToolTip(msg); @@ -689,7 +642,7 @@ void LLPanel::childSetToolTip(const std::string& id, const std::string& msg) void LLPanel::childSetRect(const std::string& id, const LLRect& rect) { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { child->setRect(rect); @@ -698,7 +651,7 @@ void LLPanel::childSetRect(const std::string& id, const LLRect& rect) bool LLPanel::childGetRect(const std::string& id, LLRect& rect) const { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { rect = child->getRect(); @@ -709,7 +662,7 @@ bool LLPanel::childGetRect(const std::string& id, LLRect& rect) const void LLPanel::childSetFocus(const std::string& id, BOOL focus) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { child->setFocus(focus); @@ -718,7 +671,7 @@ void LLPanel::childSetFocus(const std::string& id, BOOL focus) BOOL LLPanel::childHasFocus(const std::string& id) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { return child->hasFocus(); @@ -730,60 +683,28 @@ BOOL LLPanel::childHasFocus(const std::string& id) } } - -void LLPanel::childSetFocusChangedCallback(const std::string& id, void (*cb)(LLFocusableElement*, void*), void* user_data) +// *TODO: Deprecate; for backwards compatability only: +void LLPanel::childSetCommitCallback(const std::string& id, boost::function cb, void* data) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { - child->setFocusChangedCallback(cb, user_data); + child->setCommitCallback(boost::bind(cb, child, data)); } } -void LLPanel::childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void *userdata ) +void LLPanel::childSetValidate(const std::string& id, boost::function cb) { - LLUICtrl* child = getChild(id, true); - if (child) - { - child->setCommitCallback(cb); - child->setCallbackUserData(userdata); - } -} - -void LLPanel::childSetDoubleClickCallback(const std::string& id, void (*cb)(void*), void *userdata ) -{ - LLUICtrl* child = getChild(id, true); - if (child) - { - child->setDoubleClickCallback(cb); - if (userdata) - { - child->setCallbackUserData(userdata); - } - } -} - -void LLPanel::childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*)) -{ - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { child->setValidateBeforeCommit(cb); } } -void LLPanel::childSetUserData(const std::string& id, void* userdata) -{ - LLUICtrl* child = getChild(id, true); - if (child) - { - child->setCallbackUserData(userdata); - } -} - void LLPanel::childSetColor(const std::string& id, const LLColor4& color) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { child->setColor(color); @@ -792,7 +713,7 @@ void LLPanel::childSetColor(const std::string& id, const LLColor4& color) LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& id) const { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { return child->getSelectionInterface(); @@ -802,7 +723,7 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { return child->getListInterface(); @@ -812,7 +733,7 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) const { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { return child->getScrollInterface(); @@ -822,7 +743,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) c void LLPanel::childSetValue(const std::string& id, LLSD value) { - LLView* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { child->setValue(value); @@ -831,7 +752,7 @@ void LLPanel::childSetValue(const std::string& id, LLSD value) LLSD LLPanel::childGetValue(const std::string& id) const { - LLView* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { return child->getValue(); @@ -842,7 +763,7 @@ LLSD LLPanel::childGetValue(const std::string& id) const BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { return child->setTextArg(key, text); @@ -852,7 +773,7 @@ BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, con BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { - LLView* child = getChild(id); + LLView* child = findChild(id); if (child) { return child->setLabelArg(key, text); @@ -862,7 +783,7 @@ BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, co BOOL LLPanel::childSetToolTipArg(const std::string& id, const std::string& key, const LLStringExplicit& text) { - LLView* child = getChildView(id, true, FALSE); + LLView* child = findChild(id); if (child) { return child->setToolTipArg(key, text); @@ -872,7 +793,7 @@ BOOL LLPanel::childSetToolTipArg(const std::string& id, const std::string& key, void LLPanel::childSetMinValue(const std::string& id, LLSD min_value) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { child->setMinValue(min_value); @@ -881,7 +802,7 @@ void LLPanel::childSetMinValue(const std::string& id, LLSD min_value) void LLPanel::childSetMaxValue(const std::string& id, LLSD max_value) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { child->setMaxValue(max_value); @@ -890,7 +811,7 @@ void LLPanel::childSetMaxValue(const std::string& id, LLSD max_value) void LLPanel::childShowTab(const std::string& id, const std::string& tabname, bool visible) { - LLTabContainer* child = getChild(id); + LLTabContainer* child = findChild(id); if (child) { child->selectTabByName(tabname); @@ -899,7 +820,7 @@ void LLPanel::childShowTab(const std::string& id, const std::string& tabname, bo LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const { - LLTabContainer* child = getChild(id); + LLTabContainer* child = findChild(id); if (child) { return child->getCurrentPanel(); @@ -907,40 +828,9 @@ LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const return NULL; } -void LLPanel::childSetTabChangeCallback(const std::string& id, const std::string& tabname, void (*on_tab_clicked)(void*, bool), void *userdata, void (*on_precommit)(void*,bool)) -{ - LLTabContainer* child = getChild(id); - if (child) - { - LLPanel *panel = child->getPanelByName(tabname); - if (panel) - { - child->setTabChangeCallback(panel, on_tab_clicked); - child->setTabUserData(panel, userdata); - if (on_precommit) - { - child->setTabPrecommitChangeCallback(panel, on_precommit); - } - } - } -} - -void LLPanel::childSetKeystrokeCallback(const std::string& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data) -{ - LLLineEditor* child = getChild(id); - if (child) - { - child->setKeystrokeCallback(keystroke_callback); - if (user_data) - { - child->setCallbackUserData(user_data); - } - } -} - void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) ) { - LLLineEditor* child = getChild(id); + LLLineEditor* child = findChild(id); if (child) { child->setPrevalidate(func); @@ -949,7 +839,7 @@ void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWS void LLPanel::childSetWrappedText(const std::string& id, const std::string& text, bool visible) { - LLTextBox* child = getChild(id); + LLTextBox* child = findChild(id); if (child) { child->setVisible(visible); @@ -957,18 +847,18 @@ void LLPanel::childSetWrappedText(const std::string& id, const std::string& text } } -void LLPanel::childSetAction(const std::string& id, void(*function)(void*), void* value) +void LLPanel::childSetAction(const std::string& id, boost::function function, void* value) { - LLButton* button = getChild(id); + LLButton* button = findChild(id); if (button) { - button->setClickedCallback(function, value); + button->setClickedCallback(boost::bind(function, value)); } } void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*), void* value) { - LLTextBox* textbox = getChild(id); + LLTextBox* textbox = findChild(id); if (textbox) { textbox->setClickedCallback(function, value); @@ -977,7 +867,7 @@ void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void* void LLPanel::childSetControlName(const std::string& id, const std::string& control_name) { - LLView* view = getChild(id); + LLUICtrl* view = findChild(id); if (view) { view->setControlName(control_name, NULL); @@ -995,7 +885,11 @@ LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create } if (!view && create_if_missing) { - view = createDummyWidget(name); + view = getDummyWidget(name); + if (!view) + { + view = LLUICtrlFactory::createDummyWidget(name); + } } return view; } @@ -1028,621 +922,8 @@ void LLPanel::childDisplayNotFound() LLNotifications::instance().add("FloaterNotFound", args); } -void LLPanel::storeRectControl() -{ - if( !mRectControl.empty() ) - { - LLUI::sConfigGroup->setRect( mRectControl, getRect() ); - } -} - - -// -// LLLayoutStack -// -struct LLLayoutStack::LLEmbeddedPanel -{ - LLEmbeddedPanel(LLPanel* panelp, eLayoutOrientation orientation, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize) : - mPanel(panelp), - mMinWidth(min_width), - mMinHeight(min_height), - mAutoResize(auto_resize), - mUserResize(user_resize), - mOrientation(orientation), - mCollapsed(FALSE), - mCollapseAmt(0.f), - mVisibleAmt(1.f) // default to fully visible - { - LLResizeBar::Side side = (orientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM; - LLRect resize_bar_rect = panelp->getRect(); - - S32 min_dim; - if (orientation == HORIZONTAL) - { - min_dim = mMinHeight; - } - else - { - min_dim = mMinWidth; - } - mResizeBar = new LLResizeBar(std::string("resizer"), mPanel, LLRect(), min_dim, S32_MAX, side); - mResizeBar->setEnableSnapping(FALSE); - // panels initialized as hidden should not start out partially visible - if (!mPanel->getVisible()) - { - mVisibleAmt = 0.f; - } - } - - ~LLEmbeddedPanel() - { - // probably not necessary, but... - delete mResizeBar; - mResizeBar = NULL; - } - - F32 getCollapseFactor() - { - if (mOrientation == HORIZONTAL) - { - F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinWidth / (F32)llmax(1, mPanel->getRect().getWidth())); - return mVisibleAmt * collapse_amt; - } - else - { - F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinHeight / (F32)llmax(1, mPanel->getRect().getHeight()))); - return mVisibleAmt * collapse_amt; - } - } - - LLPanel* mPanel; - S32 mMinWidth; - S32 mMinHeight; - BOOL mAutoResize; - BOOL mUserResize; - BOOL mCollapsed; - LLResizeBar* mResizeBar; - eLayoutOrientation mOrientation; - F32 mVisibleAmt; - F32 mCollapseAmt; -}; - -static LLRegisterWidget r2("layout_stack"); - -LLLayoutStack::LLLayoutStack(eLayoutOrientation orientation) : - mOrientation(orientation), - mMinWidth(0), - mMinHeight(0), - mPanelSpacing(RESIZE_BAR_HEIGHT) -{ -} - -LLLayoutStack::~LLLayoutStack() -{ - std::for_each(mPanels.begin(), mPanels.end(), DeletePointer()); -} - -void LLLayoutStack::draw() -{ - updateLayout(); - - e_panel_list_t::iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - // clip to layout rectangle, not bounding rectangle - LLRect clip_rect = (*panel_it)->mPanel->getRect(); - // scale clipping rectangle by visible amount - if (mOrientation == HORIZONTAL) - { - clip_rect.mRight = clip_rect.mLeft + llround((F32)clip_rect.getWidth() * (*panel_it)->getCollapseFactor()); - } - else - { - clip_rect.mBottom = clip_rect.mTop - llround((F32)clip_rect.getHeight() * (*panel_it)->getCollapseFactor()); - } - - LLPanel* panelp = (*panel_it)->mPanel; - - LLLocalClipRect clip(clip_rect); - // only force drawing invisible children if visible amount is non-zero - drawChild(panelp, 0, 0, !clip_rect.isNull()); - } -} - -void LLLayoutStack::removeCtrl(LLUICtrl* ctrl) -{ - LLEmbeddedPanel* embedded_panelp = findEmbeddedPanel((LLPanel*)ctrl); - - if (embedded_panelp) - { - mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp)); - delete embedded_panelp; - } - - // need to update resizebars - - calcMinExtents(); - - LLView::removeCtrl(ctrl); -} - -LLXMLNodePtr LLLayoutStack::getXML(bool save_children) const -{ - LLXMLNodePtr node = LLView::getXML(); - return node; -} - -//static -LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) -{ - std::string orientation_string("vertical"); - node->getAttributeString("orientation", orientation_string); - - eLayoutOrientation orientation = VERTICAL; - - if (orientation_string == "horizontal") - { - orientation = HORIZONTAL; - } - else if (orientation_string == "vertical") - { - orientation = VERTICAL; - } - else - { - llwarns << "Unknown orientation " << orientation_string << ", using vertical" << llendl; - } - - LLLayoutStack* layout_stackp = new LLLayoutStack(orientation); - - node->getAttributeS32("border_size", layout_stackp->mPanelSpacing); - // don't allow negative spacing values - layout_stackp->mPanelSpacing = llmax(layout_stackp->mPanelSpacing, 0); - - std::string name("stack"); - node->getAttributeString("name", name); - - layout_stackp->setName(name); - layout_stackp->initFromXML(node, parent); - - LLXMLNodePtr child; - for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) - { - S32 min_width = 0; - S32 min_height = 0; - BOOL auto_resize = TRUE; - - child->getAttributeS32("min_width", min_width); - child->getAttributeS32("min_height", min_height); - child->getAttributeBOOL("auto_resize", auto_resize); - - if (child->hasName("layout_panel")) - { - BOOL user_resize = TRUE; - child->getAttributeBOOL("user_resize", user_resize); - LLPanel* panelp = (LLPanel*)LLPanel::fromXML(child, layout_stackp, factory); - if (panelp) - { - panelp->setFollowsNone(); - layout_stackp->addPanel(panelp, min_width, min_height, auto_resize, user_resize); - } - } - else - { - BOOL user_resize = FALSE; - child->getAttributeBOOL("user_resize", user_resize); - - LLPanel* panelp = new LLPanel(std::string("auto_panel")); - LLView* new_child = factory->createWidget(panelp, child); - if (new_child) - { - // put child in new embedded panel - layout_stackp->addPanel(panelp, min_width, min_height, auto_resize, user_resize); - // resize panel to contain widget and move widget to be contained in panel - panelp->setRect(new_child->getRect()); - new_child->setOrigin(0, 0); - } - else - { - panelp->die(); - } - } - } - layout_stackp->updateLayout(); - - return layout_stackp; -} - -S32 LLLayoutStack::getDefaultHeight(S32 cur_height) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == HORIZONTAL) - { - cur_height = llmax(mMinHeight, getRect().getHeight()); - } - - return cur_height; -} - -S32 LLLayoutStack::getDefaultWidth(S32 cur_width) -{ - // if we are spanning our children (crude upward propagation of size) - // then don't enforce our size on our children - if (mOrientation == VERTICAL) - { - cur_width = llmax(mMinWidth, getRect().getWidth()); - } - - return cur_width; -} - -void LLLayoutStack::addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index) +void LLPanel::requires(const std::string& name) { - // panel starts off invisible (collapsed) - if (animate == ANIMATE) - { - panel->setVisible(FALSE); - } - LLEmbeddedPanel* embedded_panel = new LLEmbeddedPanel(panel, mOrientation, min_width, min_height, auto_resize, user_resize); - - mPanels.insert(mPanels.begin() + llclamp(index, 0, (S32)mPanels.size()), embedded_panel); - - addChild(panel); - addChild(embedded_panel->mResizeBar); - - // bring all resize bars to the front so that they are clickable even over the panels - // with a bit of overlap - for (e_panel_list_t::iterator panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLResizeBar* resize_barp = (*panel_it)->mResizeBar; - sendChildToFront(resize_barp); - } - - // start expanding panel animation - if (animate == ANIMATE) - { - panel->setVisible(TRUE); - } -} - -void LLLayoutStack::removePanel(LLPanel* panel) -{ - removeChild(panel); + requires(name); } -void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) -{ - LLEmbeddedPanel* panel_container = findEmbeddedPanel(panel); - if (!panel_container) return; - - panel_container->mCollapsed = collapsed; -} - -void LLLayoutStack::updateLayout(BOOL force_resize) -{ - calcMinExtents(); - - // calculate current extents - S32 total_width = 0; - S32 total_height = 0; - - const F32 ANIM_OPEN_TIME = 0.02f; - const F32 ANIM_CLOSE_TIME = 0.03f; - - e_panel_list_t::iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLPanel* panelp = (*panel_it)->mPanel; - if (panelp->getVisible()) - { - (*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_OPEN_TIME)); - if ((*panel_it)->mVisibleAmt > 0.99f) - { - (*panel_it)->mVisibleAmt = 1.f; - } - } - else // not visible - { - (*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME)); - if ((*panel_it)->mVisibleAmt < 0.001f) - { - (*panel_it)->mVisibleAmt = 0.f; - } - } - - if ((*panel_it)->mCollapsed) - { - (*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME)); - } - else - { - (*panel_it)->mCollapseAmt = lerp((*panel_it)->mCollapseAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME)); - } - - if (mOrientation == HORIZONTAL) - { - // enforce minimize size constraint by default - if (panelp->getRect().getWidth() < (*panel_it)->mMinWidth) - { - panelp->reshape((*panel_it)->mMinWidth, panelp->getRect().getHeight()); - } - total_width += llround(panelp->getRect().getWidth() * (*panel_it)->getCollapseFactor()); - // want n-1 panel gaps for n panels - if (panel_it != mPanels.begin()) - { - total_width += mPanelSpacing; - } - } - else //VERTICAL - { - // enforce minimize size constraint by default - if (panelp->getRect().getHeight() < (*panel_it)->mMinHeight) - { - panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->mMinHeight); - } - total_height += llround(panelp->getRect().getHeight() * (*panel_it)->getCollapseFactor()); - if (panel_it != mPanels.begin()) - { - total_height += mPanelSpacing; - } - } - } - - S32 num_resizable_panels = 0; - S32 shrink_headroom_available = 0; - S32 shrink_headroom_total = 0; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - // panels that are not fully visible do not count towards shrink headroom - if ((*panel_it)->getCollapseFactor() < 1.f) - { - continue; - } - - // if currently resizing a panel or the panel is flagged as not automatically resizing - // only track total available headroom, but don't use it for automatic resize logic - if ((*panel_it)->mResizeBar->hasMouseCapture() - || (!(*panel_it)->mAutoResize - && !force_resize)) - { - if (mOrientation == HORIZONTAL) - { - shrink_headroom_total += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth; - } - else //VERTICAL - { - shrink_headroom_total += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight; - } - } - else - { - num_resizable_panels++; - if (mOrientation == HORIZONTAL) - { - shrink_headroom_available += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth; - shrink_headroom_total += (*panel_it)->mPanel->getRect().getWidth() - (*panel_it)->mMinWidth; - } - else //VERTICAL - { - shrink_headroom_available += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight; - shrink_headroom_total += (*panel_it)->mPanel->getRect().getHeight() - (*panel_it)->mMinHeight; - } - } - } - - // calculate how many pixels need to be distributed among layout panels - // positive means panels need to grow, negative means shrink - S32 pixels_to_distribute; - if (mOrientation == HORIZONTAL) - { - pixels_to_distribute = getRect().getWidth() - total_width; - } - else //VERTICAL - { - pixels_to_distribute = getRect().getHeight() - total_height; - } - - // now we distribute the pixels... - S32 cur_x = 0; - S32 cur_y = getRect().getHeight(); - - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLPanel* panelp = (*panel_it)->mPanel; - - S32 cur_width = panelp->getRect().getWidth(); - S32 cur_height = panelp->getRect().getHeight(); - S32 new_width = llmax((*panel_it)->mMinWidth, cur_width); - S32 new_height = llmax((*panel_it)->mMinHeight, cur_height); - - S32 delta_size = 0; - - // if panel can automatically resize (not animating, and resize flag set)... - if ((*panel_it)->getCollapseFactor() == 1.f - && (force_resize || (*panel_it)->mAutoResize) - && !(*panel_it)->mResizeBar->hasMouseCapture()) - { - if (mOrientation == HORIZONTAL) - { - // if we're shrinking - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - (*panel_it)->mMinWidth) / (F32)shrink_headroom_available)) : 0; - shrink_headroom_available -= (cur_width - (*panel_it)->mMinWidth); - } - else - { - // grow all elements equally - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_width = llmax((*panel_it)->mMinWidth, cur_width + delta_size); - } - else - { - new_width = getDefaultWidth(new_width); - } - - if (mOrientation == VERTICAL) - { - if (pixels_to_distribute < 0) - { - // shrink proportionally to amount over minimum - // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - (*panel_it)->mMinHeight) / (F32)shrink_headroom_available)) : 0; - shrink_headroom_available -= (cur_height - (*panel_it)->mMinHeight); - } - else - { - delta_size = llround((F32)pixels_to_distribute / (F32)num_resizable_panels); - num_resizable_panels--; - } - pixels_to_distribute -= delta_size; - new_height = llmax((*panel_it)->mMinHeight, cur_height + delta_size); - } - else - { - new_height = getDefaultHeight(new_height); - } - } - else - { - if (mOrientation == HORIZONTAL) - { - new_height = getDefaultHeight(new_height); - } - else // VERTICAL - { - new_width = getDefaultWidth(new_width); - } - } - - // adjust running headroom count based on new sizes - shrink_headroom_total += delta_size; - - panelp->reshape(new_width, new_height); - panelp->setOrigin(cur_x, cur_y - new_height); - - LLRect panel_rect = panelp->getRect(); - LLRect resize_bar_rect = panel_rect; - if (mOrientation == HORIZONTAL) - { - resize_bar_rect.mLeft = panel_rect.mRight - RESIZE_BAR_OVERLAP; - resize_bar_rect.mRight = panel_rect.mRight + mPanelSpacing + RESIZE_BAR_OVERLAP; - } - else - { - resize_bar_rect.mTop = panel_rect.mBottom + RESIZE_BAR_OVERLAP; - resize_bar_rect.mBottom = panel_rect.mBottom - mPanelSpacing - RESIZE_BAR_OVERLAP; - } - (*panel_it)->mResizeBar->setRect(resize_bar_rect); - - if (mOrientation == HORIZONTAL) - { - cur_x += llround(new_width * (*panel_it)->getCollapseFactor()) + mPanelSpacing; - } - else //VERTICAL - { - cur_y -= llround(new_height * (*panel_it)->getCollapseFactor()) + mPanelSpacing; - } - } - - // update resize bars with new limits - LLResizeBar* last_resize_bar = NULL; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - LLPanel* panelp = (*panel_it)->mPanel; - - if (mOrientation == HORIZONTAL) - { - (*panel_it)->mResizeBar->setResizeLimits( - (*panel_it)->mMinWidth, - (*panel_it)->mMinWidth + shrink_headroom_total); - } - else //VERTICAL - { - (*panel_it)->mResizeBar->setResizeLimits( - (*panel_it)->mMinHeight, - (*panel_it)->mMinHeight + shrink_headroom_total); - } - - // toggle resize bars based on panel visibility, resizability, etc - BOOL resize_bar_enabled = panelp->getVisible() && (*panel_it)->mUserResize; - (*panel_it)->mResizeBar->setVisible(resize_bar_enabled); - - if (resize_bar_enabled) - { - last_resize_bar = (*panel_it)->mResizeBar; - } - } - - // hide last resize bar as there is nothing past it - // resize bars need to be in between two resizable panels - if (last_resize_bar) - { - last_resize_bar->setVisible(FALSE); - } - - // not enough room to fit existing contents - if (force_resize == FALSE - // layout did not complete by reaching target position - && ((mOrientation == VERTICAL && cur_y != -mPanelSpacing) - || (mOrientation == HORIZONTAL && cur_x != getRect().getWidth() + mPanelSpacing))) - { - // do another layout pass with all stacked elements contributing - // even those that don't usually resize - llassert_always(force_resize == FALSE); - updateLayout(TRUE); - } -} // end LLLayoutStack::updateLayout - - -LLLayoutStack::LLEmbeddedPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const -{ - e_panel_list_t::const_iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - if ((*panel_it)->mPanel == panelp) - { - return *panel_it; - } - } - return NULL; -} - -void LLLayoutStack::calcMinExtents() -{ - mMinWidth = 0; - mMinHeight = 0; - - e_panel_list_t::iterator panel_it; - for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) - { - if (mOrientation == HORIZONTAL) - { - mMinHeight = llmax( mMinHeight, - (*panel_it)->mMinHeight); - mMinWidth += (*panel_it)->mMinWidth; - if (panel_it != mPanels.begin()) - { - mMinWidth += mPanelSpacing; - } - } - else //VERTICAL - { - mMinWidth = llmax( mMinWidth, - (*panel_it)->mMinWidth); - mMinHeight += (*panel_it)->mMinHeight; - if (panel_it != mPanels.begin()) - { - mMinHeight += mPanelSpacing; - } - } - } -} -- cgit v1.2.3 From ade6bbb06c6a842f39a3fe32decf7c66682df092 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Sun, 21 Jun 2009 17:16:27 +0000 Subject: merge -r 124105-124625 skinning-13 -> viewer-2.0.0-3 --- indra/llui/llpanel.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index ad5cdca5cc..0136a41d61 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -58,6 +58,11 @@ static LLDefaultWidgetRegistry::Register r1("panel", &LLPanel::fromXML); +const LLPanel::Params& LLPanel::getDefaultParams() +{ + return LLUICtrlFactory::getDefaultParams(); +} + LLPanel::Params::Params() : has_border("border", false), bg_opaque_color("bg_opaque_color"), @@ -114,6 +119,14 @@ void LLPanel::addBorder(LLViewBorder::Params p) addChild( mBorder ); } +void LLPanel::addBorder() +{ + LLViewBorder::Params p; + p.border_thickness(LLPANEL_BORDER_WIDTH); + addBorder(p); +} + + void LLPanel::removeBorder() { if (mBorder) @@ -885,10 +898,11 @@ LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create } if (!view && create_if_missing) { - view = getDummyWidget(name); + view = getDefaultWidget(name); if (!view) { - view = LLUICtrlFactory::createDummyWidget(name); + // create LLViews explicitly, as they are not registered widget types + view = LLUICtrlFactory::createDefaultWidget(name); } } return view; -- cgit v1.2.3 From 39905b927d60e204438705728d2c214cb3f9ef81 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 2 Jul 2009 00:38:13 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@873 https://svn.aws.productengine.com/secondlife/pe/stable@888 -> viewer-2.0.0-pe-4 --- indra/llui/llpanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 0136a41d61..3a76e72868 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -869,12 +869,12 @@ void LLPanel::childSetAction(const std::string& id, boost::function } } -void LLPanel::childSetActionTextbox(const std::string& id, void(*function)(void*), void* value) +void LLPanel::childSetActionTextbox(const std::string& id, boost::function function, void* value) { LLTextBox* textbox = findChild(id); if (textbox) { - textbox->setClickedCallback(function, value); + textbox->setClickedCallback(boost::bind(function, value)); } } -- cgit v1.2.3 From d6101558a171dbd2390792ac1e78d09fc2c27711 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 6 Jul 2009 21:58:04 +0000 Subject: Merge xui-army-5 to viewer-2, includes layout, art, and color changes, also UI color refactoring and new FreeType font library on Linux. svn merge -r126038:126164 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/xui-army-5 --- indra/llui/llpanel.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 3a76e72868..6a6e15867b 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -428,14 +428,10 @@ void LLPanel::initFromParams(const LLPanel::Params& p) mUIStrings[it->name] = it->text; } - setName(p.name()); setLabel(p.label()); - setShape(p.rect); parseFollowsFlags(p); - setEnabled(p.enabled); - setVisible(p.visible); setToolTip(p.tool_tip()); setSaveToXML(p.serializable); -- cgit v1.2.3 From 52aeaa32841e7d0b37abab0a2a2540c2be2f16b7 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 7 Jul 2009 00:53:05 +0000 Subject: Merge skinning-14 to viewer-2, including refactoring many floaters to register them with LLFloaterReg, support for introspection of ParamBlock based UI widgets to dump XML schema, splitting llfolderview.cpp into three separate files to unravel dependencies and skeleton for for LLListView widget. Resolved conflicts in these files: lldraghandle.h, lluictrl.h, llchiclet.cpp, llfolderview.h/cpp, lliinventorybridge.cpp, llpanelpicks.cpp, llviewermenu.cpp, floater_mute.xml, floater_preferences.xml, notifications.xml, panel_preferences_audio.xml, panel_preferences_graphics1.xml, panel_region_general.xml svn merge -r124961:126284 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-14 --- indra/llui/llpanel.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 6a6e15867b..2119ed4daf 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -56,11 +56,11 @@ #include "llbutton.h" #include "lltabcontainer.h" -static LLDefaultWidgetRegistry::Register r1("panel", &LLPanel::fromXML); +static LLDefaultChildRegistry::Register r1("panel", &LLPanel::fromXML); const LLPanel::Params& LLPanel::getDefaultParams() { - return LLUICtrlFactory::getDefaultParams(); + return LLUICtrlFactory::getDefaultParams(); } LLPanel::Params::Params() @@ -433,7 +433,7 @@ void LLPanel::initFromParams(const LLPanel::Params& p) parseFollowsFlags(p); setToolTip(p.tool_tip()); - setSaveToXML(p.serializable); + setSaveToXML(p.from_xui); mHoverCursor = getCursorFromString(p.hover_cursor); @@ -462,7 +462,7 @@ static LLFastTimer::DeclareTimer FTM_PANEL_POSTBUILD("Panel PostBuild"); BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) { - const LLPanel::Params& default_params(LLUICtrlFactory::getDefaultParams()); + const LLPanel::Params& default_params(LLUICtrlFactory::getDefaultParams()); Params params(default_params); { @@ -499,7 +499,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu // add children using dimensions from referenced xml for consistent layout setShape(params.rect); - LLUICtrlFactory::createChildren(this, referenced_xml); + LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance()); } LLXUIParser::instance().readXUI(node, params); @@ -520,7 +520,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu } // add children - LLUICtrlFactory::createChildren(this, node, output_node); + LLUICtrlFactory::createChildren(this, node, child_registry_t::instance(), output_node); // Connect to parent after children are built, because tab containers // do a reshape() on their child panels, which requires that the children @@ -539,12 +539,6 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu return TRUE; } -const widget_registry_t& LLPanel::getChildRegistry() const -{ - // use default widget registry - return LLDefaultWidgetRegistry::instance(); -} - bool LLPanel::hasString(const std::string& name) { return mUIStrings.find(name) != mUIStrings.end(); -- cgit v1.2.3 From 60ba000989347e92e78f9db7a966ea4e87cecc5b Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 9 Jul 2009 03:40:30 +0000 Subject: Fixed LLPanel visible and enabled settings. Set the side panel width to 280. Changed the code to use the initial width of the side tray instead of the max of the panels. --- indra/llui/llpanel.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 2119ed4daf..de102e47ac 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -418,6 +418,10 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ void LLPanel::initFromParams(const LLPanel::Params& p) { + // The LLPanel constructor doesn't correctly receive Params yet + setEnabled(p.enabled); + setVisible(p.visible); + // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible LLUICtrl::initFromParams(p); -- cgit v1.2.3 From 83a6ea234f32bf30d1f16b276d128debb2aeea02 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 14 Jul 2009 19:06:17 +0000 Subject: Merge skinning-15 to viewer-2. Fixes include: DEV-35175 Spawning context menu should not move mouse cursor (Note: introduces regression where menu can fall off bottom of screen, will fix shortly) DEV-35143 Modal alerts appear behind side tray DEV-35141 Landmarks image and description outside of landmarks Merging revisions 126418-126419,126726-126727,126856-126857,127010-127011,127014-127016 of svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-15 into G:\viewer-2.0.0-3, respecting ancestry --- indra/llui/llpanel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index de102e47ac..b18a750178 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -418,10 +418,11 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ void LLPanel::initFromParams(const LLPanel::Params& p) { - // The LLPanel constructor doesn't correctly receive Params yet - setEnabled(p.enabled); + //setting these here since panel constructor not called with params + //and LLView::initFromParams will use them to set visible and enabled setVisible(p.visible); - + setEnabled(p.enabled); + // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible LLUICtrl::initFromParams(p); -- cgit v1.2.3 From 0274c1f2b16e571a0cc6295d1f3073b136210a7c Mon Sep 17 00:00:00 2001 From: Mark Palange Date: Thu, 16 Jul 2009 17:54:58 +0000 Subject: Merged work for DEV-2066 (and formerly QAR-1538) in Viewer 2. merged all changes, post copy, from the following branches: linden/brachnes/enable-o-v user/cg/qar-1538 user/mani/viewer2-enable-o-v --- indra/llui/llpanel.cpp | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index b18a750178..116096b7b3 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -799,24 +799,6 @@ BOOL LLPanel::childSetToolTipArg(const std::string& id, const std::string& key, return FALSE; } -void LLPanel::childSetMinValue(const std::string& id, LLSD min_value) -{ - LLUICtrl* child = findChild(id); - if (child) - { - child->setMinValue(min_value); - } -} - -void LLPanel::childSetMaxValue(const std::string& id, LLSD max_value) -{ - LLUICtrl* child = findChild(id); - if (child) - { - child->setMaxValue(max_value); - } -} - void LLPanel::childShowTab(const std::string& id, const std::string& tabname, bool visible) { LLTabContainer* child = findChild(id); -- cgit v1.2.3 From 8f7ec64899c54dcee6caa0307510cc4003ba7bdd Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 27 Jul 2009 17:56:26 +0000 Subject: Merged skinning-17 into viewer-2 for bug fixes. Commented out new IM window for now, not complete. Merging revisions 127913-128319 of svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-17 into D:\viewer-2.0.0-3, respecting ancestry --- indra/llui/llpanel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 116096b7b3..9fb38bc316 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -43,6 +43,7 @@ #include "llerror.h" #include "lltimer.h" +#include "llbutton.h" #include "llmenugl.h" //#include "llstatusbar.h" #include "llui.h" @@ -53,7 +54,6 @@ #include "lluictrl.h" #include "lluictrlfactory.h" #include "llviewborder.h" -#include "llbutton.h" #include "lltabcontainer.h" static LLDefaultChildRegistry::Register r1("panel", &LLPanel::fromXML); @@ -65,6 +65,7 @@ const LLPanel::Params& LLPanel::getDefaultParams() LLPanel::Params::Params() : has_border("border", false), + border(""), bg_opaque_color("bg_opaque_color"), bg_alpha_color("bg_alpha_color"), background_visible("background_visible", false), @@ -430,7 +431,7 @@ void LLPanel::initFromParams(const LLPanel::Params& p) it != p.strings().end(); ++it) { - mUIStrings[it->name] = it->text; + mUIStrings[it->name] = it->value; } setLabel(p.label()); -- cgit v1.2.3 From eb853f55c07ae4a3c3f2aa05fbabcf2e4b4dc115 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 4 Aug 2009 01:12:59 +0000 Subject: svn merge -r 128442:129343 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-18 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3 --- indra/llui/llpanel.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 9fb38bc316..1a948fdd00 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -74,7 +74,8 @@ LLPanel::Params::Params() min_height("min_height", 100), strings("string"), filename("filename"), - class_name("class") + class_name("class"), + visible_callback("visible_callback") { name = "panel"; addSynonym(background_visible, "bg_visible"); @@ -307,6 +308,12 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) return handled; } +void LLPanel::handleVisibilityChange ( BOOL new_visibility ) +{ + LLUICtrl::handleVisibilityChange ( new_visibility ); + mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD +} + BOOL LLPanel::checkRequirements() { if (!mRequirementsError.empty()) @@ -426,7 +433,11 @@ void LLPanel::initFromParams(const LLPanel::Params& p) // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible LLUICtrl::initFromParams(p); - + + // visible callback + if (p.visible_callback.isProvided()) + initCommitCallback(p.visible_callback, mVisibleSignal); + for (LLInitParam::ParamIterator::const_iterator it = p.strings().begin(); it != p.strings().end(); ++it) -- cgit v1.2.3 From 06b079a24b743088ca51eea1a627f0b4e1722458 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 20 Aug 2009 00:21:14 +0000 Subject: EXT-580 Add Friend button in the IM floater not disabled if already friends EXT-579 Add Friend from the Im floater opens multiple invitation dialogs sidebar should be up above bottom tray reviewed by richard --- indra/llui/llpanel.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 1a948fdd00..da55ababab 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -94,7 +94,8 @@ LLPanel::LLPanel(const LLPanel::Params& p) mBorder(NULL), mLabel(p.label), mCommitCallbackRegistrar(false), - mEnableCallbackRegistrar(false) + mEnableCallbackRegistrar(false), + mXMLFilename("") { setIsChrome(FALSE); @@ -486,8 +487,13 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu LLFastTimer timer(FTM_PANEL_SETUP); LLXMLNodePtr referenced_xml; - std::string xml_filename; - node->getAttributeString("filename", xml_filename); + std::string xml_filename = mXMLFilename; + + // if the panel didn't provide a filename, check the node + if (xml_filename.empty()) + { + node->getAttributeString("filename", xml_filename); + } if (!xml_filename.empty()) { -- cgit v1.2.3 From 138bf1132262c479dbbd5c95195db46b1efd065f Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 24 Aug 2009 20:04:52 +0000 Subject: merge -r 130399-131510 skinning-21 -> viewer-2.0.0-3 DEV-11254 DEV-11254 DEV-2003: DEV-21567 DEV-37301 EXT-104 EXT-138 EXT-217 EXT-256 EXT-259 EXT-259 EXT-328 EXT-348 EXT-386 EXT-399 EXT-403 EXT-460 EXT-492 EXT-492 EXT-531 EXT-537 EXT-684 improved text editor (handles multiple fonts simultaneously as well as inline widgets) --- indra/llui/llpanel.cpp | 109 ++++--------------------------------------------- 1 file changed, 7 insertions(+), 102 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index da55ababab..667a3e10c4 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -192,10 +192,6 @@ void LLPanel::draw() void LLPanel::updateDefaultBtn() { - // This method does not call LLView::draw() so callers will need - // to take care of that themselves at the appropriate place in - // their rendering sequence - if( mDefaultBtn) { if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled()) @@ -254,7 +250,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) // handle user hitting ESC to defocus if (key == KEY_ESCAPE) { - gFocusMgr.setKeyboardFocus(NULL); + setFocus(FALSE); return TRUE; } else if( (mask == MASK_SHIFT) && (KEY_TAB == key)) @@ -315,53 +311,18 @@ void LLPanel::handleVisibilityChange ( BOOL new_visibility ) mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD } -BOOL LLPanel::checkRequirements() -{ - if (!mRequirementsError.empty()) - { - LLSD args; - args["COMPONENTS"] = mRequirementsError; - args["FLOATER"] = getName(); - - llwarns << getName() << " failed requirements check on: \n" - << mRequirementsError << llendl; - - LLNotifications::instance().add(LLNotification::Params("FailedRequirementsCheck").payload(args)); - mRequirementsError.clear(); - return FALSE; - } - - return TRUE; -} - void LLPanel::setFocus(BOOL b) { - if( b ) + if( b && !hasFocus()) { - if (!gFocusMgr.childHasKeyboardFocus(this)) - { - // give ourselves focus preemptively, to avoid infinite loop - LLUICtrl::setFocus(TRUE); - // then try to pass to first valid child - focusFirstItem(); - } + // give ourselves focus preemptively, to avoid infinite loop + LLUICtrl::setFocus(TRUE); + // then try to pass to first valid child + focusFirstItem(); } else { - if( this == gFocusMgr.getKeyboardFocus() ) - { - gFocusMgr.setKeyboardFocus( NULL ); - } - else - { - //RN: why is this here? - LLView::ctrl_list_t ctrls = getCtrlList(); - for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) - { - LLUICtrl* ctrl = *ctrl_it; - ctrl->setFocus( FALSE ); - } - } + LLUICtrl::setFocus(b); } } @@ -704,7 +665,6 @@ BOOL LLPanel::childHasFocus(const std::string& id) } else { - childNotFound(id); return FALSE; } } @@ -881,58 +841,3 @@ void LLPanel::childSetControlName(const std::string& id, const std::string& cont view->setControlName(control_name, NULL); } } - -//virtual -LLView* LLPanel::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const -{ - // just get child, don't try to create a dummy one - LLView* view = LLUICtrl::getChildView(name, recurse, FALSE); - if (!view && !recurse) - { - childNotFound(name); - } - if (!view && create_if_missing) - { - view = getDefaultWidget(name); - if (!view) - { - // create LLViews explicitly, as they are not registered widget types - view = LLUICtrlFactory::createDefaultWidget(name); - } - } - return view; -} - -void LLPanel::childNotFound(const std::string& id) const -{ - if (mExpectedMembers.find(id) == mExpectedMembers.end()) - { - mNewExpectedMembers.insert(id); - } -} - -void LLPanel::childDisplayNotFound() -{ - if (mNewExpectedMembers.empty()) - { - return; - } - std::string msg; - expected_members_list_t::iterator itor; - for (itor=mNewExpectedMembers.begin(); itor!=mNewExpectedMembers.end(); ++itor) - { - msg.append(*itor); - msg.append("\n"); - mExpectedMembers.insert(*itor); - } - mNewExpectedMembers.clear(); - LLSD args; - args["CONTROLS"] = msg; - LLNotifications::instance().add("FloaterNotFound", args); -} - -void LLPanel::requires(const std::string& name) -{ - requires(name); -} - -- cgit v1.2.3 From 745845f79987e4b4ab7f5728746a0eda8898930f Mon Sep 17 00:00:00 2001 From: Monroe Williams Date: Thu, 27 Aug 2009 19:00:18 +0000 Subject: svn merge -r 129841:129910 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/pluginapi_05-merge@129910 svn merge -r 129913:131718 svn+ssh://svn.lindenlab.com/svn/linden/branches/pluginapi/pluginapi_05 Some branch shenannigans in the pluginapi_05 branch caused this to become a two-part merge. --- indra/llui/llpanel.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 667a3e10c4..0b987bfcb5 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -190,14 +190,19 @@ void LLPanel::draw() LLView::draw(); } +/*virtual*/ +void LLPanel::setAlpha(F32 alpha) +{ + mBgColorOpaque.setAlpha(alpha); +} + void LLPanel::updateDefaultBtn() { if( mDefaultBtn) { if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled()) { - LLUICtrl* focus_ctrl = gFocusMgr.getKeyboardFocus(); - LLButton* buttonp = dynamic_cast(focus_ctrl); + LLButton* buttonp = dynamic_cast(gFocusMgr.getKeyboardFocus()); BOOL focus_is_child_button = buttonp && buttonp->getCommitOnReturn(); // only enable default button when current focus is not a return-capturing button mDefaultBtn->setBorderEnabled(!focus_is_child_button); @@ -245,7 +250,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) { BOOL handled = FALSE; - LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus(); + LLUICtrl* cur_focus = dynamic_cast(gFocusMgr.getKeyboardFocus()); // handle user hitting ESC to defocus if (key == KEY_ESCAPE) @@ -696,6 +701,14 @@ void LLPanel::childSetColor(const std::string& id, const LLColor4& color) child->setColor(color); } } +void LLPanel::childSetAlpha(const std::string& id, F32 alpha) +{ + LLUICtrl* child = getChild(id, true); + if (child) + { + child->setAlpha(alpha); + } +} LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& id) const { -- cgit v1.2.3 From eda3831041a176ae11116bd0c33077d121dc62e2 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 28 Aug 2009 16:51:34 +0000 Subject: skinning-22 -> viewer-2 trunk to pick up bug fixes, including crash on script compile when cursor is at the end of the script editor window. Replaced panel_pick_info.xml and panel_profile_view.xml with our versions, which stomped some PE changes. Panels still work, however, and Kurt is still working on layout. CHANGES: minor layout change: "start location" and "remember password" weren't on the same horizontal line. DEV-35120 image_unselected art was "transparent.j2c" - switched it out for PushButton_Off I18N: more things are missing a.. you guessed it, a name= parameter. Breaks localization. forgot to check this in earlier...fixes off-by-one crash when editing a script DEV-36740 change the displayed string per Erica's request re 'You can only set your Home Location...' VIEWER-SIDE text change. This does not change the actual message coming from the server EXT-689 Odd spinner behaviour - For Sale Price -- reviewed by james DEV-26973 Internationalize the server msg Youcan'tset this place as home -- reviewed by james EXT-618 Low/Mid/High response is broken in Preferences > Graphics -- reviewed by james EXT-618 Low/Mid/High response is broken in Preferences > Graphics -- to be reviewed EXT-655 Cannot choose Both logging options in Preferences -- to be reviewed Changes to notifications.xml text to fit Style Guide and some renamed menu items EXT-147 Ongoing revisions to new gestures layout. DEV-35097 catch more instances of 'SLURL' and make them 'SLurl' Removed Info Displays and Buy Currency Test from top menus. Clean up code to use proper childGetFoo and childSetFoo calls, as well as setCommitCallback using slots. De-inlined LLAvatarIconCtrl paramblock constructor because I was doing a full rebuild anyhow. Commented about use of childSetCommitCallback(). De-inlined LocalizedString paramblock constructor. eliminated memory leak I18N: more things are missing a name= parameter, breaks localization. EXT-714 Updated panels in sidetray that were not using the scroll_container element to adjust for viewer heights. fix for llmessage_test crash in Windows Release builds DEV-11254 I18N: replace all string instances of "Second Life" - do this in the foreign languages too DEV-11254 I18N: replace all string instances of "Second Life" - found new instances from merged code potential fix for unit test crash on parabuild, moved statics into singleton member variables to get around potential dual instantation of statics on different modules DEV-36809 Click target for slider handles is too small -- reviewed by steve EXT-403 change getChild to LLUICtrl to make it generic -- reviewed by richard DEV-35938 Horizontal scroll thumb too high -- to be reviewed EXT-386 clean up warnings - initCommitCallback... Rename Product Engine's LLFloaterMiniInspector to LLInspectAvatar, clean up XUI XML, clean up construction code, move refresh method to postBuild() so widgets are constructed before refresh, fixed a member variable in llavatarlistitem.cpp. Reviewed with Leyla. Login menu > Debug > Avatar Inspector shows test avatar inspector. Also added to main menu > Debug > XUI > Avatar Inspector. Changed text/layout of dummy inspector. Not reviewed. Merging revisions 131558-131975 of svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-22 into D:\viewer-2.0.0-3, respecting ancestry --- indra/llui/llpanel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/llui/llpanel.cpp') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 0b987bfcb5..c81be6086a 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -58,6 +58,11 @@ static LLDefaultChildRegistry::Register r1("panel", &LLPanel::fromXML); +LLPanel::LocalizedString::LocalizedString() +: name("name"), + value("value") +{} + const LLPanel::Params& LLPanel::getDefaultParams() { return LLUICtrlFactory::getDefaultParams(); @@ -675,6 +680,9 @@ BOOL LLPanel::childHasFocus(const std::string& id) } // *TODO: Deprecate; for backwards compatability only: +// Prefer getChild("foo")->setCommitCallback(boost:bind(...)), +// which takes a generic slot. Or use mCommitCallbackRegistrar.add() with +// a named callback and reference it in XML. void LLPanel::childSetCommitCallback(const std::string& id, boost::function cb, void* data) { LLUICtrl* child = findChild(id); -- cgit v1.2.3