~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Debugger/Debugger.AddIn/Pads/Commands/ParallelStacksViewCommands.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Windows.Controls;
 
6
using ICSharpCode.Core;
 
7
 
 
8
namespace ICSharpCode.SharpDevelop.Gui.Pads
 
9
{
 
10
        public sealed class ShowZoomControlCommand : AbstractCheckableMenuCommand
 
11
        {
 
12
                ParallelStackPad pad;
 
13
                
 
14
                public override object Owner {
 
15
                        get { return base.Owner; }
 
16
                        set {
 
17
                                if (!(value is ParallelStackPad))
 
18
                                        throw new Exception("Owner has to be a ParallelStackPad");
 
19
                                pad = value as ParallelStackPad;
 
20
                                base.Owner = value;
 
21
                        }
 
22
                }
 
23
                
 
24
                public override bool IsChecked {
 
25
                        get { return pad.IsZoomControlVisible; }
 
26
                        set { pad.IsZoomControlVisible = value; }
 
27
                }
 
28
                
 
29
                public override void Run()
 
30
                {
 
31
                        IsChecked = !IsChecked;
 
32
                }
 
33
        }
 
34
        
 
35
        public sealed class ToggleMethodViewCommand : AbstractCheckableMenuCommand
 
36
        {
 
37
                ParallelStackPad pad;
 
38
                
 
39
                public override object Owner {
 
40
                        get { return base.Owner; }
 
41
                        set {
 
42
                                if (!(value is ParallelStackPad))
 
43
                                        throw new Exception("Owner has to be a AbstractConsolePad");
 
44
                                pad = value as ParallelStackPad;
 
45
                                base.Owner = value;
 
46
                        }
 
47
                }
 
48
                
 
49
                public override bool IsChecked {
 
50
                        get { return pad.IsMethodView; }
 
51
                        set { pad.IsMethodView = value; }
 
52
                }
 
53
                
 
54
                public override void Run()
 
55
                {
 
56
                        IsChecked = !IsChecked;
 
57
                }
 
58
        }
 
59
        
 
60
        public sealed class ParallelStacksViewCommand : AbstractComboBoxCommand
 
61
        {
 
62
                ParallelStackPad pad;
 
63
                ComboBox box;           
 
64
                
 
65
                protected override void OnOwnerChanged(EventArgs e)
 
66
                {
 
67
                        this.pad = this.Owner as ParallelStackPad;
 
68
                        if (this.pad == null)
 
69
                                return;
 
70
                        
 
71
                        box = this.ComboBox as ComboBox;
 
72
                        
 
73
                        if (this.box == null)
 
74
                                return;
 
75
                        
 
76
                        foreach (var name in Enum.GetNames(typeof(ParallelStacksView)))
 
77
                                box.Items.Add(name);
 
78
                        
 
79
                        box.SelectedIndex = 0;
 
80
                        
 
81
                        base.OnOwnerChanged(e);
 
82
                }
 
83
                
 
84
                public override void Run()
 
85
                {
 
86
                        if (this.pad != null && this.box != null) {
 
87
                                pad.ParallelStacksView = (ParallelStacksView)Enum.Parse(typeof(ParallelStacksView), box.SelectedValue.ToString());
 
88
                        }
 
89
                        base.Run();
 
90
                }
 
91
        }
 
92
}
 
 
b'\\ No newline at end of file'