Пример #1
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;
                }
            }
        }
Пример #2
0
		private void GoToSpecifiedAddress()
		{
			WatchListView.DeselectAll();
			var prompt = new InputPrompt
			{
				Text = "Go to Address",
				StartLocation = this.ChildPointToScreen(WatchListView),
				Message = "Enter a hexadecimal value"
			};

			var result = this.ShowDialogWithTempMute(prompt);
			while (result.IsOk())
			{
				try
				{
					var addr = int.Parse(prompt.PromptText, NumberStyles.HexNumber);
					for (int index = 0; index < _searches.Count; index++)
					{
						if (_searches[index].Address == addr)
						{
							WatchListView.SelectRow(index, true);
							WatchListView.ScrollToIndex(index);
							return; // Don't re-show dialog on success
						}
					}

					// TODO add error text to dialog?
					// Re-show dialog if the address isn't found
				}
				catch (FormatException)
				{
					// Re-show dialog if given invalid text (shouldn't happen)
				}
				catch (OverflowException)
				{
					// TODO add error text to dialog?
					// Re-show dialog if the address isn't valid
				}
			}
		}
Пример #3
0
        public void EditMarkerPopUp(TasMovieMarker marker)
        {
            var         markerFrame = marker.Frame;
            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)
            {
                marker.Message = i.PromptText;
                UpdateValues();
            }
        }
Пример #4
0
 private void SetAutosaveIntervalMenuItem_Click(object sender, EventArgs e)
 {
     using (var prompt = new InputPrompt
     {
         TextInputType = InputPrompt.InputType.Unsigned,
         Message = "Autosave Interval in seconds\nSet to 0 to disable",
         InitialValue = (Settings.AutosaveInterval / 1000).ToString()
     })
     {
         DialogResult result = prompt.ShowDialog();
         if (result == DialogResult.OK)
         {
             uint val = uint.Parse(prompt.PromptText) * 1000;
             Settings.AutosaveInterval = val;
             if (val > 0)
             {
                 _autosaveTimer.Interval = (int)val;
                 _autosaveTimer.Start();
             }
         }
     }
 }
Пример #5
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();
        }
Пример #6
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();
            }
        }
Пример #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();
            }
        }
Пример #8
0
		private void wheelScrollSpeedToolStripMenuItem_Click(object sender, EventArgs e)
		{
			InputPrompt inputpromt = new InputPrompt();
			inputpromt.TextInputType = InputPrompt.InputType.Unsigned;
			inputpromt.Message = "Frames per tick:";
			inputpromt.InitialValue = TasView.ScrollSpeed.ToString();
			if (inputpromt.ShowDialog() == System.Windows.Forms.DialogResult.OK)
			{
				TasView.ScrollSpeed = int.Parse(inputpromt.PromptText);
				Settings.ScrollSpeed = TasView.ScrollSpeed;
			}
			
		}
Пример #9
0
		private void SetMaxUndoLevelsMenuItem_Click(object sender, EventArgs e)
		{
			using (var prompt = new InputPrompt
			{
				TextInputType = InputPrompt.InputType.Unsigned,
				Message = "Number of Undo Levels to keep",
				InitialValue = CurrentTasMovie.ChangeLog.MaxSteps.ToString()
			})
			{
				DialogResult result = prompt.ShowDialog();
				if (result == DialogResult.OK)
				{
					int val = int.Parse(prompt.PromptText);
					if (val > 0)
						CurrentTasMovie.ChangeLog.MaxSteps = val;
				}
			}
		}
Пример #10
0
 private void SetAutosaveIntervalMenuItem_Click(object sender, EventArgs e)
 {
     using (var prompt = new InputPrompt
     {
         TextInputType = InputPrompt.InputType.Unsigned,
         Message = "Autosave Interval in seconds\nSet to 0 to disable",
         InitialValue = (Settings.AutosaveInterval / 1000).ToString()
     })
     {
         DialogResult result = prompt.ShowDialog();
         if (result == DialogResult.OK)
         {
             uint val = uint.Parse(prompt.PromptText) * 1000;
             Settings.AutosaveInterval = val;
             if (val > 0)
             {
                 _autosaveTimer.Interval = (int)val;
                 _autosaveTimer.Start();
             }
         }
     }
 }
Пример #11
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();
		}
Пример #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 ?? 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();
		}
Пример #13
0
		private void SetSeekingCutoffIntervalMenuItem_Click(object sender, EventArgs e)
		{
			using (var prompt = new InputPrompt
			{
				TextInputType = InputPrompt.InputType.Unsigned,
				Message = "Seeking Cutoff Interval",
				InitialValue = Settings.SeekingCutoffInterval.ToString()
			})
			{
				DialogResult result = prompt.ShowDialog();
				if (result == DialogResult.OK)
				{
					int val = int.Parse(prompt.PromptText);
					if (val > 0)
					{
						Settings.SeekingCutoffInterval = val;
						TasView.SeekingCutoffInterval = val;
					}
				}
			}
		}
Пример #14
0
		private void SetBranchCellHoverIntervalMenuItem_Click(object sender, EventArgs e)
		{
			using (var prompt = new InputPrompt
			{
				TextInputType = InputPrompt.InputType.Unsigned,
				Message = "ScreenshotPopUp Delay",
				InitialValue = Settings.BranchCellHoverInterval.ToString()
			})
			{
				DialogResult result = prompt.ShowDialog();
				if (result == DialogResult.OK)
				{
					int val = int.Parse(prompt.PromptText);
					if (val > 0)
					{
						Settings.BranchCellHoverInterval = val;
						BookMarkControl.HoverInterval = val;
					}
				}
			}
		}
Пример #15
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();
            }
        }
Пример #16
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();
		}
Пример #17
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();
            }
        }
Пример #18
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();
			}
		}
Пример #19
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;
                }
            }
        }
Пример #20
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();
				}
			}
		}