~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugTextMarker.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
                        this.editor = editor;
44
44
                }
45
45
                
46
 
                public void DrawIcon (Mono.TextEditor.TextEditor editor, Gdk.Drawable win, LineSegment line, int lineNumber, int x, int y, int width, int height)
 
46
                public void DrawIcon (Mono.TextEditor.TextEditor editor, Cairo.Context cr, LineSegment line, int lineNumber, double x, double y, double width, double height)
47
47
                {
48
 
                        int size;
 
48
                        double size;
49
49
                        if (width > height) {
50
50
                                x += (width - height) / 2;
51
51
                                size = height;
54
54
                                size = width;
55
55
                        }
56
56
                        
57
 
                        using (Cairo.Context cr = Gdk.CairoHelper.Create (win)) {
58
 
                                DrawIcon (cr, x, y, size);
59
 
                        }
 
57
                        DrawIcon (cr, x, y, size);
60
58
                }
61
59
                
62
 
                protected virtual void DrawIcon (Cairo.Context cr, int x, int y, int size)
 
60
                protected virtual void DrawIcon (Cairo.Context cr, double x, double y, double size)
63
61
                {
64
62
                }
65
63
                
66
 
                protected void DrawCircle (Cairo.Context cr, double x, double y, int size)
 
64
                protected void DrawCircle (Cairo.Context cr, double x, double y, double size)
67
65
                {
68
66
                        x += 0.5; y += 0.5;
69
67
                        cr.NewPath ();
104
102
                        cr.ClosePath ();
105
103
                }
106
104
                
107
 
                protected void FillGradient (Cairo.Context cr, Cairo.Color color1, Cairo.Color color2, int x, int y, int size)
 
105
                protected void FillGradient (Cairo.Context cr, Cairo.Color color1, Cairo.Color color2, double x, double y, double size)
108
106
                {
109
 
                        Cairo.Gradient pat = new Cairo.LinearGradient (x + size / 4, y, x + size / 2, y + size - 4);
110
 
                        pat.AddColorStop (0, color1);
111
 
                        pat.AddColorStop (1, color2);
112
 
                        cr.Pattern = pat;
113
 
                        cr.FillPreserve ();
 
107
                        using (var pat = new Cairo.LinearGradient (x + size / 4, y, x + size / 2, y + size - 4)) {
 
108
                                pat.AddColorStop (0, color1);
 
109
                                pat.AddColorStop (1, color2);
 
110
                                cr.Pattern = pat;
 
111
                                cr.FillPreserve ();
 
112
                        }
114
113
                }
115
114
                
116
 
                protected void DrawBorder (Cairo.Context cr, Cairo.Color color, int x, int y, int size)
 
115
                protected void DrawBorder (Cairo.Context cr, Cairo.Color color, double x, double y, double size)
117
116
                {
118
 
                        Cairo.Gradient pat = new Cairo.LinearGradient (x, y + size, x + size, y);
119
 
                        pat.AddColorStop (0, color);
120
 
                        cr.Pattern = pat;
121
 
                        cr.LineWidth = 1;
122
 
                        cr.Stroke ();
 
117
                        using (var pat = new Cairo.LinearGradient (x, y + size, x + size, y)) {
 
118
                                pat.AddColorStop (0, color);
 
119
                                cr.Pattern = pat;
 
120
                                cr.Stroke ();
 
121
                        }
123
122
                }
124
123
 
125
124
                public void MousePress (MarginMouseEventArgs args)
129
128
                public void MouseRelease (MarginMouseEventArgs args)
130
129
                {
131
130
                }
 
131
                
 
132
                public void MouseHover (MarginMouseEventArgs args)
 
133
                {
 
134
                }
132
135
        }
133
136
        
134
137
        public class BreakpointTextMarker : DebugTextMarker
135
138
        {
136
 
                public override Color BackgroundColor {
 
139
                public override Cairo.Color BackgroundColor {
137
140
                        get { return editor.ColorStyle.BreakpointBg; }
138
141
                        set {  }
139
142
                }
140
 
                public override Color Color {
 
143
                public override Cairo.Color Color {
141
144
                        get { return editor.ColorStyle.BreakpointFg; }
142
145
                        set {  }
143
146
                }
150
153
                        IsTracepoint = isTracePoint;
151
154
                }
152
155
                
153
 
                protected override void DrawIcon (Cairo.Context cr, int x, int y, int size)
 
156
                protected override void DrawIcon (Cairo.Context cr, double x, double y, double size)
154
157
                {
155
 
                        Cairo.Color color1 = Style.ToCairoColor (editor.ColorStyle.BreakpointMarkerColor1);
156
 
                        Cairo.Color color2 = Style.ToCairoColor (editor.ColorStyle.BreakpointMarkerColor2);
 
158
                        Cairo.Color color1 = editor.ColorStyle.BreakpointMarkerColor1;
 
159
                        Cairo.Color color2 = editor.ColorStyle.BreakpointMarkerColor2;
157
160
                        if (IsTracepoint)
158
161
                                DrawDiamond (cr, x, y, size);
159
162
                        else
165
168
        
166
169
        public class DisabledBreakpointTextMarker: DebugTextMarker
167
170
        {
168
 
                public override Color BackgroundColor {
 
171
                public override Cairo.Color BackgroundColor {
169
172
                        get { return editor.ColorStyle.DisabledBreakpointBg; }
170
173
                        set {  }
171
174
                }
178
181
                
179
182
                public bool IsTracepoint { get; set; }
180
183
                
181
 
                protected override void DrawIcon (Cairo.Context cr, int x, int y, int size)
 
184
                protected override void DrawIcon (Cairo.Context cr, double x, double y, double size)
182
185
                {
183
 
                        Cairo.Color border = Style.ToCairoColor (editor.ColorStyle.InvalidBreakpointMarkerBorder);
 
186
                        Cairo.Color border = editor.ColorStyle.InvalidBreakpointMarkerBorder;
184
187
                        if (IsTracepoint)
185
188
                                DrawDiamond (cr, x, y, size);
186
189
                        else
192
195
        
193
196
        public class CurrentDebugLineTextMarker: DebugTextMarker
194
197
        {
195
 
                public override Color BackgroundColor {
 
198
                public override Cairo.Color BackgroundColor {
196
199
                        get { return editor.ColorStyle.CurrentDebugLineBg; }
197
200
                        set {  }
198
201
                }
199
202
                
200
 
                public override Color Color {
 
203
                public override Cairo.Color Color {
201
204
                        get { return editor.ColorStyle.CurrentDebugLineFg;  }
202
205
                        set {  }
203
206
                }
207
210
                        IncludedStyles |= StyleFlag.BackgroundColor | StyleFlag.Color;
208
211
                }
209
212
                
210
 
                protected override void DrawIcon (Cairo.Context cr, int x, int y, int size)
 
213
                protected override void DrawIcon (Cairo.Context cr, double x, double y, double size)
211
214
                {
212
 
                        Cairo.Color color1 = Style.ToCairoColor (editor.ColorStyle.CurrentDebugLineMarkerColor1);
213
 
                        Cairo.Color color2 = Style.ToCairoColor (editor.ColorStyle.CurrentDebugLineMarkerColor2);
214
 
                        Cairo.Color border = Style.ToCairoColor (editor.ColorStyle.CurrentDebugLineMarkerBorder);
 
215
                        Cairo.Color color1 = editor.ColorStyle.CurrentDebugLineMarkerColor1;
 
216
                        Cairo.Color color2 = editor.ColorStyle.CurrentDebugLineMarkerColor2;
 
217
                        Cairo.Color border = editor.ColorStyle.CurrentDebugLineMarkerBorder;
215
218
                
216
219
                        DrawArrow (cr, x, y, size);
217
220
                        FillGradient (cr, color1, color2, x, y, size);
221
224
        
222
225
        public class DebugStackLineTextMarker: DebugTextMarker
223
226
        {
224
 
                public override Color BackgroundColor {
 
227
                public override Cairo.Color BackgroundColor {
225
228
                        get { return editor.ColorStyle.DebugStackLineBg; }
226
229
                        set {  }
227
230
                }
228
231
                
229
 
                public override Color Color {
 
232
                public override Cairo.Color Color {
230
233
                        get { return editor.ColorStyle.DebugStackLineFg;  }
231
234
                        set {  }
232
235
                }
236
239
                        IncludedStyles |= StyleFlag.BackgroundColor | StyleFlag.Color;
237
240
                }
238
241
                
239
 
                protected override void DrawIcon (Cairo.Context cr, int x, int y, int size)
 
242
                protected override void DrawIcon (Cairo.Context cr, double x, double y, double size)
240
243
                {
241
 
                        Cairo.Color color1 = Style.ToCairoColor (editor.ColorStyle.DebugStackLineMarkerColor1);
242
 
                        Cairo.Color color2 = Style.ToCairoColor (editor.ColorStyle.DebugStackLineMarkerColor2);
243
 
                        Cairo.Color border = Style.ToCairoColor (editor.ColorStyle.DebugStackLineMarkerBorder);
 
244
                        Cairo.Color color1 = editor.ColorStyle.DebugStackLineMarkerColor1;
 
245
                        Cairo.Color color2 = editor.ColorStyle.DebugStackLineMarkerColor2;
 
246
                        Cairo.Color border = editor.ColorStyle.DebugStackLineMarkerBorder;
244
247
                
245
248
                        DrawArrow (cr, x, y, size);
246
249
                        FillGradient (cr, color1, color2, x, y, size);
250
253
        
251
254
        public class InvalidBreakpointTextMarker: DebugTextMarker
252
255
        {
253
 
                public override Color BackgroundColor {
 
256
                public override Cairo.Color BackgroundColor {
254
257
                        get { return editor.ColorStyle.InvalidBreakpointBg; }
255
258
                        set {  }
256
259
                }
260
263
                        IncludedStyles |= StyleFlag.BackgroundColor;
261
264
                }
262
265
                
263
 
                protected override void DrawIcon (Cairo.Context cr, int x, int y, int size)
 
266
                protected override void DrawIcon (Cairo.Context cr, double x, double y, double size)
264
267
                {
265
 
                        Cairo.Color color1 = Style.ToCairoColor (editor.ColorStyle.InvalidBreakpointMarkerColor1);
 
268
                        Cairo.Color color1 = editor.ColorStyle.InvalidBreakpointMarkerColor1;
266
269
                        Cairo.Color color2 = color1;
267
 
                        Cairo.Color border = Style.ToCairoColor (editor.ColorStyle.InvalidBreakpointMarkerBorder);
 
270
                        Cairo.Color border = editor.ColorStyle.InvalidBreakpointMarkerBorder;
268
271
                        DrawCircle (cr, x, y, size);
269
272
                        FillGradient (cr, color1, color2, x, y, size);
270
273
                        DrawBorder (cr, border, x, y, size);