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; }
public void SetMember(Member m) { member = m; if (member != null) LanguageSpecificInitialization(); UpdateValues(); }
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(); }
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; }
protected override void CopyFrom(Member member) { base.CopyFrom(member); Operation operation = (Operation) member; modifier = operation.modifier; argumentList = operation.argumentList.Clone(); }
private void toolNewMethod_Click(object sender, EventArgs e) { if (!Validate()) return; currentMember = parent.AddMethod(); OnValueChanged(lstMembers); SetFocus(); }
private static int MemberComparisonByKind(Member member1, Member member2) { int ret = GetMemberOrdinal(member1) - GetMemberOrdinal(member2); if (ret == 0) return MemberComparisonByName(member1, member2); return ret; }
private static int MemberComparisonByName(Member member1, Member member2) { return member1.Name.CompareTo(member2.Name); }
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; }
private static string GetMemberString(Member member) { return member.GetUmlDescription( Settings.Default.ShowType, Settings.Default.ShowParameters, Settings.Default.ShowParameterNames, Settings.Default.ShowInitialValue); }
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 "-"; } }
private void toolNewEvent_Click(object sender, EventArgs e) { if (parent.SupportsEvents && Validate()) { currentMember = parent.AddEvent(); OnValueChanged(lstMembers); SetFocus(); } }
private void toolNewProperty_Click(object sender, EventArgs e) { if (parent.SupportsProperties && Validate()) { currentMember = parent.AddProperty(); OnValueChanged(lstMembers); SetFocus(); } }
private void toolNewDestructor_Click(object sender, EventArgs e) { if (parent.SupportsDestructors && Validate()) { currentMember = parent.AddDestructor(); OnValueChanged(lstMembers); SetFocus(); } }
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); } }
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(); } }
/// <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; }
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; }
/// <exception cref="ArgumentNullException"> /// <paramref name="member"/> is null. /// </exception> public static Image GetImage(Member member) { int imageIndex = GetImageIndex(member); return images[imageIndex]; }
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; }
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; }
protected virtual void CopyFrom(Member member) { name = member.name; type = member.type; access = member.access; comments = member.comments; }
void RefreshMember(Member actualMember) { if (locked) return; memberEditor.SetMember(actualMember); schemaEditor.SetMember(actualMember); }