Ejemplo n.º 1
0
        private void SetZoomLevel(IWpfTextView textView)
        {
            // don't try overriding the zoom level for
            // a peek definition window
            if (textView.IsPeekTextWindow())
            {
                return;
            }
            if (this.settings.PresentationModeEnabled)
            {
                var textViewState = textView.Get <PresentationModeViewState>();
                bool pmEnabled()
                {
                    return(textViewState?.Enabled ?? false);
                }

                int zoomLevel = this.state.GetPresentationModeZoomLevel();

                if (this.state.PresentationModeTurnedOn)
                {
                    if (!pmEnabled())
                    {
                        textView.ZoomLevel = zoomLevel;
                        textView.Set(new PresentationModeViewState(true));
                    }
                }
                else
                {
                    if (pmEnabled())
                    {
                        textViewState.Enabled = false;
                        textView.ZoomLevel    = zoomLevel;
                    }
                }
            }
        }