<commit_before>﻿/*
 * Copyright © 2016 - 2017 EDDiscovery development team
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 * 
 * EDDiscovery is not affiliated with Frontier Developments plc.
 */
using EDDiscovery.Controls;
using EDDiscovery.Forms;
using EliteDangerousCore;
using EliteDangerousCore.DB;
using ExtendedControls;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EDDiscovery.UserControls
{
    public partial class UserControlShoppingList : UserControlCommonBase
    {
        private int displaynumber = 0;
        private EDDiscoveryForm discoveryform;
        private UserControlCursorType uctg;
        private List<Tuple<MaterialCommoditiesList.Recipe, int>> EngineeringWanted = new List<Tuple<MaterialCommoditiesList.Recipe, int>>();
        private List<Tuple<MaterialCommoditiesList.Recipe, int>> SynthesisWanted = new List<Tuple<MaterialCommoditiesList.Recipe, int>>();
        private Font displayfont;
        HistoryEntry last_he = null;
        const int PhysicalInventoryCapacity = 1000;
        const int DataInventoryCapacity = 500;

        #region Init

        public UserControlShoppingList()
        {
            InitializeComponent();
        }

        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            discoveryform.OnNewEntry += Discoveryform_OnNewEntry;
            uctg = thc;
            displaynumber = vn;
            displayfont = discoveryform.theme.GetFont;

            userControlEngineering.isEmbedded = true;
            userControlEngineering.OnChangedEngineeringWanted += Engineering_OnWantedChange;
            //Can use display number for it, because their names for db save are unique between engineering and synthesis.
            userControlEngineering.Init(ed, thc, displaynumber);
            userControlSynthesis.isEmbedded = true;
            userControlSynthesis.OnChangedSynthesisWanted += Synthesis_OnWantedChange;
            userControlSynthesis.Init(ed, thc, displaynumber);
        }

        public override void ChangeCursorType(UserControlCursorType thc)
        {
            uctg.OnTravelSelectionChanged -= Display;
            uctg = thc;
            uctg.OnTravelSelectionChanged += Display;
        }

        #endregion

        #region Display

        public override void InitialDisplay()
        {
            last_he = uctg.GetCurrentHistoryEntry;
            userControlEngineering.InitialDisplay();
            userControlSynthesis.InitialDisplay();
            Display();
        }

        public override Color ColorTransparency { get { return Color.Green; } }
        public override void SetTransparency(bool on, Color curcol)
        {
            pictureBoxList.BackColor = this.BackColor = splitContainer1.BackColor = splitContainer2.BackColor = curcol;
            splitContainer1.Panel1.BackColor = splitContainer1.Panel2.BackColor = curcol;
            splitContainer2.Panel1.BackColor = splitContainer2.Panel2.BackColor = curcol;
            Display();
        }

        private void Engineering_OnWantedChange(List<Tuple<MaterialCommoditiesList.Recipe, int>> wanted)
        {
            EngineeringWanted = wanted;
            Display();
        }

        private void Synthesis_OnWantedChange(List<Tuple<MaterialCommoditiesList.Recipe, int>> wanted)
        {
            SynthesisWanted = wanted;
            Display();
        }

        private void Discoveryform_OnNewEntry(HistoryEntry he, HistoryList hl)
        {
            last_he = he;
            Display();
        }

        private void Display(HistoryEntry he, HistoryList hl)<commit_msg>Material events only<commit_after>﻿/*
 * Copyright © 2016 - 2017 EDDiscovery development team
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
 * ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 * 
 * EDDiscovery is not affiliated with Frontier Developments plc.
 */
using EDDiscovery.Controls;
using EDDiscovery.Forms;
using EliteDangerousCore;
using EliteDangerousCore.DB;
using ExtendedControls;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EDDiscovery.UserControls
{
    public partial class UserControlShoppingList : UserControlCommonBase
    {
        private int displaynumber = 0;
        private EDDiscoveryForm discoveryform;
        private UserControlCursorType uctg;
        private List<Tuple<MaterialCommoditiesList.Recipe, int>> EngineeringWanted = new List<Tuple<MaterialCommoditiesList.Recipe, int>>();
        private List<Tuple<MaterialCommoditiesList.Recipe, int>> SynthesisWanted = new List<Tuple<MaterialCommoditiesList.Recipe, int>>();
        private Font displayfont;
        HistoryEntry last_he = null;
        const int PhysicalInventoryCapacity = 1000;
        const int DataInventoryCapacity = 500;

        #region Init

        public UserControlShoppingList()
        {
            InitializeComponent();
        }

        public override void Init(EDDiscoveryForm ed, UserControlCursorType thc, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            discoveryform.OnNewEntry += Discoveryform_OnNewEntry;
            uctg = thc;
            displaynumber = vn;
            displayfont = discoveryform.theme.GetFont;

            userControlEngineering.isEmbedded = true;
            userControlEngineering.OnChangedEngineeringWanted += Engineering_OnWantedChange;
            //Can use display number for it, because their names for db save are unique between engineering and synthesis.
            userControlEngineering.Init(ed, thc, displaynumber);
            userControlSynthesis.isEmbedded = true;
            userControlSynthesis.OnChangedSynthesisWanted += Synthesis_OnWantedChange;
            userControlSynthesis.Init(ed, thc, displaynumber);
        }

        public override void ChangeCursorType(UserControlCursorType thc)
        {
            uctg.OnTravelSelectionChanged -= Display;
            uctg = thc;
            uctg.OnTravelSelectionChanged += Display;
        }

        #endregion

        #region Display

        public override void InitialDisplay()
        {
            last_he = uctg.GetCurrentHistoryEntry;
            userControlEngineering.InitialDisplay();
            userControlSynthesis.InitialDisplay();
            Display();
        }

        public override Color ColorTransparency { get { return Color.Green; } }
        public override void SetTransparency(bool on, Color curcol)
        {
            pictureBoxList.BackColor = this.BackColor = splitContainer1.BackColor = splitContainer2.BackColor = curcol;
            splitContainer1.Panel1.BackColor = splitContainer1.Panel2.BackColor = curcol;
            splitContainer2.Panel1.BackColor = splitContainer2.Panel2.BackColor = curcol;
            Display();
        }

        private void Engineering_OnWantedChange(List<Tuple<MaterialCommoditiesList.Recipe, int>> wanted)
        {
            EngineeringWanted = wanted;
            Display();
        }

        private void Synthesis_OnWantedChange(List<Tuple<MaterialCommoditiesList.Recipe, int>> wanted)
        {
            SynthesisWanted = wanted;
            Display();
        }

        private void Discoveryform_OnNewEntry(HistoryEntry he, HistoryList hl)
        {
            last_he = he;
            if (he is IMaterialCommodityJournalEntry)
                Display();
        }

        private void Display(HistoryEntry he, HistoryList hl)
{'fraction_non_alphanumeric': 0.06827913435944914, 'fraction_numerical': 0.007406550167804653, 'mean_word_length': 2.7557583659278575, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1455525', 'n_tokens_mistral': 2244, 'n_tokens_neox': 2127, 'n_words': 611}