Explorar o código

GuiScrollCtrl Additional Changes

Repaired a few issues that I found while using the GuiScrollCtrl. Added a second set of scroll profiles.
Peter Robinson %!s(int64=5) %!d(string=hai) anos
pai
achega
78ca67aa61

+ 65 - 8
editor/EditorCore/Themes/BaseTheme.cs

@@ -64,7 +64,7 @@ function BaseTheme::makePanelProfile(%this)
 {
 	%panelBorder = new GuiBorderProfile()
 	{
-		padding = 10;
+		padding = 0;
 		border = %this.borderSize;
 		borderColor = "0 0 0 60";
 	};
@@ -82,11 +82,6 @@ function BaseTheme::makePanelProfile(%this)
 		borderDefault = %panelBorder;
 	};
 
-	%paddingBorder = new GuiBorderProfile()
-	{
-		padding = 10;
-	};
-
 	%this.fullPanelProfile = new GuiControlProfile()
 	{
 		fillColor = %this.color1;
@@ -96,8 +91,6 @@ function BaseTheme::makePanelProfile(%this)
 		fontColor = %this.color4;
 		align = center;
 		vAlign = middle;
-
-		borderDefault = %paddingBorder;
 	};
 
 	%this.overlayProfile = new GuiControlProfile()
@@ -108,6 +101,70 @@ function BaseTheme::makePanelProfile(%this)
 		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 	};
+
+	//Scrolling panel
+	%this.scrollingPanelTrackProfile = new GuiControlProfile()
+	{
+		fillColor = %this.color2;
+		fillColorHL = %this.color2;
+		fillColorSL = %this.color2;
+		fillColorNA = %this.setAlpha(%this.color2, 50);
+	};
+
+	%thumbBorder = new GuiBorderProfile()
+	{
+		margin = 3;
+		marginHL = 3;
+		marginSL = 3;
+		paddingNA = 3;
+	};
+
+	%this.scrollingPanelThumbProfile = new GuiControlProfile()
+	{
+		fillColor = %this.color3;
+		fillColorHL = %this.adjustValue(%this.color3, 10);
+		fillColorSL = %this.color5;
+		fillColorNA = %this.setAlpha(%this.color3, 0);
+
+		borderRight = %thumbBorder;
+		borderLeft = %thumbBorder;
+	};
+
+	%buttonBorder = new GuiBorderProfile()
+	{
+		padding = 3;
+		paddingHL = 3;
+		paddingSL = 3;
+		paddingNA = 3;
+	};
+
+	%this.scrollingPanelArrowProfile = new GuiControlProfile()
+	{
+		fillColor = %this.color2;
+		fillColorHL = %this.color2;
+		fillColorSL = %this.color2;
+		fillColorNA = %this.setAlpha(%this.color2, 50);
+
+		fontType = %this.font;
+		fontColor = %this.color3;
+		fontColorHL = %this.adjustValue(%this.color3, 10);
+		fontColorSL = %this.color5;
+		fontColorNA = %this.setAlpha(%this.color3, 80);
+
+		borderDefault = %buttonBorder;
+	};
+
+	%mainBorder = new GuiBorderProfile()
+	{
+		margin = 5;
+		padding = 5;
+		border = 3;
+		borderColor = %this.color5;
+	};
+	%this.scrollingPanelProfile = new GuiControlProfile()
+	{
+	    fillColor = %this.color1;
+	};
 }
 
 function BaseTheme::makeButtonProfile(%this)

+ 4 - 0
editor/EditorCore/Themes/ThemeManager.cs

@@ -92,6 +92,10 @@ function ThemeManager::activateTheme(%this, %theme)
 	%this.trackProfile = %theme.trackProfile;
 	%this.scrollArrowProfile = %theme.scrollArrowProfile;
 	%this.consoleProfile = %theme.consoleProfile;
+	%this.scrollingPanelProfile = %theme.scrollingPanelProfile;
+	%this.scrollingPanelThumbProfile = %theme.scrollingPanelThumbProfile;
+	%this.scrollingPanelTrackProfile = %theme.scrollingPanelTrackProfile;
+	%this.scrollingPanelArrowProfile = %theme.scrollingPanelArrowProfile;
 
 	%this.postEvent("ThemeChanged", %this);
 }

+ 0 - 67
editor/EditorCore/gui/temp.gui

@@ -1,67 +0,0 @@
-<!-- Console Command Entry -->
-<GuiConsoleEditCtrl
-	Name="ConsoleEntry"
-	Profile="GuiConsoleTextEditProfile"
-	HorizSizing="width"
-	VertSizing="top"
-	Position="0 738"
-	Extent="914 30"
-	minExtent="8 8"
-	Visible="1"
-	AltCommand="ConsoleEntry::eval();"
-	HelpTag="0"
-	MaxLength="255"
-	HistorySize="40"
-	password="0"
-	TabComplete="0"
-	SinkAllKeyEvents="1"
-	UseSiblingScroller="1"
-/>
-<!-- Hide Log -->
-<GuiButtonCtrl
-	Profile="BlueButtonProfile"
-	Text="Hide Log"
-	ButtonType="PushButton"
-	command="ToggleConsole(true);"
-	canSaveDynamicFields="0"
-	isContainer="0"
-	HorizSizing="relative"
-	VertSizing="relative"
-	Position="924 738"
-	Extent="100 30"
-	MinExtent="8 2"
-	canSave="1"
-	Visible="1"
-	Active="1"
-	hovertime="1000"
-	groupNum="-1"
-	useMouseEvents="1" />
-
-<GuiScrollCtrl
-	Name="ConsoleScrollCtrl"
-	canSaveDynamicFields="0"
-	isContainer="1"
-	Profile="ConsoleScrollProfile"
-	HorizSizing="width"
-	VertSizing="height"
-	Position="0 0"
-	Extent="1024 738"
-	MinExtent="8 8"
-	canSave="1"
-	Visible="1"
-	hovertime="1000"
-	willFirstRespond="1"
-	hScrollBar="alwaysOn"
-	vScrollBar="alwaysOn"
-	constantThumbHeight="0"
-	childMargin="0 0">
-
-	<!-- Console Log -->
-	<GuiConsole
-		Profile="GuiConsoleProfile"
-		Position="0 0"
-		Extent="1024 738"
-		HorizSizing="width"
-		VertSizing="height"
-		Visible="1"/>
-</GuiScrollCtrl>

+ 8 - 4
engine/source/gui/containers/guiScrollCtrl.cc

@@ -333,7 +333,7 @@ bool GuiScrollCtrl::calcChildExtents()
 
 void GuiScrollCtrl::calcScrollRects(void)
 {
-	RectI ctrlRect = applyMargins(mBounds.point, mBounds.extent, NormalState, mProfile);
+	RectI ctrlRect = applyMargins(mBounds.point.Zero, mBounds.extent, NormalState, mProfile);
 	RectI fillRect = applyBorders(ctrlRect.point, ctrlRect.extent, NormalState, mProfile);
 
 	if (mHasVScrollBar)
@@ -425,8 +425,8 @@ void GuiScrollCtrl::scrollDelta(S32 deltaX, S32 deltaY)
 	mScrollOffset.x += deltaX;
 	mScrollOffset.y += deltaY;
 
-	mScrollOffset.setMax(mScrollOffset.Zero);
 	mScrollOffset.setMin(mChildExt - mContentExt);
+	mScrollOffset.setMax(mScrollOffset.Zero);
 
 	calcThumbs();
 }
@@ -930,8 +930,10 @@ void GuiScrollCtrl::renderVScrollBar(const Point2I& offset)
 			renderBorderedRect(RectI(mVTrackRect.point + offset, mVTrackRect.extent), mTrackProfile, GuiControlState::NormalState);
 
 			//The Thumb
+			GuiControlState thumbState = getRegionCurrentState(Region::VertThumb);
 			RectI vThumb = RectI(mVTrackRect.point.x + offset.x, mVTrackRect.point.y + mVThumbPos + offset.y, mScrollBarThickness, mVThumbSize);
-			renderBorderedRect(vThumb, mThumbProfile, getRegionCurrentState(Region::VertThumb));
+			RectI vThumbWithMargins = applyMargins(vThumb.point, vThumb.extent, thumbState, mThumbProfile);
+			renderBorderedRect(vThumbWithMargins, mThumbProfile, thumbState);
 		}
 		else
 		{
@@ -959,8 +961,10 @@ void GuiScrollCtrl::renderHScrollBar(const Point2I& offset)
 			renderBorderedRect(RectI(mHTrackRect.point + offset, mHTrackRect.extent), mTrackProfile, GuiControlState::NormalState);
 
 			//The Thumb
+			GuiControlState thumbState = getRegionCurrentState(Region::HorizThumb);
 			RectI hThumb = RectI(mHTrackRect.point.x + mHThumbPos + offset.x, mHTrackRect.point.y + offset.y, mHThumbSize, mScrollBarThickness);
-			renderBorderedRect(hThumb, mThumbProfile, getRegionCurrentState(Region::HorizThumb));
+			RectI hThumbWithMargins = applyMargins(hThumb.point, hThumb.extent, thumbState, mThumbProfile);
+			renderBorderedRect(hThumbWithMargins, mThumbProfile, thumbState);
 		}
 		else
 		{