Example #1
0
        public void EditBranchTextPopUp(int index)
        {
            TasBranch branch = Movie.GetBranch(index);

            if (branch == null)
            {
                return;
            }

            InputPrompt i = new InputPrompt
            {
                Text          = "Text for branch " + index,
                TextInputType = InputPrompt.InputType.Text,
                Message       = "Enter a message",
                InitialValue  = branch.UserText
            };

            var result = i.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                branch.UserText = i.PromptText;
                UpdateValues();
            }
        }
Example #2
0
        public void EditMarkerPopUp(TasMovieMarker marker, bool followCursor = false)
        {
            var markerFrame = marker.Frame;
            var point       = default(Point);
            var i           = new InputPrompt
            {
                Text          = $"Marker for frame {markerFrame}",
                TextInputType = InputPrompt.InputType.Text,
                Message       = "Enter a message",
                InitialValue  =
                    Markers.IsMarker(markerFrame)
                                        ? Markers.PreviousOrCurrent(markerFrame).Message
                                        : ""
            };

            if (followCursor)
            {
                point = Cursor.Position;
                point.Offset(i.Width / -2, i.Height / -2);
            }

            var result = i.ShowHawkDialog(position: point);

            if (result == DialogResult.OK)
            {
                marker.Message = i.PromptText;
                UpdateTextColumnWidth();
                UpdateValues();
            }
        }
Example #3
0
        public bool EditBranchTextPopUp(int index)
        {
            TasBranch branch = Movie.GetBranch(index);

            if (branch == null)
            {
                return(false);
            }

            var i = new InputPrompt
            {
                Text          = $"Text for branch {index}",
                TextInputType = InputPrompt.InputType.Text,
                Message       = "Enter a message",
                InitialValue  = branch.UserText
            };

            var point = Cursor.Position;

            point.Offset(i.Width / -2, i.Height / -2);

            var result = i.ShowHawkDialog(position: point);

            if (result == DialogResult.OK)
            {
                branch.UserText = i.PromptText;
                UpdateTextColumnWidth();
                UpdateValues();
                return(true);
            }

            return(false);
        }
        public void AddMarker(bool editText = false, int?frame = null)
        {
            // feos: we specify the selected frame if we call this from TasView, otherwise marker should be added to the emulated frame
            var markerFrame = frame ?? Global.Emulator.Frame;

            if (editText)
            {
                InputPrompt i = new InputPrompt
                {
                    Text          = "Marker for frame " + markerFrame,
                    TextInputType = InputPrompt.InputType.Text,
                    Message       = "Enter a message",
                    InitialValue  =
                        Markers.IsMarker(markerFrame) ?
                        Markers.PreviousOrCurrent(markerFrame).Message :
                        ""
                };
                var result = i.ShowHawkDialog();
                if (result == DialogResult.OK)
                {
                    Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
                    UpdateValues();
                }
            }
            else
            {
                Markers.Add(new TasMovieMarker(markerFrame, ""));
                UpdateValues();
            }
            Tastudio.RefreshDialog();
        }
Example #5
0
        public void AddMarker(int frame, bool editText = false)
        {
            if (editText)
            {
                var i = new InputPrompt
                {
                    Text          = $"Marker for frame {frame}",
                    TextInputType = InputPrompt.InputType.Text,
                    Message       = "Enter a message",
                    InitialValue  =
                        Markers.IsMarker(frame) ?
                        Markers.PreviousOrCurrent(frame).Message :
                        ""
                };

                var point = Cursor.Position;
                point.Offset(i.Width / -2, i.Height / -2);

                var result = i.ShowHawkDialog(position: point);
                if (result.IsOk())
                {
                    Markers.Add(new TasMovieMarker(frame, i.PromptText));
                    UpdateTextColumnWidth();
                    UpdateValues();
                }
            }
            else
            {
                Markers.Add(new TasMovieMarker(frame));
                UpdateValues();
            }

            MarkerView.ScrollToIndex(Markers.Count - 1);
            Tastudio.RefreshDialog();
        }
Example #6
0
        private void SegmentSizeMenuItem_Click(object sender, EventArgs e)
        {
            var prompt = new InputPrompt
            {
                StartLocation = this.ChildPointToScreen(TraceView),
                TextInputType = InputPrompt.InputType.Unsigned,
                Message       = "Log file segment size in megabytes\nSetting 0 disables segmentation",
                InitialValue  = FileSizeCap.ToString()
            };

            var result = prompt.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                FileSizeCap = int.Parse(prompt.PromptText);
                _splitFile  = FileSizeCap != 0;
            }
        }
Example #7
0
        public void CallEditMarkerPopUp(TasMovieMarker marker)
        {
            var         markerFrame = marker.Frame;
            InputPrompt i           = new InputPrompt
            {
                Text          = "Marker for frame " + markerFrame,
                TextInputType = InputPrompt.InputType.Text,
                Message       = "Enter a message",
                InitialValue  = CurrentTasMovie.Markers.IsMarker(markerFrame) ? CurrentTasMovie.Markers.PreviousOrCurrent(markerFrame).Message : ""
            };

            var result = i.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                marker.Message = i.PromptText;
                MarkerControl.UpdateValues();
            }
        }
Example #8
0
        public void CallAddMarkerPopUp(int?frame = null)
        {
            var         markerFrame = frame ?? TasView.LastSelectedIndex ?? Emulator.Frame;
            InputPrompt i           = new InputPrompt
            {
                Text          = "Marker for frame " + markerFrame,
                TextInputType = InputPrompt.InputType.Text,
                Message       = "Enter a message",
                InitialValue  = CurrentTasMovie.Markers.IsMarker(markerFrame) ? CurrentTasMovie.Markers.PreviousOrCurrent(markerFrame).Message : ""
            };

            var result = i.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                CurrentTasMovie.Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
                MarkerControl.UpdateValues();
            }
        }
Example #9
0
		public void CallAddMarkerPopUp(int? frame = null)
		{
			var markerFrame = frame ?? TasView.LastSelectedIndex ?? Global.Emulator.Frame;
			InputPrompt i = new InputPrompt
			{
				Text = "Marker for frame " + markerFrame,
				TextInputType = InputPrompt.InputType.Text,
				Message = "Enter a message"
			};

			var result = i.ShowHawkDialog();

			if (result == DialogResult.OK)
			{
				_tas.Markers.Add(markerFrame, i.PromptText);
				MarkerControl.Refresh();
			}

			MarkerControl.Refresh();
		}
Example #10
0
        public void AddMarker(int frame, bool editText = false)
        {
            TasMovieMarker marker;

            if (editText)
            {
                var i = new InputPrompt
                {
                    Text          = $"Marker for frame {frame}",
                    TextInputType = InputPrompt.InputType.Text,
                    Message       = "Enter a message",
                    InitialValue  =
                        Markers.IsMarker(frame) ?
                        Markers.PreviousOrCurrent(frame).Message :
                        ""
                };

                var point = Cursor.Position;
                point.Offset(i.Width / -2, i.Height / -2);

                var result = i.ShowHawkDialog(this, position: point);
                if (!result.IsOk())
                {
                    return;
                }

                UpdateTextColumnWidth();
                marker = new TasMovieMarker(frame, i.PromptText);
            }
            else
            {
                marker = new TasMovieMarker(frame);
            }

            UpdateValues();
            Markers.Add(marker);
            var index = Markers.IndexOf(marker);

            MarkerView.MakeIndexVisible(index);
            Tastudio.RefreshDialog();
        }
Example #11
0
        private void MaxLinesMenuItem_Click(object sender, EventArgs e)
        {
            var prompt = new InputPrompt
            {
                StartLocation = this.ChildPointToScreen(TraceView),
                TextInputType = InputPrompt.InputType.Unsigned,
                Message       = "Max lines to display in the window",
                InitialValue  = MaxLines.ToString()
            };

            var result = prompt.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                var max = int.Parse(prompt.PromptText);
                if (max > 0)
                {
                    MaxLines = max;
                }
            }
        }
Example #12
0
        public void AddMarker(bool editText = false, int?frame = null)
        {
            // feos: we specify the selected frame if we call this from TasView, otherwise marker should be added to the emulated frame
            var markerFrame = frame ?? Tastudio.Emulator.Frame;

            if (editText)
            {
                var i = new InputPrompt
                {
                    Text          = $"Marker for frame {markerFrame}",
                    TextInputType = InputPrompt.InputType.Text,
                    Message       = "Enter a message",
                    InitialValue  =
                        Markers.IsMarker(markerFrame) ?
                        Markers.PreviousOrCurrent(markerFrame).Message :
                        ""
                };

                var point = Cursor.Position;
                point.Offset(i.Width / -2, i.Height / -2);

                var result = i.ShowHawkDialog(position: point);
                if (result == DialogResult.OK)
                {
                    Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
                    UpdateTextColumnWidth();
                    UpdateValues();
                }
            }
            else
            {
                Markers.Add(new TasMovieMarker(markerFrame));
                UpdateValues();
            }

            MarkerView.ScrollToIndex(Markers.Count - 1);
            Tastudio.RefreshDialog();
        }
Example #13
0
        private void MaxLinesMenuItem_Click(object sender, EventArgs e)
        {
            var prompt = new InputPrompt
            {
                StartLocation = this.ChildPointToScreen(TraceView),
                TextInputType = InputPrompt.InputType.Unsigned,
                Message = "Max lines to display in the window",
                InitialValue = MaxLines.ToString()
            };

            var result = prompt.ShowHawkDialog();
            if (result == DialogResult.OK)
            {
                var max = int.Parse(prompt.PromptText);
                if (max > 0)
                {
                    MaxLines = max;
                }
            }
        }
Example #14
0
		private void GoToAddressMenuItem_Click(object sender, EventArgs e)
		{
			var inputPrompt = new InputPrompt
			{
				Text = "Go to Address",
				StartLocation = this.ChildPointToScreen(MemoryViewerBox),
				Message = "Enter a hexadecimal value"
			};

			var result = inputPrompt.ShowHawkDialog();

			if (result == DialogResult.OK && inputPrompt.PromptText.IsHex())
			{
				GoToAddress(long.Parse(inputPrompt.PromptText, NumberStyles.HexNumber));
			}

			AddressLabel.Text = GenerateAddressString();
		}
Example #15
0
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = MemoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog(this);
                if (result == DialogResult.OK)
                {
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.RowCount = _watches.Count;
                        UpdateWatchCount();
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                    Changes();
                }

                GeneralUpdate();
            }
            else if (SelectedSeparators.Any() && !duplicate)
            {
                var inputPrompt = new InputPrompt
                {
                    Text          = "Edit Separator",
                    StartLocation = this.ChildPointToScreen(WatchListView),
                    Message       = "Separator Text:",
                    TextInputType = InputPrompt.InputType.Text
                };

                var result = inputPrompt.ShowHawkDialog();

                if (result == DialogResult.OK)
                {
                    Changes();

                    for (int i = 0; i < SelectedSeparators.Count(); i++)
                    {
                        var sep = SelectedSeparators.ToList()[i];
                        sep.Notes            = inputPrompt.PromptText;
                        _watches[indexes[i]] = sep;
                    }
                }

                GeneralUpdate();
            }
        }
Example #16
0
        public void CallAddMarkerPopUp(int? frame = null)
        {
            var markerFrame = frame ?? TasView.LastSelectedIndex ?? Emulator.Frame;
            InputPrompt i = new InputPrompt
            {
                Text = "Marker for frame " + markerFrame,
                TextInputType = InputPrompt.InputType.Text,
                Message = "Enter a message",
                InitialValue = CurrentTasMovie.Markers.IsMarker(markerFrame) ? CurrentTasMovie.Markers.PreviousOrCurrent(markerFrame).Message : ""
            };

            var result = i.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                CurrentTasMovie.Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
                MarkerControl.UpdateValues();
            }
        }
Example #17
0
        public void CallEditMarkerPopUp(TasMovieMarker marker)
        {
            var markerFrame = marker.Frame;
            InputPrompt i = new InputPrompt
            {
                Text = "Marker for frame " + markerFrame,
                TextInputType = InputPrompt.InputType.Text,
                Message = "Enter a message",
                InitialValue = CurrentTasMovie.Markers.IsMarker(markerFrame) ? CurrentTasMovie.Markers.PreviousOrCurrent(markerFrame).Message : ""
            };

            var result = i.ShowHawkDialog();

            if (result == DialogResult.OK)
            {
                marker.Message = i.PromptText;
                MarkerControl.UpdateValues();
            }
        }
Example #18
0
		private void GoToSpecifiedAddress()
		{
			WatchListView.SelectedIndices.Clear();
			var prompt = new InputPrompt
			{
				Text = "Go to Address",
				StartLocation = this.ChildPointToScreen(WatchListView),
				Message = "Enter a hexadecimal value"
			};

			var result = prompt.ShowHawkDialog();

			if (result == DialogResult.OK)
			{
				if (prompt.PromptText.IsHex())
				{
					var addr = int.Parse(prompt.PromptText, NumberStyles.HexNumber);
					WatchListView.SelectItem(addr, true);
					WatchListView.ensureVisible();
				}
			}
		}
Example #19
0
		public void EditBranchTextPopUp(int index)
		{
			TasBranch branch = Movie.GetBranch(index);
			if (branch == null)
				return;

			InputPrompt i = new InputPrompt
			{
				Text = "Text for branch " + index,
				TextInputType = InputPrompt.InputType.Text,
				Message = "Enter a message",
				InitialValue = branch.UserText
			};

			var result = i.ShowHawkDialog();

			if (result == DialogResult.OK)
			{
				branch.UserText = i.PromptText;
				UpdateValues();
			}
		}
Example #20
0
		public void AddMarker(bool editText = false, int? frame = null)
		{
			// feos: we specify the selected frame if we call this from TasView, otherwise marker should be added to the emulated frame
			var markerFrame = frame ?? Global.Emulator.Frame;

			if (editText)
			{
				InputPrompt i = new InputPrompt
				{
					Text = "Marker for frame " + markerFrame,
					TextInputType = InputPrompt.InputType.Text,
					Message = "Enter a message",
					InitialValue =
						Markers.IsMarker(markerFrame) ?
						Markers.PreviousOrCurrent(markerFrame).Message :
						""
				};
				var result = i.ShowHawkDialog();
				if (result == DialogResult.OK)
				{
					Markers.Add(new TasMovieMarker(markerFrame, i.PromptText));
					UpdateValues();
				}
			}
			else
			{
				Markers.Add(new TasMovieMarker(markerFrame, ""));
				UpdateValues();
			}
			Tastudio.RefreshDialog();
		}
Example #21
0
        private void EditWatch(bool duplicate = false)
        {
            var indexes = SelectedIndices.ToList();

            if (SelectedWatches.Any())
            {
                foreach (var sw in SelectedWatches)
                {
                    if (sw.Domain != SelectedWatches.First().Domain)
                    {
                        throw new InvalidOperationException("Can't edit multiple watches on varying memorydomains");
                    }
                }

                var we = new WatchEditor
                {
                    InitialLocation = this.ChildPointToScreen(WatchListView),
                    MemoryDomains   = _memoryDomains
                };

                we.SetWatch(SelectedWatches.First().Domain, SelectedWatches, duplicate ? WatchEditor.Mode.Duplicate : WatchEditor.Mode.Edit);

                var result = we.ShowHawkDialog(this);
                if (result == DialogResult.OK)
                {
                    Changes();
                    if (duplicate)
                    {
                        _watches.AddRange(we.Watches);
                        WatchListView.ItemCount = _watches.Count;
                    }
                    else
                    {
                        for (var i = 0; i < we.Watches.Count; i++)
                        {
                            _watches[indexes[i]] = we.Watches[i];
                        }
                    }
                }

                UpdateValues();
            }
            else if (SelectedSeparators.Any() && !duplicate)
            {
                var inputPrompt = new InputPrompt
                {
                    Text          = "Edit Separator",
                    StartLocation = this.ChildPointToScreen(WatchListView),
                    Message       = "Separator Text:",
                    TextInputType = InputPrompt.InputType.Text
                };

                var result = inputPrompt.ShowHawkDialog();

                if (result == DialogResult.OK)
                {
                    Changes();

                    for (int i = 0; i < SelectedSeparators.Count(); i++)
                    {
                        var sep = SelectedSeparators.ToList()[i];
                        sep.Notes            = inputPrompt.PromptText;
                        _watches[indexes[i]] = sep;
                    }
                }

                UpdateValues();
            }
        }