// on menu button.. public void ShowMenu(Map.Parts parts) { //map.displaycontrol.ApplyToControlOfName("InfoBoxForm*", (c) => { ((GLForm)c).Close(); }); // close any info box forms (don't want to I think) map.displaycontrol.ApplyToControlOfName("MS*", (c) => { c.Visible = false; }); // hide the visiblity of the on screen controls int leftmargin = 4; int vpos = 10; int hpad = 8; int ypad = 10; GLForm pform = new GLForm("Galmenu", "Configure Map", new Rectangle(10, 10, 500, 600)); pform.FormClosed = (frm) => { map.displaycontrol.ApplyToControlOfName("MS*", (c) => { c.Visible = true; }); }; pform.Resizeable = pform.Moveable = false; // provide opening animation pform.ScaleWindow = new SizeF(0.0f, 0.0f); pform.Animators.Add(new GLControlAnimateScale(10, 400, true, new SizeF(1, 1))); pform.Font = new Font("Arial", 10f); // and closing animation pform.FormClosing += (f, e) => { var nb = ((GLNumberBoxLong)pform["GalaxyStarsGB"]?["LYDist"]);; if (nb != null) { map.LocalAreaSize = (int)nb.Value; } e.Handled = true; // stop close var ani = new GLControlAnimateScale(10, 400, true, new SizeF(0, 0)); // add a close animation ani.FinishAction += (a, c, t) => { pform.ForceClose(); }; // when its complete, force close pform.Animators.Add(ani); }; { // top buttons int hpos = 0; if ((parts & Map.Parts.PerspectiveChange) != 0) { GLPanel p3d2d = new GLPanel("3d2d", new Rectangle(leftmargin, vpos, 80, iconsize), Color.Transparent); GLCheckBox but3d = new GLCheckBox("3d", new Rectangle(hpos, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.3d"), null); but3d.Checked = map.gl3dcontroller.MatrixCalc.InPerspectiveMode; but3d.ToolTipText = "3D View"; but3d.GroupRadioButton = true; but3d.MouseClick += (e1, e2) => { map.gl3dcontroller.ChangePerspectiveMode(true); }; p3d2d.Add(but3d); hpos += but3d.Width + hpad; GLCheckBox but2d = new GLCheckBox("2d", new Rectangle(hpos, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.2d"), null); but2d.Checked = !map.gl3dcontroller.MatrixCalc.InPerspectiveMode; but2d.ToolTipText = "2D View"; but2d.GroupRadioButton = true; but2d.MouseClick += (e1, e2) => { map.gl3dcontroller.ChangePerspectiveMode(false); }; p3d2d.Add(but2d); hpos += but2d.Width + hpad; pform.Add(p3d2d); } if ((parts & Map.Parts.YHoldButton) != 0) { GLCheckBox butelite = new GLCheckBox("Elite", new Rectangle(hpos, vpos, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.EliteMovement"), null); butelite.ToolTipText = "Select elite movement (on Y plain)"; butelite.Checked = map.gl3dcontroller.YHoldMovement; butelite.CheckChanged += (e1) => { map.gl3dcontroller.YHoldMovement = butelite.Checked; }; pform.Add(butelite); hpos += butelite.Width + hpad; } if ((parts & Map.Parts.Galaxy) != 0) { GLCheckBox butgal = new GLCheckBox("Galaxy", new Rectangle(hpos, vpos, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.ShowGalaxy"), null); butgal.ToolTipText = "Show galaxy image"; butgal.Checked = map.GalaxyDisplay; butgal.CheckChanged += (e1) => { map.GalaxyDisplay = butgal.Checked; }; pform.Add(butgal); hpos += butgal.Width + hpad; } if ((parts & Map.Parts.Grid) != 0) { GLCheckBox butgrid = new GLCheckBox("GridLines", new Rectangle(hpos, vpos, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.Grid"), null); butgrid.ToolTipText = "Show grid"; butgrid.Checked = map.Grid; butgrid.CheckChanged += (e1) => { map.Grid = butgrid.Checked; }; pform.Add(butgrid); hpos += butgrid.Width + hpad; } if ((parts & Map.Parts.StarDots) != 0) { GLCheckBox butsd = new GLCheckBox("StarDots", new Rectangle(hpos, vpos, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.StarDots"), null); butsd.ToolTipText = "Show star field"; butsd.Checked = map.StarDotsSpritesDisplay; butsd.CheckChanged += (e1) => { map.StarDotsSpritesDisplay = butsd.Checked; }; pform.Add(butsd); hpos += butsd.Width + hpad; } if ((parts & Map.Parts.NavRoute) != 0) { GLCheckBox butnr = new GLCheckBox("NavRoute", new Rectangle(hpos, vpos, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.NavRoute"), null); butnr.ToolTipText = "Show nav route"; butnr.Checked = map.NavRouteDisplay; butnr.CheckChanged += (e1) => { map.NavRouteDisplay = butnr.Checked; }; pform.Add(butnr); hpos += butnr.Width + hpad; } if ((parts & Map.Parts.Bookmarks) != 0) { GLCheckBox butbkmks = new GLCheckBox("Bookmarks", new Rectangle(hpos, vpos, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.ShowBookmarks"), null); butbkmks.ToolTipText = "Show bookmarks"; butbkmks.Checked = map.ShowBookmarks; butbkmks.CheckChanged += (e1) => { map.ShowBookmarks = butbkmks.Checked; }; pform.Add(butbkmks); hpos += butbkmks.Width + hpad; } vpos += iconsize + ypad; } if ((parts & Map.Parts.EDSMStars) != 0) { GLGroupBox tpgb = new GLGroupBox("GalaxyStarsGB", "Galaxy Stars", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, iconsize * 2)); tpgb.BackColor = Color.Transparent; tpgb.ForeColor = Color.Orange; pform.Add(tpgb); int hpos = leftmargin; GLCheckBox butgalstars = new GLCheckBox("GalaxyStars", new Rectangle(hpos, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.GalaxyStars"), null); butgalstars.ToolTipText = "Show stars when zoomed in"; butgalstars.Checked = (map.GalaxyStars & 1) != 0; butgalstars.CheckChanged += (e1) => { map.GalaxyStars ^= 1; }; tpgb.Add(butgalstars); hpos += butgalstars.Width + hpad; GLCheckBox butgalstarstext = new GLCheckBox("GalaxyStarsText", new Rectangle(hpos, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.GalaxyStarsText"), null); butgalstarstext.ToolTipText = "Show names of stars when zoomed in"; butgalstarstext.Checked = (map.GalaxyStars & 2) != 0; butgalstarstext.CheckChanged += (e1) => { map.GalaxyStars ^= 2; }; tpgb.Add(butgalstarstext); hpos += butgalstarstext.Width + hpad; if ((parts & Map.Parts.PrepopulateEDSMLocalArea) != 0) { GLNumberBoxLong nblong = new GLNumberBoxLong("LYDist", new Rectangle(hpos, 0, 50, iconsize), map.LocalAreaSize); nblong.Minimum = 1; nblong.Maximum = 500; nblong.ToolTipText = "Set distance in ly of the box around the current star to show"; tpgb.Add(nblong); hpos += nblong.Width + hpad; GLLabel lylab = new GLLabel("LYLab", new Rectangle(hpos, 0, 30, iconsize), "Ly"); lylab.ForeColor = Color.DarkOrange; tpgb.Add(lylab); hpos += lylab.Width + hpad; } if ((parts & Map.Parts.LimitSelector) != 0) { GLComboBox cbstars = new GLComboBox("GalaxyStarsNumber", new Rectangle(hpos, 0, 150, iconsize)); cbstars.ToolTipText = "Control how many stars are shown when zoomes in"; cbstars.Items = new List <string>() { "Stars-Ultra", "Stars-High", "Stars-Medium", "Stars-Low" }; var list = new List <int>() { 750000, 500000, 250000, 100000 }; int itemno = list.IndexOf(map.GalaxyStarsMaxObjects); // may be -1 if (itemno < 0) { itemno = 2; map.GalaxyStarsMaxObjects = list[itemno]; } cbstars.SelectedIndex = itemno; // high default cbstars.SelectedIndexChanged += (e1) => { map.GalaxyStarsMaxObjects = list[cbstars.SelectedIndex]; }; tpgb.Add(cbstars); } vpos += tpgb.Height + ypad; } if ((parts & Map.Parts.TravelPath) != 0) { GLGroupBox tpgb = new GLGroupBox("TravelPathGB", "Travel Path", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, iconsize * 3)); tpgb.BackColor = Color.Transparent; tpgb.ForeColor = Color.Orange; pform.Add(tpgb); GLCheckBox buttp = new GLCheckBox("TravelPathTape", new Rectangle(leftmargin, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.TravelPath"), null); buttp.ToolTipText = "Show travel path"; buttp.Checked = map.TravelPathTapeDisplay; buttp.CheckChanged += (e1) => { map.TravelPathTapeDisplay = buttp.Checked; }; tpgb.Add(buttp); GLDateTimePicker dtps = new GLDateTimePicker("TPStart", new Rectangle(50, 0, 350, 30), System.DateTime.Now); dtps.SuspendLayout(); dtps.AutoSize = true; dtps.ShowCheckBox = dtps.ShowCalendar = true; dtps.Value = map.TravelPathStartDate; dtps.Checked = map.TravelPathStartDateEnable; dtps.ValueChanged += (e1) => { map.TravelPathStartDate = dtps.Value; map.TravelPathRefresh(); }; dtps.CheckChanged += (e1) => { map.TravelPathStartDateEnable = dtps.Checked; map.TravelPathRefresh(); }; dtps.ShowUpDown = true; dtps.ResumeLayout(); tpgb.Add(dtps); GLCheckBox buttptext = new GLCheckBox("TravelPathText", new Rectangle(leftmargin, 34, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.GalaxyStarsText"), null); buttptext.ToolTipText = "Show names of stars when zoomed in"; buttptext.Checked = map.TravelPathTextDisplay; buttptext.CheckChanged += (e1) => { map.TravelPathTextDisplay = !map.TravelPathTextDisplay; }; tpgb.Add(buttptext); GLDateTimePicker dtpe = new GLDateTimePicker("TPEnd", new Rectangle(50, 34, 350, 30), System.DateTime.Now); dtpe.SuspendLayout(); dtpe.AutoSize = true; dtpe.ShowCheckBox = dtps.ShowCalendar = true; dtpe.Value = map.TravelPathEndDate; dtpe.Checked = map.TravelPathEndDateEnable; dtpe.ValueChanged += (e1) => { map.TravelPathEndDate = dtpe.Value; map.TravelPathRefresh(); }; dtpe.CheckChanged += (e1) => { map.TravelPathEndDateEnable = dtpe.Checked; map.TravelPathRefresh(); }; dtpe.ShowUpDown = true; dtpe.ResumeLayout(); tpgb.Add(dtpe); vpos += tpgb.Height + ypad; } if ((parts & Map.Parts.GalObjects) != 0) { GLGroupBox galgb = new GLGroupBox("GalGB", "Galaxy Objects", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, 50)); galgb.ClientHeight = (iconsize + 4) * 2; galgb.BackColor = Color.Transparent; galgb.ForeColor = Color.Orange; pform.Add(galgb); GLFlowLayoutPanel galfp = new GLFlowLayoutPanel("GALFP", DockingType.Fill, 0); galfp.FlowPadding = new PaddingType(2, 2, 2, 2); galfp.BackColor = Color.Transparent; galgb.Add(galfp); vpos += galgb.Height + ypad; IReadOnlyDictionary <GalMapType.VisibleObjectsType, Image> icons = new BaseUtils.Icons.IconGroup <GalMapType.VisibleObjectsType>("GalMap"); for (int i = GalMapType.VisibleTypes.Length - 1; i >= 0; i--) { var gt = GalMapType.VisibleTypes[i]; bool en = map.GetGalObjectTypeEnable(gt.TypeName); GLCheckBox butg = new GLCheckBox("GMSEL" + i, new Rectangle(0, 0, iconsize, iconsize), icons[gt.VisibleType.Value], null); butg.ToolTipText = "Enable/Disable " + gt.Description; butg.Checked = en; butg.CheckChanged += (e1) => { map.SetGalObjectTypeEnable(gt.TypeName, butg.Checked); }; galfp.Add(butg); } GLCheckBox butgonoff = new GLCheckBox("GMONOFF", new Rectangle(0, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.ShowGalaxy"), null); butgonoff.ToolTipText = "Enable/Disable Display"; butgonoff.Checked = map.GalObjectDisplay; butgonoff.CheckChanged += (e1) => { map.GalObjectDisplay = !map.GalObjectDisplay; }; galfp.Add(butgonoff); } if ((parts & Map.Parts.Regions) != 0) { // EDSM regions GLGroupBox edsmregionsgb = new GLGroupBox("EDSMR", "EDSM Regions", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, 50)); edsmregionsgb.ClientHeight = iconsize + 8; edsmregionsgb.BackColor = Color.Transparent; edsmregionsgb.ForeColor = Color.Orange; pform.Add(edsmregionsgb); vpos += edsmregionsgb.Height + ypad; GLCheckBox butedre = new GLCheckBox("EDSMRE", new Rectangle(leftmargin, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.ShowGalaxy"), null); butedre.ToolTipText = "Enable EDSM Regions"; butedre.Checked = map.EDSMRegionsEnable; butedre.UserCanOnlyCheck = true; edsmregionsgb.Add(butedre); GLCheckBox buted2 = new GLCheckBox("EDSMR2", new Rectangle(50, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.RegionOutlines"), null); buted2.Checked = map.EDSMRegionsOutlineEnable; buted2.Enabled = map.EDSMRegionsEnable; buted2.ToolTipText = "Enable Region Outlines"; buted2.CheckChanged += (e1) => { map.EDSMRegionsOutlineEnable = !map.EDSMRegionsOutlineEnable; }; edsmregionsgb.Add(buted2); GLCheckBox buted3 = new GLCheckBox("EDSMR3", new Rectangle(100, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.RegionShading"), null); buted3.Checked = map.EDSMRegionsShadingEnable; buted3.Enabled = map.EDSMRegionsEnable; buted3.ToolTipText = "Enable Region Shading"; buted3.CheckChanged += (e1) => { map.EDSMRegionsShadingEnable = !map.EDSMRegionsShadingEnable; }; edsmregionsgb.Add(buted3); GLCheckBox buted4 = new GLCheckBox("EDSMR4", new Rectangle(150, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.RegionNames"), null); buted4.Checked = map.EDSMRegionsTextEnable; buted4.Enabled = map.EDSMRegionsEnable; buted4.ToolTipText = "Enable Region Naming"; buted4.CheckChanged += (e1) => { map.EDSMRegionsTextEnable = !map.EDSMRegionsTextEnable; }; edsmregionsgb.Add(buted4); // elite regions GLGroupBox eliteregionsgb = new GLGroupBox("ELITER", "Elite Regions", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, 50)); eliteregionsgb.ClientHeight = iconsize + 8; eliteregionsgb.BackColor = Color.Transparent; eliteregionsgb.ForeColor = Color.Orange; pform.Add(eliteregionsgb); vpos += eliteregionsgb.Height + ypad; GLCheckBox butelre = new GLCheckBox("ELITERE", new Rectangle(leftmargin, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.ShowGalaxy"), null); butelre.ToolTipText = "Enable Elite Regions"; butelre.Checked = map.EliteRegionsEnable; butelre.UserCanOnlyCheck = true; eliteregionsgb.Add(butelre); GLCheckBox butel2 = new GLCheckBox("ELITER2", new Rectangle(50, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.RegionOutlines"), null); butel2.Checked = map.EliteRegionsOutlineEnable; butel2.Enabled = map.EliteRegionsEnable; butel2.ToolTipText = "Enable Region Outlines"; butel2.CheckChanged += (e1) => { map.EliteRegionsOutlineEnable = !map.EliteRegionsOutlineEnable; }; eliteregionsgb.Add(butel2); GLCheckBox butel3 = new GLCheckBox("ELITER3", new Rectangle(100, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.RegionShading"), null); butel3.Checked = map.EliteRegionsShadingEnable; butel3.Enabled = map.EliteRegionsEnable; butel3.ToolTipText = "Enable Region Shading"; butel3.CheckChanged += (e1) => { map.EliteRegionsShadingEnable = !map.EliteRegionsShadingEnable; }; eliteregionsgb.Add(butel3); GLCheckBox butel4 = new GLCheckBox("ELITER4", new Rectangle(150, 0, iconsize, iconsize), BaseUtils.Icons.IconSet.GetBitmap("GalMap.RegionNames"), null); butel4.Checked = map.EliteRegionsTextEnable; butel4.Enabled = map.EliteRegionsEnable; butel4.ToolTipText = "Enable Region Naming"; butel4.CheckChanged += (e1) => { map.EliteRegionsTextEnable = !map.EliteRegionsTextEnable; }; eliteregionsgb.Add(butel4); butedre.CheckChanged += (e) => { if (e.Name == "EDSMRE") { butelre.CheckedNoChangeEvent = !butedre.Checked; } else { butedre.CheckedNoChangeEvent = !butelre.Checked; } map.EDSMRegionsEnable = butedre.Checked; map.EliteRegionsEnable = butelre.Checked; buted2.Enabled = buted3.Enabled = buted4.Enabled = butedre.Checked; butel2.Enabled = butel3.Enabled = butel4.Enabled = butelre.Checked; }; butelre.CheckChanged += butedre.CheckChanged; } pform.ClientHeight = vpos; map.displaycontrol.Add(pform); }
// on menu button.. public void ShowMenu() { map.displaycontrol.ApplyToControlOfName("InfoBoxForm*", (c) => { ((GLForm)c).Close(); }); // close any info box forms map.displaycontrol.ApplyToControlOfName("MS*", (c) => { c.Visible = false; }); // hide the visiblity of the on screen controls int leftmargin = 4; int vpos = 10; int ypad = 10; GLForm pform = new GLForm("Galmenu", "Configure Map", new Rectangle(10, 10, 600, 600)); pform.BackColor = Color.FromArgb(220, 60, 60, 70); pform.ForeColor = Color.Orange; pform.FormClosed = (frm) => { map.displaycontrol.ApplyToControlOfName("MS*", (c) => { c.Visible = true; }); }; pform.Resizeable = pform.Moveable = false; // provide opening animation pform.ScaleWindow = new SizeF(0.0f, 0.0f); pform.Animators.Add(new AnimateScale(10, 400, true, new SizeF(1, 1))); // and closing animation pform.FormClosing += (f, e) => { e.Handled = true; // stop close var ani = new AnimateScale(10, 400, true, new SizeF(0, 0)); // add a close animation ani.FinishAction += (a, c, t) => { pform.ForceClose(); }; // when its complete, force close pform.Animators.Add(ani); }; { // top buttons GLPanel p3d2d = new GLPanel("3d2d", new Rectangle(leftmargin, vpos, 80, iconsize), Color.Transparent); GLCheckBox but3d = new GLCheckBox("3d", new Rectangle(0, 0, iconsize, iconsize), Properties.Resources._3d, null); but3d.Checked = map.gl3dcontroller.MatrixCalc.InPerspectiveMode; but3d.ToolTipText = "3D View"; but3d.GroupRadioButton = true; but3d.MouseClick += (e1, e2) => { map.gl3dcontroller.ChangePerspectiveMode(true); }; p3d2d.Add(but3d); GLCheckBox but2d = new GLCheckBox("2d", new Rectangle(50, 0, iconsize, iconsize), Properties.Resources._2d, null); but2d.Checked = !map.gl3dcontroller.MatrixCalc.InPerspectiveMode; but2d.ToolTipText = "2D View"; but2d.GroupRadioButton = true; but2d.MouseClick += (e1, e2) => { map.gl3dcontroller.ChangePerspectiveMode(false); }; p3d2d.Add(but2d); pform.Add(p3d2d); GLCheckBox butelite = new GLCheckBox("Elite", new Rectangle(100, vpos, iconsize, iconsize), Properties.Resources.EliteMovement, null); butelite.ToolTipText = "Select elite movement (on Y plain)"; butelite.Checked = map.gl3dcontroller.YHoldMovement; butelite.CheckChanged += (e1) => { map.gl3dcontroller.YHoldMovement = butelite.Checked; }; pform.Add(butelite); GLCheckBox butgal = new GLCheckBox("Galaxy", new Rectangle(150, vpos, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); butgal.ToolTipText = "Show galaxy image"; butgal.Checked = map.GalaxyDisplay; butgal.CheckChanged += (e1) => { map.GalaxyDisplay = butgal.Checked; }; pform.Add(butgal); GLCheckBox butsd = new GLCheckBox("StarDots", new Rectangle(200, vpos, iconsize, iconsize), Properties.Resources.StarDots, null); butsd.ToolTipText = "Show star field"; butsd.Checked = map.StarDotsDisplay; butsd.CheckChanged += (e1) => { map.StarDotsDisplay = butsd.Checked; }; pform.Add(butsd); vpos += butgal.Height + ypad; } { GLGroupBox tpgb = new GLGroupBox("TravelPathGB", "Travel Path", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, iconsize * 2)); tpgb.BackColor = pform.BackColor; tpgb.ForeColor = Color.Orange; pform.Add(tpgb); GLCheckBox buttp = new GLCheckBox("TravelPath", new Rectangle(leftmargin, 0, iconsize, iconsize), Properties.Resources.StarDots, null); buttp.ToolTipText = "Show travel path"; buttp.Checked = map.TravelPathDisplay; buttp.CheckChanged += (e1) => { map.TravelPathDisplay = buttp.Checked; }; tpgb.Add(buttp); GLDateTimePicker dtps = new GLDateTimePicker("TPStart", new Rectangle(50, 0, 250, 30), DateTime.Now); dtps.Font = new Font("Ms Sans Serif", 8.25f); dtps.ShowCheckBox = dtps.ShowCalendar = true; dtps.Value = map.TravelPathStartDate; dtps.Checked = map.TravelPathStartDateEnable; dtps.ValueChanged += (e1) => { map.TravelPathStartDate = dtps.Value; map.TravelPathRefresh(); }; dtps.CheckChanged += (e1) => { map.TravelPathStartDateEnable = dtps.Checked; map.TravelPathRefresh(); }; dtps.ShowUpDown = true; tpgb.Add(dtps); GLDateTimePicker dtpe = new GLDateTimePicker("TPEnd", new Rectangle(320, 0, 250, 30), DateTime.Now); dtpe.Font = new Font("Ms Sans Serif", 8.25f); dtpe.ShowCheckBox = dtps.ShowCalendar = true; dtpe.Value = map.TravelPathEndDate; dtpe.Checked = map.TravelPathEndDateEnable; dtpe.ValueChanged += (e1) => { map.TravelPathEndDate = dtpe.Value; map.TravelPathRefresh(); }; dtpe.CheckChanged += (e1) => { map.TravelPathEndDateEnable = dtpe.Checked; map.TravelPathRefresh(); }; dtpe.ShowUpDown = true; tpgb.Add(dtpe); vpos += tpgb.Height + ypad; } { // Galaxy objects GLGroupBox galgb = new GLGroupBox("GalGB", "Galaxy Objects", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, 50)); galgb.ClientHeight = (iconsize + 4) * 2; galgb.BackColor = pform.BackColor; galgb.ForeColor = Color.Orange; pform.Add(galgb); GLFlowLayoutPanel galfp = new GLFlowLayoutPanel("GALFP", DockingType.Fill, 0); galfp.FlowPadding = new PaddingType(2, 2, 2, 2); galfp.BackColor = pform.BackColor; galgb.Add(galfp); for (int i = map.edsmmapping.RenderableMapTypes.Length - 1; i >= 0; i--) { var gt = map.edsmmapping.RenderableMapTypes[i]; bool en = map.GetGalObjectTypeEnable(gt.Typeid); GLCheckBox butg = new GLCheckBox("GMSEL" + i, new Rectangle(0, 0, iconsize, iconsize), gt.Image, null); butg.ToolTipText = "Enable/Disable " + gt.Description; butg.Checked = en; butg.CheckChanged += (e1) => { map.SetGalObjectTypeEnable(gt.Typeid, butg.Checked); }; galfp.Add(butg); } GLCheckBox butgonoff = new GLCheckBox("GMONOFF", new Rectangle(0, 0, iconsize, iconsize), Properties.Resources.dotted, null); butgonoff.ToolTipText = "Enable/Disable Display"; butgonoff.Checked = map.GalObjectDisplay; butgonoff.CheckChanged += (e1) => { map.GalObjectDisplay = !map.GalObjectDisplay; }; galfp.Add(butgonoff); vpos += galgb.Height + ypad; } { // EDSM regions GLGroupBox edsmregionsgb = new GLGroupBox("EDSMR", "EDSM Regions", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, 50)); edsmregionsgb.ClientHeight = iconsize + 8; edsmregionsgb.BackColor = pform.BackColor; edsmregionsgb.ForeColor = Color.Orange; pform.Add(edsmregionsgb); vpos += edsmregionsgb.Height + ypad; GLCheckBox butedre = new GLCheckBox("EDSMRE", new Rectangle(leftmargin, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); butedre.ToolTipText = "Enable EDSM Regions"; butedre.Checked = map.EDSMRegionsEnable; butedre.UserCanOnlyCheck = true; edsmregionsgb.Add(butedre); GLCheckBox buted2 = new GLCheckBox("EDSMR2", new Rectangle(50, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); buted2.Checked = map.EDSMRegionsOutlineEnable; buted2.Enabled = map.EDSMRegionsEnable; buted2.ToolTipText = "Enable Region Outlines"; buted2.CheckChanged += (e1) => { map.EDSMRegionsOutlineEnable = !map.EDSMRegionsOutlineEnable; }; edsmregionsgb.Add(buted2); GLCheckBox buted3 = new GLCheckBox("EDSMR3", new Rectangle(100, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); buted3.Checked = map.EDSMRegionsShadingEnable; buted3.Enabled = map.EDSMRegionsEnable; buted3.ToolTipText = "Enable Region Shading"; buted3.CheckChanged += (e1) => { map.EDSMRegionsShadingEnable = !map.EDSMRegionsShadingEnable; }; edsmregionsgb.Add(buted3); GLCheckBox buted4 = new GLCheckBox("EDSMR4", new Rectangle(150, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); buted4.Checked = map.EDSMRegionsTextEnable; buted4.Enabled = map.EDSMRegionsEnable; buted4.ToolTipText = "Enable Region Naming"; buted4.CheckChanged += (e1) => { map.EDSMRegionsTextEnable = !map.EDSMRegionsTextEnable; }; edsmregionsgb.Add(buted4); // elite regions GLGroupBox eliteregionsgb = new GLGroupBox("ELITER", "Elite Regions", new Rectangle(leftmargin, vpos, pform.ClientWidth - leftmargin * 2, 50)); eliteregionsgb.ClientHeight = iconsize + 8; eliteregionsgb.BackColor = pform.BackColor; eliteregionsgb.ForeColor = Color.Orange; pform.Add(eliteregionsgb); vpos += eliteregionsgb.Height + ypad; GLCheckBox butelre = new GLCheckBox("ELITERE", new Rectangle(leftmargin, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); butelre.ToolTipText = "Enable Elite Regions"; butelre.Checked = map.EliteRegionsEnable; butelre.UserCanOnlyCheck = true; eliteregionsgb.Add(butelre); GLCheckBox butel2 = new GLCheckBox("ELITER2", new Rectangle(50, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); butel2.Checked = map.EliteRegionsOutlineEnable; butel2.Enabled = map.EliteRegionsEnable; butel2.ToolTipText = "Enable Region Outlines"; butel2.CheckChanged += (e1) => { map.EliteRegionsOutlineEnable = !map.EliteRegionsOutlineEnable; }; eliteregionsgb.Add(butel2); GLCheckBox butel3 = new GLCheckBox("ELITER3", new Rectangle(100, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); butel3.Checked = map.EliteRegionsShadingEnable; butel3.Enabled = map.EliteRegionsEnable; butel3.ToolTipText = "Enable Region Shading"; butel3.CheckChanged += (e1) => { map.EliteRegionsShadingEnable = !map.EliteRegionsShadingEnable; }; eliteregionsgb.Add(butel3); GLCheckBox butel4 = new GLCheckBox("ELITER4", new Rectangle(150, 0, iconsize, iconsize), Properties.Resources.ShowGalaxy, null); butel4.Checked = map.EliteRegionsTextEnable; butel4.Enabled = map.EliteRegionsEnable; butel4.ToolTipText = "Enable Region Naming"; butel4.CheckChanged += (e1) => { map.EliteRegionsTextEnable = !map.EliteRegionsTextEnable; }; eliteregionsgb.Add(butel4); butedre.CheckChanged += (e) => { if (e.Name == "EDSMRE") { butelre.CheckedNoChangeEvent = !butedre.Checked; } else { butedre.CheckedNoChangeEvent = !butelre.Checked; } map.EDSMRegionsEnable = butedre.Checked; map.EliteRegionsEnable = butelre.Checked; buted2.Enabled = buted3.Enabled = buted4.Enabled = butedre.Checked; butel2.Enabled = butel3.Enabled = butel4.Enabled = butelre.Checked; }; butelre.CheckChanged += butedre.CheckChanged; } map.displaycontrol.Add(pform); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); Closed += ShaderTest_Closed; items.Add(new GLMatrixCalcUniformBlock(), "MCUB"); // create a matrix uniform block int front = -20000, back = front + 90000, left = -45000, right = left + 90000, vsize = 2000; Vector4[] displaylines = new Vector4[] { new Vector4(left, -vsize, front, 1), new Vector4(left, +vsize, front, 1), new Vector4(left, +vsize, front, 1), new Vector4(right, +vsize, front, 1), new Vector4(right, +vsize, front, 1), new Vector4(right, -vsize, front, 1), new Vector4(right, -vsize, front, 1), new Vector4(left, -vsize, front, 1), new Vector4(left, -vsize, back, 1), new Vector4(left, +vsize, back, 1), new Vector4(left, +vsize, back, 1), new Vector4(right, +vsize, back, 1), new Vector4(right, +vsize, back, 1), new Vector4(right, -vsize, back, 1), new Vector4(right, -vsize, back, 1), new Vector4(left, -vsize, back, 1), new Vector4(left, -vsize, front, 1), new Vector4(left, -vsize, back, 1), new Vector4(left, +vsize, front, 1), new Vector4(left, +vsize, back, 1), new Vector4(right, -vsize, front, 1), new Vector4(right, -vsize, back, 1), new Vector4(right, +vsize, front, 1), new Vector4(right, +vsize, back, 1), }; GLRenderState rl = GLRenderState.Lines(1); { items.Add(new GLFixedShader(System.Drawing.Color.Yellow), "LINEYELLOW"); rObjects.Add(items.Shader("LINEYELLOW"), GLRenderableItem.CreateVector4(items, PrimitiveType.Lines, rl, displaylines)); } float h = 0; if (h != -1) { items.Add(new GLColorShaderWorld(), "COS-1L"); int dist = 1000; Color cr = Color.FromArgb(100, Color.White); rObjects.Add(items.Shader("COS-1L"), // horizontal GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, rl, GLShapeObjectFactory.CreateLines(new Vector3(left, h, front), new Vector3(left, h, back), new Vector3(dist, 0, 0), (back - front) / dist + 1), new Color4[] { cr }) ); rObjects.Add(items.Shader("COS-1L"), GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, rl, GLShapeObjectFactory.CreateLines(new Vector3(left, h, front), new Vector3(right, h, front), new Vector3(0, 0, dist), (right - left) / dist + 1), new Color4[] { cr }) ); } { items.Add(new GLTexturedShaderObjectTranslation(), "TEX"); items.Add(new GLTexture2D(Properties.Resources.dotted2, SizedInternalFormat.Rgba8), "dotted2"); GLRenderState rt = GLRenderState.Tri(); rObjects.Add(items.Shader("TEX"), GLRenderableItem.CreateVector4Vector2(items, OpenTK.Graphics.OpenGL4.PrimitiveType.Triangles, rt, GLCubeObjectFactory.CreateSolidCubeFromTriangles(2000f), GLCubeObjectFactory.CreateCubeTexTriangles(), new GLRenderDataTranslationRotationTexture(items.Tex("dotted2"), new Vector3(-2, 0, 0)) )); } { items.Add(new GLFixedColorShaderWorld(Color.FromArgb(150, Color.Green)), "FCS1"); items.Add(new GLFixedColorShaderWorld(Color.FromArgb(80, Color.Red)), "FCS2"); GLRenderState rq = GLRenderState.Quads(); rObjects.Add(items.Shader("FCS1"), GLRenderableItem.CreateVector4(items, OpenTK.Graphics.OpenGL4.PrimitiveType.Quads, rq, GLShapeObjectFactory.CreateQuad(1000, pos: new Vector3(4000, 500, 0)))); rObjects.Add(items.Shader("FCS2"), GLRenderableItem.CreateVector4(items, OpenTK.Graphics.OpenGL4.PrimitiveType.Quads, rq, GLShapeObjectFactory.CreateQuad(1000, pos: new Vector3(4000, 1000, 0)))); } MatrixCalcSpecial mc = new MatrixCalcSpecial(); mc.PerspectiveNearZDistance = 1f; mc.PerspectiveFarZDistance = 500000f; mc.ResizeViewPort(this, glwfc.Size); // must establish size before starting displaycontrol = new GLControlDisplay(items, glwfc, mc); // hook form to the window - its the master, it takes its size fro mc.ScreenCoordMax displaycontrol.Focusable = true; // we want to be able to focus and receive key presses. displaycontrol.Name = "displaycontrol"; GLForm pform = new GLForm("Form1", "GL Control demonstration", new Rectangle(0, 0, 1000, 850)); // pform.BackColor = Color.FromArgb(200, Color.Red); //pform.BackColorGradientDir = 90; //pform.BackColorGradientAlt = Color.FromArgb(200, Color.Yellow); displaycontrol.Add(pform); if (true) { GLPanel p1 = new GLPanel("P3", new Size(150, 150), DockingType.TopLeft, 0); p1.SetMarginBorderWidth(new MarginType(1), 1, Color.Black, new PaddingType(1)); pform.Add(p1); } if (true) { GLTableLayoutPanel ptable = new GLTableLayoutPanel("tablelayout", new Rectangle(5, 200, 190, 190)); ptable.Margin = new MarginType(2); ptable.Padding = new PaddingType(2); ptable.BorderWidth = 1; ptable.Rows = new List <GLTableLayoutPanel.Style> { new GLTableLayoutPanel.Style(GLTableLayoutPanel.Style.SizeTypeEnum.Weight, 50), new GLTableLayoutPanel.Style(GLTableLayoutPanel.Style.SizeTypeEnum.Weight, 50) }; ptable.Columns = new List <GLTableLayoutPanel.Style> { new GLTableLayoutPanel.Style(GLTableLayoutPanel.Style.SizeTypeEnum.Weight, 50), new GLTableLayoutPanel.Style(GLTableLayoutPanel.Style.SizeTypeEnum.Weight, 50) }; pform.Add(ptable); GLImage pti1 = new GLImage("PTI1", new Rectangle(0, 0, 24, 24), Properties.Resources.dotted); pti1.Column = 0; pti1.Row = 0; pti1.Dock = DockingType.Fill; ptable.Add(pti1); GLImage pti2 = new GLImage("PTI2", new Rectangle(100, 0, 24, 24), Properties.Resources.dotted2); pti2.Column = 1; pti1.Row = 0; ptable.Add(pti2); GLImage pti3 = new GLImage("PTI3", new Rectangle(100, 0, 48, 48), Properties.Resources.ImportSphere); pti3.Column = 0; pti3.Row = 1; pti3.Dock = DockingType.LeftCenter; pti3.ImageStretch = true; ptable.Add(pti3); GLImage pti4 = new GLImage("PTI4", new Rectangle(100, 0, 64, 64), Properties.Resources.Logo8bpp); pti4.Column = 1; pti4.Row = 1; pti4.Dock = DockingType.Center; ptable.Add(pti4); } if (true) { GLFlowLayoutPanel pflow1 = new GLFlowLayoutPanel("flowlayout", new Rectangle(5, 400, 190, 190)); pflow1.SetMarginBorderWidth(new MarginType(2), 1, Color.Black, new PaddingType(2)); pflow1.FlowPadding = new PaddingType(10, 5, 0, 0); pform.Add(pflow1); GLImage pti1 = new GLImage("PTI1", new Rectangle(0, 0, 24, 24), Properties.Resources.dotted); pflow1.Add(pti1); GLImage pti2 = new GLImage("PTI2", new Rectangle(100, 0, 32, 32), Properties.Resources.dotted2); pflow1.Add(pti2); GLImage pti3 = new GLImage("PTI3", new Rectangle(100, 0, 48, 48), Properties.Resources.ImportSphere); pflow1.Add(pti3); GLImage pti4 = new GLImage("PTI4", new Rectangle(100, 0, 64, 64), Properties.Resources.Logo8bpp); pflow1.Add(pti4); } if (true) { GLScrollPanel sp1 = new GLScrollPanel("VSP1", new Rectangle(5, 600, 200, 200)); sp1.BorderWidth = 1; sp1.BackColor = Color.Yellow; // sp1.SetMarginBorderWidth(new Margin(2), 1, Color.Black, new GLOFC.GL4.Controls.Padding(2)); pform.Add(sp1); GLImage sp1i1 = new GLImage("SP1I1", new Rectangle(0, 0, 190, 100), Properties.Resources.dotted); sp1.Add(sp1i1); GLImage sp1i2 = new GLImage("SP1I22", new Rectangle(10, 150, 100, 100), Properties.Resources.dotted); sp1.Add(sp1i2); GLImage sp1i3 = new GLImage("SP1I23", new Rectangle(100, 100, 200, 200), Properties.Resources.dotted2); sp1.Add(sp1i3); sp1.VertScrollPos = 0; sp1.HorzScrollPos = 0; GLScrollBar sb1 = new GLScrollBar("SB1", new Rectangle(220, 600, 20, 100), 0, 200); sb1.Scroll += (c, s1e) => sp1.VertScrollPos = s1e.NewValue; pform.Add(sb1); GLScrollBar sb2 = new GLScrollBar("SB2", new Rectangle(260, 600, 100, 20), 0, 200); sb2.HorizontalScroll = true; sb2.Scroll += (c, s1e) => sp1.HorzScrollPos = s1e.NewValue; pform.Add(sb2); } int col2 = 200; if (true) { GLScrollPanelScrollBar spb1 = new GLScrollPanelScrollBar("CSPan", new Rectangle(col2, 5, 190, 190)); spb1.ScrollBackColor = Color.Yellow; spb1.SetMarginBorderWidth(new MarginType(2), 1, Color.Black, new PaddingType(2)); pform.Add(spb1); GLImage spb1i1 = new GLImage("SPB1I1", new Rectangle(10, 10, 100, 100), Properties.Resources.dotted); spb1.Add(spb1i1); GLButton but = new GLButton("SPB1BUT1", new Rectangle(40, 120, 40, 20), "But1"); but.Click += (en, eb) => { System.Diagnostics.Debug.WriteLine("Click on SP Button"); }; spb1.Add(but); GLImage spb1i2 = new GLImage("SPB1I2", new Rectangle(10, 150, 100, 100), Properties.Resources.dotted); spb1.Add(spb1i2); spb1.EnableHorzScrolling = false; } { GLButton but = new GLButton("ButExample", new Rectangle(40, 160, 40, 20), "But1"); but.Click += (en, eb) => { System.Diagnostics.Debug.WriteLine("Click on SP Button"); }; pform.Add(but); } int col3 = 400; if (true) { GLScrollPanelScrollBar spb1 = new GLScrollPanelScrollBar("CSPan2", new Rectangle(col3, 5, 190, 190)); spb1.ScrollBackColor = Color.Blue; spb1.ScrollBarTheme.ThumbButtonColor = Color.Red; spb1.SetMarginBorderWidth(new MarginType(2), 1, Color.Black, new PaddingType(2)); pform.Add(spb1); GLImage spb1i1 = new GLImage("SPB1I1", new Rectangle(10, 10, 100, 100), Properties.Resources.dotted); spb1.Add(spb1i1); GLImage spb1i2 = new GLImage("SPB1I2", new Rectangle(10, 120, 100, 100), Properties.Resources.dotted); spb1.Add(spb1i2); GLImage spb1i3 = new GLImage("SPB1I3", new Rectangle(150, 50, 100, 100), Properties.Resources.dotted2); spb1.Add(spb1i3); } if (true) { //GLGroupBox p3 = new GLGroupBox("GB1", "Group Box Very Long Title", new Rectangle(col2,200,190,190)); GLGroupBox p3 = new GLGroupBox("GB1", "Group Box", new Rectangle(col2, 200, 190, 190)); p3.TextAlign = ContentAlignment.MiddleRight; p3.AutoSize = true; GLImage spb1i1 = new GLImage("SPB1I1", new Rectangle(10, 10, 100, 100), Properties.Resources.dotted); p3.Add(spb1i1); pform.Add(p3); } if (true) { GLTabControl tc = new GLTabControl("Tabc", new Rectangle(col2, 400, 200, 190)); tc.TabNotSelectedColor = Color.Yellow; tc.TabSelectedColor = Color.Red; tc.TabStyle = new TabStyleRoundedEdge(); //tc.TabStyle = new TabStyleSquare(); //tc.TabStyle = new TabStyleAngled(); tc.Font = new Font("Ms Sans Serif", 9); GLTabPage tabp1 = new GLTabPage("tabp1", "TAB 1", Color.Blue); tc.Add(tabp1); GLButton tabp1b1 = new GLButton("B1", new Rectangle(5, 5, 80, 40), "Button 1"); tabp1.Add(tabp1b1); tabp1b1.Click += (c, ev) => { System.Diagnostics.Debug.WriteLine("On click for " + c.Name + " " + ev.Button); }; tabp1b1.ToolTipText = "Button 1"; GLTabPage tabp2 = new GLTabPage("tabp2", "TAB Page 2", Color.Yellow); GLButton tabp2b1 = new GLButton("B2-2", new Rectangle(5, 25, 80, 40), "Button 2-2"); tabp2.Add(tabp2b1); tc.Add(tabp2); GLTabPage tabp3 = new GLTabPage("tabp3", "TAB Page 3", Color.Green); tc.Add(tabp3); GLTabPage tabp4 = new GLTabPage("tabp4", "TAB Page 4", Color.Magenta); tc.Add(tabp4); pform.Add(tc); // tc.SelectedTab = 0; GLButton tabselnone = new GLButton("BTSN", new Rectangle(col2 + 200 + 5, 400, 40, 15), "None"); tabselnone.Click += (c12, ev2) => { tc.SelectedTab = -1; }; pform.Add(tabselnone); } if (true) { GLPanel pouter = new GLPanel("outerflow", new Rectangle(col3, 200, 1300, 30)); // make it very wide, so the child has all the width it wants to flow into pouter.SetMarginBorderWidth(new MarginType(5), 1, Color.Blue, new PaddingType(5)); pouter.AutoSize = true; GLFlowLayoutPanel pflow2; pflow2 = new GLFlowLayoutPanel("Flowlayout2", new Rectangle(0, 0, 10, 10)); pflow2.AutoSize = true; pflow2.Margin = new MarginType(2); pflow2.Padding = new PaddingType(2); pflow2.BorderWidth = 1; pflow2.FlowPadding = new PaddingType(10, 5, 0, 5); GLImage pti1 = new GLImage("PTI1", new Rectangle(0, 0, 24, 24), Properties.Resources.dotted2); pflow2.Add(pti1); GLImage pti2 = new GLImage("PTI2", new Rectangle(0, 0, 32, 32), Properties.Resources.dotted2); pflow2.Add(pti2); GLImage pti3 = new GLImage("PTI3", new Rectangle(0, 0, 48, 48), Properties.Resources.ImportSphere); pflow2.Add(pti3); for (int i = 0; i < 5; i++) { GLImage pti4 = new GLImage("PTI00" + i, new Rectangle(0, 0, 64, 64), Properties.Resources.Logo8bpp); pflow2.Add(pti4); } pouter.Add(pflow2); pform.Add(pouter); } { GLToolTip tip = new GLToolTip("ToolTip"); displaycontrol.Add(tip); } gl3dcontroller = new Controller3D(); gl3dcontroller.ZoomDistance = 5000F; gl3dcontroller.YHoldMovement = true; gl3dcontroller.PaintObjects = Controller3dDraw; gl3dcontroller.KeyboardTravelSpeed = (ms, eyedist) => { return((float)ms * 10.0f); }; gl3dcontroller.MatrixCalc.InPerspectiveMode = true; if (displaycontrol != null) { gl3dcontroller.Start(mc, displaycontrol, new Vector3(0, 0, 10000), new Vector3(140.75f, 0, 0), 0.5F); // HOOK the 3dcontroller to the form so it gets Form events displaycontrol.Paint += (o, ts) => // subscribing after start means we paint over the scene, letting transparency work { //System.Diagnostics.Debug.WriteLine(ts + " Render"); displaycontrol.Render(glwfc.RenderState, ts); // we use the same matrix calc as done in controller 3d draw }; } else { gl3dcontroller.Start(glwfc, new Vector3(0, 0, 10000), new Vector3(140.75f, 0, 0), 0.5F); // HOOK the 3dcontroller to the form so it gets Form events } systemtimer.Interval = 25; systemtimer.Tick += new EventHandler(SystemTick); systemtimer.Start(); }