示例#1
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);
        }
        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.
        }
示例#4
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.
        }
        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);
        }
示例#6
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);
            }
        }
        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);
            }
        }