Example #1
0
        /// <summary>
        /// Call this when adding a new label
        /// </summary>
        /// <param name="mouseX">Current X-location of the mouse to determine popup location</param>
        /// <param name="mouseY">Current Y-location of the mouse to determine popu location</param>
        internal void AddLabel(int mouseX, int mouseY)
        {
            var labelInputPopup = new EditLabel("<label>", mouseX, mouseY,
                                                (newLabelText) => labels.Add(drawArea.MouseLocation, newLabelText),
                                                allowDelete: false);

            TrackViewer.Localize(labelInputPopup);
            labelInputPopup.ShowDialog();
        }
Example #2
0
        /// <summary>
        /// Callback that is called when the user clicks on the menuitem connected to a new label
        /// </summary>
        /// <param name="oldLabel">The old label that needs to be replaced</param>
        /// <param name="mouseX">Current X-location of the mouse to determine popup location</param>
        /// <param name="mouseY">Current Y-location of the mouse to determine popu location</param>
        private void ModifyLabel(StorableLabel oldLabel, int mouseX, int mouseY)
        {
            var labelInputPopup = new EditLabel(oldLabel.LabelText, mouseX, mouseY,
                                                (newLabelText) =>
            {
                if (newLabelText == null)
                {
                    labels.Delete(oldLabel);
                }
                else
                {
                    var newLabel = new StorableLabel(oldLabel.WorldLocation, newLabelText);
                    labels.Replace(oldLabel, newLabel);
                }
            }, allowDelete: true);

            TrackViewer.Localize(labelInputPopup);
            labelInputPopup.ShowDialog();
        }