/// <summary> /// Will make this OpenGL context current only if it is not already current. /// </summary> new public void MakeCurrent() { if (m_oCurrentCanvas != this) { base.MakeCurrent(); m_oCurrentCanvas = this; } }
public SystemMap() { m_oViewPortPanel = new Panels.SysMap_ViewPort(); m_oControlsPanel = new Panels.SysMap_Controls(); /// <summary> /// Add time button handlers to ViewPortPanel. /// </summary> m_oViewPortPanel.AdvanceTime5S.Click += new EventHandler(AdvanceTime5S_Click); m_oViewPortPanel.AdvanceTime30S.Click += new EventHandler(AdvanceTime30S_Click); m_oViewPortPanel.AdvanceTime2M.Click += new EventHandler(AdvanceTime2M_Click); m_oViewPortPanel.AdvanceTime5M.Click += new EventHandler(AdvanceTime5M_Click); m_oViewPortPanel.AdvanceTime20M.Click += new EventHandler(AdvanceTime20M_Click); m_oViewPortPanel.AdvanceTime1H.Click += new EventHandler(AdvanceTime1H_Click); m_oViewPortPanel.AdvanceTime3H.Click += new EventHandler(AdvanceTime3H_Click); m_oViewPortPanel.AdvanceTime8H.Click += new EventHandler(AdvanceTime8H_Click); m_oViewPortPanel.AdvanceTime1D.Click += new EventHandler(AdvanceTime1D_Click); m_oViewPortPanel.AdvanceTime5D.Click += new EventHandler(AdvanceTime5D_Click); m_oViewPortPanel.AdvanceTime30D.Click += new EventHandler(AdvanceTime30D_Click); m_oViewPortPanel.StartSim.Click += new EventHandler(StartSim_Click); // setup GL Canvas and insert it into the ViewPort: m_oGLCanvas = new GLCanvas(); m_oGLCanvas.Dock = DockStyle.Fill; m_oViewPortPanel.Controls.Add(m_oGLCanvas); // setup viewmodel: VM = new GLStarSystemViewModel(); // Bind System Selection Combo Box. m_oControlsPanel.SystemSelectionComboBox.Bind(c => c.DataSource, VM, d => d.StarSystems); m_oControlsPanel.SystemSelectionComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentStarSystem, DataSourceUpdateMode.OnPropertyChanged); m_oControlsPanel.SystemSelectionComboBox.DisplayMember = "Name"; VM.StarSystemChanged += (s, args) => CurrentStarSystem = VM.CurrentStarSystem; m_oCurrnetSystem = VM.CurrentStarSystem; m_oControlsPanel.SystemSelectionComboBox.SelectedIndexChanged += (s, args) => m_oControlsPanel.SystemSelectionComboBox.DataBindings["SelectedItem"].WriteValue(); // register event handlers:\ m_oGLCanvas.KeyDown += new KeyEventHandler(OnKeyDown); m_oGLCanvas.MouseDown += new MouseEventHandler(OnMouseDown); m_oGLCanvas.MouseMove += new MouseEventHandler(OnMouseMove); m_oGLCanvas.MouseUp += new MouseEventHandler(OnMouseUp); m_oGLCanvas.MouseHover += new EventHandler(OnMouseHover); m_oGLCanvas.MouseWheel += new MouseEventHandler(OnMouseWheel); m_oGLCanvas.Click += new EventHandler(m_oGLCanvas_Click); m_oViewPortPanel.SizeChanged += new EventHandler(ViewPort_SizeChanged); m_oControlsPanel.PanUpButton.Click += new EventHandler(PanUpButton_Click); m_oControlsPanel.PanDownButton.Click += new EventHandler(PanDownButton_Click); m_oControlsPanel.PanLeftButton.Click += new EventHandler(PanLeftButton_Click); m_oControlsPanel.PanRightButton.Click += new EventHandler(PanRightButton_Click); m_oControlsPanel.ZoomInButton.Click += new EventHandler(ZoomInButton_Click); m_oControlsPanel.ZoomOutButton.Click += new EventHandler(ZoomOutButton_Click); m_oControlsPanel.ResetViewButton.Click += new EventHandler(ResetViewButton_Click); m_oControlsPanel.CreateMapMarkerButton.Click += new EventHandler(CreateMapMarkerButton_Click); m_oControlsPanel.DeleteMapMarkerButton.Click += new EventHandler(DeleteMapMarkerButton_Click); m_oControlsPanel.SystemSelectionComboBox.SelectedIndexChanged += new EventHandler(SystemSelectComboBox_SelectedIndexChanged); m_oControlsPanel.ShowActiveSensorsCheckBox.CheckedChanged += new EventHandler(ShowActiveSensorsCheckBox_CheckedChanged); m_oControlsPanel.ShowPassiveSensorsCheckBox.CheckedChanged += new EventHandler(ShowPassiveSensorsCheckBox_CheckedChanged); }