From 5fd825058fb6586c6a3393b6521b1e444385c9f7 Mon Sep 17 00:00:00 2001 From: Michael Oborne Date: Thu, 10 Mar 2016 14:20:05 +0800 Subject: [PATCH] FlightData: add right click start camera option #1180 --- GCSViews/FlightData.Designer.cs | 85 ++++++++++++++++++------------ GCSViews/FlightData.cs | 21 ++++++++ GCSViews/FlightData.resx | 92 +++++++++++++++++++++------------ 3 files changed, 130 insertions(+), 68 deletions(-) diff --git a/GCSViews/FlightData.Designer.cs b/GCSViews/FlightData.Designer.cs index f8723d6e5c..9206bb224b 100644 --- a/GCSViews/FlightData.Designer.cs +++ b/GCSViews/FlightData.Designer.cs @@ -14,9 +14,6 @@ private void InitializeComponent() this.SubMainLeft = new System.Windows.Forms.SplitContainer(); this.hud1 = new MissionPlanner.Controls.HUD(); this.contextMenuStripHud = new System.Windows.Forms.ContextMenuStrip(this.components); - this.recordHudToAVIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.stopRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.setMJPEGSourceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setAspectRatioToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.userItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.russianHudToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -127,6 +124,7 @@ private void InitializeComponent() this.flightPlannerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setHomeHereToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.takeOffToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.but_disablejoystick = new MissionPlanner.Controls.MyButton(); this.distanceBar1 = new MissionPlanner.Controls.DistanceBar(); this.windDir1 = new MissionPlanner.Controls.WindDir(); this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components); @@ -152,7 +150,11 @@ private void InitializeComponent() this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn(); this.Messagetabtimer = new System.Windows.Forms.Timer(this.components); this.bindingSourceStatusTab = new System.Windows.Forms.BindingSource(this.components); - this.but_disablejoystick = new MissionPlanner.Controls.MyButton(); + this.videoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.recordHudToAVIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.setMJPEGSourceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.stopRecordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.startCameraToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.MainH)).BeginInit(); this.MainH.Panel1.SuspendLayout(); this.MainH.Panel2.SuspendLayout(); @@ -271,6 +273,8 @@ private void InitializeComponent() this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("wpno", this.bindingSourceHud, "wpno", true)); this.hud1.DataBindings.Add(new System.Windows.Forms.Binding("xtrack_error", this.bindingSourceHud, "xtrack_error", true)); this.hud1.datetime = new System.DateTime(((long)(0))); + this.hud1.displayekf = false; + this.hud1.displayvibe = false; this.hud1.disttowp = 0F; resources.ApplyResources(this.hud1, "hud1"); this.hud1.ekfstatus = 0F; @@ -318,9 +322,7 @@ private void InitializeComponent() // contextMenuStripHud // this.contextMenuStripHud.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.recordHudToAVIToolStripMenuItem, - this.stopRecordToolStripMenuItem, - this.setMJPEGSourceToolStripMenuItem, + this.videoToolStripMenuItem, this.setAspectRatioToolStripMenuItem, this.userItemsToolStripMenuItem, this.russianHudToolStripMenuItem, @@ -328,24 +330,6 @@ private void InitializeComponent() this.contextMenuStripHud.Name = "contextMenuStrip2"; resources.ApplyResources(this.contextMenuStripHud, "contextMenuStripHud"); // - // recordHudToAVIToolStripMenuItem - // - this.recordHudToAVIToolStripMenuItem.Name = "recordHudToAVIToolStripMenuItem"; - resources.ApplyResources(this.recordHudToAVIToolStripMenuItem, "recordHudToAVIToolStripMenuItem"); - this.recordHudToAVIToolStripMenuItem.Click += new System.EventHandler(this.recordHudToAVIToolStripMenuItem_Click); - // - // stopRecordToolStripMenuItem - // - this.stopRecordToolStripMenuItem.Name = "stopRecordToolStripMenuItem"; - resources.ApplyResources(this.stopRecordToolStripMenuItem, "stopRecordToolStripMenuItem"); - this.stopRecordToolStripMenuItem.Click += new System.EventHandler(this.stopRecordToolStripMenuItem_Click); - // - // setMJPEGSourceToolStripMenuItem - // - this.setMJPEGSourceToolStripMenuItem.Name = "setMJPEGSourceToolStripMenuItem"; - resources.ApplyResources(this.setMJPEGSourceToolStripMenuItem, "setMJPEGSourceToolStripMenuItem"); - this.setMJPEGSourceToolStripMenuItem.Click += new System.EventHandler(this.setMJPEGSourceToolStripMenuItem_Click); - // // setAspectRatioToolStripMenuItem // this.setAspectRatioToolStripMenuItem.Name = "setAspectRatioToolStripMenuItem"; @@ -1661,6 +1645,13 @@ private void InitializeComponent() resources.ApplyResources(this.takeOffToolStripMenuItem, "takeOffToolStripMenuItem"); this.takeOffToolStripMenuItem.Click += new System.EventHandler(this.takeOffToolStripMenuItem_Click); // + // but_disablejoystick + // + resources.ApplyResources(this.but_disablejoystick, "but_disablejoystick"); + this.but_disablejoystick.Name = "but_disablejoystick"; + this.but_disablejoystick.UseVisualStyleBackColor = true; + this.but_disablejoystick.Click += new System.EventHandler(this.but_disablejoystick_Click); + // // distanceBar1 // resources.ApplyResources(this.distanceBar1, "distanceBar1"); @@ -1674,7 +1665,7 @@ private void InitializeComponent() this.windDir1.BackColor = System.Drawing.Color.Transparent; this.windDir1.DataBindings.Add(new System.Windows.Forms.Binding("Direction", this.bindingSource1, "wind_dir", true, System.Windows.Forms.DataSourceUpdateMode.Never)); this.windDir1.DataBindings.Add(new System.Windows.Forms.Binding("Speed", this.bindingSource1, "wind_vel", true, System.Windows.Forms.DataSourceUpdateMode.Never)); - this.windDir1.Direction = 180D; + this.windDir1.Direction = 360D; resources.ApplyResources(this.windDir1, "windDir1"); this.windDir1.Name = "windDir1"; this.windDir1.Speed = 0D; @@ -1885,12 +1876,36 @@ private void InitializeComponent() // this.bindingSourceStatusTab.DataSource = typeof(MissionPlanner.CurrentState); // - // but_disablejoystick + // videoToolStripMenuItem // - resources.ApplyResources(this.but_disablejoystick, "but_disablejoystick"); - this.but_disablejoystick.Name = "but_disablejoystick"; - this.but_disablejoystick.UseVisualStyleBackColor = true; - this.but_disablejoystick.Click += new System.EventHandler(this.but_disablejoystick_Click); + this.videoToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.recordHudToAVIToolStripMenuItem, + this.stopRecordToolStripMenuItem, + this.setMJPEGSourceToolStripMenuItem, + this.startCameraToolStripMenuItem}); + this.videoToolStripMenuItem.Name = "videoToolStripMenuItem"; + resources.ApplyResources(this.videoToolStripMenuItem, "videoToolStripMenuItem"); + // + // recordHudToAVIToolStripMenuItem + // + this.recordHudToAVIToolStripMenuItem.Name = "recordHudToAVIToolStripMenuItem"; + resources.ApplyResources(this.recordHudToAVIToolStripMenuItem, "recordHudToAVIToolStripMenuItem"); + // + // setMJPEGSourceToolStripMenuItem + // + this.setMJPEGSourceToolStripMenuItem.Name = "setMJPEGSourceToolStripMenuItem"; + resources.ApplyResources(this.setMJPEGSourceToolStripMenuItem, "setMJPEGSourceToolStripMenuItem"); + // + // stopRecordToolStripMenuItem + // + this.stopRecordToolStripMenuItem.Name = "stopRecordToolStripMenuItem"; + resources.ApplyResources(this.stopRecordToolStripMenuItem, "stopRecordToolStripMenuItem"); + // + // startCameraToolStripMenuItem + // + this.startCameraToolStripMenuItem.Name = "startCameraToolStripMenuItem"; + resources.ApplyResources(this.startCameraToolStripMenuItem, "startCameraToolStripMenuItem"); + this.startCameraToolStripMenuItem.Click += new System.EventHandler(this.startCameraToolStripMenuItem_Click); // // FlightData // @@ -1998,8 +2013,6 @@ private void InitializeComponent() private Controls.MyButton BUT_log2kml; private Controls.MyButton BUT_joystick; private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.ToolStripMenuItem recordHudToAVIToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem stopRecordToolStripMenuItem; private Controls.MyLabel lbl_logpercent; private System.Windows.Forms.ToolStripMenuItem pointCameraHereToolStripMenuItem; private System.Windows.Forms.SplitContainer splitContainer1; @@ -2007,7 +2020,6 @@ private void InitializeComponent() private Controls.MyLabel lbl_sats; private Controls.HSI Gheading; private Controls.MyLabel lbl_playbackspeed; - private System.Windows.Forms.ToolStripMenuItem setMJPEGSourceToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem setAspectRatioToolStripMenuItem; private System.Windows.Forms.TabPage tabQuick; private Controls.QuickView quickView3; @@ -2099,5 +2111,10 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem swapWithMapToolStripMenuItem; private Controls.MyButton BUT_abortland; private Controls.MyButton but_disablejoystick; + private System.Windows.Forms.ToolStripMenuItem videoToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem recordHudToAVIToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem setMJPEGSourceToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem stopRecordToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem startCameraToolStripMenuItem; } } \ No newline at end of file diff --git a/GCSViews/FlightData.cs b/GCSViews/FlightData.cs index 349f92e24e..7946e54d48 100644 --- a/GCSViews/FlightData.cs +++ b/GCSViews/FlightData.cs @@ -10,6 +10,7 @@ using System.Text; using System.Threading; using System.Windows.Forms; +using DirectShowLib; using GMap.NET; using GMap.NET.MapProviders; using GMap.NET.WindowsForms; @@ -21,6 +22,7 @@ using MissionPlanner.Utilities; using MissionPlanner.Warnings; using OpenTK; +using WebCamService; using ZedGraph; using LogAnalyzer = MissionPlanner.Utilities.LogAnalyzer; @@ -3939,5 +3941,24 @@ private void but_disablejoystick_Click(object sender, EventArgs e) but_disablejoystick.Visible = false; } } + + private void startCameraToolStripMenuItem_Click(object sender, EventArgs e) + { + if (MainV2.MONO) + return; + + try + { + MainV2.cam = new Capture(Settings.Instance.GetInt32("video_device"), new AMMediaType()); + + MainV2.cam.Start(); + + MainV2.cam.camimage += new CamImage(cam_camimage); + } + catch (Exception ex) + { + CustomMessageBox.Show("Camera Fail: " + ex.ToString(), Strings.ERROR); + } + } } } \ No newline at end of file diff --git a/GCSViews/FlightData.resx b/GCSViews/FlightData.resx index 9431bf16fe..557f477c01 100644 --- a/GCSViews/FlightData.resx +++ b/GCSViews/FlightData.resx @@ -161,32 +161,44 @@ Set MJPEG source - + 171, 22 + + Start Camera + + + 159, 22 + + + Video + + + 159, 22 + Set Aspect Ratio - 171, 22 + 159, 22 User Items - 171, 22 + 159, 22 Russian Hud - 171, 22 + 159, 22 Swap With Map - 172, 158 + 160, 136 contextMenuStripHud @@ -613,7 +625,7 @@ modifyandSetSpeed - MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null tabActions @@ -634,7 +646,7 @@ modifyandSetAlt - MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ModifyandSet, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null tabActions @@ -1225,7 +1237,7 @@ checkListControl1 - MissionPlanner.Controls.PreFlight.CheckListControl, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.PreFlight.CheckListControl, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null tabPagePreFlight @@ -1459,7 +1471,7 @@ servoOptions1 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -1480,7 +1492,7 @@ servoOptions2 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -1501,7 +1513,7 @@ servoOptions3 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -1522,7 +1534,7 @@ servoOptions4 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -1543,7 +1555,7 @@ servoOptions5 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -1564,7 +1576,7 @@ servoOptions6 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -1585,7 +1597,7 @@ servoOptions7 - MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.ServoOptions, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null flowLayoutPanelServos @@ -2878,7 +2890,7 @@ distanceBar1 - MissionPlanner.Controls.DistanceBar, MissionPlanner, Version=1.1.5901.24733, Culture=neutral, PublicKeyToken=null + MissionPlanner.Controls.DistanceBar, MissionPlanner, Version=1.1.5913.25098, Culture=neutral, PublicKeyToken=null splitContainer1.Panel2 @@ -3486,24 +3498,6 @@ 1008, 462 - - recordHudToAVIToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - stopRecordToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - setMJPEGSourceToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - setAspectRatioToolStripMenuItem @@ -3666,6 +3660,36 @@ System.Windows.Forms.BindingSource, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + videoToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + recordHudToAVIToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + setMJPEGSourceToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + stopRecordToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + startCameraToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + FlightData