Esempio n. 1
0
        void TabPostCreate(ExtendedControls.TabStrip t, Control ctrl, int i) // called by tab strip after control has been added..
        {                                                                    // now we can do the configure of it, with the knowledge the tab has the right size
            int displaynumber = (int)t.Tag;                                  // tab strip - use tag to remember display id which helps us save context.

            UserControlCommonBase uc = ctrl as UserControlCommonBase;

            if (uc != null)
            {
                UserControlPostCreate(displaynumber, uc);
                uc.Display(userControlTravelGrid.GetCurrentHistoryEntry, _discoveryForm.history);
            }

            //System.Diagnostics.Debug.WriteLine("And theme {0}", i);
            _discoveryForm.theme.ApplyToControls(t);
        }
Esempio n. 2
0
        public List <UserControlCommonBase> GetListOfControls(Type c)
        {
            List <UserControlCommonBase> lc = new List <UserControlCommonBase>();

            foreach (UserControlForm tcf in tabforms)
            {
                if (tcf.isloaded)
                {
                    UserControlCommonBase uc = tcf.FindUserControl(c);
                    if (uc != null)
                    {
                        lc.Add(uc);
                    }
                }
            }

            return(lc);
        }
        public void UserControlPostCreate(int displaynumber, UserControlCommonBase ctrl)
        {
            ctrl.Init(_discoveryForm, displaynumber);
            ctrl.LoadLayout();

            if (ctrl is UserControlLog)
            {
                UserControlLog sc = ctrl as UserControlLog;
                sc.AppendText(_discoveryForm.LogText, _discoveryForm.theme.TextBlockColor);
            }
            else if (ctrl is UserControlStarDistance)
            {
                UserControlStarDistance sc = ctrl as UserControlStarDistance;
                if (lastclosestsystems != null)           // if we have some, fill in this grid
                {
                    sc.FillGrid(lastclosestname, lastclosestsystems);
                }
            }
            else if (ctrl is UserControlMaterials)
            {
                UserControlMaterials ucm = ctrl as UserControlMaterials;
            }
            else if (ctrl is UserControlCommodities)
            {
                UserControlCommodities ucm = ctrl as UserControlCommodities;
            }
            else if (ctrl is UserControlLedger)
            {
                UserControlLedger ucm = ctrl as UserControlLedger;
                ucm.OnGotoJID += GotoJID;
            }
            else if (ctrl is UserControlJournalGrid)
            {
                UserControlJournalGrid ucm = ctrl as UserControlJournalGrid;
                ucm.NoHistoryIcon();
                ucm.NoPopOutIcon();
            }
            else if (ctrl is UserControlTravelGrid)
            {
                UserControlTravelGrid ucm = ctrl as UserControlTravelGrid;
                ucm.NoHistoryIcon();
                ucm.NoPopOutIcon();
            }
        }
Esempio n. 4
0
 internal void LoadSavedPopouts()
 {
     foreach (int popout in Enum.GetValues(typeof(PopOuts)))
     {
         int numToOpen = SQLiteConnectionUser.GetSettingInt("SavedPopouts:" + ((PopOuts)popout).ToString(), 0);
         if (numToOpen > 0)
         {
             UserControlCommonBase ctrl = Create((PopOuts)popout);
             int numOpened = ctrl == null ? 0 : usercontrolsforms.CountOf(ctrl.GetType());
             if (numOpened < numToOpen)
             {
                 for (int i = numOpened + 1; i <= numToOpen; i++)
                 {
                     PopOut((PopOuts)popout);
                 }
             }
         }
     }
 }
Esempio n. 5
0
        public void Init(EDDiscovery.UserControls.UserControlCommonBase c, string title, bool winborder, string rf, bool deftopmostp,
                         bool deftransparentp, Color labelnormal, Color labeltransparent)
        {
            //System.Diagnostics.Debug.WriteLine("UCF Init+");
            RestoreFormPositionRegKey = "PopUpForm" + rf;      // position remember key

            UserControl = c;
            c.Dock      = DockStyle.None;
            c.Location  = new Point(0, 10);
            c.Size      = new Size(200, 200);
            this.Controls.Add(c);
            deftransparent         = deftransparentp; // only applied if allowed to be transparent.
            labelnormalcolour      = labelnormal;
            labeltransparentcolour = labeltransparent;

            transparencycolor = c.ColorTransparency;

            wintitle = label_index.Text = this.Text = title;            // label index always contains the wintitle, but may not be shown

            curwindowsborder = defwindowsborder = winborder;
            dbrefname        = "PopUpForm" + rf;
            this.Name        = rf;
            deftopmost       = deftopmostp;
            deftransparent   = false;

            labelControlText.Text = "";                                 // always starts blank..

            this.ShowInTaskbar = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(dbrefname + "Taskbar", true);

            displayTitle = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(dbrefname + "ShowTitle", true);

            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                idk = DirectInputDevices.InputDeviceKeyboard.CreateKeyboard();
            }

            UpdateControls();

            Invalidate();

            BaseUtils.Translator.Instance.Translate(toolTip1, this);
            //System.Diagnostics.Debug.WriteLine("UCF Init-");
        }
Esempio n. 6
0
        public UserControlCommonBase PopOut(PanelInformation.PanelIDs selected)
        {
            Forms.UserControlForm tcf = usercontrolsforms.NewForm();
            tcf.Icon = Properties.Resources.edlogo_3mo_icon;

            UserControlCommonBase ctrl = PanelInformation.Create(selected);

            PanelInformation.PanelInfo poi = PanelInformation.GetPanelInfoByPanelID(selected);

            if (ctrl != null && poi != null)
            {
                int    numopened   = usercontrolsforms.CountOf(ctrl.GetType()) + 1;
                string windowtitle = poi.WindowTitle + " " + ((numopened > 1) ? numopened.ToString() : "");
                string refname     = poi.WindowRefName + numopened.ToString();

                System.Diagnostics.Trace.WriteLine("PO:Make " + windowtitle + " ucf " + ctrl.GetType().Name);

                //System.Diagnostics.Debug.WriteLine("TCF init");
                tcf.Init(ctrl, windowtitle, discoveryform.theme.WindowsFrame, refname, discoveryform.TopMost,
                         poi.DefaultTransparent, discoveryform.theme.LabelColor, discoveryform.theme.SPanelColor);

                //System.Diagnostics.Debug.WriteLine("UCCB init of " + ctrl.GetType().Name);
                ctrl.Init(discoveryform, UserControls.UserControlCommonBase.DisplayNumberPopOuts + numopened - 1);

                //System.Diagnostics.Debug.WriteLine("Show");
                tcf.Show();                                                     // this ends up, via Form Shown, calls LoadLayout in the UCCB.

                if (tcf.UserControl != null)
                {
                    tcf.UserControl.Font = discoveryform.theme.GetFont;        // Important. Apply font autoscaling to the user control
                }
                // ApplyToForm does not apply the font to the actual UC, only
                // specific children controls.  The TabControl in the discoveryform ends up autoscaling most stuff
                // the children directly attached to the discoveryform are not autoscaled

                discoveryform.theme.ApplyToForm(tcf);

                discoveryform.ActionRun(Actions.ActionEventEDList.onPopUp, null, new BaseUtils.Variables(new string[] { "PopOutName", refname, "PopOutTitle", windowtitle, "PopOutIndex", numopened.ToString() }));
            }

            return(ctrl);
        }
Esempio n. 7
0
        public void PopOut(int ix)
        {
            UserControlForm tcf = usercontrolsforms.NewForm(EDDiscovery.EDDOptions.Instance.NoWindowReposition);

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EDDiscovery.EDDiscoveryForm));
            tcf.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

            UserControlCommonBase ctrl = Create(ix);

            PopOutInfo poi = PopOutList[ix];

            if (ctrl != null && poi != null)
            {
                int    numopened   = usercontrolsforms.CountOf(ctrl.GetType()) + 1;
                string windowtitle = poi.WindowTitlePrefix + " " + ((numopened > 1) ? numopened.ToString() : "");
                string refname     = poi.WindowRefName + numopened.ToString();
                tcf.Init(ctrl, windowtitle, _discoveryForm.theme.WindowsFrame, refname, _discoveryForm.TopMost);
                if (poi.SupportsTransparency)
                {
                    tcf.InitForTransparency(poi.DefaultTransparent, _discoveryForm.theme.LabelColor, _discoveryForm.theme.SPanelColor);
                }

                ctrl.Init(_discoveryForm, _discoveryForm.TravelControl.GetTravelGrid, numopened);

                tcf.Show();                                                     // this ends up, via Form Shown, calls LoadLayout in the UCCB.

                if (tcf.UserControl != null)
                {
                    tcf.UserControl.Font = _discoveryForm.theme.GetFont;        // Important. Apply font autoscaling to the user control
                }
                // ApplyToForm does not apply the font to the actual UC, only
                // specific children controls.  The TabControl in the discoveryform ends up autoscaling most stuff
                // the children directly attached to the discoveryform are not autoscaled

                _discoveryForm.theme.ApplyToForm(tcf);

                ctrl.Display(_discoveryForm.TravelControl.GetTravelHistoryCurrent, _discoveryForm.history);

                _discoveryForm.ActionRun(Actions.ActionEventEDList.onPopUp, null, new Conditions.ConditionVariables(new string[] { "PopOutName", refname, "PopOutTitle", windowtitle, "PopOutIndex", numopened.ToString() }));
            }
        }
Esempio n. 8
0
        internal void LoadSavedPopouts()
        {
            foreach (int ip in Enum.GetValues(typeof(PanelInformation.PanelIDs)))     // in terms of PopOut ENUM
            {
                PanelInformation.PanelIDs p = (PanelInformation.PanelIDs)ip;

                int numToOpen = SQLiteConnectionUser.GetSettingInt("SavedPanelInformation.PopOuts:" + p.ToString(), 0);
                if (numToOpen > 0)
                {
                    UserControlCommonBase ctrl = PanelInformation.Create(p);
                    int numOpened = ctrl == null ? 0 : usercontrolsforms.CountOf(ctrl.GetType());
                    if (numOpened < numToOpen)
                    {
                        for (int i = numOpened + 1; i <= numToOpen; i++)
                        {
                            PopOut(p);
                        }
                    }
                }
            }
        }
Esempio n. 9
0
        public void PopOut(PopOutControl.PopOuts selected)
        {
            UserControlForm tcf = usercontrolsforms.NewForm(EDDiscovery.EDDConfig.Options.NoWindowReposition);

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EDDiscovery.EDDiscoveryForm));
            tcf.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

            UserControlCommonBase ctrl = Create(selected);
            int numopened = ctrl == null ? 0 : usercontrolsforms.CountOf(ctrl.GetType()) + 1;

            if (ctrl != null)
            {
                PopOutInfo poi         = popoutinfo.ContainsKey(selected) ? popoutinfo[selected] : new PopOutInfo();
                string     windowtitle = poi.WindowTitlePrefix + " " + ((numopened > 1) ? numopened.ToString() : "");
                string     refname     = poi.WindowRefName + numopened.ToString();
                tcf.Init(ctrl, windowtitle, _discoveryForm.theme.WindowsFrame, refname, _discoveryForm.TopMost);
                if (poi.SupportsTransparency)
                {
                    tcf.InitForTransparency(poi.DefaultTransparent, _discoveryForm.theme.LabelColor, _discoveryForm.theme.SPanelColor);
                }

                _discoveryForm.TravelControl.UserControlPostCreate(numopened, ctrl);        // YUK YUK YUK wire up to some internals.. at some point this needs sorting out
                tcf.Show();

                if (tcf.UserControl != null)
                {
                    tcf.UserControl.Font = _discoveryForm.theme.GetFont;        // Important. Apply font autoscaling to the user control
                }
                // ApplyToForm does not apply the font to the actual UC, only
                // specific children controls.  The TabControl in the discoveryform ends up autoscaling most stuff
                // the children directly attached to the discoveryform are not autoscaled

                _discoveryForm.theme.ApplyToForm(tcf);

                ctrl.Display(_discoveryForm.TravelControl.GetTravelHistoryCurrent, _discoveryForm.history);

                _discoveryForm.ActionRun("onPopUp", "UserUIEvent", null, new Conditions.ConditionVariables(new string[] { "PopOutName", refname, "PopOutTitle", windowtitle, "PopOutIndex", numopened.ToString() }));
            }
        }
Esempio n. 10
0
        public void Init(EDDiscovery.UserControls.UserControlCommonBase c, string title, bool winborder, string rf, bool deftopmostp,
                         bool deftransparentp, Color labelnormal, Color labeltransparent)
        {
            RestoreFormPositionRegKey = "PopUpForm" + rf;      // position remember key

            UserControl = c;
            c.Dock      = DockStyle.None;
            c.Location  = new Point(0, 10);
            c.Size      = new Size(200, 200);
            this.Controls.Add(c);
            deftransparent         = deftransparentp; // only applied if allowed to be transparent.
            labelnormalcolour      = labelnormal;
            labeltransparentcolour = labeltransparent;

            transparencycolor = c.ColorTransparency;

            wintitle = label_index.Text = this.Text = title;            // label index always contains the wintitle, but may not be shown

            curwindowsborder = defwindowsborder = winborder;
            dbrefname        = "PopUpForm" + rf;
            this.Name        = rf;
            deftopmost       = deftopmostp;
            deftransparent   = false;

            labelControlText.Text = "";                                 // always starts blank..

            this.ShowInTaskbar = SQLiteDBClass.GetSettingBool(dbrefname + "Taskbar", true);

            displayTitle = SQLiteDBClass.GetSettingBool(dbrefname + "ShowTitle", true);

#if !__MonoCS__
            idk = DirectInputDevices.InputDeviceKeyboard.CreateKeyboard();
#endif
            UpdateControls();

            Invalidate();

            BaseUtils.Translator.Instance.Translate(toolTip1, this);
        }
Esempio n. 11
0
        public void PopOut(int ix)
        {
            UserControlForm tcf = usercontrolsforms.NewForm();

            tcf.Icon = Properties.Resources.edlogo_3mo_icon;

            UserControlCommonBase ctrl = PanelInformation.Create(ix);

            PanelInformation.PanelInfo poi = PanelInformation.PanelList[ix];

            if (ctrl != null && poi != null)
            {
                int    numopened   = usercontrolsforms.CountOf(ctrl.GetType()) + 1;
                string windowtitle = poi.WindowTitlePrefix + " " + ((numopened > 1) ? numopened.ToString() : "");
                string refname     = poi.WindowRefName + numopened.ToString();
                tcf.Init(ctrl, windowtitle, discoveryform.theme.WindowsFrame, refname, discoveryform.TopMost,
                         poi.DefaultTransparent, discoveryform.theme.LabelColor, discoveryform.theme.SPanelColor);

                ctrl.Init(discoveryform, discoveryform.TravelControl.GetTravelGrid, UserControls.UserControlCommonBase.DisplayNumberPopOuts + numopened - 1);

                tcf.Show();                                                     // this ends up, via Form Shown, calls LoadLayout in the UCCB.

                if (tcf.UserControl != null)
                {
                    tcf.UserControl.Font = discoveryform.theme.GetFont;        // Important. Apply font autoscaling to the user control
                }
                // ApplyToForm does not apply the font to the actual UC, only
                // specific children controls.  The TabControl in the discoveryform ends up autoscaling most stuff
                // the children directly attached to the discoveryform are not autoscaled

                discoveryform.theme.ApplyToForm(tcf);

                ctrl.InitialDisplay();

                discoveryform.ActionRun(Actions.ActionEventEDList.onPopUp, null, new Conditions.ConditionVariables(new string[] { "PopOutName", refname, "PopOutTitle", windowtitle, "PopOutIndex", numopened.ToString() }));
            }
        }
Esempio n. 12
0
        void TabRemoved(ExtendedControls.TabStrip t, Control ctrl)      // called by tab strip when a control is removed
        {
            UserControlCommonBase uccb = ctrl as UserControlCommonBase;

            uccb.Closing();
        }
Esempio n. 13
0
        public static void Help(Form parent, Point p, UserControlCommonBase uccb)
        {
            var pid = PanelInformation.GetPanelIDByControltype(uccb.GetType());

            Help(parent, p, pid.ToString());
        }