Tools__ViewTreeApplication.st
changeset 3174 cd45c49a0d63
parent 3171 16cec0f0e3b4
child 3183 cd02c3731897
equal deleted inserted replaced
3173:801e6bfe2581 3174:cd45c49a0d63
   435 menu
   435 menu
   436     "This resource specification was automatically generated
   436     "This resource specification was automatically generated
   437      by the MenuEditor of ST/X."
   437      by the MenuEditor of ST/X."
   438 
   438 
   439     "Do not manually edit this!! If it is corrupted,
   439     "Do not manually edit this!! If it is corrupted,
   440      the MenuEditor may not be able to read the specification."
   440      the MenuEditor may not be able to read the specification."      
   441 
   441 
   442 
   442 
   443     "
   443     "
   444      MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
   444      MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu
   445      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
   445      (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp
   573                (MenuItem
   573                (MenuItem
   574                   enabled: hasSingleSelectionHolder
   574                   enabled: hasSingleSelectionHolder
   575                   label: 'Inspect'
   575                   label: 'Inspect'
   576                   itemValue: doInspect:
   576                   itemValue: doInspect:
   577                   argument: application
   577                   argument: application
       
   578                 )
       
   579                (MenuItem
       
   580                   label: '-'
       
   581                 )
       
   582                (MenuItem
       
   583                   enabled: canBrowseWindowSpecMethod
       
   584                   label: 'Browse Window Spec Method'
       
   585                   itemValue: doBrowseWindowSpecMethod
       
   586                 )
       
   587                (MenuItem
       
   588                   enabled: canEditWindowSpec
       
   589                   label: 'Edit Window Spec'
       
   590                   itemValue: doEditWindowSpec
   578                 )
   591                 )
   579                (MenuItem
   592                (MenuItem
   580                   label: '-'
   593                   label: '-'
   581                 )
   594                 )
   582                (MenuItem
   595                (MenuItem
   935     ].
   948     ].
   936 ! !
   949 ! !
   937 
   950 
   938 !ViewTreeInspectorApplication methodsFor:'aspects'!
   951 !ViewTreeInspectorApplication methodsFor:'aspects'!
   939 
   952 
       
   953 canBrowseWindowSpecMethod
       
   954     ^ self hasSingleSelectionHolder value and:[ self windowSpecMethodOfSelection notNil ]
       
   955 !
       
   956 
       
   957 canEditWindowSpec
       
   958     ^ self hasSingleSelectionHolder value and:[ self windowSpecMethodOfSelection notNil ]
       
   959 !
       
   960 
   940 followFocusChannel
   961 followFocusChannel
   941     "boolean holder, which indicates whether selection changed dependend on the focus view"
   962     "boolean holder, which indicates whether selection changed dependend on the focus view"
   942 
   963 
   943     ^ followFocusChannel
   964     ^ followFocusChannel
   944 !
   965 !
  1047 
  1068 
  1048      false: all input events are eaten and the selection is shown on the target view.
  1069      false: all input events are eaten and the selection is shown on the target view.
  1049      true:  no  input events are eaten and no  selection is shown on the target view."
  1070      true:  no  input events are eaten and no  selection is shown on the target view."
  1050 
  1071 
  1051     ^ model testModeChannel
  1072     ^ model testModeChannel
       
  1073 !
       
  1074 
       
  1075 windowSpecMethodOfSelection
       
  1076     |item view app spec builder specSelector implementors|
       
  1077 
       
  1078     item := model selectedItem.
       
  1079     item isNil ifTrue:[^ nil]. 
       
  1080 
       
  1081     view := item widget.
       
  1082     view isNil ifTrue:[^ nil]. 
       
  1083 
       
  1084     app := view application.
       
  1085     app isNil ifTrue:[^ nil]. 
       
  1086 
       
  1087     builder := app builder.
       
  1088     builder isNil ifTrue:[^ nil]. 
       
  1089 
       
  1090     spec := builder spec.
       
  1091     spec isNil ifTrue:[^ nil].
       
  1092 
       
  1093     specSelector := spec name.
       
  1094     specSelector isNil ifTrue:[^ nil].
       
  1095 
       
  1096     (app class theNonMetaclass canUnderstand:specSelector) ifTrue:[
       
  1097         ^ app class theNonMetaclass lookupMethodFor:specSelector.
       
  1098     ].
       
  1099     (app class theMetaclass canUnderstand:specSelector) ifTrue:[
       
  1100         ^ app class theMetaclass lookupMethodFor:specSelector.
       
  1101     ].
       
  1102 
       
  1103     "/ maybe a simple dialog given a spec
       
  1104     app masterApplication notNil ifTrue:[
       
  1105         (app masterApplication class theNonMetaclass canUnderstand:specSelector) ifTrue:[     
       
  1106             ^ app masterApplication class theNonMetaclass lookupMethodFor:specSelector.
       
  1107         ].
       
  1108         (app masterApplication class theMetaclass canUnderstand:specSelector) ifTrue:[    
       
  1109             ^ app masterApplication class theMetaclass lookupMethodFor:specSelector.
       
  1110         ].
       
  1111     ].
       
  1112 
       
  1113     implementors := Smalltalk allImplementorsOf: specSelector.
       
  1114     implementors size == 1 ifTrue:[
       
  1115         ^ implementors first compiledMethodAt:specSelector.
       
  1116     ].
       
  1117 
       
  1118     ^ nil
  1052 ! !
  1119 ! !
  1053 
  1120 
  1054 !ViewTreeInspectorApplication methodsFor:'change & update'!
  1121 !ViewTreeInspectorApplication methodsFor:'change & update'!
  1055 
  1122 
  1056 inspectorModeIndexHolderChanged
  1123 inspectorModeIndexHolderChanged
  1061 
  1128 
  1062 selectionChanged
  1129 selectionChanged
  1063     |info view item|
  1130     |info view item|
  1064 
  1131 
  1065     item := model selectedItem.
  1132     item := model selectedItem.
  1066 
  1133     item notNil ifTrue:[ 
  1067     item notNil ifTrue:[ |state|
  1134         |state|
       
  1135 
  1068         view := item widget.
  1136         view := item widget.
  1069 
  1137 
  1070         view id isNil ifTrue:[
  1138         view id isNil ifTrue:[
  1071             state := 'no ID'.
  1139             state := 'no ID'.
  1072         ] ifFalse:[
  1140         ] ifFalse:[
  1076                 state := 'invisible'
  1144                 state := 'invisible'
  1077             ].
  1145             ].
  1078         ].
  1146         ].
  1079         info := '%1 [%2] - %3' bindWith:(view class name)
  1147         info := '%1 [%2] - %3' bindWith:(view class name)
  1080                                    with:(view name ? '') with:state allBold.
  1148                                    with:(view name ? '') with:state allBold.
  1081 
       
  1082     ] ifFalse:[
  1149     ] ifFalse:[
  1083         info := ''
  1150         info := ''
  1084     ].
  1151     ].
  1085     hasSingleSelectionHolder value:(view notNil).
  1152     hasSingleSelectionHolder value:(view notNil).
  1086     self updateInspector
  1153     self updateInspector
  1938     inst class browserClass openInClass:(inst class) selector:nil
  2005     inst class browserClass openInClass:(inst class) selector:nil
  1939 
  2006 
  1940     "Modified: / 28-08-2013 / 23:57:42 / cg"
  2007     "Modified: / 28-08-2013 / 23:57:42 / cg"
  1941 !
  2008 !
  1942 
  2009 
       
  2010 doBrowseWindowSpecMethod
       
  2011     |mthd|
       
  2012 
       
  2013     mthd := self windowSpecMethodOfSelection.
       
  2014     NewSystemBrowser openInClass:mthd mclass selector:mthd selector
       
  2015 !
       
  2016 
  1943 doCatchEvents
  2017 doCatchEvents
  1944     model catchEvents:true.
  2018     model catchEvents:true.
  1945     isCatchingEventsChannel value:true.
  2019     isCatchingEventsChannel value:true.
  1946 "/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
  2020 "/    ((builder componentAt:'toolbarMenu') itemAt:#doUncatchEvents) 
  1947 "/        enabled:true;
  2021 "/        enabled:true;
  1992         parent isLayoutContainer ifTrue:[
  2066         parent isLayoutContainer ifTrue:[
  1993             parent widget sizeChanged:nil
  2067             parent widget sizeChanged:nil
  1994         ].
  2068         ].
  1995         model value:nsel.
  2069         model value:nsel.
  1996     ].
  2070     ].
       
  2071 !
       
  2072 
       
  2073 doEditWindowSpec
       
  2074     |mthd|
       
  2075 
       
  2076     mthd := self windowSpecMethodOfSelection.
       
  2077     UIPainter openOnClass:mthd mclass andSelector:mthd selector
  1997 !
  2078 !
  1998 
  2079 
  1999 doFlash
  2080 doFlash
  2000     "flash the selected view"
  2081     "flash the selected view"
  2001 
  2082