30
30
using System . Linq ;
31
31
using System . Collections . Generic ;
32
32
33
+ using Foundation ;
34
+ using GLib ;
33
35
using Gtk ;
34
36
35
37
using Mono . Debugging . Client ;
36
38
37
39
using MonoDevelop . Ide ;
38
40
using MonoDevelop . Core ;
39
41
using MonoDevelop . Components ;
42
+ using MonoDevelop . Components . AtkCocoaHelper ;
40
43
using MonoDevelop . Ide . TextEditing ;
41
44
using MonoDevelop . Ide . Editor . Extension ;
42
45
@@ -56,7 +59,7 @@ class ExceptionCaughtDialog : Gtk.Window
56
59
VBox vboxAroundInnerExceptionMessage , rightVBox , container ;
57
60
Button close , helpLinkButton , innerExceptionHelpLinkButton ;
58
61
TreeView exceptionValueTreeView , stackTraceTreeView ;
59
- Expander expanderProperties , expanderStacktrace ;
62
+ MacObjectValueTreeView macExceptionValueTreeView ;
60
63
InnerExceptionsTree innerExceptionsTreeView ;
61
64
ObjectValueTreeViewController controller ;
62
65
CheckButton onlyShowMyCodeCheckbox ;
@@ -96,6 +99,8 @@ Widget CreateExceptionHeader ()
96
99
icon . Yalign = 0 ;
97
100
98
101
exceptionTypeLabel = new Label { Xalign = 0.0f , Selectable = true , CanFocus = false } ;
102
+ icon . SetCommonAccessibilityAttributes ( "ExceptionCaughtDialog.WarningIcon" , exceptionTypeLabel , null ) ;
103
+
99
104
exceptionMessageLabel = new Label { Wrap = true , Xalign = 0.0f , Selectable = true , CanFocus = false } ;
100
105
helpLinkButton = new Button { HasFocus = true , Xalign = 0 , Relief = ReliefStyle . None , BorderWidth = 0 } ;
101
106
helpLinkButton . Name = "exception_help_link_label" ;
@@ -181,12 +186,17 @@ protected override void OnSizeAllocated (Gdk.Rectangle allocation)
181
186
182
187
Widget CreateExceptionValueTreeView ( )
183
188
{
189
+ Widget scrolledWidget = null ;
184
190
if ( useNewTreeView ) {
185
191
controller = new ObjectValueTreeViewController ( ) ;
186
192
controller . SetStackFrame ( DebuggingService . CurrentFrame ) ;
187
193
controller . AllowExpanding = true ;
188
194
189
- exceptionValueTreeView = controller . GetGtkControl ( ObjectValueTreeViewFlags . ExceptionCaughtFlags ) ;
195
+ if ( Platform . IsMac ) {
196
+ macExceptionValueTreeView = controller . GetMacControl ( ObjectValueTreeViewFlags . ObjectValuePadFlags ) ;
197
+ } else {
198
+ exceptionValueTreeView = controller . GetGtkControl ( ObjectValueTreeViewFlags . ExceptionCaughtFlags ) ;
199
+ }
190
200
} else {
191
201
var objValueTreeView = new ObjectValueTreeView ( ) ;
192
202
objValueTreeView . Frame = DebuggingService . CurrentFrame ;
@@ -199,77 +209,70 @@ Widget CreateExceptionValueTreeView ()
199
209
exceptionValueTreeView = objValueTreeView ;
200
210
}
201
211
202
- exceptionValueTreeView . ModifyBase ( StateType . Normal , Styles . ExceptionCaughtDialog . ValueTreeBackgroundColor . ToGdkColor ( ) ) ;
203
- exceptionValueTreeView . ModifyBase ( StateType . Active , Styles . ObjectValueTreeActiveBackgroundColor . ToGdkColor ( ) ) ;
204
- exceptionValueTreeView . ModifyFont ( Pango . FontDescription . FromString ( Platform . IsWindows ? "9" : "11" ) ) ;
205
- exceptionValueTreeView . RulesHint = false ;
206
- exceptionValueTreeView . CanFocus = true ;
207
- exceptionValueTreeView . Show ( ) ;
212
+ if ( useNewTreeView && Platform . IsMac ) {
213
+ var scrolled = new AppKit . NSScrollView {
214
+ DocumentView = macExceptionValueTreeView ,
215
+ AutohidesScrollers = true ,
216
+ HasVerticalScroller = true ,
217
+ HasHorizontalScroller = true ,
218
+ } ;
219
+
220
+ // disable implicit animations
221
+ scrolled . WantsLayer = true ;
222
+ scrolled . Layer . Actions = new NSDictionary (
223
+ "actions" , NSNull . Null ,
224
+ "contents" , NSNull . Null ,
225
+ "hidden" , NSNull . Null ,
226
+ "onLayout" , NSNull . Null ,
227
+ "onOrderIn" , NSNull . Null ,
228
+ "onOrderOut" , NSNull . Null ,
229
+ "position" , NSNull . Null ,
230
+ "sublayers" , NSNull . Null ,
231
+ "transform" , NSNull . Null ,
232
+ "bounds" , NSNull . Null ) ;
233
+
234
+ var host = new GtkNSViewHost ( scrolled ) ;
235
+ host . ShowAll ( ) ;
236
+ scrolledWidget = host ;
237
+ } else {
238
+ exceptionValueTreeView . ModifyBase ( StateType . Normal , Styles . ExceptionCaughtDialog . ValueTreeBackgroundColor . ToGdkColor ( ) ) ;
239
+ exceptionValueTreeView . ModifyBase ( StateType . Active , Styles . ObjectValueTreeActiveBackgroundColor . ToGdkColor ( ) ) ;
240
+ exceptionValueTreeView . ModifyFont ( Pango . FontDescription . FromString ( Platform . IsWindows ? "9" : "11" ) ) ;
241
+ exceptionValueTreeView . RulesHint = false ;
242
+ exceptionValueTreeView . CanFocus = true ;
243
+ exceptionValueTreeView . Show ( ) ;
244
+
245
+ var scrolled = new ScrolledWindow {
246
+ CanFocus = true ,
247
+ HscrollbarPolicy = PolicyType . Automatic ,
248
+ VscrollbarPolicy = PolicyType . Automatic
249
+ } ;
250
+
251
+ scrolled . ShadowType = ShadowType . None ;
252
+ scrolled . Add ( exceptionValueTreeView ) ;
253
+ scrolled . Show ( ) ;
254
+ scrolledWidget = scrolled ;
255
+ }
208
256
209
- var scrolled = new ScrolledWindow {
210
- HeightRequest = 180 ,
211
- CanFocus = true ,
212
- HscrollbarPolicy = PolicyType . Automatic ,
213
- VscrollbarPolicy = PolicyType . Automatic
214
- } ;
257
+ var label = new Label ( ) ;
258
+ label . Markup = "<b>" + GettextCatalog . GetString ( "Properties" ) + "</b>" ;
259
+ label . Xalign = 0 ;
260
+ label . Xpad = 10 ;
215
261
216
- scrolled . ShadowType = ShadowType . None ;
217
- scrolled . Add ( exceptionValueTreeView ) ;
218
- scrolled . Show ( ) ;
262
+ if ( exceptionValueTreeView != null ) {
263
+ exceptionValueTreeView . SetCommonAccessibilityAttributes ( "ExceptionCaughtDialog.ExceptionValueTreeView" , label , null ) ;
264
+ } else {
265
+ macExceptionValueTreeView . AccessibilityTitle = new NSString ( label . Text ) ;
266
+ }
219
267
220
268
var vbox = new VBox ( ) ;
221
- expanderProperties = WrapInExpander ( GettextCatalog . GetString ( "Properties" ) , scrolled ) ;
222
- vbox . PackStart ( new VBox ( ) , false , false , 5 ) ;
223
- vbox . PackStart ( expanderProperties , true , true , 0 ) ;
269
+ vbox . PackStart ( label , false , false , 12 ) ;
270
+ vbox . PackStart ( scrolledWidget , true , true , 0 ) ;
224
271
vbox . ShowAll ( ) ;
225
272
226
273
return vbox ;
227
274
}
228
275
229
- class ExpanderWithMinSize : Expander
230
- {
231
- public ExpanderWithMinSize ( string label ) : base ( label )
232
- {
233
- }
234
-
235
- protected override void OnSizeRequested ( ref Requisition requisition )
236
- {
237
- base . OnSizeRequested ( ref requisition ) ;
238
- requisition . Height = 28 ;
239
- }
240
- }
241
-
242
- Expander WrapInExpander ( string title , Widget widget )
243
- {
244
- var expander = new ExpanderWithMinSize ( $ "<b>{ GLib . Markup . EscapeText ( title ) } </b>") ;
245
- expander . Name = "exception_dialog_expander" ;
246
- Gtk . Rc . ParseString ( @"style ""exception-dialog-expander""
247
- {
248
- GtkExpander::expander-spacing = 10
249
- }
250
- widget ""*.exception_dialog_expander"" style ""exception-dialog-expander""
251
- " ) ;
252
- expander . Child = widget ;
253
- expander . Spacing = 0 ;
254
- expander . Show ( ) ;
255
- expander . CanFocus = true ;
256
- expander . UseMarkup = true ;
257
- expander . Expanded = true ;
258
- expander . Activated += Expander_Activated ;
259
- expander . ModifyBg ( StateType . Prelight , Ide . Gui . Styles . PrimaryBackgroundColor . ToGdkColor ( ) ) ;
260
- return expander ;
261
- }
262
-
263
- void Expander_Activated ( object sender , EventArgs e )
264
- {
265
- if ( expanderProperties . Expanded && expanderStacktrace . Expanded )
266
- paned . PositionSet = false ;
267
- else if ( expanderStacktrace . Expanded )
268
- paned . Position = paned . MaxPosition ;
269
- else
270
- paned . Position = paned . MinPosition ;
271
- }
272
-
273
276
static void StackFrameLayout ( CellLayout layout , CellRenderer cr , TreeModel model , TreeIter iter )
274
277
{
275
278
var frame = ( ExceptionStackFrame ) model . GetValue ( iter , ( int ) ModelColumn . StackFrame ) ;
@@ -304,7 +307,6 @@ Widget CreateStackTraceTreeView ()
304
307
stackTraceTreeView . RowActivated += StackFrameActivated ;
305
308
306
309
var scrolled = new ScrolledWindow {
307
- HeightRequest = 180 ,
308
310
HscrollbarPolicy = PolicyType . Never ,
309
311
VscrollbarPolicy = PolicyType . Automatic
310
312
} ;
@@ -316,10 +318,16 @@ Widget CreateStackTraceTreeView ()
316
318
vbox . PackStart ( scrolled , true , true , 0 ) ;
317
319
vbox . Show ( ) ;
318
320
321
+ var label = new Label ( ) ;
322
+ label . Markup = "<b>" + GettextCatalog . GetString ( "Stacktrace" ) + "</b>" ;
323
+ label . Xalign = 0 ;
324
+ label . Xpad = 10 ;
325
+
326
+ stackTraceTreeView . SetCommonAccessibilityAttributes ( "ExceptionCaughtDialog.StackTraceTreeView" , label , null ) ;
327
+
319
328
var vbox2 = new VBox ( ) ;
320
- expanderStacktrace = WrapInExpander ( GettextCatalog . GetString ( "Stacktrace" ) , vbox ) ;
321
- vbox2 . PackStart ( new VBox ( ) , false , false , 5 ) ;
322
- vbox2 . PackStart ( expanderStacktrace , true , true , 0 ) ;
329
+ vbox2 . PackStart ( label , false , false , 12 ) ;
330
+ vbox2 . PackStart ( vbox , true , true , 0 ) ;
323
331
vbox2 . ShowAll ( ) ;
324
332
return vbox2 ;
325
333
}
@@ -371,6 +379,7 @@ void Build ()
371
379
paned . GrabAreaSize = 10 ;
372
380
paned . Pack1 ( CreateStackTraceTreeView ( ) , true , false ) ;
373
381
paned . Pack2 ( CreateExceptionValueTreeView ( ) , true , false ) ;
382
+ paned . Position = 160 ;
374
383
paned . Show ( ) ;
375
384
var vbox = new VBox ( false , 0 ) ;
376
385
var whiteBackground = new EventBox ( ) ;
@@ -432,6 +441,7 @@ Widget CreateInnerExceptionMessage ()
432
441
innerExceptionTypeLabel . Xalign = 0 ;
433
442
innerExceptionTypeLabel . Selectable = true ;
434
443
innerExceptionTypeLabel . CanFocus = false ;
444
+ icon . SetCommonAccessibilityAttributes ( "ExceptionCaughtDialog.InnerExceptionWarningIcon" , innerExceptionTypeLabel , null ) ;
435
445
hbox . PackStart ( innerExceptionTypeLabel , false , true , 4 ) ;
436
446
437
447
innerExceptionMessageLabel = new Label ( ) ;
@@ -515,6 +525,10 @@ Widget CreateInnerExceptionsTree ()
515
525
UpdateSelectedException ( ( ExceptionInfo ) innerExceptionsTreeView . Model . GetValue ( selectedIter , 0 ) ) ;
516
526
}
517
527
} ;
528
+ innerExceptionsTreeView . SetCommonAccessibilityAttributes (
529
+ "ExceptionCaughtDialog.InnerExceptionsTreeView" ,
530
+ GettextCatalog . GetString ( "Inner Exceptions" ) ,
531
+ null ) ;
518
532
var eventBox = new EventBox ( ) ;
519
533
eventBox . ModifyBg ( StateType . Normal , Styles . ExceptionCaughtDialog . TreeBackgroundColor . ToGdkColor ( ) ) ; // top and bottom padders
520
534
var vbox = new VBox ( ) ;
@@ -717,6 +731,7 @@ protected override void OnDestroyed ()
717
731
718
732
class CellRendererInnerException : CellRenderer
719
733
{
734
+ [ Property ( "text" ) ] // Enables Voice Over support.
720
735
public string Text { get ; set ; }
721
736
722
737
Pango . FontDescription font = Pango . FontDescription . FromString ( Platform . IsWindows ? "9" : "11" ) ;
0 commit comments