public static System.Windows.Forms.ToolStripMenuItem MakeToolStripMenuItem(int i, System.EventHandler h) { PanelInformation.PanelInfo pi = PanelInformation.PanelList[i]; if (pi.IsUserSelectable) { System.Windows.Forms.ToolStripMenuItem mi = new System.Windows.Forms.ToolStripMenuItem(); mi.Text = pi.Description; mi.Size = new System.Drawing.Size(250, 22); mi.Tag = pi.PopoutID; mi.Image = pi.TabIcon; mi.Click += h; return(mi); } else { return(null); } }
public UserControlCommonBase PopOut(PanelInformation.PanelIDs selected) { 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); tcf.Init(ctrl, windowtitle, discoveryform.theme.WindowsFrame, refname, discoveryform.TopMost, poi.DefaultTransparent, discoveryform.theme.LabelColor, discoveryform.theme.SPanelColor); ctrl.Init(discoveryform, 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); discoveryform.ActionRun(Actions.ActionEventEDList.onPopUp, null, new Conditions.ConditionVariables(new string[] { "PopOutName", refname, "PopOutTitle", windowtitle, "PopOutIndex", numopened.ToString() })); } return(ctrl); }
internal void LoadSavedPopouts() { foreach (PanelInformation.PanelIDs p in Enum.GetValues(typeof(PanelInformation.PanelIDs))) // in terms of PanelInformation.PopOuts Enum { int numtoopen = SQLiteConnectionUser.GetSettingInt("SavedPanelInformation.PopOuts:" + p.ToString(), 0); PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID(p); //System.Diagnostics.Debug.WriteLine("Load panel type " + paneltype.Name + " " + p.ToString() + " " + numtoopen); if (pi != null && numtoopen > 0) // paranoia on first.. { int numopened = usercontrolsforms.CountOf(pi.PopoutType); if (numopened < numtoopen) { for (int i = numopened + 1; i <= numtoopen; i++) { PopOut(p); } } } } }
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 = 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() })); } }