private void mniCopyToLeft_Click(object sender, EventArgs e) { if (!CheckSynchronized()) { return; } // Get the change range from the source diff control DiffEditRange range = new DiffEditRange(); ucRightDiff.GetChangeRange(ucRightDiff.GetCursorPosition(), ref range); // Copy the change lines from the source diff control ucLeftDiff.ReplaceLines(range.MinPosition.LineIndex, range.MaxPosition.LineIndex, ucRightDiff); UpdateState(); }
public DiffSnapshot(List <LineRecord> lines, DiffEditPosition cursor, DiffEditRange selection, int lineIndex, int column, bool modified, bool synched) { if (lines == null) { _lines = null; } else { _lines = new List <LineRecord>(); foreach (LineRecord lrec in lines) { _lines.Add((LineRecord)lrec.Clone()); } } // else _cursor = cursor; _selection = selection; _lineIndex = lineIndex; _columnIndex = column; _modified = modified; _synched = synched; }
private void UpdateState() { DiffEditBox ebox = null; if (ucLeftDiff.Focused) { ebox = ucLeftDiff; } else if (ucRightDiff.Focused) { ebox = ucRightDiff; } if (ebox != null) { DiffEditRange range = new DiffEditRange(); // Enable the COPY menu items only if the cursor is placed on a // change range. bool onChange = ucRightDiff.GetChangeRange(ebox.GetCursorPosition(), ref range); btnCopyLeftToRight.Enabled = onChange; btnCopyRightToLeft.Enabled = onChange; mniCopyFromLeft.Enabled = onChange; mniCopyFromRight.Enabled = onChange; mniCopyToLeft.Enabled = onChange; mniCopyToRight.Enabled = onChange; } else { btnCopyLeftToRight.Enabled = false; btnCopyRightToLeft.Enabled = false; mniCopyFromLeft.Enabled = false; mniCopyFromRight.Enabled = false; mniCopyToLeft.Enabled = false; mniCopyToRight.Enabled = false; } }