public void SelectOffset(int pcOffset, int column = -1, ISnesNavigation.HistoryArgs historyArgs = null) { if (pcOffset == -1) { return; } MarkHistoryPoint(SelectedOffset, historyArgs, "start"); var col = column == -1 ? table.CurrentCell.ColumnIndex : column; if (pcOffset < ViewOffset) { ViewOffset = pcOffset; UpdateDataGridView(); table.CurrentCell = table.Rows[0].Cells[col]; } else if (pcOffset >= ViewOffset + rowsToShow) { ViewOffset = pcOffset - rowsToShow + 1; UpdateDataGridView(); table.CurrentCell = table.Rows[rowsToShow - 1].Cells[col]; } else { table.CurrentCell = table.Rows[pcOffset - ViewOffset].Cells[col]; } MarkHistoryPoint(pcOffset, historyArgs, "end"); InvalidateTable(); }
public NavigationEntry(int snesOffset, ISnesNavigation.HistoryArgs historyArgs, Data data) { SnesOffset = snesOffset; Description = historyArgs?.Description ?? ""; Position = historyArgs?.Position ?? ""; Data = data; }
public void MarkHistoryPoint(int pcOffset, ISnesNavigation.HistoryArgs historyArgs, string position) { if (historyArgs == null) { return; } historyArgs.Position = position; RememberNavigationPoint(SelectedOffset, historyArgs); // save old position }
private void RememberNavigationPoint(int pcOffset, ISnesNavigation.HistoryArgs historyArgs) { var snesAddress = Project.Data.ConvertPCtoSnes(pcOffset); var history = Document.NavigationHistory; // if our last remembered offset IS the new offset, don't record it again // (prevents duplication) if (history.Count > 0 && history[history.Count - 1].SnesOffset == snesAddress) { return; } history.Add( new NavigationEntry( snesAddress, historyArgs, Project.Data ) ); }
public void SelectOffset(int pcOffset, ISnesNavigation.HistoryArgs historyArgs = null) => SelectOffset(pcOffset, -1, historyArgs);
public void SelectOffset(int offset, ISnesNavigation.HistoryArgs historyArgs = null) => ProjectView.SelectOffset(offset, historyArgs);