/// <summary> /// Checks that the row label on the ConstChartRow object is as expected. /// </summary> /// <param name="label"></param> /// <param name="row"></param> /// <param name="msg"></param> internal void VerifyRowNumber(string label, IConstChartRow row, string msg) { var expected = Cache.TsStrFactory.MakeString(label, Logic.WsLineNumber).Text; var actual = row.Label.Text; Assert.AreEqual(expected, actual, msg); }
/// <summary> /// Figure out what columns should be available, given a selected row. /// </summary> /// <returns></returns> internal ICmPossibility[] GetColumnChoices(IConstChartRow row) { if (row.Hvo != SentElem.GetOriginRow.Hvo) { CollectAllColumnsToCombo(); return(SentElem.AllChartCols); } var ccols = SentElem.AllChartCols.Length; var icurCol = SentElem.GetOriginColumnIndex; if (Prepose) { // Collect columns following clicked one ccols = ccols - icurCol - 1; icurCol++; } else { // Collect columns preceding clicked one ccols = icurCol; icurCol = 0; } var result = new ICmPossibility[Math.Max(0, ccols)]; for (var i = 0; i < ccols; i++) { result[i] = SentElem.AllChartCols[i + icurCol]; } return(result); }
/// <summary> /// Make a chart WordGroup object for the specified column that groups the specified words /// and append to the specified row. Assumes all IAnalysis objects are in the 1st paragraph. /// </summary> /// <param name="row"></param> /// <param name="icol"></param> /// <param name="analyses"></param> /// <returns></returns> internal object MakeWordGroup(IConstChartRow row, int icol, IAnalysis[] analyses) { var begPoint = FindAnalysisInPara(analyses[0].Hvo, true); var endPoint = FindAnalysisInPara(analyses[analyses.Length - 1].Hvo, false); return(MakeWordGroup(row, icol, begPoint, endPoint)); }
/// <summary> /// Make a dependent clause marker at the end of the specified row in the specified column /// for the specified clauses (rows) of the specified type. Caller supplies a marker. /// </summary> /// <param name="row"></param> /// <param name="icol"></param> /// <param name="depClauses"></param> /// <param name="depType"></param> /// <returns></returns> internal IConstChartClauseMarker MakeDependentClauseMarker(IConstChartRow row, int icol, IConstChartRow[] depClauses, ClauseTypes depType) { Assert.IsTrue(depType == ClauseTypes.Dependent || depType == ClauseTypes.Song || depType == ClauseTypes.Speech, "Invalid dependent type."); // Set ClauseType and begin/end group booleans in destination clauses foreach (var rowDst in depClauses) { rowDst.ClauseType = depType; if (rowDst == depClauses[0]) { rowDst.StartDependentClauseGroup = true; } if (rowDst == depClauses[depClauses.Length - 1]) { rowDst.EndDependentClauseGroup = true; } } // Create marker Assert.Less(icol, m_allColumns.Count, "Invalid column index"); return(m_clauseMrkrFact.Create(row, row.CellsOS.Count, m_allColumns[icol], depClauses)); }
/// <summary> /// Makes a MissingText chart object and appends it to the row /// </summary> /// <param name="row"></param> /// <param name="icol"></param> /// <returns></returns> internal IConstChartTag MakeMissingMarker(IConstChartRow row, int icol) { Assert.Less(icol, m_allColumns.Count, "Invalid column index"); var cct = m_ccTagFact.CreateMissingMarker(row, row.CellsOS.Count, m_allColumns[icol]); return(cct); }
internal void CallMergeCellContents(IConstChartRow rowSrc, int icolSrc, IConstChartRow rowDst, int icolDst, bool forward) { var srcCell = new ChartLocation(rowSrc, icolSrc); var dstCell = new ChartLocation(rowDst, icolDst); MergeCellContents(srcCell, dstCell, forward); }
/// <summary> /// Make a chart WordGroup object for the specified column that groups the specified words /// The FDO factory now inserts the item in a particular spot in the row. /// This method assumes you want to put it at the end of the row. /// </summary> /// <param name="row"></param> /// <param name="icol"></param> /// <param name="begPoint"></param> /// <param name="endPoint"></param> /// <returns></returns> internal IConstChartWordGroup MakeWordGroup(IConstChartRow row, int icol, AnalysisOccurrence begPoint, AnalysisOccurrence endPoint) { Assert.Less(icol, m_allColumns.Count, "Invalid column index"); var ccwg = m_wordGrpFact.Create(row, row.CellsOS.Count, m_allColumns[icol], begPoint, endPoint); return(ccwg); }
/// <summary> /// Makes a ChartTag object and appends it to the row /// </summary> /// <param name="row"></param> /// <param name="icol"></param> /// <param name="marker"></param> /// <returns></returns> internal IConstChartTag MakeChartMarker(IConstChartRow row, int icol, ICmPossibility marker) { Assert.Less(icol, m_allColumns.Count, "Invalid column index"); Assert.IsNotNull(marker, "Invalid marker."); var cct = m_ccTagFact.Create(row, row.CellsOS.Count, m_allColumns[icol], marker); return(cct); }
/// <summary> /// Makes a ChartMovedTextMarker object and appends it to the row /// </summary> /// <param name="row"></param> /// <param name="icol"></param> /// <param name="target"></param> /// <param name="fPreposed"></param> /// <returns></returns> internal IConstChartMovedTextMarker MakeMovedTextMarker(IConstChartRow row, int icol, IConstChartWordGroup target, bool fPreposed) { Assert.Less(icol, m_allColumns.Count, "Invalid column index"); Assert.IsNotNull(target, "Can't make a MovedTextMarker with no target WordGroup"); var ccmtm = m_mtmFact.Create(row, row.CellsOS.Count, m_allColumns[icol], fPreposed, target); return(ccmtm); }
private static void VerifyChangeRow(IConstChartRow rowSrc, IEnumerable <IConstituentChartCellPart> cellPartsToMove, IConstChartRow rowDst, string message, int ihvoDest) { foreach (var cellPart in cellPartsToMove) { Assert.AreEqual(cellPart.Hvo, rowDst.CellsOS[ihvoDest].Hvo, message); Assert.IsFalse(rowSrc.CellsOS.Contains(cellPart)); ihvoDest++; } }
public override void DeleteCellParts(IConstChartRow row, int ihvo, int chvo) { if (m_fRecordBasicEdits) { m_events.Add(new object[] { "delete cellParts", row, ihvo, chvo }); } else { base.DeleteCellParts(row, ihvo, chvo); } }
public ChartLocation(IConstChartRow row, int icol) { m_cellColumnIndex = icol; m_cellRow = row; }
/// <summary> /// Creates a MovedTextMarker that lives in a row/column combo. This assumes we append this cell to /// the row. It doesn't check that you haven't done something silly like tell it to add /// to a column previous to where you've already added things in this row. /// </summary> /// <param name="row">The row to add the cell to</param> /// <param name="column">The column to add the cell to</param> /// <param name="wordGrp">The WordGroup to point to</param> /// <param name="fPreposed"></param> private IConstChartMovedTextMarker CreateMTMarker(IConstChartRow row, ICmPossibility column, IConstChartWordGroup wordGrp, bool fPreposed) { return(m_mtMrkrFact.Create(row, row.CellsOS.Count, column, fPreposed, wordGrp)); }
private static void VerifyChangeRow(IConstChartRow rowSrc, IEnumerable<IConstituentChartCellPart> cellPartsToMove, IConstChartRow rowDst, string message, int ihvoDest) { foreach (var cellPart in cellPartsToMove) { Assert.AreEqual(cellPart.Hvo, rowDst.CellsOS[ihvoDest].Hvo, message); Assert.IsFalse(rowSrc.CellsOS.Contains(cellPart)); ihvoDest++; } }
// Make a CCWordGroup for the specified column that groups the specified words // and append to the specified row. private IConstChartWordGroup MakeWordGroup(IConstChartRow row, int icol, AnalysisOccurrence begPoint, AnalysisOccurrence endPoint) { return m_helper.MakeWordGroup(row, icol, begPoint, endPoint); }
/// <summary> /// Creates a new Chart Word Group from selected AnalysisOccurrence objects /// </summary> /// <param name="row"></param> /// <param name="insertAt"></param> /// <param name="column"></param> /// <param name="begPoint"></param> /// <param name="endPoint"></param> /// <returns></returns> public IConstChartWordGroup Create(IConstChartRow row, int insertAt, ICmPossibility column, AnalysisOccurrence begPoint, AnalysisOccurrence endPoint) { if (column == null || row == null) throw new ArgumentNullException(); var ccells = row.CellsOS.Count; if (insertAt < 0 || insertAt > ccells) // insertAt == Count will append throw new ArgumentOutOfRangeException("insertAt"); if (begPoint == null || !begPoint.IsValid) throw new ArgumentException("Invalid beginPoint"); if (endPoint == null || !endPoint.IsValid) throw new ArgumentException("Invalid endPoint"); // Make the thing already! var newby = Create(); row.CellsOS.Insert(insertAt, newby); newby.ColumnRA = column; newby.BeginSegmentRA = begPoint.Segment; newby.EndSegmentRA = endPoint.Segment; newby.BeginAnalysisIndex = begPoint.Index; newby.EndAnalysisIndex = endPoint.Index; return newby; }
/// <summary> /// Creates a new Chart Clause Marker (reference to dependent/speech/song clauses) /// Caller needs to setup the rows with the correct parameters (ClauseType, etc.). /// </summary> /// <param name="row"></param> /// <param name="insertAt"></param> /// <param name="column"></param> /// <param name="depClauses">The chart rows that are dependent/speech/song</param> /// <returns></returns> public IConstChartClauseMarker Create(IConstChartRow row, int insertAt, ICmPossibility column, IEnumerable<IConstChartRow> depClauses) { if (column == null || row == null) throw new ArgumentNullException(); var ccells = row.CellsOS.Count; if (insertAt < 0 || insertAt > ccells) // insertAt == Count will append throw new ArgumentOutOfRangeException("insertAt"); var newby = Create(); row.CellsOS.Insert(insertAt, newby); newby.ColumnRA = column; newby.DependentClausesRS.Replace(0, 0, depClauses as IEnumerable<ICmObject>); return newby; }
public override void ChangeColumn(IConstituentChartCellPart[] partsToMove, ICmPossibility newCol, IConstChartRow row) { if (m_fRecordBasicEdits) m_events.Add(new object[] { "change column", partsToMove, newCol, row }); else base.ChangeColumn(partsToMove, newCol, row); }
/// <summary> /// Creates a ClauseMarker that lives in a row/column combo. This assumes we append this cell to /// the row. It doesn't check that you haven't done something silly like tell it to add /// to a column previous to where you've already added things in this row. /// </summary> /// <param name="mrkrRow">The row to add the cell to</param> /// <param name="column">The column to add the cell to</param> /// <param name="refArray">The array of ConstChartRows to reference</param> private IConstChartClauseMarker CreateClauseMarker(IConstChartRow mrkrRow, ICmPossibility column, IEnumerable<IConstChartRow> refArray) { return m_clsMrkrFact.Create(mrkrRow, mrkrRow.CellsOS.Count, column, refArray); }
/// <summary> /// Creates a MovedTextMarker that lives in a row/column combo. This assumes we append this cell to /// the row. It doesn't check that you haven't done something silly like tell it to add /// to a column previous to where you've already added things in this row. /// </summary> /// <param name="row">The row to add the cell to</param> /// <param name="column">The column to add the cell to</param> /// <param name="wordGrp">The WordGroup to point to</param> /// <param name="fPreposed"></param> private IConstChartMovedTextMarker CreateMTMarker(IConstChartRow row, ICmPossibility column, IConstChartWordGroup wordGrp, bool fPreposed) { return m_mtMrkrFact.Create(row, row.CellsOS.Count, column, fPreposed, wordGrp); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a cell that lives in a row/column combo. This assumes we append this cell to /// the row. It doesn't check that you haven't done something silly like tell it to add /// to a column previous to where you've already added things in this row. /// </summary> /// <param name="row">The row to add the cell to</param> /// <param name="column">The column to add the cell to</param> /// <param name="occurrences">zero or more wordforms to add to this cell</param> /// ------------------------------------------------------------------------------------ private void CreateCell(IConstChartRow row, ICmPossibility column, params AnalysisOccurrence[] occurrences) { m_wordGrpFact.Create(row, row.CellsOS.Count, column, occurrences[0], occurrences[occurrences.Length - 1]); }
/// <summary> /// Sets the member variable for the clicked cell's RowColMenuItem. /// Call SetupParameterObject() to install it. /// </summary> /// <param name="row"></param> /// <param name="icolSrc"></param> void SetClickedCell(IConstChartRow row, int icolSrc) { m_origCell = new ChartLocation(row, icolSrc); }
internal void CallMakeMovedFrom(int icolActual, int icolMovedFrom, IConstChartRow row) { MakeMovedFrom(new ChartLocation(row, icolActual), new ChartLocation(row, icolMovedFrom)); }
internal void CallMakeMovedFrom(int icolActual, int icolMovedFrom, IConstChartRow rowActual, IConstChartRow rowMovedFrom, AnalysisOccurrence begPoint, AnalysisOccurrence endPoint) { MakeMovedFrom(new ChartLocation(rowActual, icolActual), new ChartLocation(rowMovedFrom, icolMovedFrom), begPoint, endPoint); }
public override void DeleteCellParts(IConstChartRow row, int ihvo, int chvo) { if (m_fRecordBasicEdits) m_events.Add(new object[] { "delete cellParts", row, ihvo, chvo }); else base.DeleteCellParts(row, ihvo, chvo); }
private IVwSelection MakeRowSelection(IConstChartRow row, bool fInstall) { var rgvsli = new SelLevInfo[1]; rgvsli[0].ihvo = row.IndexInOwner; // specifies which row. rgvsli[0].tag = DsConstChartTags.kflidRows; IVwSelection sel = null; try { sel = RootBox.MakeTextSelInObj(0, 1, rgvsli, 0, null, false, false, false, true, fInstall); } catch (Exception e) { Debug.WriteLine(e.StackTrace); return null; } return sel; }
internal static string GetRowStyleName(IConstChartRow row) { switch (row.ClauseType) { case ClauseTypes.Dependent: return "dependent"; case ClauseTypes.Speech: return "speech"; case ClauseTypes.Song: return "song"; default: return "normal"; } }
internal void CallRemoveMovedFromDiffRow(IConstChartRow rowActual, int icolActual, IConstChartRow rowMovedFrom, int icolMovedFrom) { RemoveMovedFrom(new ChartLocation(rowActual, icolActual), new ChartLocation(rowMovedFrom, icolMovedFrom)); }
/// <summary> /// Creates a new Chart Marker from a list of Chart Marker possibilities /// </summary> /// <param name="row"></param> /// <param name="insertAt"></param> /// <param name="column"></param> /// <param name="marker"></param> /// <returns></returns> public IConstChartTag Create(IConstChartRow row, int insertAt, ICmPossibility column, ICmPossibility marker) { if (column == null || row == null || marker == null) throw new ArgumentNullException(); var ccells = row.CellsOS.Count; if (insertAt < 0 || insertAt > ccells) // insertAt == Count will append throw new ArgumentOutOfRangeException("insertAt"); var newby = Create(); row.CellsOS.Insert(insertAt, newby); newby.ColumnRA = column; newby.TagRA = marker; return newby; }
/// <summary> /// Creates a new Chart Moved Text Marker (shows where some text was moved from). /// </summary> /// <param name="row"></param> /// <param name="insertAt"></param> /// <param name="column"></param> /// <param name="fPreposed">True if the CCWG was 'moved' earlier than its 'normal' position</param> /// <param name="wordGroup">The CCWG that was 'moved'</param> /// <returns></returns> public IConstChartMovedTextMarker Create(IConstChartRow row, int insertAt, ICmPossibility column, bool fPreposed, IConstChartWordGroup wordGroup) { if (column == null || row == null) throw new ArgumentNullException(); var ccells = row.CellsOS.Count; if (insertAt < 0 || insertAt > ccells) // insertAt == Count will append throw new ArgumentOutOfRangeException("insertAt"); var newby = Create(); row.CellsOS.Insert(insertAt, newby); newby.ColumnRA = column; newby.Preposed = fPreposed; newby.WordGroupRA = wordGroup; return newby; }
public ChartLocation MakeLocObj(int icol, IConstChartRow row) { return(new ChartLocation(row, icol)); }
protected static ChartLocation MakeLocObj(IConstChartRow row, int icol) { return(new ChartLocation(row, icol)); }
public override void ChangeColumn(IConstituentChartCellPart[] partsToMove, ICmPossibility newCol, IConstChartRow row) { if (m_fRecordBasicEdits) { m_events.Add(new object[] { "change column", partsToMove, newCol, row }); } else { base.ChangeColumn(partsToMove, newCol, row); } }
private IConstChartMovedTextMarker MakeMovedTextMarker(IConstChartRow row, int icol, IConstChartWordGroup target, bool fPreposed) { return m_helper.MakeMovedTextMarker(row, icol, target, fPreposed); }
internal void SetRows(IConstChartRow[] items) { // Convert ConstChartRows to RowMenuItems var rows = new RowMenuItem[items.Length]; for (var i = 0; i < items.Length; i++) rows[i] = new RowMenuItem(items[i]); m_rowsCombo.Items.Clear(); m_rowsCombo.Items.AddRange(rows); }
/// <summary> /// Creates a ClauseMarker that lives in a row/column combo. This assumes we append this cell to /// the row. It doesn't check that you haven't done something silly like tell it to add /// to a column previous to where you've already added things in this row. /// </summary> /// <param name="mrkrRow">The row to add the cell to</param> /// <param name="column">The column to add the cell to</param> /// <param name="refArray">The array of ConstChartRows to reference</param> private IConstChartClauseMarker CreateClauseMarker(IConstChartRow mrkrRow, ICmPossibility column, IEnumerable <IConstChartRow> refArray) { return(m_clsMrkrFact.Create(mrkrRow, mrkrRow.CellsOS.Count, column, refArray)); }
/// <summary> /// Checks that the row number on the chart row is as expected. /// </summary> /// <param name="label"></param> /// <param name="row"></param> /// <param name="msg"></param> private void VerifyRowNumber(string label, IConstChartRow row, string msg) { m_helper.VerifyRowNumber(label, row, msg); }
/// <summary> /// Make one. /// </summary> /// <param name="baseObj"></param> /// <param name="cache"></param> /// <param name="vwenv"></param> /// <param name="hvo"></param> public MakeCellsMethod(ConstChartVc baseObj, FdoCache cache, IVwEnv vwenv, int hvo) { m_this = baseObj; m_cache = cache; m_rowRepo = m_cache.ServiceLocator.GetInstance<IConstChartRowRepository>(); m_partRepo = m_cache.ServiceLocator.GetInstance<IConstituentChartCellPartRepository>(); // Decorator makes sure that things get put out in the right order if chart is RtL m_chart = baseObj.m_chart; //var sPopFormatting = m_cache.TsStrFactory.MakeString(Convert.ToString(m_chart.PDF), m_cache.DefaultAnalWs); m_vwenv = new ChartRowEnvDecorator(vwenv); m_hvoRow = hvo; m_row = m_rowRepo.GetObject(m_hvoRow); }
/// <summary> /// Figure out what columns should be available, given a selected row. /// </summary> /// <returns></returns> internal ICmPossibility[] GetColumnChoices(IConstChartRow row) { if (row.Hvo != SentElem.GetOriginRow.Hvo) { CollectAllColumnsToCombo(); return SentElem.AllChartCols; } var ccols = SentElem.AllChartCols.Length; var icurCol = SentElem.GetOriginColumnIndex; if (Prepose) { // Collect columns following clicked one ccols = ccols - icurCol - 1; icurCol++; } else { // Collect columns preceding clicked one ccols = icurCol; icurCol = 0; } var result = new ICmPossibility[Math.Max(0, ccols)]; for (var i = 0; i < ccols; i++) { result[i] = SentElem.AllChartCols[i + icurCol]; } return result; }
private void SetRowStyle(IVwEnv vwenv, IConstChartRow row) { ApplyFormatting(vwenv, GetRowStyleName(row)); }
protected static ChartLocation MakeLocObj(IConstChartRow row, int icol) { return new ChartLocation(row, icol); }
// Make a CCWordGroup for the specified column that groups the specified words // and append to the specified row. private IConstChartWordGroup MakeWordGroup(IConstChartRow row, int icol, AnalysisOccurrence begPoint, AnalysisOccurrence endPoint) { return(m_helper.MakeWordGroup(row, icol, begPoint, endPoint)); }
public ChartLocation MakeLocObj(int icol, IConstChartRow row) { return new ChartLocation(row, icol); }
ICmPossibility[] m_allColumns; // The complete array of columns in the chart #endregion public CChartSentenceElements(ChartLocation cellClicked, IConstChartRow[] eligRows, ICmPossibility[] eligColumns) { m_clickedCell = cellClicked; AffectedWordGroups = new List<IConstChartWordGroup>(); m_eligibleRows = eligRows; m_eligibleColumns = eligColumns; m_allColumns = m_eligibleColumns; m_rows = null; m_cols = null; }
private IConstChartMovedTextMarker MakeMovedTextMarker(IConstChartRow row, int icol, IConstChartWordGroup target, bool fPreposed) { return(m_helper.MakeMovedTextMarker(row, icol, target, fPreposed)); }
/// <summary> /// Verify that there is a row with the specified index that has a ConstChartClauseMarker /// with the specified index which belongs to the specified column and points to the /// specified array of ConstChartRows. /// </summary> /// <param name="irow"></param> /// <param name="icellPart"></param> /// <param name="column"></param> /// <param name="depClauses"></param> void VerifyDependentClauseMarker(int irow, int icellPart, ICmPossibility column, IConstChartRow[] depClauses) { m_helper.VerifyDependentClauseMarker(irow, icellPart, column, depClauses); }
/// <summary> /// Checks that the chart contains the rows specified. /// </summary> /// <param name="chart"></param> /// <param name="rows"></param> private void VerifyChartRows(IDsConstChart chart, IConstChartRow[] rows) { m_helper.VerifyChartRows(chart, rows); }