Example #1
0
 public FileChange(string sourceRelativePath, string targetRelativePath, ChangeKind changeKind, byte[] contents = null)
 {
     SourceRelativePath = sourceRelativePath;
     TargetRelativePath = targetRelativePath;
     ChangeKind         = changeKind;
     Contents           = contents;
 }
Example #2
0
        private static ChangeType GitChangeStatusToChangeType(ChangeKind changeKind)
        {
            switch (changeKind)
            {
            case ChangeKind.Added:
                return(ChangeType.Added);

            case ChangeKind.Deleted:
                return(ChangeType.Deleted);

            case ChangeKind.Modified:
                return(ChangeType.Modified);

            case ChangeKind.Renamed:
                return(ChangeType.Moved);

            case ChangeKind.Copied:
                return(ChangeType.Copied);

            case ChangeKind.Untracked:
                return(ChangeType.Deleted);

            //case ChangeKind.Unmodified:
            //    return ChangeType.Modified;
            //case ChangeKind.Ignored:
            //    return ChangeType.Modified;
            default:
                return(ChangeType.Modified);
            }
        }
Example #3
0
        internal CacheChange NewChange(ChangeKind kind, Data data, InstanceHandle instance)
        {
            var change = new CacheChange()
            {
                WriterGuid = Id,
                SequenceNumber = SequenceNumber.Increment(),

                Kind = kind,
                InstanceHandle = instance,

                Data = data
            };

            var message = new Message()
            {
                Header = new Header()
                {
                    Protocol = ProtocolId.ProtocolRTPS,
                    Version = ProtocolVersion.v22,
                    Vendor = VendorId.Unknown,
                    GuidPrefix = new GuidPrefix()
                }
            };

            message.AddSubMessage(new DataSubMessage(data));
            message.AddSubMessage(new HeartbeatSubMessage());

            Channel.Send(message);

            return change;
        }
Example #4
0
        public static String ToLocateString(this ChangeKind changeKind)
        {
            switch (changeKind)
            {
            case ChangeKind.Added:
                return(SR.Repository_FileAdded);

            case ChangeKind.Copied:
                return(SR.Repository_FileCopied);

            case ChangeKind.Deleted:
                return(SR.Repository_FileDeleted);

            case ChangeKind.Ignored:
                return(SR.Repository_FileIgnored);

            case ChangeKind.Modified:
                return(SR.Repository_FileModified);

            case ChangeKind.Renamed:
                return(SR.Repository_FileRenamed);

            case ChangeKind.TypeChanged:
                return(SR.Repository_FileTypeChanged);

            case ChangeKind.Unmodified:
                return(SR.Repository_FileUnmodified);

            case ChangeKind.Untracked:
                return(SR.Repository_FileUntracked);

            default:
                return(String.Empty);
            }
        }
Example #5
0
        private static string GetChangeString(ChangeKind kind)
        {
            string changeType;

            switch (kind)
            {
            case ChangeKind.Change:
                changeType = LocalizableStrings.Change;
                break;

            case ChangeKind.Delete:
                changeType = LocalizableStrings.Delete;
                break;

            case ChangeKind.Overwrite:
                changeType = LocalizableStrings.Overwrite;
                break;

            default:
                changeType = LocalizableStrings.UnknownChangeKind;
                break;
            }

            return(changeType);
        }
Example #6
0
        public GUIContent GetDiffTypeIcon(ChangeKind type, bool small)
        {
            switch (type)
            {
            case ChangeKind.Unmodified:
                return(small ? m_icons.validIconSmall : m_icons.validIcon);

            case ChangeKind.Added:
                return(small ? m_icons.addedIconSmall : m_icons.addedIcon);

            case ChangeKind.Deleted:
                return(small ? m_icons.deletedIconSmall : m_icons.deletedIcon);

            case ChangeKind.Modified:
                return(small ? m_icons.modifiedIconSmall : m_icons.modifiedIcon);

            case ChangeKind.Ignored:
                return(small ? m_icons.ignoredIconSmall : m_icons.ignoredIcon);

            case ChangeKind.Untracked:
                return(small ? m_icons.untrackedIconSmall : m_icons.untrackedIcon);

            case ChangeKind.Conflicted:
                return(small ? m_icons.conflictIconSmall : m_icons.conflictIcon);

            case ChangeKind.Renamed:
                return(small ? m_icons.renamedIconSmall : m_icons.renamedIcon);
            }
            return(null);
        }
Example #7
0
        private KindOfChange ToChangeKind(ChangeKind kind)
        {
            switch (kind)
            {
            case ChangeKind.Unmodified:
                break;

            case ChangeKind.Added:
                return(KindOfChange.Add);

            case ChangeKind.Deleted:
                return(KindOfChange.Delete);

            case ChangeKind.Modified:
                return(KindOfChange.Edit);

            case ChangeKind.Renamed:
                return(KindOfChange.Rename);

            case ChangeKind.Copied:
                return(KindOfChange.Copy);
            }

            return(KindOfChange.None);
        }
 internal TreeEntryChanges(string path, Mode mode, ChangeKind status, string oldPath, Mode oldMode, bool isBinaryComparison)
 {
     Path               = path;
     Mode               = mode;
     Status             = status;
     OldPath            = oldPath;
     OldMode            = oldMode;
     IsBinaryComparison = isBinaryComparison;
 }
Example #9
0
 /// <summary>
 /// Create change wrap, also set Node.Removed - because of invalidating previous changes
 /// </summary>
 /// <param name="node"></param>
 /// <param name="change"></param>
 public ElementChange(ElementNode node, ChangeKind change)
 {
     Node = node;
     Kind = change;
     if (Kind == ChangeKind.Removed)
     {
         Node.Removed = true;
     }
 }
Example #10
0
 private void AddCore(string filePath, ChangeKind kind)
 {
     _list.Add(
         new ChangeItem
     {
         FilePath = filePath,
         Kind     = (ChangeKindWithDependency)kind
     });
 }
Example #11
0
 internal TreeEntryChanges(string path, Mode mode, ChangeKind status, string oldPath, Mode oldMode, bool isBinaryComparison)
 {
     Path = path;
     Mode = mode;
     Status = status;
     OldPath = oldPath;
     OldMode = oldMode;
     IsBinaryComparison = isBinaryComparison;
 }
Example #12
0
 private static string GetChangeString(ChangeKind kind)
 {
     return(kind switch
     {
         ChangeKind.Create => LocalizableStrings.Create,
         ChangeKind.Change => LocalizableStrings.Change,
         ChangeKind.Delete => LocalizableStrings.Delete,
         ChangeKind.Overwrite => LocalizableStrings.Overwrite,
         _ => LocalizableStrings.UnknownChangeKind
     });
Example #13
0
 internal TreeEntryChanges(FilePath path, Mode mode, ObjectId oid, ChangeKind status, FilePath oldPath, Mode oldMode, ObjectId oldOid)
 {
     Path    = path.Native;
     Mode    = mode;
     Oid     = oid;
     Status  = status;
     OldPath = oldPath.Native;
     OldMode = oldMode;
     OldOid  = oldOid;
 }
Example #14
0
 internal TreeEntryChanges(FilePath path, Mode mode, ObjectId oid, ChangeKind status, FilePath oldPath, Mode oldMode, ObjectId oldOid)
 {
     Path = path.Native;
     Mode = mode;
     Oid = oid;
     Status = status;
     OldPath = oldPath.Native;
     OldMode = oldMode;
     OldOid = oldOid;
 }
Example #15
0
 internal TreeEntryChanges(FilePath path, Mode mode, ObjectId oid, ChangeKind status, FilePath oldPath, Mode oldMode, ObjectId oldOid, bool isBinaryComparison)
 {
     Path               = path.Native;
     Mode               = mode;
     Oid                = oid;
     Status             = status;
     OldPath            = oldPath.Native;
     OldMode            = oldMode;
     OldOid             = oldOid;
     IsBinaryComparison = isBinaryComparison;
 }
Example #16
0
 internal TreeEntryChanges(FilePath path, Mode mode, ObjectId oid, ChangeKind status, FilePath oldPath, Mode oldMode, ObjectId oldOid, bool isBinaryComparison)
 {
     Path = path.Native;
     Mode = mode;
     Oid = oid;
     Status = status;
     OldPath = oldPath.Native;
     OldMode = oldMode;
     OldOid = oldOid;
     IsBinaryComparison = isBinaryComparison;
 }
Example #17
0
        /// <summary>
        /// Enumerates the diff and yields deltas with the specified change kind.
        /// </summary>
        /// <param name="changeKind">Change type to filter on.</param>
        private IEnumerable <TreeEntryChanges> GetChangesOfKind(ChangeKind changeKind)
        {
            TreeEntryChanges entry;

            for (int i = 0; i < Count; i++)
            {
                if (TryGetEntryWithChangeTypeAt(i, changeKind, out entry))
                {
                    yield return(entry);
                }
            }
        }
        // This treatment of change kind was apparently introduced in order to be able
        // to compare a tree against the index, see commit fdc972b. It's extracted
        // here so that TreeEntry can use the same rules without having to instantiate
        // a TreeEntryChanges object.
        internal static ChangeKind GetStatusFromChangeKind(ChangeKind changeKind)
        {
            switch (changeKind)
            {
            case ChangeKind.Untracked:
            case ChangeKind.Ignored:
                return(ChangeKind.Added);

            default:
                return(changeKind);
            }
        }
Example #19
0
 public CommitInformation(ChangeKind status, Author author, DateTimeOffset authorTime, Author committer, DateTimeOffset commitTime, string message, string path, string sha, IEnumerable<string> parents)
 {
     this.Status = status;
     this.Author = author;
     this.AuthorDateTime = authorTime;
     this.Committer = committer;
     this.CommitterDateTime = commitTime;
     this.Message = message;
     this.Path = path;
     this.Sha = sha;
     this.Parents = parents.ToArray();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectRepositoryEntryChanges"/> class.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="status">The change type.</param>
        /// <param name="old">The old value.</param>
        /// <param name="new">The new value.</param>
        public ObjectRepositoryEntryChanges(string path, ChangeKind status, IModelObject old = null, IModelObject @new = null)
        {
            Path   = path ?? throw new ArgumentNullException(nameof(path));
            Status = status;

            if (old == null && @new == null)
            {
                throw new ArgumentNullException($"{nameof(old)} and {nameof(@new)}");
            }

            Old = old;
            New = @new;
        }
        public static Color Theme_Change(this ChangeKind changeKind)
        {
            switch (changeKind)
            {
            case ChangeKind.Added:
            case ChangeKind.Copied:
                return(Color.Green);

            case ChangeKind.Deleted:
                return(Color.Red);

            default:
                return(Color.Yellow);
            }
        }
Example #22
0
 public void Add(string filePath, ChangeKind kind)
 {
     if (filePath == null)
     {
         throw new ArgumentNullException(nameof(filePath));
     }
     if (filePath.Length == 0)
     {
         throw new ArgumentException("File path cannot be empty", nameof(filePath));
     }
     if (!TypeForwardedToPathUtility.IsRelativePath(filePath))
     {
         throw new ArgumentException("Expect relative path.", nameof(filePath));
     }
     AddCore(filePath, kind);
 }
        public static bool HasSemanticMeaning(this ChangeKind changeKind)
        {
            switch (changeKind)
            {
            case ChangeKind.Added:
            case ChangeKind.Copied:
            case ChangeKind.Deleted:
            case ChangeKind.Modified:
            case ChangeKind.Renamed:
            case ChangeKind.TypeChanged:
                return(true);

            default:
                return(false);
            }
        }
Example #24
0
 public static GitChangeType ConvertToChangeType(this ChangeKind changeKind)
 {
     return(changeKind switch
     {
         ChangeKind.Unmodified => GitChangeType.Unmodified,
         ChangeKind.Added => GitChangeType.Added,
         ChangeKind.Deleted => GitChangeType.Deleted,
         ChangeKind.Modified => GitChangeType.Modified,
         ChangeKind.Renamed => GitChangeType.Renamed,
         ChangeKind.Copied => GitChangeType.Copied,
         ChangeKind.Ignored => GitChangeType.Ignored,
         ChangeKind.Untracked => GitChangeType.Untracked,
         ChangeKind.TypeChanged => GitChangeType.TypeChanged,
         ChangeKind.Unreadable => GitChangeType.Unreadable,
         ChangeKind.Conflicted => GitChangeType.Conflicted,
         _ => throw new ArgumentOutOfRangeException(nameof(changeKind), changeKind, null)
     });
Example #25
0
        private string ConvertChangeKindToChangeType(ChangeKind changeKind)
        {
            if (changeKind == ChangeKind.Added)
            {
                return(ChangeType.Added);
            }
            if (changeKind == ChangeKind.Deleted)
            {
                return(ChangeType.Deleted);
            }
            if (changeKind == ChangeKind.Unmodified)
            {
                return(ChangeType.Unmodified);
            }

            return(ChangeType.Modified);
        }
Example #26
0
        private ChangeType Set_Status(ChangeKind fileChangeStatus)
        {
            var mapping = new Dictionary <ChangeKind, ChangeType>
            {
                { ChangeKind.Added, ChangeType.Added },
                { ChangeKind.Modified, ChangeType.Modified },
                { ChangeKind.Conflicted, ChangeType.Conflicted },
                { ChangeKind.Copied, ChangeType.Copied },
                { ChangeKind.Deleted, ChangeType.Deleted },
                { ChangeKind.Ignored, ChangeType.Ignored },
                { ChangeKind.Renamed, ChangeType.Renamed },
                { ChangeKind.Unmodified, ChangeType.Unmodified },
                { ChangeKind.Unreadable, ChangeType.Unreadable },
                { ChangeKind.Untracked, ChangeType.Untracked }
            };

            return(mapping[fileChangeStatus]);
        }
Example #27
0
        /// <summary>
        /// This is method exists to work around .net not allowing unsafe code
        /// in iterators.
        /// </summary>
        private unsafe bool TryGetEntryWithChangeTypeAt(int index, ChangeKind changeKind, out TreeEntryChanges entry)
        {
            if (index < 0 || index > count.Value)
            {
                throw new ArgumentOutOfRangeException("index", "Index was out of range. Must be non-negative and less than the size of the collection.");
            }

            var delta = Proxy.git_diff_get_delta(diff, index);

            if (TreeEntryChanges.GetStatusFromChangeKind(delta->status) == changeKind)
            {
                entry = new TreeEntryChanges(delta);
                return(true);
            }

            entry = null;
            return(false);
        }
Example #28
0
        public static string ToLocateString(this ChangeKind changeKind)
        {
            switch (changeKind)
            {
            case ChangeKind.Added:
                return("增加");

            //return SR.Repository_FileAdded;
            case ChangeKind.Copied:
                return("复制");

            //return SR.Repository_FileCopied;
            case ChangeKind.Deleted:
                return("删除");

            //return SR.Repository_FileDeleted;
            case ChangeKind.Ignored:
                return("忽略");

            //return SR.Repository_FileIgnored;
            case ChangeKind.Modified:
                return("修改");

            //return SR.Repository_FileModified;
            case ChangeKind.Renamed:
                return("重命名");

            //return SR.Repository_FileRenamed;
            case ChangeKind.TypeChanged:
                return("改变类型");

            //return SR.Repository_FileTypeChanged;
            case ChangeKind.Unmodified:
                return("未修改");

            //return SR.Repository_FileUnmodified;
            case ChangeKind.Untracked:
                return("未跟踪");

            //return SR.Repository_FileUntracked;
            default:
                return(string.Empty);
            }
        }
 public TreeEntryChangesMock(ChangeKind status,
                             bool exists,
                             Mode mode,
                             ObjectId?oid,
                             string?path,
                             bool oldExists,
                             Mode oldMode,
                             ObjectId?oldOid,
                             string?oldPath)
 {
     _status    = status;
     _exists    = exists;
     _mode      = mode;
     _oid       = oid;
     _path      = path;
     _oldExists = oldExists;
     _oldMode   = oldMode;
     _oldOid    = oldOid;
     _oldPath   = oldPath;
 }
        public static IEnumerable <GitFilePatch> GetGitFilePatch(this Patch filesPatch, RepositoryStatus status = null)
        {
            var ret = new List <GitFilePatch>();

            using IEnumerator <PatchEntryChanges> patches = filesPatch.GetEnumerator();
            while (patches.MoveNext() &&
                   patches.Current != null)
            {
                // minimum 88 score threshold was chose based on observation, if similarity will be less
                // than 88 then the deleted file will be marked as deleted and the other one as addition
                // if the file is part of the rename set the change type explicitly to rename,
                // otherwise git will set it to added or deleted
                ChangeKind changeKind = status?.RenamedInWorkDir.Count(
                    r => r.IndexToWorkDirRenameDetails != null &&
                    (r.IndexToWorkDirRenameDetails.NewFilePath
                     .Equals(patches.Current.Path) ||
                     r.IndexToWorkDirRenameDetails
                     .OldFilePath
                     .Equals(patches.Current.Path)) &&
                    r.IndexToWorkDirRenameDetails
                    .Similarity >= 88) > 0
                    ? ChangeKind.Renamed
                    : patches.Current.Status;

                ret.Add(
                    new GitFilePatch(
                        patches.Current.Path,
                        new FileInfo(patches.Current.Path).Extension)
                {
                    DiffContent          = patches.Current.Patch,
                    AbsoluteLinesAdded   = patches.Current.LinesAdded,
                    AbsoluteLinesDeleted = patches.Current.LinesDeleted,
                    ChangeType           = changeKind.ConvertToChangeType()
                });
            }

            return(ret);
        }
Example #31
0
 /// <summary>
 ///     Handles a change of the value of a model element
 /// </summary>
 /// <param name="value"></param>
 /// <param name="changeKind">Indicates the reason why the change occured</param>
 protected virtual void OnValueChange(IModelElement value, ChangeKind changeKind)
 {
     if (ValueChange != null)
     {
         if (value != null)
         {
             CriticalSection.WaitOne();
             HashSet <ChangeKind> changeKinds;
             if (!Changes.TryGetValue(value, out changeKinds))
             {
                 changeKinds = new HashSet <ChangeKind>();
                 Changes.Add(value, changeKinds);
             }
             changeKinds.Add(changeKind);
             CriticalSection.ReleaseMutex();
         }
         else
         {
             // ReSharper disable once ExpressionIsAlwaysNull
             ValueChange(value, changeKind);
         }
     }
 }
        private string GetStatusToGit(ChangeKind kind)
        {
            string status = string.Empty;

            if (kind == LibGit2Sharp.ChangeKind.Modified)
            {
                status = ApConst.UpdateStatus;
            }
            else if (kind == LibGit2Sharp.ChangeKind.Added)
            {
                status = ApConst.AddStatus;
            }
            else if (kind == LibGit2Sharp.ChangeKind.Deleted)
            {
                status = ApConst.DeleteStatus;
            }
            else if (kind == LibGit2Sharp.ChangeKind.Renamed)
            {
                status = ApConst.RenameStatus;
            }

            return(status);
        }
Example #33
0
 private static ChangeType GitChangeStatusToChangeType(ChangeKind changeKind)
 {
     switch (changeKind)
     {
         case ChangeKind.Added:
             return ChangeType.Added;
         case ChangeKind.Deleted:
             return ChangeType.Deleted;
         case ChangeKind.Modified:
             return ChangeType.Modified;
         case ChangeKind.Renamed:
             return ChangeType.Moved;
         case ChangeKind.Copied:
             return ChangeType.Copied;
         case ChangeKind.Untracked:
             return ChangeType.Deleted;
         //case ChangeKind.Unmodified:
         //    return ChangeType.Modified;
         //case ChangeKind.Ignored:
         //    return ChangeType.Modified;
         default:
             return ChangeType.Modified;
     }
 }
 public BranchChange(string oldPath, string path, ChangeKind status)
 {
     OldPath = oldPath;
     Path = path;
     Status = status;
 }
 public FileChange(string path, ChangeKind changeKind)
 {
     TargetRelativePath = path;
     ChangeKind         = changeKind;
 }
Example #36
0
 public GraphObjectEventArgs(
     GraphObject graphObject,
     ChangeKind changeKind)
 {
     GraphObject = graphObject;
     ChangeKind = changeKind;
 }
Example #37
0
        /// <summary>
        /// 途中出場メンバの演出を表示する
        /// </summary>
        /// <param name="member">対象メンバ</param>
        /// <param name="kind">選手交代種別)</param>
        /// <returns>演出表示するか</returns>
        private bool ShowTextForMidWay(GameMember member, ChangeKind kind)
        {
            // すでに演出済みのメンバであれば何もしない
            if (m_GameManager.CurrentInningMidwayShowMember.Contains(member))
            {
                return false;
            }

            // 演出済みのメンバとして登録
            m_GameManager.CurrentInningMidwayShowMember.Add(member);

            // 交代種別文字列の設定
            ChangeTextForMidWay.Text = StringEnumAttribute.GetStringValue(kind);

            // 対象メンバ表示の設定
            MemberTextForMidWay.Text = member.Name;
            MemberImageForMidway.Source = UIUtility.GetPlayerImage(member.Player.BreedType);

            // アニメ完了直後は元のOpacityに戻るため、アニメ後に非表示になるように0を設定しておく
            BorderForMidWay.Visibility = Visibility.Visible;
            BorderForMidWay.Opacity = 0;
            UIUtility.ShowControl(BorderForMidWay, TimeSpan.Zero, UIConstants.ShowLongTextAnimationSpan, 1, ShowTextForMidWay_Completed);
            return true;
        }
 private static RepositoryFileStatus GetState(ChangeKind status)
 {
     return statusesByChangeKind[status];
 }
Example #39
0
 public FileAndStatus(ChangeKind s, string f, string oldFileName)
 {
     Status      = s;
     FileName    = f;
     OldFileName = oldFileName;
 }
Example #40
0
 public void SetStatus(ChangeKind s)
 {
     Status = s;
 }
Example #41
0
 // This treatment of change kind was apparently introduced in order to be able
 // to compare a tree against the index, see commit fdc972b. It's extracted
 // here so that TreeEntry can use the same rules without having to instantiate
 // a TreeEntryChanges object.
 internal static ChangeKind GetStatusFromChangeKind(ChangeKind changeKind)
 {
     switch (changeKind)
     {
         case ChangeKind.Untracked:
         case ChangeKind.Ignored:
             return ChangeKind.Added;
         default:
             return changeKind;
     }
 }
        // Show the correct popup menu, give the box the user clicked.
        void PopupMenu(HitTestResult hitTest)
        {
            string text;

            // Get location for menu to appear.
            Point location = GetPopupMenuLocation(hitTest);

            // Save the line/box we are possibly changing
            popupKind = ChangeKind.None;     // will change this below if we actual pop something up!
            popupLine = hitTest.firstLine;
            popupBox = hitTest.box;

            switch (hitTest.kind) {
                case HitTestKind.NormalBox:
                    if (scoreColumn >= 0 && hitTest.box == scoreColumn) {
                        if (!(renderer.Description[hitTest.firstLine].boxes[0] is Symbol)) {
                            // In score courses, the score is in column A, so allow in-place editing of it, unless its the start triange.
                            popupKind = ChangeKind.Score;
                            popup.ShowPopup(8, (char)0, (char)0, false, MiscText.EnterScore, (string)renderer.Description[hitTest.firstLine].boxes[hitTest.box], 2, descriptionPanel, location);
                        }
                    }
                    else if (hitTest.box == 0) {
                        // Column A:
                        // We don't allow changing the sequence number, so no popup allowed
                    }
                    else if (hitTest.box == 1) {
                        // Column B
                        if (!(renderer.Description[hitTest.firstLine].boxes[0] is Symbol)) {
                            popupKind = ChangeKind.Code;
                            popup.ShowPopup(8, (char) 0, (char) 0, false, MiscText.EnterCode, (string) renderer.Description[hitTest.firstLine].boxes[1], 2, descriptionPanel, location);
                        }
                    }
                    else if (hitTest.box == 4) {
                        // Column E
                        popupKind = ChangeKind.DescriptionBox;
                        popup.ShowPopup(8, 'E', 'D', true, null, null, 0, descriptionPanel, location);
                    }
                    else if (hitTest.box == 5) {
                        // Column F
                        string initialText = "";
                        if (renderer.Description[hitTest.firstLine].boxes[5] is string && renderer.Description[hitTest.firstLine].boxes[5] != null)
                            initialText = (string) renderer.Description[hitTest.firstLine].boxes[5];
                        popupKind = ChangeKind.DescriptionBox;
                        popup.ShowPopup(8, 'F', (char) 0, true, MiscText.EnterDimensions, initialText, 4, descriptionPanel, location);
                    }
                    else {
                        // Column C, D, G, H
                        popupKind = ChangeKind.DescriptionBox;
                        popup.ShowPopup(8, (char)(hitTest.box + 'A'), (char)0, true, null, null, 0, descriptionPanel, location);
                    }
                    break;

                case HitTestKind.Directive:
                    Symbol current = renderer.Description[hitTest.firstLine].boxes[0] as Symbol;
                    if (current != null) {
                        char kind = current.Kind;       // Allow changing in the existing kind only.

                        // Only allow changing the crossing point or finish symbols.
                        if (kind == 'X' || kind == 'Z') {
                            popupKind = ChangeKind.Directive;
                            popup.ShowPopup(1, kind, (char)0, false, null, null, 0, descriptionPanel, location);
                        }
                    }
                    break;

                case HitTestKind.Title:
                    text = MiscText.EnterEventTitle;
                    popupKind = ChangeKind.Title;

                    popup.ShowPopup(8, (char)0, (char)0, false, text, CombineBoxTexts(hitTest.firstLine, hitTest.lastLine, 0, "|"), 8, descriptionPanel, location);
                    break;

                case HitTestKind.SecondaryTitle:
                    text = MiscText.EnterSecondaryTitle;
                    popupKind = ChangeKind.SecondaryTitle;

                    popup.ShowPopup(8, (char) 0, (char) 0, false, text, CombineBoxTexts(hitTest.firstLine, hitTest.lastLine, 0, "|"), 8, descriptionPanel, location);
                    break;

                case HitTestKind.Header:
                    if (hitTest.box == 0 && courseViewKind != CourseView.CourseViewKind.AllControls) {
                        // the course name. Can't change the "All Controls" name.
                        popupKind = ChangeKind.CourseName;
                        string courseName = (string) renderer.Description[hitTest.firstLine].boxes[0];
                        if (isCoursePart && courseName.Length > 2) {
                            // Remove the "-3" etc with the part number.
                            courseName = courseName.Substring(0, courseName.LastIndexOf('-'));
                        }
                        popup.ShowPopup(8, (char) 0, (char) 0, false, MiscText.EnterCourseName, courseName, 6, descriptionPanel, location);
                    }
                    else if (hitTest.box == 1  && courseViewKind == CourseView.CourseViewKind.Normal) {
                        // the length
                        string lengthText;
                        if (hasCustomLength)
                            lengthText = Util.RemoveSuffix((string)renderer.Description[hitTest.firstLine].boxes[1], "km");
                        else
                            lengthText = "";  // automatically calculated length.

                        popupKind = ChangeKind.Length;
                        popup.ShowPopup(8, (char)0, (char)0, false, MiscText.EnterLength, lengthText, 4, descriptionPanel, location);
                    }
                    else if (hitTest.box == 2) {
                        // the climb
                        popupKind = ChangeKind.Climb;
                        popup.ShowPopup(8, (char) 0, (char) 0, false, MiscText.EnterClimb, Util.RemoveMeterSuffix((string) renderer.Description[hitTest.firstLine].boxes[2]), 4, descriptionPanel, location);
                    }
                    break;

                case HitTestKind.Key:
                    popupKind = ChangeKind.Key;
                    popup.ShowPopup(8, (char) 0, (char) 0, false, MiscText.EnterSymbolText, (string) renderer.Description[hitTest.firstLine].boxes[1], 8, descriptionPanel, location);
                    break;

                case HitTestKind.OtherTextLine:
                    popupKind = ChangeKind.TextLine;
                    popup.ShowPopup(8, (char)0, (char)0, false, MiscText.EnterTextLine, CombineBoxTexts(hitTest.firstLine, hitTest.lastLine, 0, "|"), 8, descriptionPanel, location);
                    break;

                default: Debug.Fail("bad hit test kind"); break;
            }
        }
 // The popup was canceled.
 void popup_Canceled(object sender, EventArgs e)
 {
     popupKind = ChangeKind.None;
 }