Browse Source

Editor Icons

Added some basic icons to the editor.
Peter Robinson 4 years ago
parent
commit
5b31a2efcd

+ 29 - 24
editor/AssetAdmin/ParticleEditor/AssetParticleGraphUnit.cs

@@ -15,43 +15,43 @@ function AssetParticleGraphUnit::onAdd(%this)
 	%center = 6 + mRound(getWord(%this.graph.extent, 1) / 2);
 	%this.valueZoomInButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 0;
 		Position = "2" SPC (%center + 13);
-		Extent = "24 24";
-		Text = "+";
 		Command = %this.getId() @ ".valueZoomIn();";
 	};
-	ThemeManager.setProfile(%this.valueZoomInButton, "buttonProfile");
+	ThemeManager.setProfile(%this.valueZoomInButton, "iconButtonProfile");
 	%this.add(%this.valueZoomInButton);
 
 	%this.valueZoomOutButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 1;
 		Position = "2" SPC (%center - 13);
-		Extent = "24 24";
-		Text = "-";
 		Command = %this.getId() @ ".valueZoomOut();";
 	};
-	ThemeManager.setProfile(%this.valueZoomOutButton, "buttonProfile");
+	ThemeManager.setProfile(%this.valueZoomOutButton, "iconButtonProfile");
 	%this.add(%this.valueZoomOutButton);
 
 	//Value move buttons
 	%this.valueMoveUpButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 2;
 		Position = "2 18";
-		Extent = "24 24";
-		Text = "^";
 		Command = %this.getId() @ ".valueMoveUp();";
 	};
-	ThemeManager.setProfile(%this.valueMoveUpButton, "buttonProfile");
+	ThemeManager.setProfile(%this.valueMoveUpButton, "iconButtonProfile");
 	%this.add(%this.valueMoveUpButton);
 
 	%this.valueMoveDownButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 6;
 		Position = "2" SPC (getWord(%this.extent, 1) - 66);
-		Extent = "24 24";
-		Text = "v";
 		Command = %this.getId() @ ".valueMoveDown();";
 	};
-	ThemeManager.setProfile(%this.valueMoveDownButton, "buttonProfile");
+	ThemeManager.setProfile(%this.valueMoveDownButton, "iconButtonProfile");
 	%this.add(%this.valueMoveDownButton);
 
 	//time zoom buttons
@@ -68,45 +68,45 @@ function AssetParticleGraphUnit::onAdd(%this)
 
 	%this.timeZoomInButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 0;
 		Position = "0 0";
-		Extent = "24 24";
-		Text = "+";
 		Command = %this.getId() @ ".timeZoomIn();";
 	};
-	ThemeManager.setProfile(%this.timeZoomInButton, "buttonProfile");
+	ThemeManager.setProfile(%this.timeZoomInButton, "iconButtonProfile");
 	%this.timeZoomContainer.add(%this.timeZoomInButton);
 
 	%this.timeZoomOutButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 1;
 		Position = "26 0";
-		Extent = "24 24";
-		Text = "-";
 		Command = %this.getId() @ ".timeZoomOut();";
 	};
-	ThemeManager.setProfile(%this.timeZoomOutButton, "buttonProfile");
+	ThemeManager.setProfile(%this.timeZoomOutButton, "iconButtonProfile");
 	%this.timeZoomContainer.add(%this.timeZoomOutButton);
 
 	//Time move buttons
 	%this.timeMoveBackButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 8;
 		HorizSizing = "right";
 		Position = "30" SPC %bottom;
-		Extent = "24 24";
-		Text = "<";
 		Command = %this.getId() @ ".timeMoveBack();";
 	};
-	ThemeManager.setProfile(%this.timeMoveBackButton, "buttonProfile");
+	ThemeManager.setProfile(%this.timeMoveBackButton, "iconButtonProfile");
 	%this.add(%this.timeMoveBackButton);
 
 	%this.timeMoveForwardButton = new GuiButtonCtrl()
 	{
+		Class = "EditorIconButton";
+		Frame = 4;
 		HorizSizing = "left";
 		Position = (getWord(%this.graph.extent, 0) + 6) SPC %bottom;
-		Extent = "24 24";
-		Text = ">";
 		Command = %this.getId() @ ".timeMoveForward();";
 	};
-	ThemeManager.setProfile(%this.timeMoveForwardButton, "buttonProfile");
+	ThemeManager.setProfile(%this.timeMoveForwardButton, "iconButtonProfile");
 	%this.add(%this.timeMoveForwardButton);
 }
 
@@ -192,6 +192,11 @@ function AssetParticleGraphUnit::setTimeController(%this, %controller)
 
 function AssetParticleGraphUnit::refreshCamera(%this)
 {
+	if(!isObject(%this.timeController) || !isObject(%this.valueController))
+	{
+		return;
+	}
+	
 	%xMin = %this.timeController.getCameraMin();
 	%xMax = %this.timeController.getCameraMax();
 	%yMin = %this.valueController.getCameraMin();

+ 1 - 0
editor/EditorCore/EditorCore.cs

@@ -25,6 +25,7 @@ function EditorCore::create( %this )
 	exec("./Themes/ThemeManager.cs");
 	exec("./EditorDialog.cs");
 	exec("./EditorForm.cs");
+	exec("./EditorIconButton.cs");
 
 	new ScriptObject(ThemeManager);
 

+ 68 - 0
editor/EditorCore/EditorIconButton.cs

@@ -0,0 +1,68 @@
+
+function EditorIconButton::onAdd(%this)
+{
+	%this.text = "";
+	%this.extent = "24 24";
+	%this.icon = new GuiSpriteCtrl()
+	{
+		HorizSizing="center";
+		VertSizing="center";
+		Extent = "20 20";
+		minExtent = "20 20";
+		Position = "0 0";
+		constrainProportions = "1";
+		fullSize = "0";
+		Image = "EditorCore:EditorIcons16";
+		ImageSize = "18 18";
+		ImageColor = ThemeManager.activeTheme.iconButtonProfile.FontColor;
+		Frame = %this.frame;
+	};
+	ThemeManager.setProfile(%this.icon, "spriteProfile");
+	%this.add(%this.icon);
+
+	%this.startListening(ThemeManager);
+}
+
+function EditorIconButton::onTouchEnter(%this)
+{
+	%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColorHL, 200, "EaseInOut");
+	%this.icon.growTo("20 20", 200, "EaseInOut");
+}
+
+function EditorIconButton::onTouchLeave(%this)
+{
+	%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColor, 200, "EaseInOut");
+	%this.icon.growTo("18 18", 200, "EaseInOut");
+}
+
+function EditorIconButton::onTouchDown(%this)
+{
+	%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColorSL, 200, "EaseInOut");
+}
+
+function EditorIconButton::onTouchUp(%this)
+{
+	%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColorHL, 200, "EaseInOut");
+}
+
+function EditorIconButton::onActive(%this)
+{
+	%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColor, 200, "EaseInOut");
+}
+
+function EditorIconButton::onInactive(%this)
+{
+	%this.icon.fadeTo(ThemeManager.activeTheme.iconButtonProfile.fontColorNA, 200, "EaseInOut");
+}
+
+function EditorIconButton::onThemeChange(%this, %theme)
+{
+	if(%this.active)
+	{
+		%this.icon.setImageColor(ThemeManager.activeTheme.iconButtonProfile.fontColor);
+	}
+	else
+	{
+		%this.icon.setImageColor(ThemeManager.activeTheme.iconButtonProfile.fontColorNA);
+	}
+}

+ 57 - 0
editor/EditorCore/Themes/BaseTheme/BaseTheme.cs

@@ -50,6 +50,7 @@ function BaseTheme::onAdd(%this)
 	%this.makePanelProfile();
 	%this.makeItemSelectProfile();
 	%this.makeButtonProfile();
+	%this.makeIconButtonProfile();
 	%this.makePrimaryButtonProfile();
 	%this.makeCheckboxProfile();
 	%this.makeTabProfile();
@@ -476,6 +477,62 @@ function BaseTheme::makeButtonProfile(%this)
 	};
 }
 
+function BaseTheme::makeIconButtonProfile(%this)
+{
+	%borderLight = new GuiBorderProfile()
+	{
+		border = 2;
+		borderHL = 2;
+		borderSL = 2;
+		borderNA = 2;
+
+		borderColor = "255 255 255 80";
+		borderColorHL = "255 255 255 80";
+		borderColorSL = "0 0 0 80";
+		borderColorNA = "255 255 255 80";
+
+		underfill = true;
+	};
+
+	%borderDark = new GuiBorderProfile()
+	{
+		border = 2;
+		borderHL = 2;
+		borderSL = 2;
+		borderNA = 2;
+
+		borderColor = "0 0 0 80";
+		borderColorHL = "0 0 0 80";
+		borderColorSL = "255 255 255 80";
+		borderColorNA = "0 0 0 80";
+
+		underfill = true;
+	};
+
+	%this.iconButtonProfile = new GuiControlProfile()
+	{
+		fillColor = %this.color4;
+		fillColorHL = %this.adjustValue(%this.color4, 10);
+		fillColorSL = %this.color5;
+		fillColorNA = %this.setAlpha(%this.color4, 80);
+
+		fontColor = %this.color1;
+		fontColorHL = %this.adjustValue(%this.color1, 10);
+		fontColorSL = %this.color1;
+		fontColorNA = %this.setAlpha(%this.color1, 100);
+		align = center;
+		vAlign = middle;
+
+		borderLeft = %borderLight;
+		borderRight = %borderDark;
+		borderTop = %borderLight;
+		borderBottom = %borderDark;
+
+		canKeyFocus = true;
+		tab = true;
+	};
+}
+
 function BaseTheme::makePrimaryButtonProfile(%this)
 {
 	%borderLightH = new GuiBorderProfile()

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

@@ -67,6 +67,7 @@ function ThemeManager::setTheme(%this, %i)
 	%theme = %this.themeList.getObject(%i);
 	%this.activeTheme = %theme;
 	%this.refreshProfiles();
+	%this.postEvent("ThemeChange", %theme);
 }
 
 function ThemeManager::nextTheme(%this)

+ 33 - 3
editor/EditorCore/Themes/TorqueSuit/TorqueSuitTheme.cs

@@ -32,7 +32,7 @@ function TorqueSuitTheme::makeButtonProfile(%this)
 	{
 		fillColor = %this.color2;
 		fillColorHL = %this.adjustValue(%this.color2, 10);
-		fillColorSL = %this.adjustValue(%this.color2, -20);
+		fillColorSL = %this.adjustValue(%this.color2, -2);
 		fillColorNA = %this.setAlpha(%this.color2, 80);
 
 		fontType = %this.font[2];
@@ -40,9 +40,39 @@ function TorqueSuitTheme::makeButtonProfile(%this)
 		fontSize = %this.fontSize;
 		fontColor = %this.color4;
 		fontColorHL = %this.adjustValue(%this.color4, 10);
-		fontColorSL = "255 255 255 150";
-		fontColorNA = %this.setAlpha(%this.color4, 100);
+		fontColorSL = %this.color5;
+		fontColorNA = %this.setAlpha(%this.color3, 100);
+		align = Center;
+		valign = Middle;
+
+		borderDefault = %buttonBorder;
+	};
+}
+
+function TorqueSuitTheme::makeIconButtonProfile(%this)
+{
+	%buttonBorder = new GuiBorderProfile()
+	{
+		padding = 2;
+		paddingHL = 2;
+		paddingSL = 2;
+		paddingNA = 2;
+	};
+
+	%this.iconButtonProfile = new GuiControlProfile()
+	{
+		fillColor = %this.color2;
+		fillColorHL = %this.adjustValue(%this.color2, 10);
+		fillColorSL = %this.adjustValue(%this.color2, -2);
+		fillColorNA = %this.setAlpha(%this.color2, 80);
+
+		fontSize = %this.fontSize;
+		fontColor = %this.color4;
+		fontColorHL = %this.adjustValue(%this.color4, 10);
+		fontColorSL = %this.color5;
+		fontColorNA = %this.setAlpha(%this.color3, 100);
 		align = Center;
+		valign = Middle;
 
 		borderDefault = %buttonBorder;
 	};

+ 8 - 0
editor/EditorCore/images/editorIcons16.asset.taml

@@ -0,0 +1,8 @@
+<ImageAsset
+    AssetName="editorIcons16"
+    ImageFile="editorIcons16.png"
+    CellCountX="32"
+    CellCountY="2"
+    CellWidth="16"
+    CellHeight="16"
+	AssetInternal="1" />

BIN
editor/EditorCore/images/editorIcons16.png


+ 4 - 0
editor/EditorCore/module.taml

@@ -9,4 +9,8 @@
 			Path="Themes"
 			Extension="asset.taml"
 			Recurse="true"/>
+		<DeclaredAssets
+			Path="images"
+			Extension="asset.taml"
+			Recurse="true"/>
 </ModuleDefinition>