summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltoolbar.cpp19
-rw-r--r--indra/llui/lltoolbarview.cpp36
-rw-r--r--indra/llui/lltoolbarview.h8
-rw-r--r--indra/llui/llui.cpp1
-rw-r--r--indra/llui/lluictrlfactory.h4
5 files changed, 43 insertions, 25 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index e5ffe391a6..31a18dc707 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -89,7 +89,7 @@ LLToolBar::Params::Params()
button_panel("button_panel")
{}
-LLToolBar::LLToolBar(const Params& p)
+LLToolBar::LLToolBar(const LLToolBar::Params& p)
: LLUICtrl(p),
mButtonType(p.button_display_mode),
mSideType(p.side),
@@ -112,6 +112,9 @@ LLToolBar::LLToolBar(const Params& p)
void LLToolBar::initFromParams(const LLToolBar::Params& p)
{
+ // Initialize the base object
+ LLUICtrl::initFromParams(p);
+
LLLayoutStack::ELayoutOrientation orientation = getOrientation(p.side);
LLLayoutStack::Params centering_stack_p;
@@ -217,7 +220,7 @@ void LLToolBar::updateLayoutAsNeeded()
if (!mNeedsLayout) return;
LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType);
-
+
// our terminology for orientation-agnostic layout is such that
// length refers to a distance in the direction we stack the buttons
// and girth refers to a distance in the direction buttons wrap
@@ -261,8 +264,8 @@ void LLToolBar::updateLayoutAsNeeded()
std::vector<LLToolBarButton*> buttons_in_row;
- BOOST_FOREACH(LLToolBarButton* button, mButtons)
- {
+ BOOST_FOREACH(LLToolBarButton* button, mButtons)
+ {
button->reshape(mMinButtonWidth, mButtonHeight);
button->autoResize();
@@ -293,11 +296,11 @@ void LLToolBar::updateLayoutAsNeeded()
cur_start = row_pad_start;
cur_row += max_row_girth + mPadBetween;
max_row_girth = 0;
- }
+ }
LLRect button_rect;
if (orientation == LLLayoutStack::HORIZONTAL)
- {
+ {
button_rect.setLeftTopAndSize(cur_start, panel_rect.mTop - cur_row, button_clamped_width, button->getRect().getHeight());
}
else // VERTICAL
@@ -305,7 +308,7 @@ void LLToolBar::updateLayoutAsNeeded()
button_rect.setLeftTopAndSize(cur_row, panel_rect.mTop - cur_start, button_clamped_width, button->getRect().getHeight());
}
button->setShape(button_rect);
-
+
buttons_in_row.push_back(button);
row_running_length += button_length + mPadBetween;
@@ -338,7 +341,7 @@ void LLToolBar::updateLayoutAsNeeded()
mButtonPanel->translate(mButtonPanel->getRect().getWidth() - total_girth, 0);
}
mButtonPanel->reshape(total_girth, max_row_length);
- }
+ }
// re-center toolbar buttons
mCenteringStack->updateLayout();
diff --git a/indra/llui/lltoolbarview.cpp b/indra/llui/lltoolbarview.cpp
index 0e54c91cea..590cd4ffca 100644
--- a/indra/llui/lltoolbarview.cpp
+++ b/indra/llui/lltoolbarview.cpp
@@ -28,6 +28,7 @@
#include "linden_common.h"
#include "lltoolbarview.h"
+
#include "lltoolbar.h"
#include "llbutton.h"
@@ -35,33 +36,39 @@ LLToolBarView* gToolBarView = NULL;
static LLDefaultChildRegistry::Register<LLToolBarView> r("toolbar_view");
-LLToolBarView::LLToolBarView(const Params& p)
+LLToolBarView::LLToolBarView(const LLToolBarView::Params& p)
: LLUICtrl(p)
{
}
-BOOL LLToolBarView::postBuild()
+void LLToolBarView::initFromParams(const LLToolBarView::Params& p)
+{
+ // Initialize the base object
+ LLUICtrl::initFromParams(p);
+}
+
+LLToolBarView::~LLToolBarView()
{
- LLRect ctrl_rect = getRect();
- LLButton* btn = getChild<LLButton>("test");
- LLRect btn_rect = btn->getRect();
- llinfos << "Merov debug : control rect = " << ctrl_rect.mLeft << ", " << ctrl_rect.mTop << ", " << ctrl_rect.mRight << ", " << ctrl_rect.mBottom << llendl;
- llinfos << "Merov debug : test rect = " << btn_rect.mLeft << ", " << btn_rect.mTop << ", " << btn_rect.mRight << ", " << btn_rect.mBottom << llendl;
- return TRUE;
}
void LLToolBarView::draw()
{
static bool debug_print = true;
+ static S32 old_width = 0;
+ static S32 old_height = 0;
LLToolBar* toolbar_bottom = getChild<LLToolBar>("toolbar_bottom");
LLToolBar* toolbar_left = getChild<LLToolBar>("toolbar_left");
LLToolBar* toolbar_right = getChild<LLToolBar>("toolbar_right");
+ LLPanel* sizer_left = getChild<LLPanel>("sizer_left");
LLRect bottom_rect = toolbar_bottom->getRect();
LLRect left_rect = toolbar_left->getRect();
LLRect right_rect = toolbar_right->getRect();
+ LLRect sizer_left_rect = sizer_left->getRect();
+ if ((old_width != getRect().getWidth()) || (old_height != getRect().getHeight()))
+ debug_print = true;
if (debug_print)
{
LLRect ctrl_rect = getRect();
@@ -69,13 +76,18 @@ void LLToolBarView::draw()
llinfos << "Merov debug : draw bottom rect = " << bottom_rect.mLeft << ", " << bottom_rect.mTop << ", " << bottom_rect.mRight << ", " << bottom_rect.mBottom << llendl;
llinfos << "Merov debug : draw left rect = " << left_rect.mLeft << ", " << left_rect.mTop << ", " << left_rect.mRight << ", " << left_rect.mBottom << llendl;
llinfos << "Merov debug : draw right rect = " << right_rect.mLeft << ", " << right_rect.mTop << ", " << right_rect.mRight << ", " << right_rect.mBottom << llendl;
+ llinfos << "Merov debug : draw s left rect = " << sizer_left_rect.mLeft << ", " << sizer_left_rect.mTop << ", " << sizer_left_rect.mRight << ", " << sizer_left_rect.mBottom << llendl;
+ old_width = ctrl_rect.getWidth();
+ old_height = ctrl_rect.getHeight();
debug_print = false;
}
// Debug draw
- gl_rect_2d(getLocalRect(), LLColor4::blue, TRUE);
- gl_rect_2d(bottom_rect, LLColor4::red, TRUE);
- gl_rect_2d(left_rect, LLColor4::green, TRUE);
- gl_rect_2d(right_rect, LLColor4::yellow, TRUE);
+ LLColor4 back_color = LLColor4::blue;
+ back_color[VALPHA] = 0.5f;
+// gl_rect_2d(getLocalRect(), back_color, TRUE);
+// gl_rect_2d(bottom_rect, LLColor4::red, TRUE);
+// gl_rect_2d(left_rect, LLColor4::green, TRUE);
+// gl_rect_2d(right_rect, LLColor4::yellow, TRUE);
LLUICtrl::draw();
}
diff --git a/indra/llui/lltoolbarview.h b/indra/llui/lltoolbarview.h
index 0bd0070ab7..73278e226b 100644
--- a/indra/llui/lltoolbarview.h
+++ b/indra/llui/lltoolbarview.h
@@ -30,19 +30,23 @@
#include "lluictrl.h"
+class LLUICtrlFactory;
+
// Parent of all LLToolBar
class LLToolBarView : public LLUICtrl
{
public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> {};
- void draw();
- /*virtual*/ BOOL postBuild();
+ virtual ~LLToolBarView();
+ virtual void draw();
protected:
friend class LLUICtrlFactory;
LLToolBarView(const Params&);
+ void initFromParams(const Params&);
+
private:
LLHandle<LLView> mSnapView;
};
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 1bc575438c..a4303780fd 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -93,7 +93,6 @@ std::list<std::string> gUntranslated;
static LLDefaultChildRegistry::Register<LLFilterEditor> register_filter_editor("filter_editor");
static LLDefaultChildRegistry::Register<LLFlyoutButton> register_flyout_button("flyout_button");
static LLDefaultChildRegistry::Register<LLSearchEditor> register_search_editor("search_editor");
-static LLDefaultChildRegistry::Register<LLToolBar> r1("toolbar");
// register other widgets which otherwise may not be linked in
static LLDefaultChildRegistry::Register<LLLoadingIndicator> register_loading_indicator("loading_indicator");
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index d345ad4cd0..71c38237c1 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -172,7 +172,7 @@ public:
static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry, LLXMLNodePtr output_node = NULL)
{
T* widget = NULL;
-
+
std::string skinned_filename = findSkinnedFilename(filename);
instance().pushFileName(filename);
{
@@ -201,10 +201,10 @@ public:
// not of right type, so delete it
if (!widget)
{
+ llwarns << "Widget in " << filename << " was of type " << typeid(view).name() << " instead of expected type " << typeid(T).name() << llendl;
delete view;
view = NULL;
}
-
}
}
fail: