///// ------------------------------------------------------------------------------------
        //internal bool ShowF2ToolTip
        //{
        //    set
        //    {
        //        if (value)
        //        {
        //            ShowCellToolTips = false;
        //            ToolTip = PlaybackInProgress && !_paused ?
        //                LocalizationManager.GetString("SessionsView.Transcription.TextAnnotationEditor.F2ToPause",
        //                    "F2: Pause") :
        //                LocalizationManager.GetString("SessionsView.Transcription.TextAnnotationEditor.F2ToPlay",
        //                    "F2: Play");
        //        }
        //        else
        //        {
        //            ShowCellToolTips = true;
        //            ToolTip = string.Empty;
        //        }
        //    }
        //}

        ///// ------------------------------------------------------------------------------------
        //private string ToolTip
        //{
        //    set
        //    {
        //        if (_toolTip.GetToolTip(this) != value)
        //            _toolTip.SetToolTip(this, value);
        //    }
        //}

        /// ------------------------------------------------------------------------------------
        public void Load(AnnotationComponentFile file)
        {
            _annotationFile = file;

            this.SetWindowRedraw(false);
            EndEdit();
            RowCount = 0;
            Columns.Clear();

            if (_annotationFile == null || !_annotationFile.Tiers.Any())
            {
                return;
            }

            RowCount = _annotationFile.Tiers.Select(AddColumnForTier).Concat(new[] { 0 }).Max();
            Font     = Columns[0].DefaultCellStyle.Font;

            this.SetWindowRedraw(true);
            if (IsHandleCreated)
            {
                Invalidate();
            }
            else
            {
                try
                {
                    CreateHandle();
                }
                catch (ObjectDisposedException)
                {
                    // This probably can't happen, but just in case
                    return;
                }
            }

            if (Settings.Default.SegmentGrid != null)
            {
                Settings.Default.SegmentGrid.InitializeGrid(this);
            }

            // Select the first non-ignored row
            int targetRow    = 0;
            int segmentCount = _annotationFile.Tiers.GetTimeTier().Segments.Count;

            while (targetRow < segmentCount && _annotationFile.Tiers.GetIsSegmentIgnored(targetRow))
            {
                targetRow++;
            }
            if (targetRow < segmentCount && CurrentCellAddress.X >= 0)             // found a row that is not ignored.
            {
                CurrentCell = Rows[targetRow].Cells[CurrentCellAddress.X];
            }
        }
Exemple #2
0
        private ComponentFile CreateVideoComponentFile(string filename)
        {
            var file = new ComponentFile(null, _parentFolder.Combine(filename),
                                         new FileType[] { new VideoFileType(null, null, null), new UnknownFileType(null, null) },
                                         new ComponentRole[] { }, new XmlFileSerializer(null), null, null, null);

            var annotationPath = Path.Combine(_parentFolder.Path,
                                              AnnotationFileHelper.ComputeEafFileNameFromOralAnnotationFile(filename));

            AnnotationFileHelperTests.CreateTestEaf(annotationPath);
            var annotationFile = new AnnotationComponentFile(null, annotationPath,
                                                             file, _fileTypes, null);

            file.SetAnnotationFile(annotationFile);
            return(file);
        }