public void Display(HistoryList hl) // rowno current.. -1 if nothing { if (hl == null) // just for safety { return; } current_historylist = hl; Tuple <long, int> pos = CurrentGridPosByJID(); var filter = (TravelHistoryFilter)comboBoxHistoryWindow.SelectedItem ?? TravelHistoryFilter.NoFilter; List <HistoryEntry> result = filter.Filter(hl); int ftotal; result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotal); toolTip1.SetToolTip(buttonFilter, (ftotal > 0) ? ("Total filtered out " + ftotal) : "Filter out entries based on event type"); result = HistoryList.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotal); toolTip1.SetToolTip(buttonField, (ftotal > 0) ? ("Total filtered out " + ftotal) : "Filter out entries matching the field selection"); dataGridViewTravel.Rows.Clear(); rowsbyjournalid.Clear(); for (int ii = 0; ii < result.Count; ii++) //foreach (var item in result) { AddNewHistoryRow(false, result[ii]); // for every one in filter, add a row. } StaticFilters.FilterGridView(dataGridViewTravel, textBoxFilter.Text); int rowno = FindGridPosByJID(pos.Item1, true); // find row.. must be visible.. -1 if not found/not visible if (rowno >= 0) { dataGridViewTravel.CurrentCell = dataGridViewTravel.Rows[rowno].Cells[pos.Item2]; // its the current cell which needs to be set, moves the row marker as well currentGridRow = (rowno!=-1) ? } else if (dataGridViewTravel.Rows.GetRowCount(DataGridViewElementStates.Visible) > 0) { rowno = dataGridViewTravel.Rows.GetFirstRow(DataGridViewElementStates.Visible); dataGridViewTravel.CurrentCell = dataGridViewTravel.Rows[rowno].Cells[TravelHistoryColumns.Description]; } else { rowno = -1; } currentGridRow = rowno; dataGridViewTravel.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time"; if (OnRedisplay != null) { OnRedisplay(hl); } }
public bool WouldAddEntry(HistoryEntry he) // do we filter? if its not in the journal event filter, or it is in the field filter { return(he.IsJournalEventInEventFilter(SQLiteDBClass.GetSettingString(DbFilterSave, "All")) && HistoryList.FilterHistory(he, fieldfilter, discoveryform.Globals)); }
public void Display(HistoryList hl) // when user clicks around.. HE may be null here { pictureBox.ClearImageList(); current_historylist = hl; if (hl != null && hl.Count > 0) // just for safety { List <HistoryEntry> result = current_historylist.LastFirst; // Standard filtering int ftotal; // event filter result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotal); result = HistoryList.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotal); // and the field filter.. RevertToNormalSize(); // ensure size is back to normal.. scanpostextoffset = new Point(0, 0); // left/ top used by scan display Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor; Color backcolour = IsTransparent ? (Config(Configuration.showBlackBoxAroundText) ? Color.Black : Color.Transparent) : this.BackColor; bool drawnnootherstuff = DrawScanText(true, textcolour, backcolour); // go 1 for some of the scan positions if (!drawnnootherstuff) // and it may indicate its overwriting all stuff, which is fine { int rowpos = scanpostextoffset.Y; int rowheight = Config(Configuration.showIcon) ? 26 : 20; if (Config(Configuration.showNothingWhenDocked) && (hl.GetLast.IsDocked || hl.GetLast.IsLanded)) { AddColText(0, 0, rowpos, rowheight, (hl.GetLast.IsDocked) ? "Docked" : "Landed", textcolour, backcolour, null); } else { string name; Point3D tpos; bool targetpresent = TargetClass.GetTargetPosition(out name, out tpos); if (targetpresent && Config(Configuration.showTargetLine) && hl.GetLast != null) { string dist = (hl.GetLast.System.HasCoordinate) ? SystemClassDB.Distance(hl.GetLast.System, tpos.X, tpos.Y, tpos.Z).ToString("0.00") : "Unknown"; AddColText(0, 0, rowpos, rowheight, "Target: " + name + " @ " + dist + " ly", textcolour, backcolour, null); rowpos += rowheight; } foreach (HistoryEntry rhe in result) { DrawHistoryEntry(rhe, rowpos, rowheight, tpos, textcolour, backcolour); rowpos += rowheight; if (rowpos > ClientRectangle.Height) // stop when off of screen { break; } } } } DrawScanText(false, textcolour, backcolour); // go 2 } pictureBox.Render(); }
private void AddNewEntry(HistoryEntry he, HistoryList hl) // add if in event filter, and not in field filter.. { if (he.IsJournalEventInEventFilter(SQLiteDBClass.GetSettingString(DbFilterSave, "All")) && HistoryList.FilterHistory(he, fieldfilter, discoveryform.Globals)) { AddNewJournalRow(true, he); if (EDDiscoveryForm.EDDConfig.FocusOnNewSystem) // Move focus to new row { SelectTopRow(); } } }