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; } } }
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 } } }
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(); } }
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(); } } } }
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(); }
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(); } }
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(); } }
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; } }
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; } } }
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(); }
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(); }
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; } } } }
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; } } } }
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(); } }
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(); }
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(); } }
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(); } }
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(); } } }