コード例 #1
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
        void Show(IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
        {
            if (content == null)
            {
                throw new ArgumentNullException();
            }
            var t = GetToolWindowGroup(content);

            if (t != null)
            {
                if (active)
                {
                    t.Item2.ActiveTabContent = content;
                }
                if (focus)
                {
                    t.Item2.SetFocus(content);
                }
                return;
            }

            var g = GetOrCreateGroup(location);

            g.Add(content);
            SaveLocationAndActivate(g, content, location, active, focus);
        }
コード例 #2
0
        public void MoveTo(IToolWindowGroup destGroup, IToolWindowContent content)
        {
            if (destGroup == null)
            {
                throw new ArgumentNullException(nameof(destGroup));
            }
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                throw new InvalidOperationException();
            }
            if (destGroup == this)
            {
                return;
            }
            var destGroupImpl = destGroup as ToolWindowGroup;

            if (destGroupImpl == null)
            {
                throw new InvalidOperationException();
            }

            impl.PrepareMove();
            Close(impl);

            impl = new TabContentImpl(destGroupImpl, content);
            impl.PrepareMove();
            destGroupImpl.TabGroup.Add(impl);
        }
コード例 #3
0
 public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content)
 {
     this.elementZoomer = new TabElementZoomer();
     this.owner         = owner;
     this.Content       = content;
     AddEvents();
 }
コード例 #4
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
 public void Show(IToolWindowContent content, AppToolWindowLocation?location)
 {
     if (content == null)
     {
         throw new ArgumentNullException();
     }
     Show(content, GetLocation(content.Guid, location), true, true);
 }
コード例 #5
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
 void SaveLocationAndActivate(IToolWindowGroup g, IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
 {
     if (active)
     {
         g.ActiveTabContent = content;
     }
     if (focus)
     {
         g.SetFocus(content);
     }
     savedLocations[content.Guid] = location;
 }
コード例 #6
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
        public bool CanMove(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);

            location = Convert(location);
            if (t == null || t.Item1.Location == location)
            {
                return(false);
            }

            return(true);
        }
コード例 #7
0
 void Window_Disposed(object sender, EventArgs e)
 {
     if (_session != null)
     {
         _session.SmartWindowManager.OnActiveWindowChanged -= _viewerChangedHandler;
     }
     _viewerChangedHandler = null;
     _onWindowClosed       = null;
     if (_content != null)
     {
         _content.Free();
         _content = null;
     }
 }
コード例 #8
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
 Tuple <ToolWindowUI, IToolWindowGroup> GetToolWindowGroup(IToolWindowContent content)
 {
     foreach (var ui in this.toolWindowUIs.Values)
     {
         foreach (var g in ui.ToolWindowGroupManager.TabGroups)
         {
             if (g.TabContents.Contains(content))
             {
                 return(Tuple.Create(ui, g));
             }
         }
     }
     return(null);
 }
コード例 #9
0
ファイル: ToolWindowGroup.cs プロジェクト: haise0/reAtomizer
        public void SetFocus(IToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException();
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                return;
            }
            tabGroup.SetFocus(impl);
        }
コード例 #10
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
        public void Close(IToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException();
            }
            var t = GetToolWindowGroup(content);

            Debug.Assert(t != null);
            if (t == null)
            {
                throw new InvalidOperationException();
            }
            t.Item2.Close(content);
        }
コード例 #11
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
        public void Move(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);

            location = Convert(location);
            if (t == null || t.Item1.Location == location)
            {
                return;
            }

            var g = GetOrCreateGroup(location);

            t.Item2.MoveTo(g, content);
            SaveLocationAndActivate(g, content, location, true, true);
        }
コード例 #12
0
        public void Close(IToolWindowContent content)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            var impl = GetTabContentImpl(content);

            Debug.Assert(impl != null);
            if (impl == null)
            {
                return;
            }
            TabGroup.Close(impl);
        }
コード例 #13
0
 public ToolWindowBase()
 {
     InitializeComponent();
     _content = GetToolWindowContent();
     if (_content != null)
     {
         (_content as Control).Dock = DockStyle.Fill;
         this.Controls.Add(_content as Control);
         //_content.Apply(_session);
         _viewerChangedHandler = new OnActiveWindowChangedHandler(
             (sender, oldv, newv) =>
         {
             _content.Apply(_session);
         }
             );
     }
     this.Disposed += new EventHandler(Window_Disposed);
 }
コード例 #14
0
 public void Add(IToolWindowContent content) => TabGroup.Add(new TabContentImpl(this, content));
コード例 #15
0
 TabContentImpl GetTabContentImpl(IToolWindowContent content) => TabContentImpls.FirstOrDefault(a => a.Content == content);
コード例 #16
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
 public bool IsShown(IToolWindowContent content)
 {
     return GetToolWindowGroup(content) != null;
 }
コード例 #17
0
ファイル: ToolWindowGroup.cs プロジェクト: lovebanyi/dnSpy
 public void SetFocus(IToolWindowContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     var impl = GetTabContentImpl(content);
     Debug.Assert(impl != null);
     if (impl == null)
         return;
     tabGroup.SetFocus(impl);
 }
コード例 #18
0
ファイル: ToolWindowGroup.cs プロジェクト: lovebanyi/dnSpy
 TabContentImpl GetTabContentImpl(IToolWindowContent content)
 {
     return TabContentImpls.FirstOrDefault(a => a.Content == content);
 }
コード例 #19
0
 protected override IToolWindowContent GetToolWindowContent()
 {
     _toolWindowContent = new FeatureListContent();
     return(_toolWindowContent);
 }
コード例 #20
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tabGroup">Tab group</param>
 /// <param name="selected">Selected content or null</param>
 /// <param name="unselected">Unselected content or null</param>
 public ToolWindowSelectedEventArgs(IToolWindowGroup tabGroup, IToolWindowContent selected, IToolWindowContent unselected)
 {
     this.TabGroup = tabGroup;
     this.Selected = selected;
     this.Unselected = unselected;
 }
コード例 #21
0
ファイル: ToolWindowGroup.cs プロジェクト: haise0/reAtomizer
 TabContentImpl GetTabContentImpl(IToolWindowContent content)
 {
     return(TabContentImpls.FirstOrDefault(a => a.Content == content));
 }
コード例 #22
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
        void Show(IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
        {
            if (content == null)
                throw new ArgumentNullException();
            var t = GetToolWindowGroup(content);
            if (t != null) {
                if (active)
                    t.Item2.ActiveTabContent = content;
                if (focus)
                    t.Item2.SetFocus(content);
                return;
            }

            var g = GetOrCreateGroup(location);
            g.Add(content);
            SaveLocationAndActivate(g, content, location, active, focus);
        }
コード例 #23
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
 void SaveLocationAndActivate(IToolWindowGroup g, IToolWindowContent content, AppToolWindowLocation location, bool active, bool focus)
 {
     if (active)
         g.ActiveTabContent = content;
     if (focus)
         g.SetFocus(content);
     savedLocations[content.Guid] = location;
 }
コード例 #24
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
 Tuple<ToolWindowUI, IToolWindowGroup> GetToolWindowGroup(IToolWindowContent content)
 {
     foreach (var ui in this.toolWindowUIs.Values) {
         foreach (var g in ui.ToolWindowGroupManager.TabGroups) {
             if (g.TabContents.Contains(content))
                 return Tuple.Create(ui, g);
         }
     }
     return null;
 }
コード例 #25
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
 public void Show(IToolWindowContent content, AppToolWindowLocation? location)
 {
     if (content == null)
         throw new ArgumentNullException();
     Show(content, GetLocation(content.Guid, location), true, true);
 }
コード例 #26
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
        public void Move(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);
            location = Convert(location);
            if (t == null || t.Item1.Location == location)
                return;

            var g = GetOrCreateGroup(location);
            t.Item2.MoveTo(g, content);
            SaveLocationAndActivate(g, content, location, true, true);
        }
コード例 #27
0
ファイル: TabContentImpl.cs プロジェクト: lovebanyi/dnSpy
 public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content)
 {
     this.owner = owner;
     this.content = content;
     AddEvents();
 }
コード例 #28
0
ファイル: ToolWindowGroup.cs プロジェクト: lovebanyi/dnSpy
        public void MoveTo(IToolWindowGroup destGroup, IToolWindowContent content)
        {
            if (destGroup == null || content == null)
                throw new ArgumentNullException();
            var impl = GetTabContentImpl(content);
            Debug.Assert(impl != null);
            if (impl == null)
                throw new InvalidOperationException();
            if (destGroup == this)
                return;
            var destGroupImpl = destGroup as ToolWindowGroup;
            if (destGroupImpl == null)
                throw new InvalidOperationException();

            impl.PrepareMove();
            Close(impl);

            impl = new TabContentImpl(destGroupImpl, content);
            impl.PrepareMove();
            destGroupImpl.tabGroup.Add(impl);
        }
コード例 #29
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
 public ToolWindowContentState Save(IToolWindowContent c)
 {
     this.Guid = c.Guid;
     return(this);
 }
コード例 #30
0
ファイル: MainWindowControl.cs プロジェクト: weimingtom/dnSpy
 public bool IsShown(IToolWindowContent content) => GetToolWindowGroup(content) != null;
コード例 #31
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="tabGroup">Tab group</param>
 /// <param name="selected">Selected content or null</param>
 /// <param name="unselected">Unselected content or null</param>
 public ToolWindowSelectedEventArgs(IToolWindowGroup tabGroup, IToolWindowContent selected, IToolWindowContent unselected)
 {
     this.TabGroup   = tabGroup;
     this.Selected   = selected;
     this.Unselected = unselected;
 }
コード例 #32
0
ファイル: TabContentImpl.cs プロジェクト: GreenDamTan/dnSpy
		public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content) {
			this.elementScaler = new TabElementScaler();
			this.owner = owner;
			this.content = content;
			AddEvents();
		}
コード例 #33
0
ファイル: MainWindowControl.cs プロジェクト: imanadib/dnSpy
 public bool IsShown(IToolWindowContent content)
 {
     return(GetToolWindowGroup(content) != null);
 }
コード例 #34
0
 public TabContentImpl(ToolWindowGroup owner, IToolWindowContent content)
 {
     this.owner   = owner;
     this.content = content;
     AddEvents();
 }
コード例 #35
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
 public ToolWindowContentState Save(IToolWindowContent c)
 {
     this.Guid = c.Guid;
     return this;
 }
コード例 #36
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
 public void Close(IToolWindowContent content)
 {
     if (content == null)
         throw new ArgumentNullException();
     var t = GetToolWindowGroup(content);
     Debug.Assert(t != null);
     if (t == null)
         throw new InvalidOperationException();
     t.Item2.Close(content);
 }
コード例 #37
0
ファイル: MainWindowControl.cs プロジェクト: n017/dnSpy
        public bool CanMove(IToolWindowContent content, AppToolWindowLocation location)
        {
            var t = GetToolWindowGroup(content);
            location = Convert(location);
            if (t == null || t.Item1.Location == location)
                return false;

            return true;
        }
コード例 #38
0
ファイル: ToolWindowGroup.cs プロジェクト: lovebanyi/dnSpy
 public void Add(IToolWindowContent content)
 {
     tabGroup.Add(new TabContentImpl(this, content));
 }