コード例 #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;
        }
コード例 #2
0
 public void SetMember(Member m)
 {
     member = m;
     if (member != null)
         LanguageSpecificInitialization();
     UpdateValues();
 }
コード例 #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();
 }
コード例 #4
0
ファイル: Field.cs プロジェクト: BachelorEric/ModelFirst
		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;
		}
コード例 #5
0
ファイル: Operation.cs プロジェクト: BachelorEric/ModelFirst
		protected override void CopyFrom(Member member)
		{
			base.CopyFrom(member);

			Operation operation = (Operation) member;
			modifier = operation.modifier;
			argumentList = operation.argumentList.Clone();
		}
コード例 #6
0
 private void toolNewMethod_Click(object sender, EventArgs e)
 {
     if (!Validate()) return;
     currentMember = parent.AddMethod();
     OnValueChanged(lstMembers);
     SetFocus();
 }
コード例 #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;
		}
コード例 #8
0
		private static int MemberComparisonByName(Member member1, Member member2)
		{
			return member1.Name.CompareTo(member2.Name);
		}
コード例 #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;
		}
コード例 #10
0
		private static string GetMemberString(Member member)
		{
			return member.GetUmlDescription(
				Settings.Default.ShowType,
				Settings.Default.ShowParameters,
				Settings.Default.ShowParameterNames,
				Settings.Default.ShowInitialValue);
		}
コード例 #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 "-";
			}
		}
コード例 #12
0
 private void toolNewEvent_Click(object sender, EventArgs e)
 {
     if (parent.SupportsEvents && Validate())
     {
         currentMember = parent.AddEvent();
         OnValueChanged(lstMembers);
         SetFocus();
     }
 }
コード例 #13
0
 private void toolNewProperty_Click(object sender, EventArgs e)
 {
     if (parent.SupportsProperties && Validate())
     {
         currentMember = parent.AddProperty();
         OnValueChanged(lstMembers);
         SetFocus();
     }
 }
コード例 #14
0
 private void toolNewDestructor_Click(object sender, EventArgs e)
 {
     if (parent.SupportsDestructors && Validate())
     {
         currentMember = parent.AddDestructor();
         OnValueChanged(lstMembers);
         SetFocus();
     }
 }
コード例 #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);
            }
        }
コード例 #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();
			}
		}
コード例 #17
0
ファイル: Icons.cs プロジェクト: BachelorEric/ModelFirst
		/// <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;
		}
コード例 #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;
		}
コード例 #19
0
ファイル: Icons.cs プロジェクト: BachelorEric/ModelFirst
		/// <exception cref="ArgumentNullException">
		/// <paramref name="member"/> is null.
		/// </exception>
		public static Image GetImage(Member member)
		{
			int imageIndex = GetImageIndex(member);
			return images[imageIndex];
		}
コード例 #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;
		}
コード例 #21
0
ファイル: Property.cs プロジェクト: BachelorEric/ModelFirst
		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;
		}
コード例 #22
0
ファイル: Member.cs プロジェクト: BachelorEric/ModelFirst
		protected virtual void CopyFrom(Member member)
		{
			name = member.name;
			type = member.type;
			access = member.access;
            comments = member.comments;
		}
コード例 #23
0
        void RefreshMember(Member actualMember)
        {
            if (locked)
                return;
            memberEditor.SetMember(actualMember);
            schemaEditor.SetMember(actualMember);

        }