void IView.SetViewModel(IViewModel viewModel) { this.viewModel = viewModel; this.graphicsResources = new GraphicsResources( viewModel, (fontData) => new LJD.Font(fontData.Name ?? "monaco", (float)NSFont.SystemFontSizeForControlSize(NSControlSize.Small)), textFormat: null, images: ( error: new LJD.Image(NSImage.ImageNamed("ErrorLogSeverity.png")), warn: new LJD.Image(NSImage.ImageNamed("WarnLogSeverity.png")), bookmark: new LJD.Image(NSImage.ImageNamed("Bookmark.png")), focusedMark: new LJD.Image(NSImage.ImageNamed("FocusedMsg.png")) ), graphicsForMeasurmentFactory: () => graphicsForMeasurment ); this.viewDrawing = new ViewDrawing(viewModel, graphicsResources, 1f, () => 0, () => viewWidth ); this.drawingPerfCounters = new Profiling.Counters(viewModel.Trace, "drawing"); this.graphicsCounters = LJD.Graphics.CreateCounters(drawingPerfCounters); this.controlPaintTimeCounter = this.drawingPerfCounters.AddCounter("paint", unit: "ms"); this.controlPaintWidthCounter = this.drawingPerfCounters.AddCounter("width", unit: "pixel"); this.controlPaintHeightCounter = this.drawingPerfCounters.AddCounter("height", unit: "pixel"); var viewUpdater = Updaters.Create( () => viewModel.ViewLines, () => viewModel.FocusedMessageMark, (_1, _2) => { this.InnerView.NeedsDisplay = true; } ); var emptyViewMessageUpdater = Updaters.Create( () => viewModel.EmptyViewMessage, value => { drawDropMessage = value; DragDropIconView.Hidden = value == null; } ); var vScrollUpdater = Updaters.Create( () => viewModel.VerticalScrollerPosition, value => { VertScroller.Enabled = value.HasValue; VertScroller.KnobProportion = 0.0001f; VertScroller.DoubleValue = value.GetValueOrDefault(); } ); viewModel.ChangeNotification.CreateSubscription(() => { viewUpdater(); emptyViewMessageUpdater(); vScrollUpdater(); }); }
partial void Init(Profiling.Counters countersContainer) { if (countersContainer == null) { return; } drawStringPoint = countersContainer.AddCounter("DrawString(pt)", unit: "ms", reportCount: true); drawStringPoint_CreateAS = countersContainer.AddCounter("DrawString(pt).CreateAttributedString", unit: "ms"); drawStringPoint_Draw1 = countersContainer.AddCounter("DrawString(pt).Draw(1)", unit: "ms"); drawStringPoint_Draw2 = countersContainer.AddCounter("DrawString(pt).Draw(2)", unit: "ms"); fillRectangle = countersContainer.AddCounter("FillRectangle", unit: "ms", reportCount: true); fillRoundRectangle = countersContainer.AddCounter("FillRoundRectangle", unit: "ms"); measureCharRange = countersContainer.AddCounter("MeasureCharRange", unit: "ms"); }
public static PerformanceCounters CreateCounters(Profiling.Counters countersContainer) { return(new PerformanceCounters(countersContainer)); }
internal PerformanceCounters(Profiling.Counters countersContainer) { }