aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/wind.png
blob: 23d2e0035b475e87cc57c78fc15b4b59d94223c1 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 20 00 00 00 20 08 06 00 00 00 73 7a 7a .PNG........IHDR.............szz
0020 f4 00 00 00 04 73 42 49 54 08 08 08 08 7c 08 64 88 00 00 00 09 70 48 59 73 00 00 00 dd 00 00 00 .....sBIT....|.d.....pHYs.......
0040 dd 01 70 53 a2 07 00 00 00 19 74 45 58 74 53 6f 66 74 77 61 72 65 00 77 77 77 2e 69 6e 6b 73 63 ..pS......tEXtSoftware.www.inksc
0060 61 70 65 2e 6f 72 67 9b ee 3c 1a 00 00 04 70 49 44 41 54 58 85 c5 57 6b 6c 54 45 14 fe ce dc b9 ape.org..<....pIDATX..WklTE.....
0080 db ee 76 1f 34 06 0b 22 d1 80 a0 21 52 9a b6 5b 6c 21 b1 d0 40 0c b1 31 2a 8d 09 fc 29 11 6a ad ..v.4.."...!R..[l!..@..1*...).j.
00a0 b6 85 80 11 9f 85 bf 86 c8 6e 29 12 24 94 47 42 24 41 25 08 e2 a3 6a db 28 2d ed f6 61 1a 85 a4 .........n).$.GB$A%...j.(-..a...
00c0 b6 26 1a 13 23 2a 6b f7 dd 76 ef 1c 7f 90 26 db ed be 5a 11 4e 32 3f e6 7c df 39 f3 e5 cc cc 99 .&..#*k..v....&...Z.N2?.|.9.....
00e0 7b 89 99 71 37 4d dc d5 d5 33 11 70 f3 44 c9 62 9c 2e 58 94 8a f3 fe 50 e5 be d6 c1 a7 ee bb ed {..q7M...3.p.D.b..X....P........
0100 02 02 c7 8a fa 74 ff c4 af 7e 2f 7e 0b 1c 2b 1c 4c 9a 84 f8 a2 6d 24 eb 8f b9 08 90 c9 80 e0 89 .....t...~/~..+.L....m$.........
0120 62 17 87 8c 22 b2 68 10 b9 12 20 fa 25 19 77 fb ca 4b fd 58 39 97 e5 53 08 e0 28 af a7 2c 01 ed b...".h.....%.w..K.X9..S..(..,..
0140 5e 13 40 50 4c 38 3a b7 25 52 5b d2 2d 10 3a bb 84 55 5e 25 81 cb 4c 78 d2 52 d9 fd 59 aa 44 e1 ^.@PL8:.%R[.-.:..U^%..Lx.R..Y.D.
0160 0b 8f 6d 0e 5d 2c 6d 9d ad 80 a4 15 b0 54 0f b4 02 c8 38 21 09 e1 20 70 5e bc bf a3 63 9d bc 2e ..m.],m......T....8!...p^...c...
0180 a3 b6 17 d7 7e eb 4d 18 37 db 3e 70 e0 cb 55 39 e6 79 8e 0f f5 6c fb d9 9a fc 4b a7 d2 f1 dd 5d ....~.M.7.>p..U9.y...l....K....]
01a0 65 c3 9a 66 5a 92 65 c9 f9 9a 27 b4 ad 35 45 9f fc 15 8b cf ba 0f b0 d5 ba 60 3c 12 7e 02 ac 4e e..fZ.e...'..5E..........`<.~..N
01c0 1e 1d aa ac 48 cb 37 8c 25 cc 4a 03 d3 46 d2 d5 07 f1 78 5a 01 de 73 c5 8e c8 c5 b2 c7 a7 e6 af ....H.7.%.J..F....xZ..s.........
01e0 94 5d 19 95 ba a9 2b e8 ff 53 45 c7 43 cb d3 c5 93 10 be e8 64 18 ca 88 02 c0 fa 43 3d 9b ec b1 .]....+..SE.C.......d......C=...
0200 78 d2 33 30 65 66 5d cf 05 63 29 80 ce 29 5f 43 e9 95 35 e7 4
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)

using System;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
using System.Windows;
using System.Windows.Media;

using Tango.Scripting.Editors.Rendering;

namespace Tango.Scripting.Editors.Highlighting
{
	/// <summary>
	/// A brush used for syntax highlighting. Can retrieve a real brush on-demand.
	/// </summary>
	[Serializable]
	public abstract class HighlightingBrush
	{
		/// <summary>
		/// Gets the real brush.
		/// </summary>
		/// <param name="context">The construction context. context can be null!</param>
		public abstract Brush GetBrush(ITextRunConstructionContext context);
		
		/// <summary>
		/// Gets the color of the brush.
		/// </summary>
		/// <param name="context">The construction context. context can be null!</param>
		public virtual Color? GetColor(ITextRunConstructionContext context)
		{
			SolidColorBrush scb = GetBrush(context) as SolidColorBrush;
			if (scb != null)
				return scb.Color;
			else
				return null;
		}
	}
	
	/// <summary>
	/// Highlighting brush implementation that takes a frozen brush.
	/// </summary>
	[Serializable]
	sealed class SimpleHighlightingBrush : HighlightingBrush, ISerializable
	{
		readonly SolidColorBrush brush;
		
		public SimpleHighlightingBrush(SolidColorBrush brush)
		{
			brush.Freeze();
			this.brush = brush;
		}
		
		public SimpleHighlightingBrush(Color color) : this(new SolidColorBrush(color)) {}
		
		public override Brush GetBrush(ITextRunConstructionContext context)
		{
			return brush;
		}
		
		public override string ToString()
		{
			return brush.ToString();
		}
		
		SimpleHighlightingBrush(SerializationInfo info, StreamingContext context)
		{
			this.brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.GetString("color")));
			brush.Freeze();
		}
		
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("color", brush.Color.ToString(CultureInfo.InvariantCulture));
		}
	}
	
	/// <summary>
	/// HighlightingBrush implementation that finds a brush using a resource.
	/// </summary>
	[Serializable]
	sealed class SystemColorHighlightingBrush : HighlightingBrush, ISerializable
	{
		readonly PropertyInfo property;
		
		public SystemColorHighlightingBrush(PropertyInfo property)
		{
			Debug.Assert(property.ReflectedType == typeof(SystemColors));
			Debug.Assert(typeof(Brush).IsAssignableFrom(property.PropertyType));
			this.property = property;
		}
		
		public override Brush GetBrush(ITextRunConstructionContext context)
		{
			return (Brush)property.GetValue(null, null);
		}
		
		public override string ToString()
		{
			return property.Name;
		}
		
		SystemColorHighlightingBrush(SerializationInfo info, StreamingContext context)
		{
			property = typeof(SystemColors).GetProperty(info.GetString("propertyName"));
			if (property == null)
				throw new ArgumentException("Error deserializing SystemColorHighlightingBrush");
		}
		
		void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
		{
			info.AddValue("propertyName", property.Name);
		}
	}
}