Esempio n. 1
0
        private void mnuPreferencesOnClick(object sender, EventArgs e)
        {
            DelegatesPool dp = DelegatesPool.Instance();

            if (dp.StopPlaying != null && dp.DeactivateKeyboardHandler != null)
            {
                dp.StopPlaying();
                dp.DeactivateKeyboardHandler();
            }

            FormPreferences2 fp = new FormPreferences2(-1);

            fp.ShowDialog();
            fp.Dispose();

            if (dp.ActivateKeyboardHandler != null)
            {
                dp.ActivateKeyboardHandler();
            }

            // Refresh Preferences
            PreferencesManager pm = PreferencesManager.Instance();

            log.Debug("Setting current ui culture.");
            Thread.CurrentThread.CurrentUICulture = pm.GetSupportedCulture();
            RefreshUICulture();
        }
Esempio n. 2
0
        private void mnuSealMeasure_Click(object sender, EventArgs e)
        {
            // display a dialog that let the user specify how many real-world-units long is this line.

            if (m_StartPoint.X != m_EndPoint.X || m_StartPoint.Y != m_EndPoint.Y)
            {
                if (!m_bShowMeasure)
                {
                    m_bShowMeasure = true;
                }

                DrawingToolLine2D.ShowMeasure = true;

                DelegatesPool dp = DelegatesPool.Instance();
                if (dp.DeactivateKeyboardHandler != null)
                {
                    dp.DeactivateKeyboardHandler();
                }

                formConfigureMeasure fcm = new formConfigureMeasure(m_ParentMetadata, this);
                ScreenManagerKernel.LocateForm(fcm);
                fcm.ShowDialog();
                fcm.Dispose();

                // Update traj for distance and speed after calibration.
                m_ParentMetadata.UpdateTrajectoriesForKeyframes();

                CallInvalidateFromMenu(sender);

                if (dp.ActivateKeyboardHandler != null)
                {
                    dp.ActivateKeyboardHandler();
                }
            }
        }
Esempio n. 3
0
        public void SetEditMode(bool _bEdit, CoordinateSystem _transformer)
        {
            m_bEditMode = _bEdit;

            if (m_CoordinateSystem == null)
            {
                m_CoordinateSystem = _transformer;
            }

            // Activate or deactivate the ScreenManager Keyboard Handler,
            // so we can use <space>, <return>, etc.
            DelegatesPool dp = DelegatesPool.Instance();

            if (m_bEditMode)
            {
                if (dp.DeactivateKeyboardHandler != null)
                {
                    dp.DeactivateKeyboardHandler();
                }

                RelocateEditbox(); // This is needed because the container top-left corner may have changed
            }
            else
            {
                if (dp.ActivateKeyboardHandler != null)
                {
                    dp.ActivateKeyboardHandler();
                }
            }

            m_TextBox.Visible = m_bEditMode;
        }
Esempio n. 4
0
        private void mnuCheckForUpdatesOnClick(object sender, EventArgs e)
        {
            // Stop playing if needed.
            DelegatesPool dp = DelegatesPool.Instance();

            if (dp.StopPlaying != null)
            {
                dp.StopPlaying();
            }

            // Download the update configuration file from the webserver.
            HelpIndex hiRemote;

            if (PreferencesManager.ExperimentalRelease)
            {
                hiRemote = new HelpIndex("http://www.kinovea.org/setup/updatebeta.xml");
            }
            else
            {
                hiRemote = new HelpIndex("http://www.kinovea.org/setup/update.xml");
            }

            if (hiRemote.LoadSuccess)
            {
                if (dp.DeactivateKeyboardHandler != null)
                {
                    dp.DeactivateKeyboardHandler();
                }

                // Check if we are up to date.
                ThreePartsVersion currentVersion = new ThreePartsVersion(PreferencesManager.ReleaseVersion);
                if (hiRemote.AppInfos.Version > currentVersion)
                {
                    // We are not up to date, display the full dialog.
                    // The dialog is responsible for displaying the download success msg box.
                    UpdateDialog2 ud = new UpdateDialog2(hiRemote);
                    ud.ShowDialog();
                    ud.Dispose();
                }
                else
                {
                    // We are up to date, display a simple confirmation box.
                    MessageBox.Show(UpdaterLang.Updater_UpToDate, UpdaterLang.Updater_Title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                if (dp.ActivateKeyboardHandler != null)
                {
                    dp.ActivateKeyboardHandler();
                }
            }
            else
            {
                // Remote connection failed, we are probably firewalled.
                MessageBox.Show(resManager.GetString("Updater_InternetError", Thread.CurrentThread.CurrentUICulture),
                                resManager.GetString("Updater_Title", Thread.CurrentThread.CurrentUICulture),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 5
0
        private void DeactivateKeyboardHandler()
        {
            // Mouse enters the info box : deactivate the keyboard handling for the screens
            // so we can use <space>, <return>, etc. here.
            DelegatesPool dp = DelegatesPool.Instance();

            if (dp.DeactivateKeyboardHandler != null)
            {
                dp.DeactivateKeyboardHandler();
            }
        }
Esempio n. 6
0
		public override void PromptDeviceSelector()
		{
			DelegatesPool dp = DelegatesPool.Instance();
			if (dp.DeactivateKeyboardHandler != null)
            {
                dp.DeactivateKeyboardHandler();
			}
			
			bool reconnected = false;
			
			// Ask the user which device he wants to use or which size/framerate.
			formDevicePicker fdp = new formDevicePicker(ListDevices(), m_CurrentVideoDevice, DisplayDevicePropertyPage);
			
			if(fdp.ShowDialog() == DialogResult.OK)
			{
				DeviceDescriptor dev = fdp.SelectedDevice;
				
				if(dev == null || dev.Empty)
				{
					log.DebugFormat("Selected device is null or empty.");
					if(m_CurrentVideoDevice != null)
					{
						// From something to empty.
						Disconnect();
					}
				}
				else if(dev.Network)
				{
					if(m_CurrentVideoDevice == null || !m_CurrentVideoDevice.Network)
					{
						// From empty or non-network to network.
						log.DebugFormat("Selected network camera - connect with default parameters");
						reconnected = ConnectToDevice(dev);	
					}
					else
					{
						// From network to network.
						log.DebugFormat("Network camera - parameters changed - connect with new parameters");
						// Parameters were set on the dialog. We don't care if the parameters were actually changed.
						DeviceDescriptor netDevice = new DeviceDescriptor(ScreenManagerLang.Capture_NetworkCamera, fdp.SelectedUrl, fdp.SelectedFormat);
						reconnected = ConnectToDevice(netDevice);
					}
				} 
				else
				{
					if(m_CurrentVideoDevice == null || m_CurrentVideoDevice.Network || dev.Identification != m_CurrentVideoDevice.Identification)
					{
						// From network or different capture device to capture device.
						log.DebugFormat("Selected capture device");
						reconnected = ConnectToDevice(dev);
					}
					else
					{
						// From same capture device - caps changed.
						DeviceCapability cap = fdp.SelectedCapability;
						if(cap != null && !cap.Equals(m_CurrentVideoDevice.SelectedCapability))
						{							
							log.DebugFormat("Capture device, capability changed.");
							
							m_CurrentVideoDevice.SelectedCapability = cap;
							//PreferencesManager.CapturePreferences.UpdateDeviceConfiguration(m_CurrentVideoDevice.Identification, cap);
							//PreferencesManager.Save();
							
							if(m_bIsGrabbing)
							{
								m_VideoSource.Stop();
							}
							
							((VideoCaptureDevice)m_VideoSource).DesiredFrameSize = cap.FrameSize;
							((VideoCaptureDevice)m_VideoSource).DesiredFrameRate = cap.Framerate;
							
							m_FrameSize = cap.FrameSize;
							m_FramesInterval = 1000 / (double)cap.Framerate;
				
							log.Debug(String.Format("New capability: {0}", cap.ToString()));
							
							m_bSizeChanged = true;
							
							if(m_bIsGrabbing)
							{
								m_VideoSource.Start();
							}	
						}
					}
				}
				
				if(reconnected)
					m_Container.Connected();
			}
			
			fdp.Dispose();
			
			if(dp.ActivateKeyboardHandler != null)
            {
            	dp.ActivateKeyboardHandler();
            }
		}