Inheritance: LanguageElement
Esempio n. 1
0
		protected override void CopyFrom(Member member)
		{
			base.CopyFrom(member);

			Property property = (Property) member;
			isReadonly = property.isReadonly;
			isWriteonly = property.isWriteonly;
			readAccess = property.readAccess;
			writeAccess = property.writeAccess;
		}
Esempio n. 2
0
		protected virtual void CopyFrom(Member member)
		{
			name = member.name;
			type = member.type;
			access = member.access;
		}
Esempio n. 3
0
 protected virtual void CopyFrom(Member member)
 {
     name   = member.name;
     type   = member.type;
     access = member.access;
 }
Esempio n. 4
0
		/// <exception cref="ArgumentNullException">
		/// A <paramref name="member"/> nem lehet null.
		/// </exception>
		public static int GetImageIndex(Member member)
		{
			if (member == null)
				throw new ArgumentNullException("member");

			int group = 0;

			if (member is Field)
			{
				if (((Field) member).IsConstant)
				{
					group = 0;
				}
				else
				{
					group = 1;
				}
			}
			else if (member is Method)
			{
				if (member is Destructor)
				{
					return PrivateDestructorIndex;
				}
				else if (member is Constructor)
				{
					group = 2;
				}
				else if (((Method) member).IsOperator)
				{
					group = 3;
				}
				else
				{
					group = 4;
				}
			}
			else if (member is Property)
			{
				Property property = (Property) member;

				if (property.IsReadonly)
				{
					group = 5;
				}
				else if (property.IsWriteonly)
				{
					group = 6;
				}
				else
				{
					group = 7;
				}
			}
			else if (member is Event)
			{
				group = 8;
			}

			return group * 6 + (int) member.Access;
		}
Esempio n. 5
0
		/// <exception cref="ArgumentNullException">
		/// <paramref name="member"/> is null.
		/// </exception>
		public static Image GetImage(Member member)
		{
			int imageIndex = GetImageIndex(member);
			return images[imageIndex];
		}
Esempio n. 6
0
		private void DisableFields()
		{
			member = null;

			locked = true;

			txtSyntax.Text = null;
			txtName.Text = null;
			cboType.Text = null;
			cboAccess.Text = null;
			txtInitialValue.Text = null;

			txtSyntax.Enabled = false;
			txtName.Enabled = false;
			cboType.Enabled = false;
			cboAccess.Enabled = false;
			txtInitialValue.Enabled = false;

			grpFieldModifiers.Enabled = false;
			grpOperationModifiers.Enabled = false;

			if (lstMembers.Items.Count == 0) {
				toolSortByKind.Enabled = false;
				toolSortByAccess.Enabled = false;
				toolSortByName.Enabled = false;
			}
			toolMoveUp.Enabled = false;
			toolMoveDown.Enabled = false;
			toolDelete.Enabled = false;

			locked = false;
		}
Esempio n. 7
0
		private void DrawMember(IGraphics g, Member member, Rectangle record, Style style)
		{
			Font memberFont = GetMemberFont(member, style);

			if (member is Field)
				memberBrush.Color = style.AttributeColor;
			else
				memberBrush.Color = style.OperationColor;

			if (style.UseIcons)
			{
				Image icon = Icons.GetImage(member);
				g.DrawImage(icon, record.X, record.Y);

				Rectangle textBounds = new Rectangle(
					record.X + IconSpacing, record.Y,
					record.Width - IconSpacing, record.Height);

				string memberString = GetMemberString(member);
				g.DrawString(memberString, memberFont, memberBrush, textBounds, memberFormat);
			}
			else
			{
				Rectangle accessBounds = new Rectangle(
					record.X, record.Y, AccessSpacing, record.Height);
				Rectangle textBounds = new Rectangle(
					record.X + AccessSpacing, record.Y,
					record.Width - AccessSpacing, record.Height);

				g.DrawString(GetAccessString(member), GetFont(style),
					memberBrush, accessBounds, accessFormat);
				g.DrawString(GetMemberString(member), memberFont,
					memberBrush, textBounds, memberFormat);
			}
		}
Esempio n. 8
0
		private static string GetAccessString(Member member)
		{
			switch (member.Access)
			{
				case AccessModifier.Public:
					return "+";

				case AccessModifier.Internal:
					return "~";

				case AccessModifier.ProtectedInternal:
				case AccessModifier.Protected:
					return "#";

				case AccessModifier.Private:
				default:
					return "-";
			}
		}
Esempio n. 9
0
		private static string GetMemberString(Member member)
		{
			return member.GetUmlDescription(
				Settings.Default.ShowType,
				Settings.Default.ShowParameters,
				Settings.Default.ShowParameterNames,
				Settings.Default.ShowInitialValue);
		}
Esempio n. 10
0
		private static int MemberComparisonByKind(Member member1, Member member2)
		{
			int ret = GetMemberOrdinal(member1) - GetMemberOrdinal(member2);

			if (ret == 0)
				return MemberComparisonByName(member1, member2);

			return ret;
		}
Esempio n. 11
0
		private static int GetMemberOrdinal(Member member)
		{
			if (member is Field)
			{
				if (((Field) member).IsConstant)
					return 0;
				else
					return 1;
			}
			if (member is Property)
			{
				Property property = (Property) member;

				if (property.IsReadonly)
					return 2;
				else if (property.IsWriteonly)
					return 3;
				else
					return 4;
			}
			if (member is Constructor)
				return 5;
			if (member is Method && ((Method) member).IsOperator)
				return 6;
			if (member is Destructor)
				return 8; // (!)
			if (member is Method)
				return 7;
			if (member is Event)
				return 9;

			// Unreachable case
			return 10;
		}
Esempio n. 12
0
		private static int MemberComparisonByAccess(Member member1, Member member2)
		{
			int access1 = (int) member1.Access;
			int access2 = (int) member2.Access;

			if (access1 == access2)
				return MemberComparisonByKind(member1, member2);
			else
				return access1 - access2;
		}
Esempio n. 13
0
		private static int MemberComparisonByName(Member member1, Member member2)
		{
			return member1.Name.CompareTo(member2.Name);
		}
Esempio n. 14
0
		public void RemoveMember(Member member)
		{
			if (member is Field)
			{
				if (FieldList.Remove((Field) member))
					Changed();
			}
			else if (member is Operation)
			{
				if (OperationList.Remove((Operation) member))
					Changed();
			}
		}
Esempio n. 15
0
		protected override void CopyFrom(Member member)
		{
			base.CopyFrom(member);

			Operation operation = (Operation) member;
			modifier = operation.modifier;
			argumentList = operation.argumentList.Clone();
		}
Esempio n. 16
0
		private Font GetMemberFont(Member member, Style style)
		{
			Font memberFont;
			if (member.IsStatic)
			{
				memberFont = style.StaticMemberFont;
			}
			else if (member is Operation &&
				(((Operation) member).IsAbstract || member.Parent is InterfaceType))
			{
				memberFont = style.AbstractMemberFont;
			}
			else
			{
				memberFont = GetFont(style);
			}

			return memberFont;
		}
Esempio n. 17
0
		protected override void CopyFrom(Member member)
		{
			base.CopyFrom(member);

			Field field = (Field) member;
			modifier = field.modifier;
			initialValue = field.initialValue;
		}
Esempio n. 18
0
		private void ShowNewMember(Member actualMember)
		{
			if (locked || actualMember == null)
				return;
			else
				member = actualMember;

			RefreshValues();
		}