Exemplo n.º 1
0
        public void Display(HistoryList hl)
        {
            if (hl == null)     // just for safety
            {
                return;
            }

            current_historylist = hl;

            Tuple <long, int> pos = CurrentGridPosByJID();

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            List <HistoryEntry> result = filter.Filter(hl);

            result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"));

            dataGridViewJournal.Rows.Clear();

            for (int ii = 0; ii < result.Count; ii++) //foreach (var item in result)
            {
                AddNewJournalRow(false, result[ii]);  // for every one in filter, add a row.
            }

            StaticFilters.FilterGridView(dataGridViewJournal, textBoxFilter.Text);

            int rowno = FindGridPosByJID(pos.Item1);

            if (rowno > 0)
            {
                dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well            currentGridRow = (rowno!=-1) ?
            }

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time";
        }
        private void Display(HistoryList hl, bool disablesorting)
        {
            if (hl == null)     // just for safety
            {
                return;
            }

            current_historylist = hl;

            Tuple <long, int> pos = CurrentGridPosByJID();

            SortOrder sortorder = dataGridViewJournal.SortOrder;
            int       sortcol   = dataGridViewJournal.SortedColumn?.Index ?? -1;

            if (sortcol >= 0 && disablesorting)
            {
                dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = SortOrder.None;
                sortcol = -1;
            }

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            List <HistoryEntry> result = filter.Filter(hl);

            fdropdown = hl.Count() - result.Count();

            result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotalevents);
            result = FilterHelpers.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotalfilters);


            dataGridViewJournal.Rows.Clear();
            rowsbyjournalid.Clear();

            for (int ii = 0; ii < result.Count; ii++) //foreach (var item in result)
            {
                AddNewJournalRow(false, result[ii]);  // for every one in filter, add a row.
            }

            StaticFilters.FilterGridView(dataGridViewJournal, textBoxFilter.Text);

            UpdateToolTipsForFilter();

            int rowno = FindGridPosByJID(pos.Item1, true);

            if (rowno >= 0)
            {
                dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well            currentGridRow = (rowno!=-1) ?
            }

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time";

            if (sortcol >= 0)
            {
                dataGridViewJournal.Sort(dataGridViewJournal.Columns[sortcol], (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = sortorder;
            }

            FireChangeSelection();
        }
        public void HistoryChanged(HistoryList hl) // on History change
        {
            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);
            toolTip.SetToolTip(buttonFilter, (ftotal > 0) ? ("Total filtered out " + ftotal) : "Filter out entries based on event type");

            result = FilterHelpers.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotal);
            toolTip.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;
            }

            dataGridViewTravel.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time";

            //System.Diagnostics.Debug.WriteLine("Fire HC");
            if (OnHistoryChanged != null)
            {
                OnHistoryChanged(hl);
            }

            FireChangeSelection();      // and since we repainted, we should fire selection, as we in effect may have selected a new one
        }
Exemplo n.º 4
0
        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);

            result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"));

            dataGridViewTravel.Rows.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(preferred_jid >= 0 ? preferred_jid : pos.Item1);   // either go back to preferred, or to remembered above

            preferred_jid = -1;                                                             // 1 shot at this

            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 void Display(HistoryList hl)
        {
            if (hl == null)     // just for safety
            {
                return;
            }

            current_historylist = hl;

            Tuple <long, int> pos = CurrentGridPosByJID();

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            List <HistoryEntry> result = filter.Filter(hl);

            int ftotal;

            result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotal);
            toolTip.SetToolTip(buttonFilter, (ftotal > 0) ? ("Total filtered out " + ftotal) : "Filter out entries based on event type");

            result = FilterHelpers.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotal);
            toolTip.SetToolTip(buttonField, (ftotal > 0) ? ("Total filtered out " + ftotal) : "Filter out entries matching the field selection");

            dataGridViewJournal.Rows.Clear();
            rowsbyjournalid.Clear();

            for (int ii = 0; ii < result.Count; ii++) //foreach (var item in result)
            {
                AddNewJournalRow(false, result[ii]);  // for every one in filter, add a row.
            }

            StaticFilters.FilterGridView(dataGridViewJournal, textBoxFilter.Text);

            int rowno = FindGridPosByJID(pos.Item1, true);

            if (rowno >= 0)
            {
                dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well            currentGridRow = (rowno!=-1) ?
            }

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time";

            FireChangeSelection();
        }
Exemplo n.º 6
0
        public override bool GetData(Object _discoveryForm)
        {
            bool datepicked = false;
            var  picker     = new DateTimePicker();

            if (this.datepopup)
            {
                Button button1 = new Button();
                button1.Text         = "OK";
                button1.DialogResult = DialogResult.OK;
                Form             f   = new Form();
                TableLayoutPanel tlp = new TableLayoutPanel();
                tlp.ColumnCount  = 2;
                tlp.RowCount     = 2;
                tlp.Dock         = DockStyle.Fill;
                tlp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                tlp.AutoSize     = true;
                f.Name           = TITLE;
                tlp.Controls.Add(picker, 0, 0);
                tlp.Controls.Add(button1, 1, 1);
                f.Controls.Add(tlp);
                f.AutoSize = true;
                var result = f.ShowDialog();
                if (result == DialogResult.OK)
                {
                    datepicked = true;
                }
            }

            int count = 0;

            data = HistoryList.FilterByJournalEvent((_discoveryForm as EDDiscoveryForm).history.ToList(), "Sell Exploration Data", out count);

            scans = HistoryList.FilterByJournalEvent((_discoveryForm as EDDiscoveryForm).history.ToList(), "Scan", out count);
            if (datepicked)
            {
                data = (from he in data where he.EventTimeUTC >= picker.Value.Date.ToUniversalTime() orderby he.EventTimeUTC descending select he).ToList();
            }
            return(true);
        }
Exemplo n.º 7
0
        private void Display(HistoryList hl, bool disablesorting)
        {
            if (hl == null)     // just for safety
            {
                return;
            }

            loadcomplete           = false;
            this.Cursor            = Cursors.WaitCursor;
            buttonExtExcel.Enabled = buttonFilter.Enabled = buttonField.Enabled = comboBoxJournalWindow.Enabled = false;

            current_historylist = hl;

            Tuple <long, int> pos = CurrentGridPosByJID();

            SortOrder sortorder = dataGridViewJournal.SortOrder;
            int       sortcol   = dataGridViewJournal.SortedColumn?.Index ?? -1;

            if (sortcol >= 0 && disablesorting)
            {
                dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = SortOrder.None;
                sortcol = -1;
            }

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            List <HistoryEntry> result = filter.Filter(hl);

            fdropdown = hl.Count() - result.Count();

            result = HistoryList.FilterByJournalEvent(result, EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbFilterSave, "All"), out ftotalevents);
            result = FilterHelpers.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotalfilters);

            dataGridViewJournal.Rows.Clear();
            rowsbyjournalid.Clear();

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.GetTimeTitle();

            List <HistoryEntry[]> chunks = new List <HistoryEntry[]>();

            int chunksize = 500;

            for (int i = 0; i < result.Count; i += chunksize, chunksize = 2000)
            {
                HistoryEntry[] chunk = new HistoryEntry[i + chunksize > result.Count ? result.Count - i : chunksize];

                result.CopyTo(i, chunk, 0, chunk.Length);
                chunks.Add(chunk);
            }

            todo.Clear();
            string filtertext = textBoxFilter.Text;

            System.Diagnostics.Stopwatch swtotal = new System.Diagnostics.Stopwatch(); swtotal.Start();

            //int lrowno = 0;

            foreach (var chunk in chunks)
            {
                todo.Enqueue(() =>
                {
                    //System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start();

                    List <DataGridViewRow> rowstoadd = new List <DataGridViewRow>();

                    foreach (var item in chunk)
                    {
                        var row = CreateHistoryRow(item, filtertext);
                        if (row != null)
                        {
                            //row.Cells[2].Value = (lrowno++).ToString() + " " + item.Journalid + " " + (string)row.Cells[2].Value;
                            rowstoadd.Add(row);
                        }
                    }

                    dataGridViewJournal.Rows.AddRange(rowstoadd.ToArray()); // much faster to send in one chunk

                    // System.Diagnostics.Debug.WriteLine("J Chunk Load in " + sw.ElapsedMilliseconds);

                    if (dataGridViewJournal.MoveToSelection(rowsbyjournalid, ref pos, false, Columns.Event))
                    {
                        FireChangeSelection();
                    }
                });
            }

            todo.Enqueue(() =>
            {
                System.Diagnostics.Debug.WriteLine(BaseUtils.AppTicks.TickCount + " JG TOTAL TIME " + swtotal.ElapsedMilliseconds);

                UpdateToolTipsForFilter();

                if (dataGridViewJournal.MoveToSelection(rowsbyjournalid, ref pos, true, Columns.Event))
                {
                    FireChangeSelection();
                }

                if (sortcol >= 0)
                {
                    dataGridViewJournal.Sort(dataGridViewJournal.Columns[sortcol], (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                    dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = sortorder;
                }

                this.Cursor            = Cursors.Default;
                buttonExtExcel.Enabled = buttonFilter.Enabled = buttonField.Enabled = comboBoxJournalWindow.Enabled = true;

                loadcomplete = true;
            });

            todotimer.Start();
        }
Exemplo n.º 8
0
        private void buttonExtExcel_Click(object sender, EventArgs e)
        {
            Forms.ExportForm frm = new Forms.ExportForm();
            frm.Init(new string[] { "All", "Stars only",
                                    "Planets only",             //2
                                    "Exploration List Stars",   //3
                                    "Exploration List Planets", //4
                                    "Sold Exploration Data",    // 5
                     });

            if (frm.ShowDialog(FindForm()) == DialogResult.OK)
            {
                BaseUtils.CSVWrite csv = new BaseUtils.CSVWrite();
                csv.SetCSVDelimiter(frm.Comma);

                try
                {
                    using (System.IO.StreamWriter writer = new System.IO.StreamWriter(frm.Path))
                    {
                        if (frm.SelectedIndex == 5)
                        {
                            int count;
                            List <HistoryEntry> data = HistoryList.FilterByJournalEvent(discoveryform.history.ToList(), "Sell Exploration Data", out count);
                            data = (from he in data where he.EventTimeLocal >= frm.StartTime && he.EventTimeLocal <= frm.EndTime orderby he.EventTimeUTC descending select he).ToList();

                            List <HistoryEntry> scans = HistoryList.FilterByJournalEvent(discoveryform.history.ToList(), "Scan", out count);

                            if (frm.IncludeHeader)
                            {
                                writer.Write(csv.Format("Time"));
                                writer.Write(csv.Format("System"));
                                writer.Write(csv.Format("Star type"));
                                writer.Write(csv.Format("Planet type", false));
                                writer.WriteLine();
                            }

                            foreach (HistoryEntry he in data)
                            {
                                JournalSellExplorationData jsed = he.journalEntry as JournalSellExplorationData;
                                if (jsed == null || jsed.Discovered == null)
                                {
                                    continue;
                                }
                                foreach (String system in jsed.Discovered)
                                {
                                    writer.Write(csv.Format(jsed.EventTimeLocal));
                                    writer.Write(csv.Format(system));

                                    EDStar   star   = EDStar.Unknown;
                                    EDPlanet planet = EDPlanet.Unknown_Body_Type;

                                    foreach (HistoryEntry scanhe in scans)
                                    {
                                        JournalScan scan = scanhe.journalEntry as JournalScan;
                                        if (scan.BodyName.Equals(system, StringComparison.OrdinalIgnoreCase))
                                        {
                                            star   = scan.StarTypeID;
                                            planet = scan.PlanetTypeID;
                                            break;
                                        }
                                    }
                                    writer.Write(csv.Format((star != EDStar.Unknown) ? Enum.GetName(typeof(EDStar), star) : ""));
                                    writer.Write(csv.Format((planet != EDPlanet.Unknown_Body_Type) ? Enum.GetName(typeof(EDPlanet), planet) : "", false));
                                    writer.WriteLine();
                                }
                            }
                        }
                        else
                        {
                            List <JournalScan> scans = null;

                            if (frm.SelectedIndex < 3)
                            {
                                var entries = JournalEntry.GetByEventType(JournalTypeEnum.Scan, EDCommander.CurrentCmdrID, frm.StartTime, frm.EndTime);
                                scans = entries.ConvertAll(x => (JournalScan)x);
                            }
                            else
                            {
                                ExplorationSetClass currentExplorationSet = new ExplorationSetClass();

                                string file = currentExplorationSet.DialogLoad(FindForm());

                                if (file != null)
                                {
                                    scans = new List <JournalScan>();

                                    foreach (string system in currentExplorationSet.Systems)
                                    {
                                        ISystem sys = SystemCache.FindSystem(system);
                                        if (sys != null)
                                        {
                                            List <JournalScan> sysscans = EDSMClass.GetBodiesList(sys.EDSMID);
                                            if (sysscans != null)
                                            {
                                                scans.AddRange(sysscans);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    return;
                                }
                            }

                            bool ShowStars   = frm.SelectedIndex < 2 || frm.SelectedIndex == 3;
                            bool ShowPlanets = frm.SelectedIndex == 0 || frm.SelectedIndex == 2 || frm.SelectedIndex == 4;

                            List <JournalSAAScanComplete> mappings = ShowPlanets ?
                                                                     JournalEntry.GetByEventType(JournalTypeEnum.SAAScanComplete, EDCommander.CurrentCmdrID, frm.StartTime, frm.EndTime)
                                                                     .ConvertAll(x => (JournalSAAScanComplete)x)
                                : null;

                            if (frm.IncludeHeader)
                            {
                                // Write header

                                writer.Write(csv.Format("Time"));
                                writer.Write(csv.Format("BodyName"));
                                writer.Write(csv.Format("Estimated Value"));
                                writer.Write(csv.Format("DistanceFromArrivalLS"));
                                writer.Write(csv.Format("WasMapped"));
                                writer.Write(csv.Format("WasDiscovered"));
                                if (ShowStars)
                                {
                                    writer.Write(csv.Format("StarType"));
                                    writer.Write(csv.Format("StellarMass"));
                                    writer.Write(csv.Format("AbsoluteMagnitude"));
                                    writer.Write(csv.Format("Age MY"));
                                    writer.Write(csv.Format("Luminosity"));
                                }
                                writer.Write(csv.Format("Radius"));
                                writer.Write(csv.Format("RotationPeriod"));
                                writer.Write(csv.Format("SurfaceTemperature"));

                                if (ShowPlanets)
                                {
                                    writer.Write(csv.Format("TidalLock"));
                                    writer.Write(csv.Format("TerraformState"));
                                    writer.Write(csv.Format("PlanetClass"));
                                    writer.Write(csv.Format("Atmosphere"));
                                    writer.Write(csv.Format("Iron"));
                                    writer.Write(csv.Format("Silicates"));
                                    writer.Write(csv.Format("SulphurDioxide"));
                                    writer.Write(csv.Format("CarbonDioxide"));
                                    writer.Write(csv.Format("Nitrogen"));
                                    writer.Write(csv.Format("Oxygen"));
                                    writer.Write(csv.Format("Water"));
                                    writer.Write(csv.Format("Argon"));
                                    writer.Write(csv.Format("Ammonia"));
                                    writer.Write(csv.Format("Methane"));
                                    writer.Write(csv.Format("Hydrogen"));
                                    writer.Write(csv.Format("Helium"));
                                    writer.Write(csv.Format("Volcanism"));
                                    writer.Write(csv.Format("SurfaceGravity"));
                                    writer.Write(csv.Format("SurfacePressure"));
                                    writer.Write(csv.Format("Landable"));
                                    writer.Write(csv.Format("EarthMasses"));
                                    writer.Write(csv.Format("IcePercent"));
                                    writer.Write(csv.Format("RockPercent"));
                                    writer.Write(csv.Format("MetalPercent"));
                                }
                                // Common orbital param
                                writer.Write(csv.Format("SemiMajorAxis"));
                                writer.Write(csv.Format("Eccentricity"));
                                writer.Write(csv.Format("OrbitalInclination"));
                                writer.Write(csv.Format("Periapsis"));
                                writer.Write(csv.Format("OrbitalPeriod"));
                                writer.Write(csv.Format("AxialTilt"));


                                if (ShowPlanets)
                                {
                                    writer.Write(csv.Format("Carbon"));
                                    writer.Write(csv.Format("Iron"));
                                    writer.Write(csv.Format("Nickel"));
                                    writer.Write(csv.Format("Phosphorus"));
                                    writer.Write(csv.Format("Sulphur"));
                                    writer.Write(csv.Format("Arsenic"));
                                    writer.Write(csv.Format("Chromium"));
                                    writer.Write(csv.Format("Germanium"));
                                    writer.Write(csv.Format("Manganese"));
                                    writer.Write(csv.Format("Selenium"));
                                    writer.Write(csv.Format("Vanadium"));
                                    writer.Write(csv.Format("Zinc"));
                                    writer.Write(csv.Format("Zirconium"));
                                    writer.Write(csv.Format("Cadmium"));
                                    writer.Write(csv.Format("Mercury"));
                                    writer.Write(csv.Format("Molybdenum"));
                                    writer.Write(csv.Format("Niobium"));
                                    writer.Write(csv.Format("Tin"));
                                    writer.Write(csv.Format("Tungsten"));
                                    writer.Write(csv.Format("Antimony"));
                                    writer.Write(csv.Format("Polonium"));
                                    writer.Write(csv.Format("Ruthenium"));
                                    writer.Write(csv.Format("Technetium"));
                                    writer.Write(csv.Format("Tellurium"));
                                    writer.Write(csv.Format("Yttrium"));
                                }

                                writer.WriteLine();
                            }

                            foreach (JournalScan je in scans)
                            {
                                JournalScan scan = je as JournalScan;

                                if (ShowPlanets == true && !string.IsNullOrEmpty(scan.PlanetClass))
                                {
                                    var mapping = mappings?.FirstOrDefault(m => m.BodyID == scan.BodyID);

                                    if (mapping != null)
                                    {
                                        scan.SetMapped(true, mapping.ProbesUsed <= mapping.EfficiencyTarget);
                                    }
                                }

                                if (ShowPlanets == false)  // Then only show stars.
                                {
                                    if (String.IsNullOrEmpty(scan.StarType))
                                    {
                                        continue;
                                    }
                                }

                                if (ShowStars == false)   // Then only show planets
                                {
                                    if (String.IsNullOrEmpty(scan.PlanetClass))
                                    {
                                        continue;
                                    }
                                }

                                writer.Write(csv.Format(scan.EventTimeUTC));
                                writer.Write(csv.Format(scan.BodyName));
                                writer.Write(csv.Format(scan.EstimatedValue));
                                writer.Write(csv.Format(scan.DistanceFromArrivalLS));
                                writer.Write(csv.Format(scan.WasMapped));
                                writer.Write(csv.Format(scan.WasDiscovered));

                                if (ShowStars)
                                {
                                    writer.Write(csv.Format(scan.StarType));
                                    writer.Write(csv.Format((scan.nStellarMass.HasValue) ? scan.nStellarMass.Value : 0));
                                    writer.Write(csv.Format((scan.nAbsoluteMagnitude.HasValue) ? scan.nAbsoluteMagnitude.Value : 0));
                                    writer.Write(csv.Format((scan.nAge.HasValue) ? scan.nAge.Value : 0));
                                    writer.Write(csv.Format(scan.Luminosity));
                                }


                                writer.Write(csv.Format(scan.nRadius.HasValue ? scan.nRadius.Value : 0));
                                writer.Write(csv.Format(scan.nRotationPeriod.HasValue ? scan.nRotationPeriod.Value : 0));
                                writer.Write(csv.Format(scan.nSurfaceTemperature.HasValue ? scan.nSurfaceTemperature.Value : 0));

                                if (ShowPlanets)
                                {
                                    writer.Write(csv.Format(scan.nTidalLock.HasValue ? scan.nTidalLock.Value : false));
                                    writer.Write(csv.Format((scan.TerraformState != null) ? scan.TerraformState : ""));
                                    writer.Write(csv.Format((scan.PlanetClass != null) ? scan.PlanetClass : ""));
                                    writer.Write(csv.Format((scan.Atmosphere != null) ? scan.Atmosphere : ""));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Iron")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Silicates")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("SulphurDioxide")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("CarbonDioxide")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Nitrogen")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Oxygen")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Water")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Argon")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Ammonia")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Methane")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Hydrogen")));
                                    writer.Write(csv.Format(scan.GetAtmosphereComponent("Helium")));
                                    writer.Write(csv.Format((scan.Volcanism != null) ? scan.Volcanism : ""));
                                    writer.Write(csv.Format(scan.nSurfaceGravity.HasValue ? scan.nSurfaceGravity.Value : 0));
                                    writer.Write(csv.Format(scan.nSurfacePressure.HasValue ? scan.nSurfacePressure.Value : 0));
                                    writer.Write(csv.Format(scan.nLandable.HasValue ? scan.nLandable.Value : false));
                                    writer.Write(csv.Format((scan.nMassEM.HasValue) ? scan.nMassEM.Value : 0));
                                    writer.Write(csv.Format(scan.GetCompositionPercent("Ice")));
                                    writer.Write(csv.Format(scan.GetCompositionPercent("Rock")));
                                    writer.Write(csv.Format(scan.GetCompositionPercent("Metal")));
                                }
                                // Common orbital param
                                writer.Write(csv.Format(scan.nSemiMajorAxis.HasValue ? scan.nSemiMajorAxis.Value : 0));
                                writer.Write(csv.Format(scan.nEccentricity.HasValue ? scan.nEccentricity.Value : 0));
                                writer.Write(csv.Format(scan.nOrbitalInclination.HasValue ? scan.nOrbitalInclination.Value : 0));
                                writer.Write(csv.Format(scan.nPeriapsis.HasValue ? scan.nPeriapsis.Value : 0));
                                writer.Write(csv.Format(scan.nOrbitalPeriod.HasValue ? scan.nOrbitalPeriod.Value : 0));
                                writer.Write(csv.Format(scan.nAxialTilt.HasValue ? scan.nAxialTilt : null));

                                if (ShowPlanets)
                                {
                                    writer.Write(csv.Format(scan.GetMaterial("Carbon")));
                                    writer.Write(csv.Format(scan.GetMaterial("Iron")));
                                    writer.Write(csv.Format(scan.GetMaterial("Nickel")));
                                    writer.Write(csv.Format(scan.GetMaterial("Phosphorus")));
                                    writer.Write(csv.Format(scan.GetMaterial("Sulphur")));
                                    writer.Write(csv.Format(scan.GetMaterial("Arsenic")));
                                    writer.Write(csv.Format(scan.GetMaterial("Chromium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Germanium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Manganese")));
                                    writer.Write(csv.Format(scan.GetMaterial("Selenium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Vanadium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Zinc")));
                                    writer.Write(csv.Format(scan.GetMaterial("Zirconium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Cadmium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Mercury")));
                                    writer.Write(csv.Format(scan.GetMaterial("Molybdenum")));
                                    writer.Write(csv.Format(scan.GetMaterial("Niobium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Tin")));
                                    writer.Write(csv.Format(scan.GetMaterial("Tungsten")));
                                    writer.Write(csv.Format(scan.GetMaterial("Antimony")));
                                    writer.Write(csv.Format(scan.GetMaterial("Polonium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Ruthenium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Technetium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Tellurium")));
                                    writer.Write(csv.Format(scan.GetMaterial("Yttrium")));
                                }
                                writer.WriteLine();
                            }
                        }

                        writer.Close();

                        if (frm.AutoOpen)
                        {
                            System.Diagnostics.Process.Start(frm.Path);
                        }
                    }
                }
                catch
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), "Failed to write to " + frm.Path, "Export Failed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Exemplo n.º 9
0
        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();
        }
Exemplo n.º 10
0
        private void Display(HistoryList hl, bool disablesorting)
        {
            if (hl == null)     // just for safety
            {
                return;
            }

            loadcomplete = false;
            this.Cursor  = Cursors.WaitCursor;

            current_historylist = hl;

            Tuple <long, int> pos = CurrentGridPosByJID();

            SortOrder sortorder = dataGridViewJournal.SortOrder;
            int       sortcol   = dataGridViewJournal.SortedColumn?.Index ?? -1;

            if (sortcol >= 0 && disablesorting)
            {
                dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = SortOrder.None;
                sortcol = -1;
            }

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this, true) + " JG " + displaynumber + " Load start");

            List <HistoryEntry> result = filter.Filter(hl);

            fdropdown = hl.Count() - result.Count();

            result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotalevents);
            result = FilterHelpers.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotalfilters);

            dataGridViewJournal.Rows.Clear();
            rowsbyjournalid.Clear();

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time".Tx() : "Time".Tx();

            List <HistoryEntry[]> chunks = new List <HistoryEntry[]>();

            for (int i = 0; i < result.Count; i += 1000)
            {
                HistoryEntry[] chunk = new HistoryEntry[i + 1000 > result.Count ? result.Count - i : 1000];

                result.CopyTo(i, chunk, 0, chunk.Length);
                chunks.Add(chunk);
            }

            todo.Clear();
            string filtertext = textBoxFilter.Text;

            foreach (var chunk in chunks)
            {
                todo.Enqueue(() =>
                {
                    dataViewScrollerPanel.Suspend();
                    foreach (var item in chunk)
                    {
                        var row = CreateHistoryRow(item, filtertext);
                        if (row != null)
                        {
                            dataGridViewJournal.Rows.Add(row);
                        }
                    }
                    dataViewScrollerPanel.Resume();
                });
            }

            todo.Enqueue(() =>
            {
                UpdateToolTipsForFilter();

                int rowno = FindGridPosByJID(pos.Item1, true);

                if (rowno >= 0)
                {
                    dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well            currentGridRow = (rowno!=-1) ?
                }

                System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this) + " JG " + displaynumber + " Load Finish");

                if (sortcol >= 0)
                {
                    dataGridViewJournal.Sort(dataGridViewJournal.Columns[sortcol], (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                    dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = sortorder;
                }

                FireChangeSelection();

                this.Cursor = Cursors.Default;

                loadcomplete = true;
            });

            todotimer.Start();
        }
Exemplo n.º 11
0
        private void Display(HistoryList hl)
        {
            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 = FilterHelpers.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.IsCurrentlyDocked || hl.IsCurrentlyLanded))
                    {
                        AddColText(0, 0, rowpos, rowheight, (hl.IsCurrentlyDocked) ? "Docked" : "Landed", textcolour, backcolour, null);
                    }
                    else if ((uistate == UIState.GalMap && Config(Configuration.showNothingWhenGalmap)) || (uistate == UIState.SystemMap && Config(Configuration.showNothingWhenSysmap)))
                    {
                        AddColText(0, 0, rowpos, rowheight, (uistate == UIState.GalMap) ? "Galaxy Map" : "System Map", textcolour, backcolour, null);
                    }
                    else
                    {
                        string  name;
                        Point3D tpos;
                        bool    targetpresent = TargetClass.GetTargetPosition(out name, out tpos);

                        ISystem currentsystem = hl.CurrentSystem; // may be null

                        HistoryEntry last = hl.GetLast;

                        if (Config(Configuration.showSystemInformation) && last != null)
                        {
                            string allegiance, economy, gov, faction, factionstate, security;
                            hl.ReturnSystemInfo(last, out allegiance, out economy, out gov, out faction, out factionstate, out security);

                            string str = last.System.Name + " : " + BaseUtils.FieldBuilder.Build(
                                "", faction,
                                "", factionstate,
                                "", security,
                                "", allegiance,
                                "", economy,
                                "", gov
                                );


                            HistoryEntry lastfsd        = hl.GetLastHistoryEntry(x => x.journalEntry is EliteDangerousCore.JournalEvents.JournalFSDJump, last);
                            bool         firstdiscovery = (lastfsd != null && (lastfsd.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).EDSMFirstDiscover);

                            AddColText(0, 0, rowpos, rowheight, str, textcolour, backcolour, null, firstdiscovery ? EDDiscovery.Icons.Controls.firstdiscover : null, "Shows if EDSM indicates your it's first discoverer");

                            rowpos += rowheight;
                        }

                        if (Config(Configuration.showHabInformation) && last != null)
                        {
                            StarScan scan = hl.starscan;

                            StarScan.SystemNode sn = scan.FindSystem(last.System, true);    // EDSM look up here..

                            string res = null;

                            if (sn != null && sn.starnodes.Count > 0 && sn.starnodes.Values[0].ScanData != null)
                            {
                                JournalScan js = sn.starnodes.Values[0].ScanData;
                                res = js.HabZoneString().Replace("\r\n", " ");
                            }

                            if (res != null)
                            {
                                AddColText(0, 0, rowpos, rowheight, res, textcolour, backcolour, null);
                                rowpos += rowheight;
                            }
                        }

                        if (targetpresent && Config(Configuration.showTargetLine) && currentsystem != null)
                        {
                            string dist = (currentsystem.HasCoordinate) ? currentsystem.Distance(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();
        }
Exemplo n.º 12
0
        private async void Display(HistoryList hl)
        {
            pictureBox.ClearImageList();

            current_historylist = hl;

            if (hl != null && hl.Count > 0)                                                                   // just for safety
            {
                List <HistoryEntry> result = current_historylist.LatestFirst();                               // Standard filtering

                int ftotal;                                                                                   // event filter
                result = HistoryList.FilterByJournalEvent(result, GetSetting(dbFilter, "All"), out ftotal);
                result = FilterHelpers.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 rowmargin = displayfont.ScalePixels(4);

                    // Check if need to hide the UI
                    var ts = hl.CurrentTravelState();

                    if (Config(Configuration.showNothingWhenDocked) && (ts == HistoryEntryStatus.TravelStateType.Docked))
                    {
                        if (!Config(Configuration.showNoTitleWhenHidden))
                        {
                            AddColText(0, 0, rowpos, "<>", textcolour, backcolour, null);                                   // just show a marker
                        }
                    }
                    else if (uistate != EliteDangerousCore.UIEvents.UIGUIFocus.Focus.NoFocus && Config(Configuration.showNothingWhenPanel))
                    {
                        if (!Config(Configuration.showNoTitleWhenHidden))
                        {
                            AddColText(0, 0, rowpos, uistate.ToString().SplitCapsWord(),
                                       textcolour, backcolour, null);
                        }
                    }
                    else
                    {
                        string  name;
                        Point3D tpos;
                        bool    targetpresent = TargetClass.GetTargetPosition(out name, out tpos);

                        ISystem currentsystem = hl.CurrentSystem(); // may be null

                        HistoryEntry last = hl.GetLast;

                        // last = hl.FindByName("Myeia Thaa QY-H c23-0");

                        if (Config(Configuration.showSystemInformation) && last != null)
                        {
                            string allegiance, economy, gov, faction, factionstate, security;
                            hl.ReturnSystemInfo(last, out allegiance, out economy, out gov, out faction, out factionstate, out security);

                            string str = last.System.Name + " : " + BaseUtils.FieldBuilder.Build(
                                "", faction,
                                "", factionstate,
                                "", security,
                                "", allegiance,
                                "", economy,
                                "", gov
                                );


                            HistoryEntry lastfsd        = hl.GetLastHistoryEntry(x => x.journalEntry is EliteDangerousCore.JournalEvents.JournalFSDJump, last);
                            bool         firstdiscovery = (lastfsd != null && (lastfsd.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).EDSMFirstDiscover);

                            rowpos = rowmargin + AddColText(0, 0, rowpos, str, textcolour, backcolour, null, firstdiscovery ? EDDiscovery.Icons.Controls.firstdiscover : null, "Shows if EDSM indicates your it's first discoverer").Location.Bottom;
                        }

                        if (Config(Configuration.showHabInformation) && last != null)
                        {
                            StarScan scan = hl.StarScan;

                            StarScan.SystemNode sn = await scan.FindSystemAsync(last.System, true);    // EDSM look up here..

                            StringBuilder res = new StringBuilder();

                            if (sn != null && sn.StarNodes.Count > 0 && sn.StarNodes.Values[0].ScanData != null)
                            {
                                JournalScan js = sn.StarNodes.Values[0].ScanData;

                                if (showCircumstellarZonesToolStripMenuItem.Checked)
                                {
                                    string hz = js.CircumstellarZonesString(false, JournalScan.CZPrint.CZHab);
                                    res.AppendFormat(hz + Environment.NewLine);
                                }

                                if (showMetalRichPlanetsToolStripMenuItem.Checked)
                                {
                                    string hz = js.CircumstellarZonesString(false, JournalScan.CZPrint.CZMR);
                                    res.AppendFormat(hz + Environment.NewLine);
                                }

                                if (showWaterWorldsToolStripMenuItem.Checked)
                                {
                                    string hz = js.CircumstellarZonesString(false, JournalScan.CZPrint.CZWW);
                                    res.AppendFormat(hz + Environment.NewLine);
                                }

                                if (showEarthLikeToolStripMenuItem.Checked)
                                {
                                    string hz = js.CircumstellarZonesString(false, JournalScan.CZPrint.CZEL);
                                    res.AppendFormat(hz + Environment.NewLine);
                                }

                                if (showAmmoniaWorldsToolStripMenuItem.Checked)
                                {
                                    string hz = js.CircumstellarZonesString(false, JournalScan.CZPrint.CZAW);
                                    res.AppendFormat(hz + Environment.NewLine);
                                }

                                if (showIcyPlanetsToolStripMenuItem.Checked)
                                {
                                    string hz = js.CircumstellarZonesString(false, JournalScan.CZPrint.CZIP);
                                    res.AppendFormat(hz + Environment.NewLine);
                                }
                            }

                            if (res.ToString().HasChars())
                            {
                                rowpos = rowmargin + AddColText(0, 0, rowpos, res.ToString(), textcolour, backcolour, null).Location.Bottom;
                            }
                        }

                        if (targetpresent && Config(Configuration.showTargetLine) && currentsystem != null)
                        {
                            string dist = (currentsystem.HasCoordinate) ? currentsystem.Distance(tpos.X, tpos.Y, tpos.Z).ToString("0.00") : "Unknown".T(EDTx.Unknown);
                            rowpos = rowmargin + AddColText(0, 0, rowpos, "Target".T(EDTx.UserControlSpanel_Target) + ": " + name + " @ " + dist + " ly", textcolour, backcolour, null).Location.Bottom;
                        }

                        foreach (HistoryEntry rhe in result)
                        {
                            rowpos = rowmargin + DrawHistoryEntry(rhe, rowpos, tpos, textcolour, backcolour);

                            if (rowpos > ClientRectangle.Height)                // stop when off of screen
                            {
                                break;
                            }
                        }
                    }
                }

                DrawScanText(false, textcolour, backcolour);     // go 2
            }

            pictureBox.Render();
        }
        private void Display(HistoryList hl, bool disablesorting)
        {
            if (hl == null)     // just for safety
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;

            current_historylist = hl;

            Tuple <long, int> pos = CurrentGridPosByJID();

            SortOrder sortorder = dataGridViewJournal.SortOrder;
            int       sortcol   = dataGridViewJournal.SortedColumn?.Index ?? -1;

            if (sortcol >= 0 && disablesorting)
            {
                dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = SortOrder.None;
                sortcol = -1;
            }

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCount100 + " JG " + displaynumber + " Load start");

            List <HistoryEntry> result = filter.Filter(hl);

            fdropdown = hl.Count() - result.Count();

            result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotalevents);
            result = FilterHelpers.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotalfilters);

            dataGridViewJournal.Rows.Clear();
            rowsbyjournalid.Clear();

            for (int ii = 0; ii < result.Count; ii++) //foreach (var item in result)
            {
                DataGridViewRow rw = CreateHistoryRow(result[ii], textBoxFilter.Text);
                if (rw != null)
                {
                    dataGridViewJournal.Rows.Add(rw);
                }
            }

            UpdateToolTipsForFilter();

            int rowno = FindGridPosByJID(pos.Item1, true);

            if (rowno >= 0)
            {
                dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well            currentGridRow = (rowno!=-1) ?
            }

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time";

            System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCount100 + " JG " + displaynumber + " Load Finish");

            if (sortcol >= 0)
            {
                dataGridViewJournal.Sort(dataGridViewJournal.Columns[sortcol], (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = sortorder;
            }

            FireChangeSelection();

            this.Cursor = Cursors.Default;
        }