Browse Source

Fix uninitialized member variable in TurboBadger

Josh Engebretson 10 years ago
parent
commit
a00afee00d

+ 1 - 1
Data/AtomicEditor/Resources/EditorData/AtomicEditor/resources/default_skin/skin.tb.txt

@@ -481,7 +481,7 @@ elements
 	TBResizer
 	TBResizer
 		bitmap resizer.png
 		bitmap resizer.png
 	TBInlineSelect
 	TBInlineSelect
-		max-width 110
+		max-width 140
 	TBDimmer
 	TBDimmer
 		background-color #00000088
 		background-color #00000088
 
 

+ 2 - 2
Source/AtomicEditor/Source/Player/UIPlayer.cpp

@@ -72,7 +72,7 @@ UIPlayer::UIPlayer(Context* context):
 
 
     window_->ResizeToFitContent();
     window_->ResizeToFitContent();
 
 
-    Center();
+    Center();    
 
 
     SubscribeToEvent(E_UPDATE, HANDLER(UIPlayer, HandleUpdate));
     SubscribeToEvent(E_UPDATE, HANDLER(UIPlayer, HandleUpdate));
 }
 }
@@ -105,7 +105,7 @@ void UIPlayer::HandleUpdate(StringHash eventType, VariantMap& eventData)
 
 
 bool UIPlayer::OnEvent(const TBWidgetEvent &ev)
 bool UIPlayer::OnEvent(const TBWidgetEvent &ev)
 {
 {
-    return false;
+    return true;
 }
 }
 
 
 
 

+ 2 - 0
Source/AtomicEditor/Source/UI/Modal/UIModalOps.cpp

@@ -52,6 +52,8 @@ UIModalOpWindow::UIModalOpWindow(Context* context):
     // start with full screen as size
     // start with full screen as size
     delegate_->SetRect(TBRect(0, 0, root->GetRect().w, root->GetRect().h));
     delegate_->SetRect(TBRect(0, 0, root->GetRect().w, root->GetRect().h));
     delegate_->AddChild(window_);
     delegate_->AddChild(window_);
+
+    delegate_->SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
 }
 }
 
 
 UIModalOpWindow::~UIModalOpWindow()
 UIModalOpWindow::~UIModalOpWindow()

+ 4 - 1
Source/AtomicEditor/Source/UI/UIInspectorDataBinding.cpp

@@ -332,7 +332,7 @@ InspectorDataBinding* InspectorDataBinding::Create(Serializable* object, const A
         layout->SetSpacing(0);
         layout->SetSpacing(0);
 
 
         LayoutParams lp;
         LayoutParams lp;
-        lp.SetWidth(90);
+        lp.SetWidth(100);
 
 
         for (unsigned i = 0; i < 3; i++)
         for (unsigned i = 0; i < 3; i++)
         {
         {
@@ -341,6 +341,9 @@ InspectorDataBinding* InspectorDataBinding::Create(Serializable* object, const A
             select->SetFontDescription(fd);
             select->SetFontDescription(fd);
             select->SetSkinBg(TBIDC("InspectorTextAttrName"));
             select->SetSkinBg(TBIDC("InspectorTextAttrName"));
             select->SetLimits(-10000000, 10000000);
             select->SetLimits(-10000000, 10000000);
+            LayoutParams editlp;
+            editlp.min_w = 60;
+            select->SetEditFieldLayoutParams(editlp);
             select->SetLayoutParams(lp);
             select->SetLayoutParams(lp);
             layout->AddChild(select);
             layout->AddChild(select);
         }
         }

+ 1 - 2
Source/AtomicEditor/Source/UI/UIInspectorFrame.cpp

@@ -151,6 +151,7 @@ void InspectorFrame::InspectNode(Node* node)
         LayoutParams nlp;
         LayoutParams nlp;
         nlp.SetWidth(304);
         nlp.SetWidth(304);
         TBLayout* nodeLayout = new TBLayout(AXIS_Y);
         TBLayout* nodeLayout = new TBLayout(AXIS_Y);
+        nodeLayout->SetSpacing(4);
 
 
         nodeLayout->SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
         nodeLayout->SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
         nodeLayout->SetLayoutPosition(LAYOUT_POSITION_LEFT_TOP);
         nodeLayout->SetLayoutPosition(LAYOUT_POSITION_LEFT_TOP);
@@ -172,8 +173,6 @@ void InspectorFrame::InspectNode(Node* node)
         nodeLabel->SetSkinBg(TBIDC("InspectorTextLabel"));
         nodeLabel->SetSkinBg(TBIDC("InspectorTextLabel"));
         attrsVerticalLayout->AddChild(nodeLabel);
         attrsVerticalLayout->AddChild(nodeLabel);
 
 
-
-
         const Vector<AttributeInfo>* attrs = node->GetAttributes();
         const Vector<AttributeInfo>* attrs = node->GetAttributes();
 
 
         for (unsigned i = 0; i < attrs->Size(); i++)
         for (unsigned i = 0; i < attrs->Size(); i++)

+ 17 - 2
Source/ThirdParty/TurboBadger/tb_inline_select.cpp

@@ -5,6 +5,7 @@
 
 
 #include "tb_inline_select.h"
 #include "tb_inline_select.h"
 #include <assert.h>
 #include <assert.h>
+#include <math.h>
 #include <stdlib.h>
 #include <stdlib.h>
 
 
 namespace tb {
 namespace tb {
@@ -50,6 +51,11 @@ TBInlineSelect::~TBInlineSelect()
 	RemoveChild(&m_layout);
 	RemoveChild(&m_layout);
 }
 }
 
 
+void TBInlineSelect::SetEditFieldLayoutParams(LayoutParams& lp)
+{
+    m_editfield.SetLayoutParams(lp);
+}
+
 void TBInlineSelect::SetLimits(double min, double max)
 void TBInlineSelect::SetLimits(double min, double max)
 {
 {
 	assert(min <= max);
 	assert(min <= max);
@@ -66,9 +72,18 @@ void TBInlineSelect::SetValueInternal(double value, bool update_text)
 	m_value = value;
 	m_value = value;
 
 
 	if (update_text)
 	if (update_text)
-	{
+	{        
 		TBStr strval;
 		TBStr strval;
-        strval.SetFormatted("%.2f", m_value);
+
+        double prec = m_value - floor(m_value);
+        if (prec < .001)
+        {
+            strval.SetFormatted("%.0f", m_value);
+        }
+        else
+            strval.SetFormatted("%.2f", m_value);
+
+
 		m_editfield.SetText(strval);
 		m_editfield.SetText(strval);
 	}
 	}
 
 

+ 2 - 0
Source/ThirdParty/TurboBadger/tb_inline_select.h

@@ -42,6 +42,8 @@ public:
 	virtual void SetValue(int value) { SetValueInternal(value, true); }
 	virtual void SetValue(int value) { SetValueInternal(value, true); }
     virtual int GetValue() { return m_value; }
     virtual int GetValue() { return m_value; }
 
 
+    void SetEditFieldLayoutParams(LayoutParams& lp);
+
 	virtual void OnInflate(const INFLATE_INFO &info);
 	virtual void OnInflate(const INFLATE_INFO &info);
 	virtual void OnSkinChanged();
 	virtual void OnSkinChanged();
 	virtual bool OnEvent(const TBWidgetEvent &ev);
 	virtual bool OnEvent(const TBWidgetEvent &ev);

+ 1 - 0
Source/ThirdParty/TurboBadger/tb_scroll_container.cpp

@@ -98,6 +98,7 @@ TBScrollContainer::TBScrollContainer()
 	: m_adapt_to_content_size(false)
 	: m_adapt_to_content_size(false)
 	, m_adapt_content_size(false)
 	, m_adapt_content_size(false)
 	, m_layout_is_invalid(false)
 	, m_layout_is_invalid(false)
+    , m_ignore_scroll_events(false)
 	, m_mode(SCROLL_MODE_X_Y)
 	, m_mode(SCROLL_MODE_X_Y)
 {
 {
 	AddChild(&m_scrollbar_x);
 	AddChild(&m_scrollbar_x);