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 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); }
private void LoadLayoutPanel(UserControlContainerResizable uccr, UserControlCommonBase uccb, Point pos, Size size) { //System.Diagnostics.Trace.WriteLine("GD:Cursor/Load/Init " + uccb.GetType().Name + " to " + pos + " " + size); uccb.SetCursor(ucursor_inuse); uccb.LoadLayout(); uccb.InitialDisplay(); uccr.Location = pos; // must set on load layout, themeing is defined between init and load layout and can shift numbers uccr.Size = size; }
bool checkmulticall = false; // debug for now public override void LoadLayout() // unlike splitter, we don't need to be so careful about the cursor. We can load in load layout { ucursor_history = ucursor_inuse = uctg; System.Diagnostics.Debug.Assert(checkmulticall == false); checkmulticall = true; // examples seen of multi call, lets trap it //System.Diagnostics.Debug.WriteLine("Grid Restore from " + DbWindows); string[] names = SQLiteConnectionUser.GetSettingString(DbWindows, "").Split(','); int[] positions; int[] zorder; string pos = SQLiteConnectionUser.GetSettingString(DbPositions, ""); string zo = SQLiteConnectionUser.GetSettingString(DbZOrder, ""); SuspendLayout(); if (pos.RestoreArrayFromString(out positions) && zo.RestoreArrayFromString(out zorder, 0, names.Length - 1) && names.Length == zorder.Length && positions.Length == 4 * names.Length) { int ppos = 0; foreach (string n in names) { Type t = Type.GetType("EDDiscovery.UserControls." + n); if (t != null) { UserControlCommonBase uccb = (UserControlCommonBase)Activator.CreateInstance(t); CreatePanel(uccb, new Point(positions[ppos++], positions[ppos++]), new Size(positions[ppos++], positions[ppos++])); } } ppos = 0; foreach (int item in zorder) { if (item >= 0 && item < uccrlist.Count) { UserControlContainerResizable uccr = uccrlist[item]; panelPlayfield.Controls.SetChildIndex(uccr, ppos++); } } } ResumeLayout(); Invalidate(true); Update(); // need this to FORCE a full refresh in case there are lots of windows //System.Diagnostics.Debug.WriteLine("----- Grid Restore END " + DbWindows); UpdateButtons(); AssignTHC(); }
private void ComboBoxGridSelector_SelectedIndexChanged(object sender, EventArgs e) { UserControlContainerResizable uccr = CreatePanel(PopOutControl.Create(comboBoxGridSelector.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(); }
public void ClosePanel(UserControlContainerResizable uccr) { UserControlCommonBase uc = (UserControlCommonBase)uccr.control; uc.CloseDown(); panelPlayfield.Controls.Remove(uccr); uccrlist.Remove(uccr); Invalidate(); uc.Dispose(); uccr.Dispose(); UpdateButtons(); AssignTHC(); }
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); }
public bool ClosePanel(UserControlContainerResizable uccr) { UserControlCommonBase uc = (UserControlCommonBase)uccr.control; if (uc.AllowClose()) { uc.CloseDown(); panelPlayfield.Controls.Remove(uccr); uccrlist.Remove(uccr); Invalidate(); uc.Dispose(); uccr.Dispose(); UpdateButtons(); AssignTHC(); return(true); } else { return(false); } }
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); }