private void MixedCodeDataView_TopAddressChanged() { var topAddress = combinedCodeView.MixedCodeDataView.TopAddress; MixedCodeDataModel.DataItemNode dataItemNode; if (!nodeByAddress.TryGetLowerBound(topAddress, out dataItemNode)) { return; } int numer; int denom; if (topAddress < dataItemNode.EndAddress) { var mixedCodeDataModel = (MixedCodeDataModel)combinedCodeView.MixedCodeDataView.Model; numer = mixedCodeDataModel.CountLines(dataItemNode.StartAddress, topAddress); denom = dataItemNode.NumLines; } else { numer = 1; denom = 1; } nestedTextModel.SetPositionAsNode(dataItemNode.ModelNode, numer, denom); combinedCodeView.CodeView.InvalidateModel(); }
private void MixedCodeDataView_TopAddressChanged() { if (!(combinedCodeView.MixedCodeDataView.Model is MixedCodeDataModel mixedCodeDataModel)) { return; } var topAddress = combinedCodeView.MixedCodeDataView.TopAddress; MixedCodeDataModel.DataItemNode dataItemNode = null; if (nodeByAddress == null || !nodeByAddress.TryGetLowerBound(topAddress, out dataItemNode)) { return; } int numer; int denom; if (topAddress < dataItemNode.EndAddress) { var startAddr = dataItemNode.StartAddress; var endAddr = topAddress; var startPos = MixedCodeDataModel.Position(startAddr, 0); var endPos = MixedCodeDataModel.Position(endAddr, 0); numer = mixedCodeDataModel.CountLines(startPos, endPos); denom = dataItemNode.NumLines; if (denom == 0) { Debug.Print("dataItem.NumLines = 0"); numer = 1; denom = 1; } } else { numer = 1; denom = 1; } nestedTextModel.SetPositionAsNode(dataItemNode.ModelNode, numer, denom); combinedCodeView.CodeView.InvalidateModel(); }