public UserControls.UserControl3DMap Open3DMap() // Current map - open at last position or configured position { var t3dmap = typeof(UserControls.UserControl3DMap); UserControls.UserControlCommonBase uccb = null; var tabfind3dmap = tabControlMain.Find(t3dmap); if (tabfind3dmap != null) { tabControlMain.SelectTab(tabfind3dmap.Item1); // goto tab uccb = tabfind3dmap.Item2; } else { var findpopoutform = PopOuts.FindUCCB(t3dmap); if (findpopoutform != null) { uccb = findpopoutform.UserControl; } } if (uccb == null) // none found, make one, on major tab { var tp = tabControlMain.EnsureMajorTabIsPresent(PanelInformation.PanelIDs.Map3D, true); uccb = (UserControls.UserControlCommonBase)tp.Controls[0]; } return((UserControls.UserControl3DMap)uccb); }
public PopOutInfo(PopOuts p, string prefix, string rf, Bitmap icon, string tooltip, bool?transparent = null) { popoutid = p; WindowTitlePrefix = prefix; WindowRefName = rf; TabIcon = icon; Tooltip = tooltip; SupportsTransparency = transparent != null; DefaultTransparent = transparent ?? false; }
public static UserControlCommonBase Create(PopOuts p) { switch (p) { case PopOuts.Spanel: return(new UserControlSpanel()); case PopOuts.Trippanel: return(new UserControlTrippanel()); case PopOuts.NotePanel: return(new UserControlNotePanel()); case PopOuts.RouteTracker: return(new UserControlRouteTracker()); case PopOuts.Log: return(new UserControlLog()); case PopOuts.StarDistance: return(new UserControlStarDistance()); case PopOuts.Materials: return(new UserControlMaterials()); case PopOuts.Commodities: return(new UserControlCommodities()); case PopOuts.Ledger: return(new UserControlLedger()); case PopOuts.Journal: return(new UserControlJournalGrid()); case PopOuts.TravelGrid: return(new UserControlTravelGrid()); case PopOuts.ScreenShot: return(new UserControlScreenshot()); case PopOuts.Statistics: return(new UserControlStats()); case PopOuts.Scan: return(new UserControlScan()); case PopOuts.EstimatedValues: return(new UserControlEstimatedValues()); case PopOuts.Modules: return(new UserControlModules()); case PopOuts.Exploration: return(new UserControlExploration()); case PopOuts.Synthesis: return(new UserControlSynthesis()); case PopOuts.Missions: return(new UserControlMissions()); case PopOuts.Engineering: return(new UserControlEngineering()); case PopOuts.MarketData: return(new UserControlMarketData()); case PopOuts.SystemInformation: return(new UserControlSysInfo()); case PopOuts.StarList: return(new UserControlStarList()); case PopOuts.Grid: return(new UserControlContainerGrid()); default: return(null); } }
internal void SaveCurrentPopouts() { foreach (int i in Enum.GetValues(typeof(PopOuts))) // in terms of PopOuts Enum { PopOuts p = (PopOuts)i; UserControlCommonBase ctrl = Create(p); int numopened = ctrl == null ? 0 : usercontrolsforms.CountOf(ctrl.GetType()); SQLiteConnectionUser.PutSettingInt("SavedPopouts:" + ((PopOuts)i).ToString(), numopened); } }
private void ChangeToProfileId(int id, bool checksavecur) { if (!checksavecur || EDDProfiles.Instance.Current.Id != id) { System.Diagnostics.Debug.WriteLine(BaseUtils.AppTicks.TickCountLap("ProfT") + " *************************** CHANGE To profile " + id); if (checksavecur) { if (tabControlMain.AllowClose() == false) // if we don't allow closing, we can't change profile { return; } else if (PopOuts.AllowClose() == false) { return; } tabControlMain.CloseTabList(); PopOuts.SaveCurrentPopouts(); } PopOuts.CloseAllPopouts(); comboBoxCustomProfiles.Enabled = false; // and update the selection box, making sure we don't trigger a change comboBoxCustomProfiles.SelectedIndex = EDDProfiles.Instance.IndexOf(id); comboBoxCustomProfiles.Enabled = true; EDDProfiles.Instance.ChangeToId(id); UserControls.UserControlContainerSplitter.CheckPrimarySplitterControlSettings(false); // use a nonsense name to make sure we just get the default set if we don't have a valid save tabControlMain.TabPages.Clear(); tabControlMain.CreateTabs(this, EDDOptions.Instance.TabsReset, "0, -1,0, 26,0, 27,0, 29,0, 34,0"); // numbers from popouts, which are FIXED! tabControlMain.LoadTabs(); ApplyTheme(); PopOuts.LoadSavedPopouts(); System.Diagnostics.Debug.WriteLine(BaseUtils.AppTicks.TickCountLap("ProfT") + " *************************** Finished Profile " + id); LogLine(string.Format("Profile {0} Loaded".T(EDTx.EDDiscoveryForm_PL), EDDProfiles.Instance.Current.Name)); } }
internal void LoadSavedPopouts() { foreach (int ip in Enum.GetValues(typeof(PopOuts))) // in terms of PopOut ENUM { PopOuts p = (PopOuts)ip; int numToOpen = SQLiteConnectionUser.GetSettingInt("SavedPopouts:" + p.ToString(), 0); if (numToOpen > 0) { UserControlCommonBase ctrl = Create(p); int numOpened = ctrl == null ? 0 : usercontrolsforms.CountOf(ctrl.GetType()); if (numOpened < numToOpen) { for (int i = numOpened + 1; i <= numToOpen; i++) { PopOut(p); } } } } }
static public int GetPopOutIndexByEnum(PopOuts p) { return(PopOutList.FindIndex(x => x.popoutid == p)); }
public void PopOut(PopOuts selected) { UserControlForm tcf = usercontrolsforms.NewForm(_discoveryForm.option_nowindowreposition); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EDDiscovery.EDDiscoveryForm)); tcf.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); if (selected == PopOuts.Log) { int numopened = usercontrolsforms.CountOf(typeof(UserControlLog)) + 1; UserControlLog uclog = new UserControlLog(); // Add a log tcf.Init(uclog, "Log " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "Log" + numopened, _discoveryForm.TopMost); uclog.Init(_discoveryForm, numopened); uclog.AppendText(_discoveryForm.LogText, _discoveryForm.theme.TextBackColor); } else if (selected == PopOuts.NS) { int numopened = usercontrolsforms.CountOf(typeof(UserControlStarDistance)) + 1; UserControlStarDistance ucsd = new UserControlStarDistance(); // Add a closest distance tab tcf.Init(ucsd, "Nearest Stars " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "StarDistance" + numopened, _discoveryForm.TopMost); ucsd.Init(_discoveryForm, numopened); if (lastclosestsystems != null) // if we have some, fill in this grid ucsd.FillGrid(lastclosestname, lastclosestsystems); } else if (selected == PopOuts.Materials) { int numopened = usercontrolsforms.CountOf(typeof(UserControlMaterials)) + 1; UserControlMaterials ucmc = new UserControlMaterials(); // Add a closest distance tab tcf.Init(ucmc, "Materials " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "Materials" + numopened, _discoveryForm.TopMost); ucmc.Init(_discoveryForm, numopened); HistoryEntry curpos = userControlTravelGrid.GetCurrentHistoryEntry; if (curpos != null) ucmc.Display(curpos.MaterialCommodity.Sort(false)); } else if (selected == PopOuts.Commodities) { int numopened = usercontrolsforms.CountOf(typeof(UserControlCommodities)) + 1; UserControlCommodities ucmc = new UserControlCommodities(); // Add a closest distance tab tcf.Init(ucmc, "Commodities " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "Commodities" + numopened, _discoveryForm.TopMost); ucmc.Init(_discoveryForm, numopened); HistoryEntry curpos = userControlTravelGrid.GetCurrentHistoryEntry; if (curpos != null) ucmc.Display(curpos.MaterialCommodity.Sort(true)); } else if (selected == PopOuts.Ledger) { int numopened = usercontrolsforms.CountOf(typeof(UserControlLedger)) + 1; UserControlLedger ucmc = new UserControlLedger(); // Add a closest distance tab tcf.Init(ucmc, "Ledger " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "Ledger" + numopened, _discoveryForm.TopMost); ucmc.Init(_discoveryForm, numopened); ucmc.Display(_discoveryForm.history.materialcommodititiesledger); ucmc.OnGotoJID += GotoJID; } else if (selected == PopOuts.Journal) { int numopened = usercontrolsforms.CountOf(typeof(UserControlJournalGrid)) + 1; // used to determine name and also key for DB UserControlJournalGrid uctg = new UserControlJournalGrid(); tcf.Init(uctg, "Journal History " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "JournalHistory" + numopened, _discoveryForm.TopMost); uctg.Init(_discoveryForm, numopened); uctg.Display(_discoveryForm.history); uctg.NoPopOutIcon(); uctg.NoHistoryIcon(); } else if (selected == PopOuts.TravelGrid) // match order in bitmap mp and comboBoxCustomPopOut { int numopened = usercontrolsforms.CountOf(typeof(UserControlTravelGrid)) + 1; // used to determine name and also key for DB UserControlTravelGrid uctg = new UserControlTravelGrid(); tcf.Init(uctg,"Travel History " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "TravelHistory" + numopened, _discoveryForm.TopMost); uctg.Init(_discoveryForm, numopened); uctg.Display(_discoveryForm.history); uctg.NoPopOutIcon(); uctg.NoHistoryIcon(); } else if (selected == PopOuts.ScreenShot) // match order in bitmap mp and comboBoxCustomPopOut { int numopened = usercontrolsforms.CountOf(typeof(UserControlScreenshot)) + 1; // used to determine name and also key for DB UserControlScreenshot ucm = new UserControlScreenshot(); tcf.Init(ucm, "ScreenShot " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "ScreenShot" + numopened, _discoveryForm.TopMost); ucm.Init(_discoveryForm, numopened); } else if (selected == PopOuts.Statistics) // match order in bitmap mp and comboBoxCustomPopOut { int numopened = usercontrolsforms.CountOf(typeof(UserControlStats)) + 1; // used to determine name and also key for DB UserControlStats ucm = new UserControlStats(); tcf.Init(ucm,"Statistics " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "Stats" + numopened, _discoveryForm.TopMost); ucm.Init(_discoveryForm, numopened); ucm.SelectionChanged(userControlTravelGrid.GetCurrentHistoryEntry, _discoveryForm.history); } else if (selected == PopOuts.Scan) { int numopened = usercontrolsforms.CountOf(typeof(UserControlScan)) + 1; // used to determine name and also key for DB UserControlScan ucm = new UserControlScan(); tcf.Init(ucm, "Scan " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "Scan" + numopened, _discoveryForm.TopMost); tcf.InitForTransparency(false, _discoveryForm.theme.LabelColor, _discoveryForm.theme.SPanelColor); ucm.Init(_discoveryForm, numopened); } else if (selected == PopOuts.Spanel2) { int numopened = usercontrolsforms.CountOf(typeof(UserControlSpanel)) + 1; // used to determine name and also key for DB UserControlSpanel ucm = new UserControlSpanel(); tcf.Init(ucm, "Summary Panel " + ((numopened > 1) ? numopened.ToString() : ""), _discoveryForm.theme.WindowsFrame, "Spanel" + numopened, true); tcf.InitForTransparency(true, _discoveryForm.theme.LabelColor, _discoveryForm.theme.SPanelColor); ucm.Init(_discoveryForm, numopened); } tcf.Show(); 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); if (selected == PopOuts.Spanel2) // need to theme, before draw, as it needs the theme colours set up ((UserControlSpanel)tcf.UserControl).Display(_discoveryForm.history); if (selected == PopOuts.Scan) // need to theme, before draw, as it needs the theme colours set up ((UserControlScan)tcf.UserControl).Display(userControlTravelGrid.GetCurrentHistoryEntry, _discoveryForm.history); }
static public string GetPopOutName(PopOuts p) { return(popoutinfo[p].WindowTitlePrefix); }