Exemplo n.º 1
0
        public AutoExpander(
            IWpfTextView textView,
            IVsOutliningManager outlining,
            IVsfSettings settings)
        {
            this.settings         = settings;
            this.theView          = textView;
            this.outliningManager = outlining;
            this.expandMode       = settings.AutoExpandRegions;

            this.theView.Closed           += OnViewClosed;
            this.settings.SettingsChanged += OnSettingsChanged;

            if (this.expandMode == AutoExpandMode.Disable)
            {
                outlining.Enabled = false;
            }
            else if (this.expandMode == AutoExpandMode.Expand)
            {
                // in most cases, this is enough to
                // expand all outlining as necessary.
                // However, it does not appear to work
                // if the solution is just opened
                // so take notice of when regions are
                // collapsed and do it again just in case
                // Try expanding it when the window gets focus
                // as a last chance for Visual Basic
                this.theView.LayoutChanged             += OnLayoutChanged;
                this.outliningManager.RegionsCollapsed += OnRegionsCollapsed;
                this.theView.GotAggregateFocus         += OnGotFocus;
            }
        }
Exemplo n.º 2
0
        public AutoExpander(
            IWpfTextView textView,
            IVsOutliningManager outlining,
            IVsfSettings settings)
        {
            this.settings = settings;
              this.theView = textView;
              this.outliningManager = outlining;
              this.expandMode = settings.AutoExpandRegions;

              this.theView.Closed += OnViewClosed;
              this.settings.SettingsChanged += OnSettingsChanged;

              if ( expandMode == AutoExpandMode.Disable ) {
            outlining.Enabled = false;
              } else if ( expandMode == AutoExpandMode.Expand ) {
            // in most cases, this is enough to
            // expand all outlining as necessary.
            // However, it does not appear to work
            // if the solution is just opened
            // so take notice of when regions are
            // collapsed and do it again just in case
            // Try expanding it when the window gets focus
            // as a last chance for Visual Basic
            this.theView.LayoutChanged += OnLayoutChanged;
            this.outliningManager.RegionsCollapsed += OnRegionsCollapsed;
            this.theView.GotAggregateFocus += OnGotFocus;
              }
        }
Exemplo n.º 3
0
        public AutoExpander(
            IWpfTextView textView,
            IVsOutliningManager outlining,
            AutoExpandMode mode)
        {
            this.expandMode       = mode;
            this.theView          = textView;
            this.outliningManager = outlining;

            this.theView.Closed         += OnViewClosed;
            VsfSettings.SettingsUpdated += OnSettingsUpdated;
            if (expandMode == AutoExpandMode.Disable)
            {
                outlining.Enabled = false;
            }
            else if (expandMode == AutoExpandMode.Expand)
            {
                // in most cases, this is enough to
                // expand all outlining as necessary.
                // However, it does not appear to work
                // if the solution is just opened
                // so take notice of when regions are
                // collapsed and do it again just in case
                this.theView.LayoutChanged             += OnLayoutChanged;
                this.outliningManager.RegionsCollapsed += OnRegionsCollapsed;
            }
        }
Exemplo n.º 4
0
 private void OnViewClosed(object sender, EventArgs e)
 {
     VsfSettings.SettingsUpdated            -= OnSettingsUpdated;
     this.outliningManager.RegionsCollapsed -= OnRegionsCollapsed;
     this.theView.LayoutChanged             -= OnLayoutChanged;
     this.theView.Closed  -= OnViewClosed;
     this.theView          = null;
     this.outliningManager = null;
 }
Exemplo n.º 5
0
 private void OnViewClosed(object sender, EventArgs e)
 {
     this.settings.SettingsChanged -= OnSettingsChanged;
     this.settings = null;
     this.outliningManager.RegionsCollapsed -= OnRegionsCollapsed;
     this.theView.LayoutChanged             -= OnLayoutChanged;
     this.theView.GotAggregateFocus         -= OnGotFocus;
     this.theView.Closed  -= OnViewClosed;
     this.theView          = null;
     this.outliningManager = null;
 }
Exemplo n.º 6
0
 private void OnViewClosed(object sender, EventArgs e)
 {
     this.settings.SettingsChanged -= OnSettingsChanged;
       this.settings = null;
       this.outliningManager.RegionsCollapsed -= OnRegionsCollapsed;
       this.theView.LayoutChanged -= OnLayoutChanged;
       this.theView.GotAggregateFocus -= OnGotFocus;
       this.theView.Closed -= OnViewClosed;
       this.theView = null;
       this.outliningManager = null;
 }