Exemplo n.º 1
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);

                discoveryform.theme.ApplyStd(tcf);  // apply theming/scaling to form before shown, so that it restored back to correct position (done in UCF::onLoad)

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

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

            return(ctrl);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        // MAY return null!

        private TabPage CreateTab(PanelInformation.PanelIDs ptype, string name, int dn, int posindex)
        {
            // debug - create an example tab page
            // keep for now
            //TabPage page = new TabPage();
            //page.Location = new System.Drawing.Point(4, 22);    // copied from normal tab creation code
            //page.Padding = new System.Windows.Forms.Padding(3);
            //UserControl uc = new UserControl();
            //uc.Dock = DockStyle.Fill;
            //uc.AutoScaleMode = AutoScaleMode.Inherit;
            //page.Controls.Add(uc);
            //ExtendedControls.TabStrip ts = new ExtendedControls.TabStrip();
            //ts.Dock = DockStyle.Fill;
            //uc.Controls.Add(ts);
            //TabPages.Insert(posindex, page);


            UserControls.UserControlCommonBase uccb = PanelInformation.Create(ptype); // must create, since its a ptype.
            if (uccb == null)                                                         // if ptype is crap, it returns null.. catch
            {
                return(null);
            }

            uccb.AutoScaleMode = AutoScaleMode.Inherit;               // inherit will mean Font autoscale won't happen at attach
            uccb.Dock          = System.Windows.Forms.DockStyle.Fill; // uccb has to be fill, even though the VS designer does not indicate you need to set it.. copied from designer code
            uccb.Location      = new System.Drawing.Point(3, 3);

            if (dn == -1) // if work out display number
            {
                List <int> idlist = (from TabPage p in TabPages where p.Controls[0].GetType() == uccb.GetType() select(p.Controls[0] as UserControls.UserControlCommonBase).displaynumber).ToList();

                if (!idlist.Contains(UserControls.UserControlCommonBase.DisplayNumberPrimaryTab))
                {
                    dn = UserControls.UserControlCommonBase.DisplayNumberPrimaryTab;
                }
                else
                {   // search for empty id.
                    for (int i = UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs; i <= UserControls.UserControlCommonBase.DisplayNumberStartExtraTabsMax; i++)
                    {
                        if (!idlist.Contains(i))
                        {
                            dn = i;
                            break;
                        }
                    }
                }
            }

            //System.Diagnostics.Debug.WriteLine("Create tab {0} dn {1} at {2}", ptype, dn, posindex);

            int numoftab = (dn == UserControls.UserControlCommonBase.DisplayNumberPrimaryTab) ? 0 : (dn - UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs + 1);

            if (uccb is UserControls.UserControlContainerSplitter && numoftab > 0)          // so history is a splitter, so first real splitter will be dn=100, adjust for it
            {
                numoftab--;
            }

            string postfix = numoftab == 0 ? "" : "(" + numoftab.ToStringInvariant() + ")";
            string title   = name != null ? name : (PanelInformation.GetPanelInfoByPanelID(ptype).WindowTitle + postfix);

            uccb.Name = title;              // for debugging use

            TabPage page = new TabPage(title);

            page.Location = new System.Drawing.Point(4, 22);     // copied from normal tab creation code
            page.Padding  = new System.Windows.Forms.Padding(3); // this is to allow a pad around the sides

            page.Controls.Add(uccb);

            TabPages.Insert(posindex, page);        // with inherit above, no font autoscale

            //Init control after it is added to the form
            uccb.Init(eddiscovery, dn);                           // start the uccb up

            uccb.Scale(this.FindForm().CurrentAutoScaleFactor()); // scale and
            EDDTheme.Instance.ApplyStd(page);                     // theme it.  Order as per the contract in UCCB

            return(page);
        }
Exemplo n.º 4
0
        // MAY return null!

        private TabPage CreateTab(PanelInformation.PanelIDs ptype, string name, int dn, int posindex, bool dotheme)
        {
            UserControls.UserControlCommonBase uccb = PanelInformation.Create(ptype); // must create, since its a ptype.
            if (uccb == null)                                                         // if ptype is crap, it returns null.. catch
            {
                return(null);
            }

            uccb.Dock     = System.Windows.Forms.DockStyle.Fill; // uccb has to be fill, even though the VS designer does not indicate you need to set it.. copied from designer code
            uccb.Location = new System.Drawing.Point(3, 3);

            if (dn == -1) // if work out display number
            {
                List <int> idlist = (from TabPage p in TabPages where p.Controls[0].GetType() == uccb.GetType() select(p.Controls[0] as UserControls.UserControlCommonBase).displaynumber).ToList();

                if (!idlist.Contains(UserControls.UserControlCommonBase.DisplayNumberPrimaryTab))
                {
                    dn = UserControls.UserControlCommonBase.DisplayNumberPrimaryTab;
                }
                else
                {   // search for empty id.
                    for (int i = UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs; i <= UserControls.UserControlCommonBase.DisplayNumberStartExtraTabsMax; i++)
                    {
                        if (!idlist.Contains(i))
                        {
                            dn = i;
                            break;
                        }
                    }
                }
            }

            //System.Diagnostics.Debug.WriteLine("Create tab {0} dn {1} at {2}", ptype, dn, posindex);

            int numoftab = (dn == UserControls.UserControlCommonBase.DisplayNumberPrimaryTab) ? 0 : (dn - UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs + 1);

            if (uccb is UserControls.UserControlContainerSplitter && numoftab > 0)          // so history is a splitter, so first real splitter will be dn=100, adjust for it
            {
                numoftab--;
            }

            string postfix = numoftab == 0 ? "" : "(" + numoftab.ToStringInvariant() + ")";
            string title   = name != null ? name : (PanelInformation.GetPanelInfoByPanelID(ptype).WindowTitle + postfix);

            uccb.Name = title;              // for debugging use

            TabPage page = new TabPage(title);

            page.Location = new System.Drawing.Point(4, 22);    // copied from normal tab creation code
            page.Padding  = new System.Windows.Forms.Padding(3);

            page.Controls.Add(uccb);

            TabPages.Insert(posindex, page);

            //Init control after it is added to the form
            uccb.Init(eddiscovery, dn); // start the uccb up

            if (dotheme)                // only user created ones need themeing
            {
                EDDTheme.Instance.ApplyToControls(page, applytothis: true);
            }

            return(page);
        }
Exemplo n.º 5
0
        // MAY return null!

        private TabPage CreateTab(PanelInformation.PanelIDs ptype, string name, int dn, int posindex, bool dotheme)
        {
            UserControls.UserControlCommonBase uccb = PanelInformation.Create(ptype); // must create, since its a ptype.
            if (uccb == null)                                                         // if ptype is crap, it returns null.. catch
            {
                return(null);
            }

            uccb.Dock     = System.Windows.Forms.DockStyle.Fill; // uccb has to be fill, even though the VS designer does not indicate you need to set it.. copied from designer code
            uccb.Location = new System.Drawing.Point(3, 3);

            List <int> idlist = (from TabPage p in TabPages where p.Controls[0].GetType() == uccb.GetType() select(p.Controls[0] as UserControls.UserControlCommonBase).displaynumber).ToList();

            if (dn == -1) // if work out display number
            {
                // not travel grid (due to clash with History control) and not in list, use primary number (0)
                if (ptype != PanelInformation.PanelIDs.TravelGrid && !idlist.Contains(UserControls.UserControlCommonBase.DisplayNumberPrimaryTab))
                {
                    dn = UserControls.UserControlCommonBase.DisplayNumberPrimaryTab;
                }
                else
                {   // search for empty id.
                    for (int i = UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs; i <= UserControls.UserControlCommonBase.DisplayNumberStartExtraTabsMax; i++)
                    {
                        if (!idlist.Contains(i))
                        {
                            dn = i;
                            break;
                        }
                    }
                }
            }

            System.Diagnostics.Debug.WriteLine("Create tab {0} dn {1} at {2}", ptype, dn, posindex);

            uccb.Init(eddiscovery, travelgrid, dn);    // start the uccb up

            string postfix;

            if (ptype != PanelInformation.PanelIDs.TravelGrid)      // given the dn, work out the name
            {
                postfix = (dn == UserControls.UserControlCommonBase.DisplayNumberPrimaryTab) ? "" : "(" + (dn - UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs + 1).ToStringInvariant() + ")";
            }
            else
            {
                postfix = (dn == UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs) ? "" : "(" + (dn - UserControls.UserControlCommonBase.DisplayNumberStartExtraTabs).ToStringInvariant() + ")";
            }

            string  title = name != null ? name : (PanelInformation.GetPanelInfoByEnum(ptype).WindowTitle + postfix);
            TabPage page  = new TabPage(title);

            page.Location = new System.Drawing.Point(4, 22);    // copied from normal tab creation code
            page.Padding  = new System.Windows.Forms.Padding(3);

            page.Controls.Add(uccb);

            TabPages.Insert(posindex, page);

            if (dotheme)                // only user created ones need themeing
            {
                EDDTheme.Instance.ApplyToControls(page, applytothis: true);
            }

            return(page);
        }