private void OverviewValueChanged(object p) { lock (_lockObject) { if ((p is double) == false) { return; } double param = (double)p; if (_IgnoreNextSliderValueChange == true) { if (_LastLineToSync == (int)param) { return; } _IgnoreNextSliderValueChange = false; return; } _LastLineToSync = (int)param; IDiffSideViewModel nonActView; IDiffSideViewModel activeView = DiffCtrl.GetActiveView(out nonActView); var gotoPos = new DiffViewPosition((int)param, 0); DiffCtrl.ScrollToLine(gotoPos, nonActView, activeView, false); } }
private void UpdateOtherView(CaretPositionChangedEvent e, IDiffSideViewModel otherView) { if (otherView != null) { switch (e.ChangeType) { case CaretChangeType.ColumnAndLine: otherView.Line = e.Line; otherView.Column = e.Column; break; case CaretChangeType.Column: otherView.Column = e.Column; break; case CaretChangeType.Line: otherView.Line = e.Line; break; default: throw new NotImplementedException(e.ChangeType.ToString()); } } }
/// <summary> /// Gets the view (of the 2 side by side views) that was activated last /// (had the focus the last time) /// </summary> /// <returns></returns> public IDiffSideViewModel GetActiveView(out IDiffSideViewModel nonActiveView) { nonActiveView = null; if (ViewA == null && ViewB == null) { return(null); } if (ViewA == null) { return(ViewB); } if (ViewB == null) { return(ViewA); } if (ViewA.ViewActivation < ViewB.ViewActivation) { nonActiveView = ViewA; return(ViewB); } nonActiveView = ViewB; return(ViewA); }
private bool OverviewValueChangedCanExecute() { IDiffSideViewModel nonActView; IDiffSideViewModel activeView = DiffCtrl.GetActiveView(out nonActView); if (activeView == null) { return(false); } return(true); }
/// <summary> /// Moves both views to the requested line position. /// </summary> /// <param name="gotoPos"></param> /// <param name="viewA"></param> /// <param name="viewB"></param> /// <param name="positionCursor"></param> public void ScrollToLine(IDiffViewPosition gotoPos, IDiffSideViewModel viewA, IDiffSideViewModel viewB, bool positionCursor) { if (viewA != null) { viewA.ScrollToLine(gotoPos.Line + 1, positionCursor); viewA.SetPosition(gotoPos); } if (viewB != null) { viewB.ScrollToLine(gotoPos.Line + 1, positionCursor); viewB.SetPosition(gotoPos); } }