/// ------------------------------------------------------------------------------------ public TierColumnBase(DataGridViewCell cellTemplate, TierBase tier) : base(cellTemplate) { DefaultCellStyle.ForeColor = SystemColors.WindowText; DefaultCellStyle.BackColor = SystemColors.Window; CellTemplate.Style = DefaultCellStyle; SetTier(tier); }
/// ------------------------------------------------------------------------------------ public AudioWaveFormColumn(TierBase tier) : base(new AudioWaveFormCell(), tier) { Debug.Assert(tier.TierType == TierType.Time); ReadOnly = true; DefaultCellStyle.Font = FontHelper.MakeFont(Program.DialogFont, 9f); MinimumWidth = 40; }
/// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { Tier = null; if (_grid != null) { UnsubscribeToGridEvents(); } base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ public TextAnnotationColumn(TierBase tier) : base(tier) { Debug.Assert(tier is TextTier); DefaultCellStyle.WrapMode = DataGridViewTriState.True; DefaultCellStyle.Font = Program.DialogFont; // This seems utterly pointless, but for some reason it fixes SP-566. Without this // code, the cell template's style has a font that is not the same as the default // column font. By doing this, the new DataGridViewTextBoxCell ends up with a null // font in its style. But just setting the style font to null for the existing one // makes the program crash. Of course, we have no concrete evidence that SP-566 has // anything to do with any of this font stuff. CellTemplate = new DataGridViewTextBoxCell(); }
/// ------------------------------------------------------------------------------------ private int AddColumnForTier(TierBase tier) { tier.GridColumn.InitializeColumnContextMenu(); Columns.Add(tier.GridColumn); var col = tier.GridColumn as TextAnnotationColumn; if (col != null) { col.SegmentChangedAction = _annotationFile.Save; col.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } return(tier.Segments.Count()); }
public static void Export(string outputFilePath, TierBase tier) { const string ktimeFormat = "hh\\:mm\\:ss\\,ff"; using (var stream = File.CreateText(outputFilePath)) { int index = 1; foreach (var segment in tier.Segments) { stream.WriteLine(index); stream.WriteLine(segment.TimeRange.Start.ToString(ktimeFormat) + " --> " + segment.TimeRange.End.ToString(ktimeFormat)); stream.WriteLine(segment.Text); stream.WriteLine(); index++; } } }
public static void Export(string outputFilePath, TierBase tier) { const string ktimeFormat = "0.000000"; using (var stream = File.CreateText(outputFilePath)) { int index = 1; foreach (var segment in tier.Segments) { var start = (segment.TimeRange.Start.TotalMilliseconds / 1000.0).ToString(ktimeFormat); var end = (segment.TimeRange.End.TotalMilliseconds / 1000.0).ToString(ktimeFormat); stream.WriteLine(start + "\t" + end + "\t" + (segment.Text ?? "")); index++; } } }
/// ------------------------------------------------------------------------------------ public static void CheckTier(TierBase expected, TierBase actual) { Assert.AreEqual(expected.DisplayName, actual.DisplayName); Assert.AreEqual(expected.TierType, actual.TierType); Assert.AreEqual(expected.Id, actual.Id); var expectedSegs = expected.Segments; var actualSegs = actual.Segments; Assert.AreEqual(expectedSegs.Count, actualSegs.Count); for (int i = 0; i < expectedSegs.Count; i++) { Assert.AreEqual(expectedSegs[i].Start, actualSegs[i].Start); Assert.AreEqual(expectedSegs[i].End, actualSegs[i].End); Assert.AreEqual(expectedSegs[i].Text, actualSegs[i].Text); } }
/// ------------------------------------------------------------------------------------ public TextAnnotationColumnWithMenu(TierBase tier) : base(tier) { SortMode = DataGridViewColumnSortMode.Programmatic; HeaderCell.Style.Font = new Font(DefaultCellStyle.Font, FontStyle.Bold); }
/// ------------------------------------------------------------------------------------ public TranslationAnnotationColumn(TierBase tier) : base(tier) { PlaybackType = (AudioRecordingType)Settings.Default.TranslationPlaybackType; }
/// ------------------------------------------------------------------------------------ public virtual void SetTier(TierBase tier) { Tier = tier; Name = Tier.Id.Replace(" ", string.Empty); HeaderText = Tier.DisplayName; }
/// ------------------------------------------------------------------------------------ public TierColumnBase(TierBase tier) : this(new DataGridViewTextBoxCell(), tier) { }