예제 #1
0
        private void CheckTimecodeMenu()
        {
            mnuTimecodeClassic.Checked       = false;
            mnuTimecodeFrames.Checked        = false;
            mnuTimecodeMilliseconds.Checked  = false;
            mnuTimecodeTimeAndFrames.Checked = false;

            TimeCodeFormat tf = PreferencesManager.Instance().TimeCodeFormat;

            switch (tf)
            {
            case TimeCodeFormat.ClassicTime:
                mnuTimecodeClassic.Checked = true;
                break;

            case TimeCodeFormat.Frames:
                mnuTimecodeFrames.Checked = true;
                break;

            case TimeCodeFormat.Milliseconds:
                mnuTimecodeMilliseconds.Checked = true;
                break;

            case TimeCodeFormat.TimeAndFrames:
                mnuTimecodeTimeAndFrames.Checked = true;
                break;

            default:
                break;
            }
        }
예제 #2
0
        public static TimeCodeType GetTimecodeType(TimeCodeFormat _tcf)
        {
            TimeCodeType tct = TimeCodeType.String;

            switch (_tcf)
            {
            case TimeCodeFormat.ClassicTime:
                tct = TimeCodeType.String;
                break;

            case TimeCodeFormat.Frames:
            case TimeCodeFormat.HundredthOfMinutes:
            case TimeCodeFormat.TenThousandthOfHours:
            case TimeCodeFormat.Timestamps:
                tct = TimeCodeType.Number;
                break;

            case TimeCodeFormat.TimeAndFrames:
            default:
                tct = TimeCodeType.String;
                break;
            }

            return(tct);
        }
예제 #3
0
        private void SwitchTimecode(TimeCodeFormat _timecode)
        {
            // Todo: turn this into a command ?
            PreferencesManager pm = PreferencesManager.Instance();

            pm.TimeCodeFormat = _timecode;
            RefreshUICulture();
            pm.Export();
        }
예제 #4
0
        private void ImportPreferences()
        {
            CultureInfo ci = m_prefManager.GetSupportedCulture();

            m_UICultureName    = ci.IsNeutralCulture ? ci.Name : ci.Parent.Name;
            m_iFilesToSave     = m_prefManager.HistoryCount;
            m_TimeCodeFormat   = m_prefManager.TimeCodeFormat;
            m_ImageAspectRatio = m_prefManager.AspectRatio;
            m_SpeedUnit        = m_prefManager.SpeedUnit;
        }
예제 #5
0
        private void ImportPreferences()
        {
            // Put the values in the current pref file into local variables
            // They will then be used to fill the controls.

            m_iFilesToSave          = m_prefManager.HistoryCount;
            m_UICultureName         = m_prefManager.GetSupportedCulture().Name;
            m_TimeCodeFormat        = m_prefManager.TimeCodeFormat;
            m_SpeedUnit             = m_prefManager.SpeedUnit;
            m_ImageAspectRatio      = m_prefManager.AspectRatio;
            m_bDeinterlaceByDefault = m_prefManager.DeinterlaceByDefault;
            m_GridColor             = m_prefManager.GridColor;
            m_Plane3DColor          = m_prefManager.Plane3DColor;
            m_iWorkingZoneSeconds   = m_prefManager.WorkingZoneSeconds;
            m_iWorkingZoneMemory    = m_prefManager.WorkingZoneMemory;
            m_DefaultFading         = new InfosFading(0, 0);
            m_bDrawOnPlay           = m_prefManager.DrawOnPlay;
        }
예제 #6
0
        private void ParseConfigFile(string filePath)
        {
            // Fill the local variables with infos found in the XML file.
            XmlReader PreferencesReader = new XmlTextReader(filePath);

            if (PreferencesReader != null)
            {
                try
                {
                    while (PreferencesReader.Read())
                    {
                        if ((PreferencesReader.IsStartElement()) && (PreferencesReader.Name == "KinoveaPreferences"))
                        {
                            while (PreferencesReader.Read())
                            {
                                if (PreferencesReader.IsStartElement())
                                {
                                    switch (PreferencesReader.Name)
                                    {
                                    case "HistoryCount":
                                        m_iFilesToSave = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "Language":
                                        m_UICultureName = PreferencesReader.ReadString();
                                        break;

                                    case "TimeCodeFormat":
                                        m_TimeCodeFormat = ParseTimeCodeFormat(PreferencesReader.ReadString());
                                        break;

                                    case "SpeedUnit":
                                        m_SpeedUnit = ParseSpeedUnit(PreferencesReader.ReadString());
                                        break;

                                    case "ImageAspectRatio":
                                        m_AspectRatio = ParseImageAspectRatio(PreferencesReader.ReadString());
                                        break;

                                    case "DeinterlaceByDefault":
                                        m_bDeinterlaceByDefault = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "WorkingZoneSeconds":
                                        m_iWorkingZoneSeconds = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "WorkingZoneMemory":
                                        m_iWorkingZoneMemory = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "InfosFading":
                                        //m_DefaultFading.ReadXml(PreferencesReader);
                                        break;

                                    case "MaxFading":
                                        m_iMaxFading = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "DrawOnPlay":
                                        m_bDrawOnPlay = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerThumbnailsSize":
                                        m_iExplorerThumbsSize = (ExplorerThumbSizes)ExplorerThumbSizes.Parse(m_iExplorerThumbsSize.GetType(), PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerVisible":
                                        m_bIsExplorerVisible = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerSplitterDistance":
                                        m_iExplorerSplitterDistance = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ActiveFileBrowserTab":
                                        m_ActiveFileBrowserTab = (ActiveFileBrowserTab)ActiveFileBrowserTab.Parse(m_ActiveFileBrowserTab.GetType(), PreferencesReader.ReadString());
                                        break;

                                    case "ExplorerFilesSplitterDistance":
                                        m_iExplorerFilesSplitterDistance = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "ShortcutsFilesSplitterDistance":
                                        m_iShortcutsFilesSplitterDistance = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "Shortcuts":
                                        ParseShortcuts(PreferencesReader);
                                        break;

                                    case "RecentColors":
                                        ParseRecentColors(PreferencesReader);
                                        break;

                                    case "CaptureImageDirectory":
                                        m_CaptureImageDirectory = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureImageFile":
                                        m_CaptureImageFile = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureVideoDirectory":
                                        m_CaptureVideoDirectory = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureVideoFile":
                                        m_CaptureVideoFile = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureImageFormat":
                                        m_CaptureImageFormat = ParseImageFormat(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureVideoFormat":
                                        m_CaptureVideoFormat = ParseVideoFormat(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureUsePattern":
                                        m_bCaptureUsePattern = bool.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "CapturePattern":
                                        m_CapturePattern = PreferencesReader.ReadString();
                                        break;

                                    case "CaptureImageCounter":
                                        m_iCaptureImageCounter = long.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureVideoCounter":
                                        m_iCaptureVideoCounter = long.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "CaptureMemoryBuffer":
                                        m_iCaptureMemoryBuffer = int.Parse(PreferencesReader.ReadString());
                                        break;

                                    case "DeviceConfigurations":
                                        ParseDeviceConfigurations(PreferencesReader);
                                        break;

                                    case "NetworkCameraUrl":
                                        m_NetworkCameraUrl = PreferencesReader.ReadString();
                                        break;

                                    case "NetworkCameraFormat":
                                        m_NetworkCameraFormat = ParseCameraFormat(PreferencesReader.ReadString());
                                        break;

                                    case "RecentNetworkCameras":
                                        ParseRecentCameras(PreferencesReader);
                                        break;

                                    default:
                                        // Preference from a newer file format...
                                        // We don't have a holder variable for it.
                                        break;
                                    }
                                }
                                else if (PreferencesReader.Name == "KinoveaPreferences")
                                {
                                    break;
                                }
                                else
                                {
                                    // Fermeture d'un tag interne.
                                }
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    log.Error("Error happenned while parsing preferences. We'll keep the default values.");
                }
                finally
                {
                    PreferencesReader.Close();
                }
            }
        }
예제 #7
0
 private void cmbTimeCodeFormat_SelectedIndexChanged(object sender, EventArgs e)
 {
     // the combo box items have been filled in the order of the enum.
     m_TimeCodeFormat = (TimeCodeFormat)cmbTimeCodeFormat.SelectedIndex;
 }