Browse Source

Merge pull request #62 from viciious/warsow10_bugfixes

Warsow 1.0 bugfixes
Lloyd Weehuizen 13 years ago
parent
commit
bc8b334d2f

+ 6 - 0
Include/Rocket/Controls/ElementTabSet.h

@@ -84,6 +84,12 @@ public:
 	/// Process the incoming event.
 	void ProcessEvent(Core::Event& event);
 
+	/// Called when the listener has been attached to a new Element
+	void OnAttach(Element* ROCKET_UNUSED(element));
+
+	/// Called when the listener has been detached from a Element
+	void OnDetach(Element* ROCKET_UNUSED(element));
+
 protected:
 	// Catch child add/removes so we can correctly set up their events.
 	virtual void OnChildAdd(Core::Element* child);

+ 2 - 0
Source/Controls/ElementDataGridRow.cpp

@@ -383,6 +383,7 @@ void ElementDataGridRow::AddChildren(int first_row_added, int num_rows_added)
 		for (int i = first_row_added + num_rows_added; i < (int)children.size(); i++)
 		{
 			children[i]->SetChildIndex(i);
+			children[i]->DirtyTableRelativeIndex();
 		}
 
 		if (parent_row)
@@ -417,6 +418,7 @@ void ElementDataGridRow::RemoveChildren(int first_row_removed, int num_rows_remo
     for (int i = first_row_removed; i < (int) children.size(); i++)
 	{
 		children[i]->SetChildIndex(i);
+		children[i]->DirtyTableRelativeIndex();
 	}
 
 	Rocket::Core::Dictionary parameters;

+ 11 - 0
Source/Controls/ElementTabSet.cpp

@@ -223,5 +223,16 @@ Core::Element* ElementTabSet::GetChildByTag(const Rocket::Core::String& tag)
 	return element;
 }
 
+void ElementTabSet::OnAttach(Core::Element * ROCKET_UNUSED(element))
+{
+	AddReference();
+}
+
+void ElementTabSet::OnDetach(Core::Element * ROCKET_UNUSED(element))
+{
+	RemoveReference();
+}
+
+
 }
 }

+ 0 - 2
Source/Controls/InputTypeRange.h

@@ -68,8 +68,6 @@ public:
 	virtual bool GetIntrinsicDimensions(Rocket::Core::Vector2f& dimensions);
 
 private:
-	int size;
-
 	WidgetSliderInput* widget;
 };
 

+ 1 - 0
Source/Controls/WidgetSlider.cpp

@@ -47,6 +47,7 @@ WidgetSlider::WidgetSlider(ElementFormControl* _parent)
 	arrows[1] = NULL;
 
 	bar_position = 0;
+	bar_drag_anchor = 0;
 
 	arrow_timers[0] = -1;
 	arrow_timers[1] = -1;

+ 2 - 1
Source/Core/Element.cpp

@@ -1564,7 +1564,8 @@ void Element::OnReferenceDeactivate()
 
 void Element::ProcessEvent(Event& event)
 {
-	if (event == MOUSEDOWN && IsPointWithinElement(Vector2f(event.GetParameter< float >("mouse_x", 0), event.GetParameter< float >("mouse_y", 0))))
+	if (event == MOUSEDOWN && IsPointWithinElement(Vector2f(event.GetParameter< float >("mouse_x", 0), event.GetParameter< float >("mouse_y", 0))) &&
+		event.GetParameter< int >("button", 0) == 0)
 		SetPseudoClass("active", true);
 
 	if (event == MOUSESCROLL)

+ 4 - 0
Source/Core/ElementDocument.cpp

@@ -472,6 +472,10 @@ bool ElementDocument::SearchFocusSubtree(Element* element, bool forward)
 	{
 		return false;
 	}
+	if (!element->IsVisible())
+	{
+		return false;
+	}
 
 	// Check if this is the node we're looking for
 	if (element->GetProperty<int>(TAB_INDEX) == TAB_INDEX_AUTO)

+ 7 - 3
Source/Core/LayoutEngine.cpp

@@ -48,6 +48,7 @@ struct LayoutChunk
 {
 	LayoutChunk()
 	{
+		memset(buffer, 0, size);
 	}
 
 	static const unsigned int size = MAX(sizeof(LayoutBlockBox), MAX(sizeof(LayoutInlineBox), MAX(sizeof(LayoutInlineBoxText), MAX(sizeof(LayoutLineBox), sizeof(LayoutBlockBoxSpace)))));
@@ -561,15 +562,18 @@ void LayoutEngine::BuildBoxHeight(Box& box, Element* element, float containing_b
 	else
 	{
 		const Property* height_property = element->GetProperty(HEIGHT);
-		if (height_property->unit == Property::KEYWORD)
+		if (height_property == NULL)
+		{
+			height_auto = false;		
+		}
+		else if (height_property->unit == Property::KEYWORD)
 		{
 			height_auto = true;
 		}
 		else
 		{
 			height_auto = false;
-			if (height_property != NULL)
-				content_area.y = element->ResolveProperty(HEIGHT, containing_block_height);
+			content_area.y = element->ResolveProperty(HEIGHT, containing_block_height);
 		}
 	}
 

+ 1 - 0
Source/Core/WidgetSlider.cpp

@@ -52,6 +52,7 @@ WidgetSlider::WidgetSlider(Element* _parent)
 	arrows[1] = NULL;
 
 	bar_position = 0;
+	bar_drag_anchor = 0;
 
 	arrow_timers[0] = -1;
 	arrow_timers[1] = -1;