public override void LoadLayout()
        {
            // ORDER IMPORTANT for right outer/inner splitter, otherwise windows fixes it

            if (!EDDOptions.Instance.NoWindowReposition)
            {
                splitContainerLeftRight.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterLR", 0.75));
                splitContainerLeft.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterL", 0.75));
                splitContainerRightOuter.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterRO", 0.4));
                splitContainerRightInner.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterR", 0.5));
            }

            userControlTravelGrid.LoadLayout();

            // NO NEED to reload the three tabstrips - code below will cause a LoadLayout on the one selected.

            int max = PanelInformation.GetNumberPanels - 1; // fix, its up to but not including endlist

            // saved as the pop out enum value, for historical reasons
            int piindex_bottom      = Math.Min(SQLiteDBClass.GetSettingInt("TravelControlBottomTab", (int)(PanelInformation.PanelIDs.Scan)), max);
            int piindex_bottomright = Math.Min(SQLiteDBClass.GetSettingInt("TravelControlBottomRightTab", (int)(PanelInformation.PanelIDs.Log)), max);
            int piindex_middleright = Math.Min(SQLiteDBClass.GetSettingInt("TravelControlMiddleRightTab", (int)(PanelInformation.PanelIDs.StarDistance)), max);
            int piindex_topright    = Math.Min(SQLiteDBClass.GetSettingInt("TravelControlTopRightTab", (int)(PanelInformation.PanelIDs.SystemInformation)), max);

            tabStripBottom.SelectedIndex      = PanelInformation.GetPanelIndexByEnum((PanelInformation.PanelIDs)piindex_bottom);  // translate to image index
            tabStripBottomRight.SelectedIndex = PanelInformation.GetPanelIndexByEnum((PanelInformation.PanelIDs)piindex_bottomright);
            tabStripMiddleRight.SelectedIndex = PanelInformation.GetPanelIndexByEnum((PanelInformation.PanelIDs)piindex_middleright);
            tabStripTopRight.SelectedIndex    = PanelInformation.GetPanelIndexByEnum((PanelInformation.PanelIDs)piindex_topright);
        }
        public override void Init()
        {
            DBBaseName = "GridControl";

            var enumlisttt = new Enum[] { EDTx.UserControlContainerGrid_buttonExtTile_ToolTip, EDTx.UserControlContainerGrid_buttonExtDelete_ToolTip, EDTx.UserControlContainerGrid_buttonExtPopOut_ToolTip };

            BaseUtils.Translator.Instance.TranslateTooltip(toolTip, enumlisttt, this);
            rollUpPanelMenu.SetToolTip(toolTip);    // use the defaults

            //System.Diagnostics.Debug.WriteLine("Grid Restore from " + DBWindowNames);

            var windows = GetSavedSettings();

            if (windows != null)
            {
                foreach (var n in windows)
                {
                    UserControlCommonBase uccb = PanelInformation.Create(n.Item1);
                    if (uccb != null)
                    {
                        CreateInitPanel(uccb);
                    }
                }
            }

            rollUpPanelMenu.PinState = GetSetting(dbRolledUp, true);

            ResumeLayout();
            UpdateButtons();

            // contract states the PanelAndPopOuts OR the MajorTabControl will now theme and size it.
        }
        public override void Closing()
        {
            PanelInformation.PanelIDs[] pids = PanelInformation.GetPanelIDs();

            string state = ControlHelpersStaticFunc.SplitterTreeState(panelPlayfield.Controls[0] as SplitContainer, "",
                                                                      (c) => // S is either a TabStrip, or a direct UCCB. See the
            {
                ExtendedControls.TabStrip ts = c as ExtendedControls.TabStrip;
                int tagid = (int)c.Tag;
                if (ts != null)           // if tab strip..
                {
                    return(tagid.ToStringInvariant() + "," + (ts.SelectedIndex >= 0 ? (int)pids[ts.SelectedIndex] : NoTabPanelSelected).ToStringInvariant());
                }
                else
                {
                    PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByType(c.GetType());           // must return, as it must be one of the UCCB types
                    return(tagid.ToStringInvariant() + "," + (FixedPanelOffset + ((int)pi.PopoutID)).ToStringInvariant());
                }
            });

            //System.Diagnostics.Debug.WriteLine("Split save " + state);
            SQLiteConnectionUser.PutSettingString(DbWindows, state);

            (panelPlayfield.Controls[0] as SplitContainer).RunActionOnSplitterTree((p, c) =>        // runs on each split panel node exactly..
            {
                UserControlCommonBase uccb = ((c is ExtendedControls.TabStrip) ? ((c as ExtendedControls.TabStrip).CurrentControl) : c) as UserControlCommonBase;
                if (uccb != null)     // tab strip may not have a control set..
                {
                    uccb.Closing();
                    //System.Diagnostics.Debug.WriteLine("Closing " + c.Name + " " + c.GetType().Name + " " + uccb.Name);
                }
            });
        }
示例#4
0
 void Update()
 {
     if (MyModel != null && EnemysModel != null && (MyModel.ActualHealth <= 0 || EnemysModel.ActualHealth <= 0))
     {
         PanelInformation.GetComponent <PanelInformation>().SetText((MyModel.ActualHealth > 0 ? "You won" : "You lost"));
     }
 }
示例#5
0
        private void buttonExtPopOut_Click(object sender, EventArgs e)
        {
            popoutdropdown = new ExtendedControls.DropDownCustom("", true);

            popoutdropdown.ItemHeight     = 26;
            popoutdropdown.Items          = PanelInformation.GetUserSelectablePanelDescriptions(EDDConfig.Instance.SortPanelsByName).ToList();
            popoutdropdown.ImageItems     = PanelInformation.GetUserSelectablePanelImages(EDDConfig.Instance.SortPanelsByName).ToList();
            popoutdropdown.ItemSeperators = PanelInformation.GetUserSelectableSeperatorIndex(EDDConfig.Instance.SortPanelsByName);
            PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(EDDConfig.Instance.SortPanelsByName);
            popoutdropdown.FlatStyle  = FlatStyle.Popup;
            popoutdropdown.Activated += (s, ea) =>
            {
                Point location = buttonExtPopOut.PointToScreen(new Point(0, 0));
                popoutdropdown.Location = popoutdropdown.PositionWithinScreen(location.X + buttonExtPopOut.Width, location.Y);
                this.Invalidate(true);
            };
            popoutdropdown.SelectedIndexChanged += (s, ea) =>
            {
                UserControlContainerResizable uccr = CreatePanel(PanelInformation.Create(pids[popoutdropdown.SelectedIndex]),
                                                                 new Point((uccrlist.Count % 5) * 50, (uccrlist.Count % 5) * 50),
                                                                 new Size(Math.Min(300, panelPlayfield.Width - 10), Math.Min(300, panelPlayfield.Height - 10)));
                Select(null);
                uccr.Selected = true;
                uccr.BringToFront();
                UpdateButtons();
                AssignTHC();
            };

            popoutdropdown.Size = new Size(500, 26 * 20);
            discoveryform.theme.ApplyToControls(popoutdropdown);
            popoutdropdown.SelectionBackColor = discoveryform.theme.ButtonBackColor;
            popoutdropdown.Show(this);
        }
        private void buttonExtPopOut_Click(object sender, EventArgs e)
        {
            popoutdropdown = new ExtendedControls.ExtListBoxForm("", true);

            popoutdropdown.Items          = PanelInformation.GetUserSelectablePanelDescriptions(EDDConfig.Instance.SortPanelsByName).ToList();
            popoutdropdown.ImageItems     = PanelInformation.GetUserSelectablePanelImages(EDDConfig.Instance.SortPanelsByName).ToList();
            popoutdropdown.ItemSeperators = PanelInformation.GetUserSelectableSeperatorIndex(EDDConfig.Instance.SortPanelsByName);
            PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(EDDConfig.Instance.SortPanelsByName);
            popoutdropdown.FlatStyle = FlatStyle.Popup;
            popoutdropdown.PositionBelow(buttonExtPopOut);
            popoutdropdown.SelectedIndexChanged += (s, ea) =>
            {
                UserControlContainerResizable uccr = CreateInitPanel(PanelInformation.Create(pids[popoutdropdown.SelectedIndex]));
                // uccb init done above, contract states we now theme.
                discoveryform.theme.ApplyStd(uccr);

                LoadLayoutPanel(uccr, uccr.control as UserControlCommonBase,
                                new Point((uccrlist.Count % 5) * 50, (uccrlist.Count % 5) * 50),
                                new Size(Math.Min(300, panelPlayfield.Width - 10), Math.Min(300, panelPlayfield.Height - 10)));


                Select(null);
                uccr.Selected = true;
                uccr.BringToFront();
                UpdateButtons();
                AssignTHC();
            };

            discoveryform.theme.ApplyStd(popoutdropdown);
            popoutdropdown.SelectionBackColor = discoveryform.theme.ButtonBackColor;
            popoutdropdown.Show(this);
        }
示例#7
0
        public override void Init()
        {
            DBBaseName = "GridControl";

            //System.Diagnostics.Debug.WriteLine("Grid Restore from " + DBWindowNames);

            var windows = GetSavedSettings();

            if (windows != null)
            {
                foreach (var n in windows)
                {
                    UserControlCommonBase uccb = PanelInformation.Create(n.Item1);
                    if (uccb != null)
                    {
                        CreateInitPanel(uccb);
                    }
                }
            }

            ResumeLayout();
            UpdateButtons();

            // contract states the PanelAndPopOuts OR the MajorTabControl will now theme and size it.
        }
        private UserControlContainerResizable CreateInitPanel(UserControlCommonBase uccb)
        {
            UserControlContainerResizable uccr = new UserControlContainerResizable();

            PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByType(uccb.GetType());
            uccr.Init(uccb, pi.WindowTitle);
            uccr.ResizeStart        += ResizeStart;
            uccr.ResizeEnd          += ResizeEnd;
            uccr.BorderColor         = discoveryform.theme.GridBorderLines;
            uccr.SelectedBorderColor = discoveryform.theme.TextBlockHighlightColor;

            uccrlist.Add(uccr);

            int numopenedinside = uccrlist.Count(x => x.GetType().Equals(uccb.GetType()));    // how many others are there?

            int dnum = DisplayNumberOfGrid(numopenedinside);

            panelPlayfield.Controls.Add(uccr);

            //System.Diagnostics.Trace.WriteLine("GD:Create " + uccb.GetType().Name + " " + dnum);
            uccb.Init(discoveryform, dnum);
            discoveryform.theme.ApplyToControls(uccr, discoveryform.theme.GetFont);

            return(uccr);
        }
示例#9
0
        public override void LoadLayout()
        {
            // ORDER IMPORTANT for right outer/inner splitter, otherwise windows fixes it

            if (!EDDOptions.Instance.NoWindowReposition)
            {
                splitContainerLeftRight.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterLR", 0.75));
                splitContainerLeft.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterL", 0.75));
                splitContainerRightOuter.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterRO", 0.4));
                splitContainerRightInner.SplitterDistance(SQLiteDBClass.GetSettingDouble("TravelControlSpliterR", 0.5));
            }

            userControlTravelGrid.LoadLayout();

            // NO NEED to reload the three tabstrips - code below will cause a LoadLayout on the one selected.

            PanelInformation.PanelIDs[] pids = PanelInformation.GetPanelIDs();      // valid PIDs

            // saved as the pop out enum value, for historical reasons. Allow for crap values by using int
            int enum_bottom      = SQLiteDBClass.GetSettingInt("TravelControlBottomTab", (int)(PanelInformation.PanelIDs.Scan));
            int enum_bottomright = SQLiteDBClass.GetSettingInt("TravelControlBottomRightTab", (int)(PanelInformation.PanelIDs.Log));
            int enum_middleright = SQLiteDBClass.GetSettingInt("TravelControlMiddleRightTab", (int)(PanelInformation.PanelIDs.StarDistance));
            int enum_topright    = SQLiteDBClass.GetSettingInt("TravelControlTopRightTab", (int)(PanelInformation.PanelIDs.SystemInformation));

            int ibottom      = Array.IndexOf(pids, (PanelInformation.PanelIDs)enum_bottom);         //given the enum, find it in the list of PIDs
            int ibottomright = Array.IndexOf(pids, (PanelInformation.PanelIDs)enum_bottomright);
            int imiddleright = Array.IndexOf(pids, (PanelInformation.PanelIDs)enum_middleright);
            int itopright    = Array.IndexOf(pids, (PanelInformation.PanelIDs)enum_topright);

            tabStripBottom.SelectedIndex      = ibottom >= 0 ? ibottom : 0;
            tabStripBottomRight.SelectedIndex = ibottomright >= 0 ? ibottomright: 0;
            tabStripMiddleRight.SelectedIndex = imiddleright >= 0 ? imiddleright : 0;
            tabStripTopRight.SelectedIndex    = itopright >= 0 ? itopright : 0;
        }
 void TabConfigure(ExtendedControls.TabStrip t, string name, int displayno)
 {
     t.ImageList        = PanelInformation.GetPanelImages();
     t.TextList         = PanelInformation.GetPanelDescriptions();
     t.Tag              = displayno; // these are IDs for purposes of identifying different instances of a control.. 0 = main ones (main travel grid, main tab journal). 1..N are popups
     t.OnRemoving      += TabRemoved;
     t.OnCreateTab     += TabCreate;
     t.OnPostCreateTab += TabPostCreate;
     t.OnPopOut        += TabPopOut;
     t.Name             = name;
 }
示例#11
0
 public void EndTurn()
 {
     if (Mode != Mode.Ready)
     {
         PanelInformation.GetComponent <PanelInformation>().SetText("Finish " + Mode + " first.");
     }
     else
     {
         StartCoroutine(EndTurnCoroutine());
     }
 }
        Control TabCreate(ExtendedControls.TabStrip t, int si)        // called by tab strip when selected index changes.. create a new one.. only create.
        {
            Control c = PanelInformation.Create(si);

            c.Name = PanelInformation.PanelList[si].WindowTitle;        // tabs uses Name field for display, must set it

            discoveryform.ActionRun(Actions.ActionEventEDList.onPanelChange, null,
                                    new Conditions.ConditionVariables(new string[] { "PanelTabName", PanelInformation.PanelList[si].WindowRefName, "PanelTabTitle", PanelInformation.PanelList[si].WindowTitle, "PanelName", t.Name }));

            return(c);
        }
    /// <summary>
    /// Creates panel of input fields (heading and text) with edit and delete buttons
    /// Adds panel under the main heading in which add button was pressed (under parent object)
    /// </summary>
    /// <param name="parent"> The object to add new panel to </param>
    public void addInfoDel(GameObject parent)
    {
        GameObject       newPanel        = Instantiate(infoDelPrefab, parent.transform);
        PanelInformation thisInformation = newPanel.GetComponent <PanelInformation>();

        thisInformation.editButton.onClick.AddListener(delegate { EditPanel(newPanel); });
        thisInformation.delButton.onClick.AddListener(delegate { DelPanel(newPanel); });

        thisInformation.headingInput.onEndEdit.AddListener(delegate { finishEditText(newPanel); });
        thisInformation.editInput.onEndEdit.AddListener(delegate { finishEditText(newPanel); });

        panelDelList.Add(newPanel);
    }
        private UserControlContainerResizable CreatePanel(UserControlCommonBase uccb, Point pos, Size size)
        {
            UserControlContainerResizable uccr = new UserControlContainerResizable();

            PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByType(uccb.GetType());
            uccr.Init(uccb, pi.WindowTitlePrefix);
            uccr.ResizeStart        += ResizeStart;
            uccr.ResizeEnd          += ResizeEnd;
            uccr.BorderColor         = discoveryform.theme.GridBorderLines;
            uccr.SelectedBorderColor = discoveryform.theme.TextBlockHighlightColor;

            uccrlist.Add(uccr);

            int numopenedinside = uccrlist.Count(x => x.GetType().Equals(uccb.GetType()));    // how many others are there?

            int dnum = DisplayNumberOfGridInstance(numopenedinside);

            //System.Diagnostics.Debug.WriteLine("  Create " + uccb.GetType().Name + " " + dnum + " Assign THC " + ucursor_inuse.GetHashCode() );

            panelPlayfield.Controls.Add(uccr);

            uccb.Init(discoveryform, ucursor_inuse, dnum);
            uccb.LoadLayout();

            uccr.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.ApplyToControls(uccr, discoveryform.theme.GetFont);

            uccr.Location = pos;
            uccr.Size     = size;

            uccb.InitialDisplay();

            if (uccb is UserControlTravelGrid)
            {
                (uccb as UserControlTravelGrid).ExtraIcons(true, false);
            }
            if (uccb is UserControlJournalGrid)
            {
                (uccb as UserControlJournalGrid).ExtraIcons(true, false);
            }

            return(uccr);
        }
        List <Tuple <PanelInformation.PanelIDs, Point, Size, int> > GetSavedSettings()
        {
            string[] names = GetSetting(dbWindowNames, "").Split(',');
            int[]    positions;
            int[]    zorder;
            string   pos = GetSetting(dbPositionSize, "");
            string   zo  = GetSetting(dbZOrder, "");

            if (pos.RestoreArrayFromString(out positions) && zo.RestoreArrayFromString(out zorder, 0, names.Length - 1) &&
                names.Length == zorder.Length && positions.Length == 4 * names.Length)
            {
                var ret = new List <Tuple <PanelInformation.PanelIDs, Point, Size, int> >();
                for (int i = 0; i < names.Length; i++)
                {
                    PanelInformation.PanelIDs pid = PanelInformation.PanelIDs.Log;
                    if (names[i].Contains("UserControl"))
                    {
                        Type t = Type.GetType("EDDiscovery.UserControls." + names[i]);      // previously saved by name, now we are going to save by id from now on for future use
                        if (t == null)
                        {
                            return(null);
                        }

                        var pi = PanelInformation.GetPanelInfoByType(t);            // look it up
                        if (pi == null)
                        {
                            return(null);
                        }

                        pid = pi.PopoutID;
                    }
                    else
                    {
                        pid = (PanelInformation.PanelIDs)names[i].InvariantParseInt(0); // convert to panel ID, default is 0 (log)
                    }
                    int ppos = i * 4;
                    ret.Add(new Tuple <PanelInformation.PanelIDs, Point, Size, int>(pid, new Point(positions[ppos++], positions[ppos++]),
                                                                                    new Size(positions[ppos++], positions[ppos++]), zorder[i]));
                }
                return(ret);
            }
            else
            {
                return(null);
            }
        }
示例#16
0
        public override void Closing()     // called by form when closing
        {
            SQLiteDBClass.PutSettingDouble("TravelControlSpliterLR", splitContainerLeftRight.GetSplitterDistance());
            SQLiteDBClass.PutSettingDouble("TravelControlSpliterL", splitContainerLeft.GetSplitterDistance());
            SQLiteDBClass.PutSettingDouble("TravelControlSpliterRO", splitContainerRightOuter.GetSplitterDistance());
            SQLiteDBClass.PutSettingDouble("TravelControlSpliterR", splitContainerRightInner.GetSplitterDistance());

            PanelInformation.PanelIDs[] pids = PanelInformation.GetPanelIDs();

            SQLiteDBClass.PutSettingInt("TravelControlBottomTab", (int)pids[tabStripBottom.SelectedIndex]);
            SQLiteDBClass.PutSettingInt("TravelControlBottomRightTab", (int)pids[tabStripBottomRight.SelectedIndex]);
            SQLiteDBClass.PutSettingInt("TravelControlMiddleRightTab", (int)pids[tabStripMiddleRight.SelectedIndex]);
            SQLiteDBClass.PutSettingInt("TravelControlTopRightTab", (int)pids[tabStripTopRight.SelectedIndex]);

            userControlTravelGrid.Closing();
            ((UserControlCommonBase)(tabStripBottom.CurrentControl)).Closing();
            ((UserControlCommonBase)(tabStripBottomRight.CurrentControl)).Closing();
            ((UserControlCommonBase)(tabStripMiddleRight.CurrentControl)).Closing();
            ((UserControlCommonBase)(tabStripTopRight.CurrentControl)).Closing();
        }
        private UserControlContainerResizable CreateInitPanel(UserControlCommonBase uccb)
        {
            UserControlContainerResizable uccr = new UserControlContainerResizable();

            PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByType(uccb.GetType());
            uccr.Init(uccb, pi.WindowTitle);
            uccr.ResizeStart        += ResizeStart;
            uccr.ResizeEnd          += ResizeEnd;
            uccr.BorderColor         = ExtendedControls.Theme.Current.GridBorderLines;
            uccr.SelectedBorderColor = ExtendedControls.Theme.Current.TextBlockHighlightColor;

            int numopenedinsidealready = uccrlist.Count(x => x.control.GetType().Equals(uccb.GetType()));    // how many others are there BEFORE add

            uccrlist.Add(uccr);

            int dnum = DisplayNumberOfGrid(numopenedinsidealready);      // will be at least 1 (si

            panelPlayfield.Controls.Add(uccr);

            //System.Diagnostics.Trace.WriteLine("GD:Create " + uccb.GetType().Name + " " + dnum + " " + numopenedinsidealready);
            uccb.Init(discoveryform, dnum);

            return(uccr);
        }
示例#18
0
        public override bool ExecuteAction(ActionProgramRun ap)
        {
            string res;

            if (ap.functions.ExpandString(UserData, out res) != Conditions.ConditionFunctions.ExpandResult.Failed)
            {
                StringParser sp     = new StringParser(res);
                string       prefix = "P_";

                string cmdname = sp.NextQuotedWord();

                if (cmdname != null && cmdname.Equals("PREFIX", StringComparison.InvariantCultureIgnoreCase))
                {
                    prefix = sp.NextWord();

                    if (prefix == null)
                    {
                        ap.ReportError("Missing name after Prefix in in Popout");
                        return(true);
                    }

                    cmdname = sp.NextQuotedWord();
                }

                PopOutControl poc = (ap.actioncontroller as ActionController).DiscoveryForm.PopOuts;

                if (cmdname == null)
                {
                    ap.ReportError("Missing command or popout name in Popout");
                }
                else if (cmdname.Equals("Status", StringComparison.InvariantCultureIgnoreCase))
                {
                    ap[prefix + "Count"] = poc.Count.ToString(System.Globalization.CultureInfo.InvariantCulture);
                    for (int i = 0; i < poc.Count; i++)
                    {
                        ap[prefix + i.ToString(System.Globalization.CultureInfo.InvariantCulture)] = poc[i].Name;
                    }
                }
                else
                {
                    Forms.UserControlForm ucf = poc.GetByWindowsRefName(cmdname);

                    string nextcmd = sp.NextWordLCInvariant(" ");

                    if (nextcmd == null)
                    {
                        ap.ReportError("Missing command after popout name in Popout");
                    }
                    else if (nextcmd.Equals("status"))
                    {
                        ap[prefix + "Exists"] = (ucf != null) ? "1" : "0";

                        if (ucf != null)
                        {
                            ap[prefix + "Transparent"]   = ucf.IsTransparent ? "1" : "0";
                            ap[prefix + "TopMost"]       = ucf.TopMost ? "1" : "0";
                            ap[prefix + "DisplayTitle"]  = ucf.displayTitle ? "1" : "0";
                            ap[prefix + "ShowInTaskbar"] = ucf.ShowInTaskbar ? "1" : "0";
                            ap[prefix + "WindowState"]   = ucf.WindowState.ToString();
                            ap[prefix + "Top"]           = ucf.Top.ToString(System.Globalization.CultureInfo.InvariantCulture);
                            ap[prefix + "Left"]          = ucf.Left.ToString(System.Globalization.CultureInfo.InvariantCulture);
                            ap[prefix + "Width"]         = ucf.Width.ToString(System.Globalization.CultureInfo.InvariantCulture);
                            ap[prefix + "Height"]        = ucf.Height.ToString(System.Globalization.CultureInfo.InvariantCulture);
                        }
                    }
                    else if (ucf != null)        // found a panel with the name
                    {
                        if (nextcmd.Equals("toggle") || nextcmd.Equals("off"))
                        {
                            ucf.Close();
                        }
                        else if (nextcmd.Equals("on"))   // does nothing
                        {
                        }
                        else if (nextcmd.Equals("transparent"))
                        {
                            ucf.SetTransparency(Forms.UserControlForm.TransparencyMode.On);
                        }
                        else if (nextcmd.Equals("opaque"))
                        {
                            ucf.SetTransparency(Forms.UserControlForm.TransparencyMode.Off);
                        }
                        else if (nextcmd.Equals("title"))
                        {
                            ucf.SetShowInTaskBar(true);
                        }
                        else if (nextcmd.Equals("notitle"))
                        {
                            ucf.SetShowInTaskBar(false);
                        }
                        else if (nextcmd.Equals("topmost"))
                        {
                            ucf.SetTopMost(true);
                        }
                        else if (nextcmd.Equals("normalz"))
                        {
                            ucf.SetTopMost(false);
                        }
                        else if (nextcmd.Equals("showintaskbar"))
                        {
                            ucf.SetShowInTaskBar(true);
                        }
                        else if (nextcmd.Equals("notshowintaskbar"))
                        {
                            ucf.SetShowInTaskBar(false);
                        }
                        else if (nextcmd.Equals("minimize"))
                        {
                            ucf.WindowState = FormWindowState.Minimized;
                        }
                        else if (nextcmd.Equals("normal"))
                        {
                            ucf.WindowState = FormWindowState.Normal;
                        }
                        else if (nextcmd.Equals("maximize"))
                        {
                            ucf.WindowState = FormWindowState.Maximized;
                        }
                        else if (nextcmd.Equals("location"))
                        {
                            int?x = sp.NextWordComma().InvariantParseIntNull();
                            int?y = sp.NextWordComma().InvariantParseIntNull();
                            int?w = sp.NextWordComma().InvariantParseIntNull();
                            int?h = sp.NextWord().InvariantParseIntNull();

                            if (x.HasValue && y.HasValue && w.HasValue && h.HasValue)
                            {
                                ucf.Location = new Point(x.Value, y.Value);
                                ucf.Size     = new Size(w.Value, h.Value);
                            }
                            else
                            {
                                ap.ReportError("Location needs x,y,w,h in Popout");
                            }
                        }
                        else if (nextcmd.Equals("position"))
                        {
                            int?x = sp.NextWordComma().InvariantParseIntNull();
                            int?y = sp.NextWord().InvariantParseIntNull();

                            if (x.HasValue && y.HasValue)
                            {
                                ucf.Location = new Point(x.Value, y.Value);
                            }
                            else
                            {
                                ap.ReportError("Position needs x,y in Popout");
                            }
                        }
                        else if (nextcmd.Equals("size"))
                        {
                            int?w = sp.NextWordComma().InvariantParseIntNull();
                            int?h = sp.NextWord().InvariantParseIntNull();

                            if (w.HasValue && h.HasValue)
                            {
                                ucf.Size = new Size(w.Value, h.Value);
                            }
                            else
                            {
                                ap.ReportError("Size needs x,y,w,h in Popout");
                            }
                        }
                        else
                        {
                            ap.ReportError("Unknown option " + nextcmd + " after popout name in Popout");
                        }
                    }
                    else
                    {       // pop out not found..
                        PanelInformation.PanelIDs?id = PanelInformation.GetPanelIDByWindowsRefName(cmdname);

                        if (id != null)
                        {
                            if (nextcmd.Equals("off")) // if off, do nothing
                            {
                            }
                            else if (nextcmd.Equals("toggle") || nextcmd.Equals("on"))
                            {
                                poc.PopOut(id.Value);
                            }
                            else
                            {
                                ap.ReportError("Cannot use command " + nextcmd + " after generic popout name in Popout");
                            }
                        }
                        else
                        {
                            ap.ReportError("Cannot find generic popout name " + cmdname + " in Popout");
                        }
                    }
                }
            }
            else
            {
                ap.ReportError(res);
            }

            return(true);
        }
示例#19
0
        public override bool ExecuteAction(ActionProgramRun ap)
        {
            string res;

            if (ap.functions.ExpandString(UserData, out res) != Conditions.ConditionFunctions.ExpandResult.Failed)
            {
                StringParser sp = new StringParser(res);

                string cmdname = sp.NextWord();

                if (cmdname == null)
                {
                    ap.ReportError("Missing panel name in Historytab");
                }
                else
                {
                    ExtendedControls.TabStrip ts = (ap.actioncontroller as ActionController).DiscoveryForm.PrimarySplitter.GetTabStrip(cmdname);     // case insensitive

                    if (ts != null)
                    {
                        string nextcmd = sp.NextWordLCInvariant(" ");

                        if (nextcmd == null)
                        {
                            ap.ReportError("Missing command after panel name in Historytab");
                        }
                        else if (nextcmd.Equals("toggle"))
                        {
                            ts.Toggle();
                        }
                        else
                        {
                            PopOutControl             poc = (ap.actioncontroller as ActionController).DiscoveryForm.PopOuts;
                            PanelInformation.PanelIDs?id  = PanelInformation.GetPanelIDByWindowsRefName(nextcmd);

                            if (id != null)
                            {
                                PanelInformation.PanelIDs[] list = ts.TagList.Cast <PanelInformation.PanelIDs>().ToArray();
                                int index = Array.IndexOf(list, id.Value);
                                if (!ts.ChangePanel(index))
                                {
                                    ap.ReportError("Panel " + nextcmd + " cannot be used in Historytab");
                                }
                            }
                            else
                            {
                                ap.ReportError("Cannot find generic panel type name " + nextcmd + " in Historytab");
                            }
                        }
                    }
                    else
                    {
                        ap.ReportError("Unknown panel name or panels re-ordered " + cmdname + " in Historytab");
                    }
                }
            }
            else
            {
                ap.ReportError(res);
            }

            return(true);
        }
        private void Redraw()
        {
            panelVScroll.SuspendLayout();

            panelVScroll.RemoveAllControls();

            Bitmap backimage = new Bitmap(EDDiscovery.Icons.Controls.Selector_Background);
            Color  centre    = backimage.GetPixel(48, 48);


            {
                Versions.VersioningManager mgr = new Versions.VersioningManager();
                AddOnManagerForm.ReadLocalFiles(mgr, true);

                int i = mgr.DownloadItems.Count;

                CompositeButton cb = new CompositeButton();
                cb.Size    = panelsize;
                cb.Tag     = 999;
                cb.Padding = new Padding(10);
                cb.QuickInit(EDDiscovery.Icons.Controls.Selector_Background,
                             (i == 0) ? "NO ADD ONS!".Tx(this) : i.ToString() + " Add Ons".Tx(this),
                             EDDTheme.Instance.GetFontAtSize(11),
                             (i == 0) ? Color.Red : (EDDTheme.Instance.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : EDDTheme.Instance.TextBlockColor),
                             centre,
                             EDDiscovery.Icons.Controls.Main_Addons_ManageAddOns,
                             new Size(48, 48),
                             new Image[] { EDDiscovery.Icons.Controls.Main_Addons_ManageAddOns },
                             new Size(48, 48),
                             ButtonPress);

                toolTip.SetToolTip(cb.Buttons[0], "Click to add or remove Add Ons".Tx(this, "TTA"));
                toolTip.SetToolTip(cb.Decals[0], "Add ons are essential additions to your EDD experience!".Tx(this, "TTB"));
                panelVScroll.Controls.Add(cb);
                EDDTheme.Instance.ApplyToControls(cb.Buttons[0], null, true); // need to theme up the button
                cb.Buttons[0].BackColor = centre;                             // but then fix the back colour again
            }

            PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(EDDConfig.Instance.SortPanelsByName);

            for (int i = 0; i < pids.Length; i++)
            {
                PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID(pids[i]);

                CompositeButton cb = new CompositeButton();
                cb.Size    = panelsize;
                cb.Tag     = pi.PopoutID;
                cb.Padding = new Padding(10);
                cb.QuickInit(EDDiscovery.Icons.Controls.Selector_Background,
                             pi.WindowTitle,
                             EDDTheme.Instance.GetFontAtSize(11),
                             EDDTheme.Instance.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : EDDTheme.Instance.TextBlockColor,
                             centre,
                             pi.TabIcon,
                             new Size(48, 48),
                             new Image[] { EDDiscovery.Icons.Controls.TabStrip_Popout, EDDiscovery.Icons.Controls.Selector_AddTab },
                             new Size(48, 48),
                             ButtonPress);
                toolTip.SetToolTip(cb.Buttons[0], "Pop out in a new window".Tx(this, "PP1"));
                toolTip.SetToolTip(cb.Buttons[1], "Open as a new menu tab".Tx(this, "MT1"));
                toolTip.SetToolTip(cb.Decals[0], pi.Description);
                EDDTheme.Instance.ApplyToControls(cb.Buttons[0], null, true);
                cb.Buttons[0].BackColor = centre; // need to reset the colour back!
                EDDTheme.Instance.ApplyToControls(cb.Buttons[1], null, true);
                cb.Buttons[1].BackColor = centre;

                panelVScroll.Controls.Add(cb);       // we don't theme it.. its already fully themed to a fixed theme.
            }

            Reposition();

            panelVScroll.ResumeLayout();
        }
示例#21
0
    internal void Prepare()
    {
        AvatarModel am = new AvatarModel(Card.Druid, false, null);

        Me = this;
        PanelInformation.SetActive(true);

        List <List <TileTemplate> > templates = new List <List <TileTemplate> >();

        for (int i = 0; i < 3; i++)
        {
            List <TileTemplate> col = new List <TileTemplate>();
            for (int j = 0; j < 4; j++)
            {
                TileTemplate tt = new TileTemplate();
                col.Add(tt);
            }
            templates.Add(col);
        }

        PanelBoardBack.GetComponent <ScrollableList>().Build(templates);

        templates[2][2].AddTemplate(Card.Druid);
        templates[0][1].AddTemplate(Card.Shaman);

        PanelBoardFront.GetComponent <ScrollableList>().Build(templates);

        PanelAvatar lasiaAvatar = PanelBoardFront.GetComponent <ScrollableList>().ElementsToPut[2 * 4 + 2].GetComponent <PanelTile>().PanelAvatar.GetComponent <PanelAvatar>();
        AvatarModel lasiaModel  = lasiaAvatar.Model;

        List <Card> all = new List <Card>();

        all.Add(Card.AncestralHealing);
        all.Add(Card.StonetuskBoar);
        all.Add(Card.RiverCrocolisk);
        all.Add(Card.Wolfrider);
        all.Add(Card.StormwindKnight);
        all.Add(Card.StormpikeCommando);
        all.Add(Card.RecklessRocketeer);
        all.Add(Card.WarGolem);
        all.Add(Card.Nightblade);
        all.Add(Card.LordOfTheArena);
        all.Add(Card.Archmage);
        all.Add(Card.GurubashiBerserker);
        all.Add(Card.DarkscaleHealer);
        all.Add(Card.BootyBayBodyguard);
        all.Add(Card.OgreMagi);
        all.Add(Card.OasisSnapjaw);
        all.Add(Card.DragonlingMechanic);
        all.Add(Card.SilverbackPatriarch);
        all.Add(Card.RaidLeader);
        all.Add(Card.MagmaRager);
        all.Add(Card.IronforgeRifleman);
        all.Add(Card.NoviceEngineer);
        all.Add(Card.Moonfire);
        all.Add(Card.DalaranMage);
        all.Add(Card.FrostwolfGrunt);
        all.Add(Card.GoldshireFootman);
        all.Add(Card.VoodooDoctor);
        all.Add(Card.ElvenArcher);
        all.Add(Card.MurlocTidehunter);
        all.Add(Card.HealingTouch);
        all.Add(Card.Innervate);
        all.Add(Card.MarkOfTheWild);
        all.Add(Card.IronfurGrizzly);
        all.Add(Card.SavageRoar);
        all.Add(Card.Claw);
        all.Add(Card.GnomishInventor);
        all.Add(Card.ChillwindYeti);
        all.Add(Card.Sprint);
        all.Add(Card.Flamestrike);
        all.Add(Card.CoreHound);
        all.Add(Card.KoboldGeomancer);
        all.Add(Card.RockbiterWeapon);
        all.Add(Card.Swipe);
        all.Add(Card.MindControl);
        all.Add(Card.Starfire);
        all.Add(Card.FlametongueTotem);
        all.Add(Card.RazorfenHunter);
        all.Add(Card.SenjinShieldmasta);
        all.Add(Card.Bloodlust);
        all.Add(Card.BoulderfishOgre);
        all.Add(Card.FireElemental);
        all.Add(Card.FrostwolfWarlord);
        all.Add(Card.Hex);
        all.Add(Card.StormwindChampion);
        all.Add(Card.ShatteredSunCleric);
        all.Add(Card.BloodfenRaptor);
        all.Add(Card.Thrallmar);
        all.Add(Card.Wisp);
        all.Add(Card.IronbarkProtector);

        all.Add(Card.KillTheBullies);
        all.Add(Card.BubblingVolcano);
        all.Add(Card.MagicArrow);

        all.RemoveAll(x => x.Cost > 5);

        all.Shuffle();

        lasiaModel.Deck = all.GetRange(0, 15);
        lasiaModel.PullCardFromDeck();
        lasiaModel.PullCardFromDeck();

        PanelAvatar dementorAvatar = PanelBoardFront.GetComponent <ScrollableList>().ElementsToPut[1].GetComponent <PanelTile>().PanelAvatar.GetComponent <PanelAvatar>();
        AvatarModel dementorModel  = dementorAvatar.Model;

        all.Shuffle();
        dementorModel.Deck = all.GetRange(0, 15);
        dementorModel.Hand.Add(Card.ManaCrystal);
        dementorModel.PullCardFromDeck();
        dementorModel.PullCardFromDeck();
        dementorModel.PullCardFromDeck();

        MyModel     = lasiaModel;
        EnemysModel = dementorModel;

        ActualTurnModel = EnemysModel;
        EndTurn();
        RevalidateEffects();
    }
示例#22
0
        private void Redraw()
        {
            panelVScroll.SuspendLayout();

            panelVScroll.RemoveAllControls();

            // design for std 8.25 font sizes

            Bitmap backimage = new Bitmap(EDDiscovery.Icons.Controls.Selector);
            Color  centre = backimage.GetPixel(48, 48);
            Size   iconsize = new Size(24, 24);
            int    width = 96;
            int    padbot = 6, padbetween = 5;

            float brigthness = ExtendedControls.Theme.Current.Form.GetBrightness();
            Image selback    = brigthness < 0.3 ? EDDiscovery.Icons.Controls.Selector : EDDiscovery.Icons.Controls.Selector2;

            {
                Versions.VersioningManager mgr = new Versions.VersioningManager();
                AddOnManagerForm.ReadLocalFiles(mgr, true);

                int i = mgr.DownloadItems.Count;

                CompositeButton cb = CompositeButton.QuickInit(
                    selback,
                    (i == 0) ? "NO ADD ONS!".T(EDTx.UserControlPanelSelector_NOADDONS) : i.ToString() + " Add Ons".T(EDTx.UserControlPanelSelector_AddOns),
                    ExtendedControls.Theme.Current.GetFont,
                    (i == 0) ? Color.Red : (ExtendedControls.Theme.Current.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : ExtendedControls.Theme.Current.TextBlockColor),
                    Color.Transparent,
                    EDDiscovery.Icons.Controls.ManageAddOns, iconsize,
                    new Image[] { EDDiscovery.Icons.Controls.ManageAddOns }, iconsize,
                    padbetween,
                    ButtonPress);

                panelVScroll.Controls.Add(cb);
                cb.Name = "Add on";
                cb.Tag  = null;
                toolTip.SetToolTip(cb.Buttons[0], "Click to add or remove Add Ons".T(EDTx.UserControlPanelSelector_TTA));
                toolTip.SetToolTip(cb.Decals[0], "Add ons are essential additions to your EDD experience!".T(EDTx.UserControlPanelSelector_TTB));

                ExtendedControls.Theme.Current.ApplyStd(cb);       // need to theme up the button
                cb.Size                 = new Size(width, cb.FindMaxSubControlArea(0, padbot).Height);
                cb.Label.BackColor      = cb.Decals[0].BackColor = Color.Transparent;
                cb.Buttons[0].BackColor = centre;   // but then fix the back colour again
            }

            PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(EDDConfig.Instance.SortPanelsByName);

            for (int i = 0; i < pids.Length; i++)
            {
                PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID(pids[i]);

                CompositeButton cb = CompositeButton.QuickInit(
                    selback,
                    pi.WindowTitle,
                    ExtendedControls.Theme.Current.GetFont,
                    ExtendedControls.Theme.Current.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : ExtendedControls.Theme.Current.TextBlockColor,
                    Color.Transparent,
                    pi.TabIcon, iconsize,
                    new Image[] { EDDiscovery.Icons.Controls.Popout, EDDiscovery.Icons.Controls.AddTab }, iconsize,
                    padbetween,
                    ButtonPress);
                cb.SuspendLayout();
                panelVScroll.Controls.Add(cb);
                cb.Tag = pi.PopoutID;
                toolTip.SetToolTip(cb.Buttons[0], "Pop out in a new window".T(EDTx.UserControlPanelSelector_PP1));
                toolTip.SetToolTip(cb.Buttons[1], "Open as a new menu tab".T(EDTx.UserControlPanelSelector_MT1));
                toolTip.SetToolTip(cb.Decals[0], pi.Description);

                ExtendedControls.Theme.Current.ApplyStd(cb);
                cb.ResumeLayout();

                cb.Size                 = new Size(width, cb.FindMaxSubControlArea(0, padbot).Height);
                cb.Label.BackColor      = cb.Decals[0].BackColor = Color.Transparent;
                cb.Buttons[0].BackColor = centre; // need to reset the colour back!
                cb.Buttons[1].BackColor = centre; // need to reset the colour back!
            }

            panelVScroll.Scale(this.FindForm().CurrentAutoScaleFactor());
            Reposition();

            panelVScroll.ResumeLayout();
        }
        private Control MakeNode(string s)
        {
            BaseUtils.StringParser sp = new BaseUtils.StringParser(s); // ctrl string is tag,panelid enum number
            int tagid = sp.NextInt(",") ?? 0;                          // enum id

            sp.IsCharMoveOn(',');
            int panelid = sp.NextInt(",") ?? NoTabPanelSelected; // if not valid, we get an empty tab control

            if (panelid >= FixedPanelOffset)                     // this range of ids are UCCB directly in the splitter, so are not changeable
            {
                PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID((PanelInformation.PanelIDs)(panelid - FixedPanelOffset));
                if (pi == null)
                {
                    pi = PanelInformation.GetPanelInfoByPanelID(PanelInformation.PanelIDs.Log); // make sure we have a valid one - can't return nothing
                }
                UserControlCommonBase uccb = PanelInformation.Create(pi.PopoutID);              // must return as we made sure pi is valid
                uccb.Dock = DockStyle.Fill;

                uccb.Tag  = tagid;
                uccb.Name = "UC-" + tagid.ToStringInvariant();

                return(uccb);
            }
            else                        // positive ones are tab strip with the panel id selected, if valid..
            {
                ExtendedControls.TabStrip tabstrip = new ExtendedControls.TabStrip();
                tabstrip.ImageList      = PanelInformation.GetPanelImages();
                tabstrip.TextList       = PanelInformation.GetPanelDescriptions();
                tabstrip.TagList        = PanelInformation.GetPanelIDs().Cast <Object>().ToArray();
                tabstrip.Dock           = DockStyle.Fill;
                tabstrip.DropDownWidth  = 500;
                tabstrip.DropDownHeight = 500;
                tabstrip.StripMode      = ExtendedControls.TabStrip.StripModeType.ListSelection;

                tabstrip.Tag  = tagid;                        // Tag stores the ID index of this view
                tabstrip.Name = Name + "." + tagid.ToStringInvariant();

                //System.Diagnostics.Debug.WriteLine("Make new tab control " + tabstrip.Name + " id "  + tagid + " of " + panelid );

                tabstrip.OnRemoving += (tab, ctrl) =>
                {
                    UserControlCommonBase uccb = ctrl as UserControlCommonBase;
                    uccb.Closing();
                    AssignTHC();        // in case we removed anything
                };

                tabstrip.OnCreateTab += (tab, si) =>
                {
                    PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID((PanelInformation.PanelIDs)tab.TagList[si]); // must be valid, as it came from the taglist
                    Control c = PanelInformation.Create(pi.PopoutID);
                    c.Name = pi.WindowTitle;                                                                                            // tabs uses Name field for display, must set it

                    return(c);
                };

                tabstrip.OnPostCreateTab += (tab, ctrl, i) =>                       // only called during dynamic creation..
                {
                    int tabstripid           = (int)tab.Tag;                        // tag from tab strip
                    int displaynumber        = DisplayNumberOfSplitter(tabstripid); // tab strip - use tag to remember display id which helps us save context.
                    UserControlCommonBase uc = ctrl as UserControlCommonBase;

                    if (uc != null)
                    {
                        System.Diagnostics.Trace.WriteLine("SP:Make Tab " + tabstripid + " with dno " + displaynumber + " Use THC " + ucursor_inuse.GetHashCode());
                        uc.Init(discoveryform, displaynumber);
                        uc.SetCursor(ucursor_inuse);
                        uc.LoadLayout();
                        uc.InitialDisplay();
                    }

                    //System.Diagnostics.Debug.WriteLine("And theme {0}", i);
                    discoveryform.theme.ApplyToControls(tab);
                    AssignTHC();        // in case we added one
                };

                tabstrip.OnPopOut += (tab, i) => { discoveryform.PopOuts.PopOut((PanelInformation.PanelIDs)tabstrip.TagList[i]); };

                discoveryform.theme.ApplyToControls(tabstrip, applytothis: true);

                PanelInformation.PanelIDs[] pids = PanelInformation.GetPanelIDs();

                panelid = Array.FindIndex(pids, x => x == (PanelInformation.PanelIDs)panelid); // find ID in array..  -1 if not valid ID, it copes with -1

                if (panelid >= 0)                                                              // if we have a panel, open it
                {
                    tabstrip.Create(panelid);                                                  // create but not post create yet...
                }

                return(tabstrip);
            }
        }
示例#24
0
        private Control MakeNode(string s)
        {
            BaseUtils.StringParser sp = new BaseUtils.StringParser(s); // ctrl string is tag,panelid enum number
            int tagid = sp.NextInt(",") ?? 0;                          // enum id

            sp.IsCharMoveOn(',');
            int panelid = sp.NextInt(",") ?? NoTabPanelSelected; // if not valid, we get an empty tab control

            if (panelid >= FixedPanelOffset)                     // this range of ids are UCCB directly in the splitter, so are not changeable
            {
                PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID((PanelInformation.PanelIDs)(panelid - FixedPanelOffset));
                if (pi == null)
                {
                    pi = PanelInformation.GetPanelInfoByPanelID(PanelInformation.PanelIDs.Log); // make sure we have a valid one - can't return nothing
                }
                UserControlCommonBase uccb = PanelInformation.Create(pi.PopoutID);              // must return as we made sure pi is valid
                uccb.AutoScaleMode = AutoScaleMode.Inherit;                                     // very very important and took 2 days to work out!
                uccb.Dock          = DockStyle.Fill;
                uccb.Tag           = tagid;
                uccb.Name          = "UC-" + tagid.ToStringInvariant();

                return(uccb);
            }
            else                        // positive ones are tab strip with the panel id selected, if valid..
            {
                ExtendedControls.TabStrip tabstrip = new ExtendedControls.TabStrip();
                tabstrip.ImageList = PanelInformation.GetUserSelectablePanelImages(TabListSortAlpha);
                tabstrip.TextList  = PanelInformation.GetUserSelectablePanelDescriptions(TabListSortAlpha);
                tabstrip.TagList   = PanelInformation.GetUserSelectablePanelIDs(TabListSortAlpha).Cast <Object>().ToArray();
                tabstrip.ListSelectionItemSeparators = PanelInformation.GetUserSelectableSeperatorIndex(TabListSortAlpha);

                tabstrip.Dock      = DockStyle.Fill;
                tabstrip.StripMode = ExtendedControls.TabStrip.StripModeType.ListSelection;

                tabstrip.Tag  = tagid;                        // Tag stores the ID index of this view
                tabstrip.Name = Name + "." + tagid.ToStringInvariant();

                //System.Diagnostics.Debug.WriteLine("Make new tab control " + tabstrip.Name + " id "  + tagid + " of " + panelid );

                tabstrip.OnRemoving += (tab, ctrl) =>
                {
                    UserControlCommonBase uccb = ctrl as UserControlCommonBase;
                    uccb.CloseDown();
                    AssignTHC();        // in case we removed anything
                };

                tabstrip.OnCreateTab += (tab, si) =>                                                                                    // called when the tab strip wants a new control for a tab.
                {
                    PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID((PanelInformation.PanelIDs)tab.TagList[si]); // must be valid, as it came from the taglist
                    Control c = PanelInformation.Create(pi.PopoutID);
                    (c as UserControlCommonBase).AutoScaleMode = AutoScaleMode.Inherit;
                    c.Name = pi.WindowTitle;        // tabs uses Name field for display, must set it
                    System.Diagnostics.Trace.WriteLine("SP:Create Tab " + c.Name);
                    return(c);
                };

                tabstrip.OnPostCreateTab += (tab, ctrl, i) =>                       // only called during dynamic creation..
                {
                    int tabstripid           = (int)tab.Tag;                        // tag from tab strip
                    int displaynumber        = DisplayNumberOfSplitter(tabstripid); // tab strip - use tag to remember display id which helps us save context.
                    UserControlCommonBase uc = ctrl as UserControlCommonBase;

                    if (uc != null)
                    {
                        System.Diagnostics.Trace.WriteLine("SP:Make Tab " + tabstripid + " with dno " + displaynumber + " Use THC " + ucursor_inuse.GetHashCode());
                        uc.Init(discoveryform, displaynumber);              // init..

                        uc.Scale(this.FindForm().CurrentAutoScaleFactor()); // keeping to the contract, scale and
                        discoveryform.theme.ApplyStd(uc);                   // theme the uc. between init and set cursor

                        uc.SetCursor(ucursor_inuse);
                        uc.LoadLayout();
                        uc.InitialDisplay();
                    }

                    AssignTHC();        // in case we added one
                };

                tabstrip.OnPopOut += (tab, i) => { discoveryform.PopOuts.PopOut((PanelInformation.PanelIDs)tabstrip.TagList[i]); };

                PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(TabListSortAlpha); // sort order v.important.. we need the right index, dep

                int indexofentry = Array.FindIndex(pids, x => x == (PanelInformation.PanelIDs)panelid);          // find ID in array..  -1 if not valid ID, it copes with -1

                if (indexofentry >= 0)                                                                           // if we have a panel, open it
                {
                    tabstrip.Create(indexofentry);                                                               // create but not post create during the init phase. Post create is only used during dynamics
                }

                return(tabstrip);
            }
        }