Ejemplo n.º 1
0
        void DisableFields()
        {
            member = null;

            locked = true;

            txtSyntax.Clear();
            txtName.Clear();
            cbxType.Text = null;
            cbxAccess.Text = null;
            txtInitValue.Clear();
            txtComments.Clear();
            txtSyntax.Enabled = false;
            txtName.Enabled = false;
            cbxType.Enabled = false;
            cbxAccess.Enabled = false;
            txtInitValue.Enabled = false;
            txtComments.Enabled = false;
            gbFieldModifiers.Enabled = false;
            gbOperationModifiers.Enabled = false;

            ckbGetter.Checked = false;
            ckbSetter.Checked = false;
            tableLayoutPanelGetterSetter.Visible = false;

            locked = false;
        }
Ejemplo n.º 2
0
 public void SetMember(Member m)
 {
     member = m;
     if (member != null)
         LanguageSpecificInitialization();
     UpdateValues();
 }
Ejemplo n.º 3
0
 public void SetMember(Member m)
 {
     if (m == null || !(m is Field))
         field = null;
     else
         field = (Field)m;
     if (m != null)
     {
         memberName = m.Name;
         memberType = m.Type;
     }
     UpdateValues();
 }
Ejemplo n.º 4
0
		protected override void CopyFrom(Member member)
		{
			base.CopyFrom(member);

			Field field = (Field) member;
			modifier = field.modifier;
			initialValue = field.initialValue;
            setter = field.setter;
            getter = field.getter;
            generateDbColumn = field.generateDbColumn;
            DbSchema.Initialing = true;
            DbSchema.NotNull = field.DbSchema.NotNull;
            DbSchema.AutoIncrement = field.DbSchema.AutoIncrement;
            DbSchema.DbType = field.DbSchema.DbType;
            DbSchema.DefaultValue = field.DbSchema.DefaultValue;
            DbSchema.Index = field.DbSchema.Index;
            DbSchema.IsPrimaryKey = field.DbSchema.IsPrimaryKey;
            DbSchema.Length = field.DbSchema.Length;
            DbSchema.Name = field.DbSchema.Name;
            DbSchema.Initialing = false;
		}
Ejemplo n.º 5
0
		protected override void CopyFrom(Member member)
		{
			base.CopyFrom(member);

			Operation operation = (Operation) member;
			modifier = operation.modifier;
			argumentList = operation.argumentList.Clone();
		}
Ejemplo n.º 6
0
 private void toolNewMethod_Click(object sender, EventArgs e)
 {
     if (!Validate()) return;
     currentMember = parent.AddMethod();
     OnValueChanged(lstMembers);
     SetFocus();
 }
Ejemplo n.º 7
0
		private static int MemberComparisonByKind(Member member1, Member member2)
		{
			int ret = GetMemberOrdinal(member1) - GetMemberOrdinal(member2);

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

			return ret;
		}
Ejemplo n.º 8
0
		private static int MemberComparisonByName(Member member1, Member member2)
		{
			return member1.Name.CompareTo(member2.Name);
		}
Ejemplo n.º 9
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;
		}
Ejemplo n.º 10
0
		private static string GetMemberString(Member member)
		{
			return member.GetUmlDescription(
				Settings.Default.ShowType,
				Settings.Default.ShowParameters,
				Settings.Default.ShowParameterNames,
				Settings.Default.ShowInitialValue);
		}
Ejemplo n.º 11
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 "-";
			}
		}
Ejemplo n.º 12
0
 private void toolNewEvent_Click(object sender, EventArgs e)
 {
     if (parent.SupportsEvents && Validate())
     {
         currentMember = parent.AddEvent();
         OnValueChanged(lstMembers);
         SetFocus();
     }
 }
Ejemplo n.º 13
0
 private void toolNewProperty_Click(object sender, EventArgs e)
 {
     if (parent.SupportsProperties && Validate())
     {
         currentMember = parent.AddProperty();
         OnValueChanged(lstMembers);
         SetFocus();
     }
 }
Ejemplo n.º 14
0
 private void toolNewDestructor_Click(object sender, EventArgs e)
 {
     if (parent.SupportsDestructors && Validate())
     {
         currentMember = parent.AddDestructor();
         OnValueChanged(lstMembers);
         SetFocus();
     }
 }
Ejemplo n.º 15
0
        private void DrawMember(IGraphics g, Member member, Rectangle record, Style style)
        {
            Font memberFont = GetMemberFont(member, style);

            if (member is Field)
                memberBrush.Color = GetForeColor(style.AttributeColor);
            else
                memberBrush.Color = GetForeColor(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);
            }
        }
Ejemplo n.º 16
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();
			}
		}
Ejemplo n.º 17
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;
		}
Ejemplo n.º 18
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;
		}
Ejemplo n.º 19
0
		/// <exception cref="ArgumentNullException">
		/// <paramref name="member"/> is null.
		/// </exception>
		public static Image GetImage(Member member)
		{
			int imageIndex = GetImageIndex(member);
			return images[imageIndex];
		}
Ejemplo n.º 20
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;
		}
Ejemplo n.º 21
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;
		}
Ejemplo n.º 22
0
		protected virtual void CopyFrom(Member member)
		{
			name = member.name;
			type = member.type;
			access = member.access;
            comments = member.comments;
		}
Ejemplo n.º 23
0
        void RefreshMember(Member actualMember)
        {
            if (locked)
                return;
            memberEditor.SetMember(actualMember);
            schemaEditor.SetMember(actualMember);

        }