diff options
Diffstat (limited to 'indra/llui')
35 files changed, 260 insertions, 183 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 6afe276379..4b0b7c561d 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -339,7 +339,7 @@ LLAccordionCtrlTab::Params::Params() ,fit_panel("fit_panel",true) ,selection_enabled("selection_enabled", false) { - mouse_opaque(false); + changeDefault(mouse_opaque, false); } LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index fde3c53a65..8ede4e3468 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -27,11 +27,14 @@ #define LLBADGE_CPP #include "llbadge.h" +#include "llscrollcontainer.h" #include "lluictrlfactory.h" static LLDefaultChildRegistry::Register<LLBadge> r("badge"); +static const S32 BADGE_OFFSET_NOT_SPECIFIED = 0x7FFFFFFF; + // Compiler optimization, generate extern template template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const; @@ -46,14 +49,13 @@ LLBadge::Params::Params() , label_offset_horiz("label_offset_horiz") , label_offset_vert("label_offset_vert") , location("location", LLRelPos::TOP_LEFT) + , location_offset_hcenter("location_offset_hcenter") + , location_offset_vcenter("location_offset_vcenter") , location_percent_hcenter("location_percent_hcenter") , location_percent_vcenter("location_percent_vcenter") , padding_horiz("padding_horiz") , padding_vert("padding_vert") -{ - // We set a name here so the name isn't necessary in any xml files that use badges - name = "badge"; -} +{} bool LLBadge::Params::equals(const Params& a) const { @@ -70,6 +72,8 @@ bool LLBadge::Params::equals(const Params& a) const comp &= (label_offset_horiz() == a.label_offset_horiz()); comp &= (label_offset_vert() == a.label_offset_vert()); comp &= (location() == a.location()); + comp &= (location_offset_hcenter() == a.location_offset_hcenter()); + comp &= (location_offset_vcenter() == a.location_offset_vcenter()); comp &= (location_percent_hcenter() == a.location_percent_hcenter()); comp &= (location_percent_vcenter() == a.location_percent_vcenter()); comp &= (padding_horiz() == a.padding_horiz()); @@ -91,16 +95,29 @@ LLBadge::LLBadge(const LLBadge::Params& p) , mLabelOffsetHoriz(p.label_offset_horiz) , mLabelOffsetVert(p.label_offset_vert) , mLocation(p.location) + , mLocationOffsetHCenter(BADGE_OFFSET_NOT_SPECIFIED) + , mLocationOffsetVCenter(BADGE_OFFSET_NOT_SPECIFIED) , mLocationPercentHCenter(0.5f) , mLocationPercentVCenter(0.5f) , mPaddingHoriz(p.padding_horiz) , mPaddingVert(p.padding_vert) + , mParentScroller(NULL) { if (mImage.isNull()) { llwarns << "Badge: " << getName() << " with no image!" << llendl; } + if (p.location_offset_hcenter.isProvided()) + { + mLocationOffsetHCenter = p.location_offset_hcenter(); + } + + if (p.location_offset_vcenter.isProvided()) + { + mLocationOffsetVCenter = p.location_offset_vcenter(); + } + // // The following logic is to set the mLocationPercentHCenter and mLocationPercentVCenter // based on the Location enum and our horizontal and vertical location percentages. The @@ -144,6 +161,15 @@ bool LLBadge::addToView(LLView * view) if (child_added) { setShape(view->getLocalRect()); + + // Find a parent scroll container, if there is one in case we need it for positioning + + LLView * parent = mOwner.get(); + + while ((parent != NULL) && ((mParentScroller = dynamic_cast<LLScrollContainer *>(parent)) == NULL)) + { + parent = parent->getParent(); + } } return child_added; @@ -201,21 +227,11 @@ void LLBadge::draw() if (owner_view) { // - // Calculate badge position based on owner - // - - LLRect owner_rect; - owner_view->localRectToOtherView(owner_view->getLocalRect(), & owner_rect, this); - - F32 badge_center_x = owner_rect.mLeft + owner_rect.getWidth() * mLocationPercentHCenter; - F32 badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; - - // // Calculate badge size based on label text // LLWString badge_label_wstring = mLabel; - + S32 badge_label_begin_offset = 0; S32 badge_char_length = S32_MAX; S32 badge_pixel_length = S32_MAX; @@ -228,6 +244,77 @@ void LLBadge::draw() F32 badge_height = (2.0f * mPaddingVert) + mGLFont->getLineHeight(); // + // Calculate badge position based on owner + // + + LLRect owner_rect; + owner_view->localRectToOtherView(owner_view->getLocalRect(), & owner_rect, this); + + S32 location_offset_horiz = mLocationOffsetHCenter; + S32 location_offset_vert = mLocationOffsetVCenter; + + // If we're in a scroll container, do some math to keep us in the same place on screen if applicable + if (mParentScroller != NULL) + { + LLRect visibleRect = mParentScroller->getVisibleContentRect(); + + if (mLocationOffsetHCenter != BADGE_OFFSET_NOT_SPECIFIED) + { + if (LLRelPos::IsRight(mLocation)) + { + location_offset_horiz += visibleRect.mRight; + } + else if (LLRelPos::IsLeft(mLocation)) + { + location_offset_horiz += visibleRect.mLeft; + } + else // center + { + location_offset_horiz += (visibleRect.mLeft + visibleRect.mRight) / 2; + } + } + + if (mLocationOffsetVCenter != BADGE_OFFSET_NOT_SPECIFIED) + { + if (LLRelPos::IsTop(mLocation)) + { + location_offset_vert += visibleRect.mTop; + } + else if (LLRelPos::IsBottom(mLocation)) + { + location_offset_vert += visibleRect.mBottom; + } + else // center + { + location_offset_vert += (visibleRect.mBottom + visibleRect.mTop) / 2; + } + } + } + + F32 badge_center_x; + F32 badge_center_y; + + // Compute x position + if (mLocationOffsetHCenter == BADGE_OFFSET_NOT_SPECIFIED) + { + badge_center_x = owner_rect.mLeft + owner_rect.getWidth() * mLocationPercentHCenter; + } + else + { + badge_center_x = location_offset_horiz; + } + + // Compute y position + if (mLocationOffsetVCenter == BADGE_OFFSET_NOT_SPECIFIED) + { + badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; + } + else + { + badge_center_y = location_offset_vert; + } + + // // Draw button image, if available. // Otherwise draw basic rectangular button. // diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index f81ccdf0cd..4b21a71aaa 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -39,8 +39,9 @@ // Declarations // -class LLUICtrlFactory; class LLFontGL; +class LLScrollContainer; +class LLUICtrlFactory; // // Relative Position Alignment @@ -108,6 +109,8 @@ public: Optional< S32 > label_offset_vert; Optional< LLRelPos::Location > location; + Optional< S32 > location_offset_hcenter; + Optional< S32 > location_offset_vcenter; Optional< U32 > location_percent_hcenter; Optional< U32 > location_percent_vcenter; @@ -150,6 +153,8 @@ private: S32 mLabelOffsetVert; LLRelPos::Location mLocation; + S32 mLocationOffsetHCenter; + S32 mLocationOffsetVCenter; F32 mLocationPercentHCenter; F32 mLocationPercentVCenter; @@ -157,6 +162,8 @@ private: F32 mPaddingHoriz; F32 mPaddingVert; + + LLScrollContainer* mParentScroller; }; // Build time optimization, generate once in .cpp file diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 7b015bd576..a12235c16f 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -104,8 +104,7 @@ LLButton::Params::Params() handle_right_mouse("handle_right_mouse") { addSynonym(is_toggle, "toggle"); - held_down_delay.seconds = 0.5f; - initial_value.set(LLSD(false), false); + changeDefault(initial_value, LLSD(false)); } diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h index bb8ea50bed..f32f1dd74c 100644 --- a/indra/llui/llconsole.h +++ b/indra/llui/llconsole.h @@ -54,7 +54,7 @@ public: persist_time("persist_time", 0.f), // forever font_size_index("font_size_index") { - mouse_opaque(false); + changeDefault(mouse_opaque, false); } }; protected: diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index 7d3d5cf787..e81600fd6c 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -50,7 +50,7 @@ public: show_label("show_label", FALSE), display_children("display_children", TRUE) { - mouse_opaque(false); + changeDefault(mouse_opaque, false); } }; diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index 7c56475e75..e095e577b1 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -51,8 +51,8 @@ public: drag_highlight_color("drag_highlight_color", LLUIColorTable::instance().getColor("DefaultHighlightLight")), drag_shadow_color("drag_shadow_color", LLUIColorTable::instance().getColor("DefaultShadowDark")) { - mouse_opaque(true); - follows.flags(FOLLOWS_ALL); + changeDefault(mouse_opaque, true); + changeDefault(follows.flags, FOLLOWS_ALL); } }; void initFromParams(const Params&); diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h index 710699fdc1..3a05bc05a1 100644 --- a/indra/llui/llfiltereditor.h +++ b/indra/llui/llfiltereditor.h @@ -42,12 +42,7 @@ class LLFilterEditor : public LLSearchEditor { public: struct Params : public LLInitParam::Block<Params, LLSearchEditor::Params> - { - Params() - { - name = "filter_editor"; - } - }; + {}; protected: LLFilterEditor(const Params&); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 8917d5490c..bc494e97f5 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -182,7 +182,7 @@ LLFloater::Params::Params() open_callback("open_callback"), close_callback("close_callback") { - visible = false; + changeDefault(visible, false); } diff --git a/indra/llui/llflyoutbutton.h b/indra/llui/llflyoutbutton.h index 8d59380a00..36998eba2e 100644 --- a/indra/llui/llflyoutbutton.h +++ b/indra/llui/llflyoutbutton.h @@ -46,7 +46,7 @@ public: : action_button("action_button"), allow_text_entry("allow_text_entry") { - LLComboBox::Params::allow_text_entry = false; + changeDefault(LLComboBox::Params::allow_text_entry, false); } }; diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 47f2cfaf89..30b79b4d20 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -43,10 +43,7 @@ LLIconCtrl::Params::Params() color("color"), use_draw_context_alpha("use_draw_context_alpha", true), scale_image("scale_image") -{ - tab_stop = false; - mouse_opaque = false; -} +{} LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) : LLUICtrl(p), diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index a59247ba09..a250404292 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -115,9 +115,7 @@ LLLayoutStack::Params::Params() open_time_constant("open_time_constant", 0.02f), close_time_constant("close_time_constant", 0.03f), border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0)) -{ - name="stack"; -} +{} LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) : LLView(p), diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 06fbc0f234..c2173fb89c 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -103,7 +103,7 @@ LLLineEditor::Params::Params() text_pad_right("text_pad_right"), default_text("default_text") { - mouse_opaque = true; + changeDefault(mouse_opaque, true); addSynonym(select_on_focus, "select_all_on_focus_received"); addSynonym(border, "border"); addSynonym(label, "watermark_text"); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 8de9c769e2..6cac841cde 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -90,7 +90,6 @@ const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10; const S32 MENU_ITEM_PADDING = 4; const std::string SEPARATOR_NAME("separator"); -const std::string SEPARATOR_LABEL( "-----------" ); const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK @@ -149,7 +148,7 @@ LLMenuItemGL::Params::Params() highlight_bg_color("highlight_bg_color"), highlight_fg_color("highlight_fg_color") { - mouse_opaque = true; + changeDefault(mouse_opaque, true); } // Default constructor @@ -566,8 +565,6 @@ void LLMenuItemGL::handleVisibilityChange(BOOL new_visibility) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLMenuItemSeparatorGL::Params::Params() { - name = "separator"; - label = SEPARATOR_LABEL; } LLMenuItemSeparatorGL::LLMenuItemSeparatorGL(const LLMenuItemSeparatorGL::Params& p) : @@ -755,30 +752,6 @@ U32 LLMenuItemTearOffGL::getNominalHeight( void ) const return TEAROFF_SEPARATOR_HEIGHT_PIXELS; } - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLMenuItemBlankGL -// -// This class represents a blank, non-functioning item. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLMenuItemBlankGL : public LLMenuItemGL -{ -public: - struct Params : public LLInitParam::Block<Params, LLMenuItemGL::Params> - { - Params() - { - name=""; - enabled = false; - } - }; - LLMenuItemBlankGL( const Params& p ) : LLMenuItemGL( p ) - {} - virtual void draw( void ) {} -}; - - ///============================================================================ /// Class LLMenuItemCallGL ///============================================================================ diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 7bde8e83ec..b5579a831a 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -381,8 +381,6 @@ public: { addSynonym(bg_visible, "opaque"); addSynonym(bg_color, "color"); - - name = "menu"; } }; @@ -650,7 +648,7 @@ public: { Params() { - visible = false; + changeDefault(visible, false); } }; @@ -698,16 +696,7 @@ class LLMenuBarGL : public LLMenuGL { public: struct Params : public LLInitParam::Block<Params, LLMenuGL::Params> - { - Params() - { - can_tear_off = false; - keep_fixed_size = true; - horizontal_layout = true; - visible = true; - drop_shadow = false; - } - }; + {}; LLMenuBarGL( const Params& p ); virtual ~LLMenuBarGL(); @@ -825,13 +814,7 @@ class LLMenuItemTearOffGL : public LLMenuItemGL { public: struct Params : public LLInitParam::Block<Params, LLMenuItemGL::Params> - { - Params() - { - name = "tear off"; - label = "~~~~~~~~~~~"; - } - }; + {}; LLMenuItemTearOffGL( const Params& ); diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 9052bc7d1d..70bcfb5b4f 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -66,11 +66,7 @@ LLMultiSlider::Params::Params() mouse_up_callback("mouse_up_callback"), thumb_width("thumb_width"), sliders("slider") -{ - name = "multi_slider_bar"; - mouse_opaque(true); - follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); -} +{} LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) : LLF32UICtrl(p), diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index e3193bc352..a45b617c2e 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -90,7 +90,6 @@ LLPanel::Params::Params() visible_callback("visible_callback"), accepts_badge("accepts_badge") { - name = "panel"; addSynonym(background_visible, "bg_visible"); addSynonym(has_border, "border_visible"); addSynonym(label, "title"); diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 3a12debf7e..95a7d09382 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -74,9 +74,6 @@ LLRadioGroup::Params::Params() { addSynonym(items, "radio_item"); - name = "radio_group"; - mouse_opaque = true; - follows.flags = FOLLOWS_LEFT | FOLLOWS_TOP; // radio items are not tabbable until they are selected tab_stop = false; } @@ -96,7 +93,10 @@ void LLRadioGroup::initFromParams(const Params& p) { LLRadioGroup::ItemParams item_params(*it); - item_params.font.setIfNotProvided(mFont); // apply radio group font by default + if (!item_params.font.isProvided()) + { + item_params.font = mFont; // apply radio group font by default + } item_params.commit_callback.function = boost::bind(&LLRadioGroup::onClickButton, this, _1); item_params.from_xui = p.from_xui; if (p.from_xui) diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 3a867a10a7..5d3bf7a670 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -63,9 +63,7 @@ LLScrollbar::Params::Params() right_button("right_button"), bg_visible("bg_visible", false), bg_color("bg_color", LLColor4::black) -{ - tab_stop = false; -} +{} LLScrollbar::LLScrollbar(const Params & p) : LLUICtrl(p), diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index 380c477eb2..b44b4c36b6 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -74,11 +74,7 @@ LLScrollContainer::Params::Params() min_auto_scroll_rate("min_auto_scroll_rate", 100), max_auto_scroll_rate("max_auto_scroll_rate", 1000), reserve_scroll_corner("reserve_scroll_corner", false) -{ - name = "scroll_container"; - mouse_opaque(true); - tab_stop(false); -} +{} // Default constructor diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h index 8f569c2a58..e8df176ec3 100644 --- a/indra/llui/llscrollingpanellist.h +++ b/indra/llui/llscrollingpanellist.h @@ -51,12 +51,7 @@ class LLScrollingPanelList : public LLUICtrl { public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> - { - Params() - { - name = "scrolling_panel_list"; - } - }; + {}; LLScrollingPanelList(const Params& p) : LLUICtrl(p) {} diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index 696e4a2bb1..07a6dfaa10 100644 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp @@ -46,10 +46,7 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterColumnHeaderParams(&typeid //--------------------------------------------------------------------------- LLScrollColumnHeader::Params::Params() : column("column") -{ - name = "column_header"; - tab_stop(false); -} +{} LLScrollColumnHeader::LLScrollColumnHeader(const LLScrollColumnHeader::Params& p) diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index e2711ac75a..12baea8e0c 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -135,7 +135,7 @@ public: halign("halign", LLFontGL::LEFT) { // default choice to "dynamic_width" - width.dynamic_width = true; + changeDefault(width.dynamic_width, true); addSynonym(sort_column, "sort"); } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index b7848ec37c..622f3e215c 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -147,12 +147,9 @@ LLScrollListCtrl::Params::Params() highlighted_color("highlighted_color"), contents(""), scroll_bar_bg_visible("scroll_bar_bg_visible"), - scroll_bar_bg_color("scroll_bar_bg_color") - , border("border") -{ - name = "scroll_list"; - mouse_opaque = true; -} + scroll_bar_bg_color("scroll_bar_bg_color"), + border("border") +{} LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) : LLUICtrl(p), @@ -2813,7 +2810,10 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS } S32 index = columnp->mIndex; - cell_p.width.setIfNotProvided(columnp->getWidth()); + if (!cell_p.width.isProvided()) + { + cell_p.width = columnp->getWidth(); + } LLScrollListCell* cell = LLScrollListCell::create(cell_p); diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index f5c3b532c4..c2d7916938 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -55,9 +55,7 @@ public: search_button_visible("search_button_visible"), clear_button("clear_button"), clear_button_visible("clear_button_visible") - { - name = "search_editor"; - } + {} }; void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index 013950a5ad..db72234f94 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -54,9 +54,7 @@ LLSlider::Params::Params() track_highlight_vertical_image("track_highlight_vertical_image"), mouse_down_callback("mouse_down_callback"), mouse_up_callback("mouse_up_callback") -{ - follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); -} +{} LLSlider::LLSlider(const LLSlider::Params& p) : LLF32UICtrl(p), diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index d760178e35..583ed1ed2e 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -76,8 +76,14 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) } LLRect label_rect( left, top, label_width, bottom ); LLTextBox::Params params(p.slider_label); - params.rect.setIfNotProvided(label_rect); - params.font.setIfNotProvided(p.font); + if (!params.rect.isProvided()) + { + params.rect = label_rect; + } + if (!params.font.isProvided()) + { + params.font = p.font; + } params.initial_value(p.label()); mLabelBox = LLUICtrlFactory::create<LLTextBox> (params); addChild(mLabelBox); @@ -113,15 +119,33 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) S32 slider_left = label_width ? label_width + sliderctrl_spacing : 0; LLSlider::Params slider_p(p.slider_bar); slider_p.name("slider_bar"); - slider_p.rect.setIfNotProvided(LLRect(slider_left,top,slider_right,bottom)); - slider_p.initial_value.setIfNotProvided(p.initial_value().asReal()); - slider_p.min_value.setIfNotProvided(p.min_value); - slider_p.max_value.setIfNotProvided(p.max_value); - slider_p.increment.setIfNotProvided(p.increment); - slider_p.orientation.setIfNotProvided(p.orientation); + if (!slider_p.rect.isProvided()) + { + slider_p.rect = LLRect(slider_left,top,slider_right,bottom); + } + if (!slider_p.initial_value.isProvided()) + { + slider_p.initial_value = p.initial_value().asReal(); + } + if (!slider_p.min_value.isProvided()) + { + slider_p.min_value = p.min_value; + } + if (!slider_p.max_value.isProvided()) + { + slider_p.max_value = p.max_value; + } + if (!slider_p.increment.isProvided()) + { + slider_p.increment = p.increment; + } + if (!slider_p.orientation.isProvided()) + { + slider_p.orientation = p.orientation; + } - slider_p.commit_callback.function(&LLSliderCtrl::onSliderCommit); - slider_p.control_name(p.control_name); + slider_p.commit_callback.function = &LLSliderCtrl::onSliderCommit; + slider_p.control_name = p.control_name; slider_p.mouse_down_callback( p.mouse_down_callback ); slider_p.mouse_up_callback( p.mouse_up_callback ); mSlider = LLUICtrlFactory::create<LLSlider> (slider_p); @@ -134,8 +158,15 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) if( p.can_edit_text() ) { LLLineEditor::Params line_p(p.value_editor); - line_p.rect.setIfNotProvided(text_rect); - line_p.font.setIfNotProvided(p.font); + if (!line_p.rect.isProvided()) + { + line_p.rect = text_rect; + } + if (!line_p.font.isProvided()) + { + line_p.font = p.font; + } + line_p.commit_callback.function(&LLSliderCtrl::onEditorCommit); line_p.prevalidate_callback(&LLTextValidate::validateFloat); mEditor = LLUICtrlFactory::create<LLLineEditor>(line_p); @@ -149,8 +180,14 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) else { LLTextBox::Params text_p(p.value_text); - text_p.rect.setIfNotProvided(text_rect); - text_p.font.setIfNotProvided(p.font); + if (!text_p.rect.isProvided()) + { + text_p.rect = text_rect; + } + if (!text_p.font.isProvided()) + { + text_p.font = p.font; + } mTextBox = LLUICtrlFactory::create<LLTextBox>(text_p); addChild(mTextBox); } diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index 62a9db82fe..513fff3234 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -65,7 +65,7 @@ public: show_mean("show_mean", TRUE), stat("stat") { - follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); } }; LLStatBar(const Params&); diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index 22a9fcd672..5abdc42448 100644 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h @@ -46,7 +46,7 @@ public: Params() : setting("setting") { - follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); } }; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 7f0d650403..9c6a76822c 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -217,10 +217,7 @@ LLTabContainer::Params::Params() tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), use_ellipses("use_ellipses"), font_halign("halign") -{ - name(std::string("tab_container")); - mouse_opaque = false; -} +{} LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) : LLPanel(p), diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 6390039794..bc6461a0c2 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -55,7 +55,7 @@ static LLDefaultChildRegistry::Register<LLToolTipView> register_tooltip_view("to LLToolTipView::Params::Params() { - mouse_opaque = false; + changeDefault(mouse_opaque, false); } LLToolTipView::LLToolTipView(const LLToolTipView::Params& p) @@ -156,7 +156,7 @@ LLToolTip::Params::Params() web_based_media("web_based_media", false), media_playing("media_playing", false) { - chrome = true; + changeDefault(chrome, true); } LLToolTip::LLToolTip(const LLToolTip::Params& p) @@ -402,12 +402,12 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) LLToolTip::Params tooltip_params(params); // block mouse events if there is a click handler registered (specifically, hover) - if (params.click_callback.isProvided()) + if (params.click_callback.isProvided() && !params.mouse_opaque.isProvided()) { // set mouse_opaque to true if it wasn't already set to something else // this prevents mouse down from going "through" the tooltip and ultimately // causing the tooltip to disappear - tooltip_params.mouse_opaque.setIfNotProvided(true); + tooltip_params.mouse_opaque = true; } tooltip_params.rect = LLRect (0, 1, 1, 0); diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 499b97f52d..f0ba7fc7d7 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -104,14 +104,17 @@ private: public: ParamDefaults() { - // recursively initialize from base class param block - ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom(ParamDefaults<typename PARAM_BLOCK::base_block_t, DUMMY>::instance().get()); - // after initializing base classes, look up template file for this param block + // look up template file for this param block... const std::string* param_block_tag = getWidgetTag(&typeid(PARAM_BLOCK)); if (param_block_tag) - { - LLUICtrlFactory::loadWidgetTemplate(*param_block_tag, mPrototype); + { // ...and if it exists, back fill values using the most specific template first + PARAM_BLOCK params; + LLUICtrlFactory::loadWidgetTemplate(*param_block_tag, params); + mPrototype.fillFrom(params); } + // recursively fill from base class param block + ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom(ParamDefaults<typename PARAM_BLOCK::base_block_t, DUMMY>::instance().get()); + } const PARAM_BLOCK& get() { return mPrototype; } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 659a54cc6e..0616c2a0c0 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -2485,7 +2485,7 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) { LLRect parent_rect = parent->getLocalRect(); // overwrite uninitialized rect params, using context - LLRect last_rect = parent->getLocalRect(); + LLRect default_rect = parent->getLocalRect(); bool layout_topleft = (p.layout() == "topleft"); @@ -2509,15 +2509,13 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) p.rect.height = MIN_WIDGET_HEIGHT; } - last_rect.translate(0, last_rect.getHeight()); + default_rect.translate(0, default_rect.getHeight()); // If there was a recently constructed child, use its rectangle - get_last_child_rect(parent, &last_rect); + get_last_child_rect(parent, &default_rect); if (layout_topleft) { - p.bottom_delta.setIfNotProvided(0, false); - // Invert the sense of bottom_delta for topleft layout if (p.bottom_delta.isProvided()) { @@ -2530,33 +2528,44 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) else if (p.top_delta.isProvided()) { p.bottom_delta = - -(p.top_delta + p.rect.height - last_rect.getHeight()); + -(p.top_delta + p.rect.height - default_rect.getHeight()); } - else if (!p.bottom_delta.isProvided() - && !p.left_delta.isProvided() - && !p.top_pad.isProvided() + else if (!p.left_delta.isProvided() && !p.left_pad.isProvided()) { // set default position is just below last rect p.bottom_delta.set(-(p.rect.height + VPAD), false); } + else + { + p.bottom_delta.set(0, false); + } // default to same left edge - p.left_delta.setIfNotProvided(0, false); + if (!p.left_delta.isProvided()) + { + p.left_delta.set(0, false); + } if (p.left_pad.isProvided()) { // left_pad is based on prior widget's right edge - p.left_delta.set(p.left_pad + last_rect.getWidth(), false); + p.left_delta.set(p.left_pad + default_rect.getWidth(), false); } - last_rect.translate(p.left_delta, p.bottom_delta); + default_rect.translate(p.left_delta, p.bottom_delta); } else { // set default position is just below last rect - p.bottom_delta.setIfNotProvided(-(p.rect.height + VPAD), false); - p.left_delta.setIfNotProvided(0, false); - last_rect.translate(p.left_delta, p.bottom_delta); + if (!p.bottom_delta.isProvided()) + { + p.bottom_delta.set(-(p.rect.height + VPAD), false); + } + if (!p.left_delta.isProvided()) + { + p.left_delta.set(0, false); + } + default_rect.translate(p.left_delta, p.bottom_delta); } // this handles case where *both* x and x_delta are provided @@ -2567,12 +2576,30 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) // selectively apply rectangle defaults, making sure that // params are not flagged as having been "provided" // as rect params are overconstrained and rely on provided flags - p.rect.left.setIfNotProvided(last_rect.mLeft, false); - p.rect.bottom.setIfNotProvided(last_rect.mBottom, false); - p.rect.top.setIfNotProvided(last_rect.mTop, false); - p.rect.right.setIfNotProvided(last_rect.mRight, false); - p.rect.width.setIfNotProvided(last_rect.getWidth(), false); - p.rect.height.setIfNotProvided(last_rect.getHeight(), false); + if (!p.rect.left.isProvided()) + { + p.rect.left.set(default_rect.mLeft, false); + } + if (!p.rect.bottom.isProvided()) + { + p.rect.bottom.set(default_rect.mBottom, false); + } + if (!p.rect.top.isProvided()) + { + p.rect.top.set(default_rect.mTop, false); + } + if (!p.rect.right.isProvided()) + { + p.rect.right.set(default_rect.mRight, false); + } + if (!p.rect.width.isProvided()) + { + p.rect.width.set(default_rect.getWidth(), false); + } + if (!p.rect.height.isProvided()) + { + p.rect.height.set(default_rect.getHeight(), false); + } } } diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index 32d7ea7c25..919267dcc6 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -57,9 +57,6 @@ LLViewBorder::Params::Params() { addSynonym(border_thickness, "thickness"); addSynonym(render_style, "style"); - name = "view_border"; - mouse_opaque = false; - follows.flags = FOLLOWS_ALL; } diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index 77e94385d4..cf76202215 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -43,7 +43,7 @@ LLWindowShade::Params::Params() text_color("text_color"), can_close("can_close", true) { - mouse_opaque = false; + changeDefault(mouse_opaque, false); } LLWindowShade::LLWindowShade(const LLWindowShade::Params& params) |