14 "{ NameSpace: Tools }" |
14 "{ NameSpace: Tools }" |
15 |
15 |
16 ToolApplicationModel subclass:#ViewTreeInspectorApplication |
16 ToolApplicationModel subclass:#ViewTreeInspectorApplication |
17 instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint |
17 instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint |
18 motionAction process followFocusChannel showNamesHolder |
18 motionAction process followFocusChannel showNamesHolder |
19 inspectorView' |
19 inspectorView inspectorModeIndexHolder' |
20 classVariableNames:'' |
20 classVariableNames:'' |
21 poolDictionaries:'' |
21 poolDictionaries:'' |
22 category:'Interface-Smalltalk' |
22 category:'Interface-Smalltalk' |
23 ! |
23 ! |
24 |
24 |
278 " |
278 " |
279 |
279 |
280 <resource: #canvas> |
280 <resource: #canvas> |
281 |
281 |
282 ^ |
282 ^ |
283 #(FullSpec |
283 #(FullSpec |
284 name: windowSpec |
284 name: windowSpec |
285 window: |
285 window: |
286 (WindowSpec |
286 (WindowSpec |
287 label: 'View Tree Inspector' |
287 label: 'View Tree Inspector' |
288 name: 'View Tree Inspector' |
288 name: 'View Tree Inspector' |
289 min: (Point 10 10) |
289 min: (Point 10 10) |
290 max: (Point 1024 9999) |
290 max: (Point 1024 9999) |
291 bounds: (Rectangle 0 0 381 654) |
291 bounds: (Rectangle 0 0 381 654) |
292 menu: menu |
292 menu: menu |
293 ) |
293 ) |
294 component: |
294 component: |
295 (SpecCollection |
295 (SpecCollection |
296 collection: ( |
296 collection: ( |
297 (MenuPanelSpec |
297 (MenuPanelSpec |
298 name: 'toolbarMenu' |
298 name: 'toolbarMenu' |
299 layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0) |
299 layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0) |
300 menu: toolbarMenu |
300 menu: toolbarMenu |
301 textDefault: true |
301 textDefault: true |
302 ) |
302 ) |
303 (VariableVerticalPanelSpec |
303 (VariableVerticalPanelSpec |
304 name: 'VariableVerticalPanel1' |
304 name: 'VariableVerticalPanel1' |
305 layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0) |
305 layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0) |
306 component: |
306 component: |
307 (SpecCollection |
307 (SpecCollection |
308 collection: ( |
308 collection: ( |
309 (HierarchicalListViewSpec |
309 (HierarchicalListViewSpec |
310 name: 'List' |
310 name: 'List' |
311 level: 1 |
311 level: 1 |
312 model: model |
312 model: model |
313 menu: middleButtonMenu |
313 menu: middleButtonMenu |
314 hasHorizontalScrollBar: true |
314 hasHorizontalScrollBar: true |
315 hasVerticalScrollBar: true |
315 hasVerticalScrollBar: true |
316 miniScrollerHorizontal: true |
316 miniScrollerHorizontal: true |
317 miniScrollerVertical: false |
317 miniScrollerVertical: false |
318 listModel: listOfItems |
318 listModel: listOfItems |
319 multipleSelectOk: true |
319 multipleSelectOk: true |
320 useIndex: false |
320 useIndex: false |
321 highlightMode: label |
321 highlightMode: label |
322 showLeftIndicators: false |
322 showLeftIndicators: false |
323 indicatorSelector: indicatorClicked: |
323 indicatorSelector: indicatorClicked: |
324 useDefaultIcons: false |
324 useDefaultIcons: false |
325 postBuildCallback: postBuildTree: |
325 postBuildCallback: postBuildTree: |
326 ) |
|
327 (ViewSpec |
|
328 name: 'Box1' |
|
329 viewClassName: 'InspectorView' |
|
330 postBuildCallback: postBuildInspectorView: |
|
331 ) |
|
332 ) |
326 ) |
333 |
327 (ViewSpec |
334 ) |
328 name: 'Box2' |
335 handles: (Any 0.5 1.0) |
329 component: |
336 ) |
330 (SpecCollection |
|
331 collection: ( |
|
332 (ViewSpec |
|
333 name: 'Inspector' |
|
334 layout: (LayoutFrame 0 0 26 0 0 1 0 1) |
|
335 postBuildCallback: postBuildInspectorView: |
|
336 viewClassName: 'InspectorView' |
|
337 ) |
|
338 (TabViewSpec |
|
339 name: 'TabHeader1' |
|
340 layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
|
341 model: inspectorModeIndexHolder |
|
342 menu: inspectorModes |
|
343 useIndex: true |
|
344 translateLabel: true |
|
345 ) |
|
346 ) |
|
347 |
|
348 ) |
|
349 ) |
|
350 ) |
|
351 |
|
352 ) |
|
353 handles: (Any 0.5 1.0) |
337 ) |
354 ) |
338 |
355 ) |
339 ) |
356 |
340 ) |
357 ) |
|
358 ) |
341 ! ! |
359 ! ! |
342 |
360 |
343 !ViewTreeInspectorApplication class methodsFor:'menu specs'! |
361 !ViewTreeInspectorApplication class methodsFor:'menu specs'! |
344 |
362 |
345 menu |
363 menu |
833 "answer the channel which is set to true if a target widget exists" |
851 "answer the channel which is set to true if a target widget exists" |
834 |
852 |
835 ^ model hasTargetWidgetChannel |
853 ^ model hasTargetWidgetChannel |
836 ! |
854 ! |
837 |
855 |
|
856 inspectorMode |
|
857 "what is shwn in the inspector: |
|
858 1->widget |
|
859 2->application" |
|
860 |
|
861 ^ (inspectorModeIndexHolder value == 1) |
|
862 ifTrue:[#widget] |
|
863 ifFalse:[#application] |
|
864 |
|
865 "Created: / 30-07-2013 / 07:44:59 / cg" |
|
866 ! |
|
867 |
|
868 inspectorModeIndexHolder |
|
869 "what is shwn in the inspector: |
|
870 1->widget |
|
871 2->application" |
|
872 |
|
873 ^ inspectorModeIndexHolder |
|
874 |
|
875 "Created: / 30-07-2013 / 07:44:07 / cg" |
|
876 ! |
|
877 |
|
878 inspectorModes |
|
879 ^ #('Widget' 'Application') |
|
880 |
|
881 "Created: / 30-07-2013 / 09:42:16 / cg" |
|
882 ! |
|
883 |
838 listOfItems |
884 listOfItems |
839 "returns the hierarchical list of items" |
885 "returns the hierarchical list of items" |
840 |
886 |
841 ^ model listOfItems |
887 ^ model listOfItems |
842 ! |
888 ! |
914 self selectionChanged. |
968 self selectionChanged. |
915 ^ self |
969 ^ self |
916 ]. |
970 ]. |
917 |
971 |
918 super update:something with:someArgument from:aModel. |
972 super update:something with:someArgument from:aModel. |
|
973 ! |
|
974 |
|
975 updateInspector |
|
976 |view obj| |
|
977 |
|
978 view := self selectedView. |
|
979 (view isNil or:[self inspectorMode == #widget]) ifTrue:[ |
|
980 obj := view. |
|
981 ] ifFalse:[ |
|
982 obj := view application. |
|
983 ]. |
|
984 inspectorView inspect:obj. |
|
985 inspectorView headLineLabel:(obj class nameWithoutPrefix) |
|
986 |
|
987 "Created: / 30-07-2013 / 09:21:16 / cg" |
919 ! ! |
988 ! ! |
920 |
989 |
921 !ViewTreeInspectorApplication methodsFor:'event processing'! |
990 !ViewTreeInspectorApplication methodsFor:'event processing'! |
922 |
991 |
923 processButtonMotionEvent:ev |
992 processButtonMotionEvent:ev |
1142 |
1211 |
1143 super initialize. |
1212 super initialize. |
1144 |
1213 |
1145 hasSingleSelectionHolder := false asValue. |
1214 hasSingleSelectionHolder := false asValue. |
1146 followFocusChannel := false asValue. |
1215 followFocusChannel := false asValue. |
|
1216 inspectorModeIndexHolder := 1 asValue. |
|
1217 inspectorModeIndexHolder onChangeSend:#inspectorModeIndexHolderChanged to:self. |
1147 |
1218 |
1148 model := ViewTreeModel new. |
1219 model := ViewTreeModel new. |
1149 model inputEventAction:[:ev| self processEvent:ev ]. |
1220 model inputEventAction:[:ev| self processEvent:ev ]. |
1150 model mappedViewAction:[:vw| self processMappedView:vw ]. |
1221 model mappedViewAction:[:vw| self processMappedView:vw ]. |
1151 model application:self. |
1222 model application:self. |
1152 model addDependent:self. |
1223 model addDependent:self. |
1153 |
1224 |
1154 |
1225 |
1155 showNamesHolder := false asValue. |
1226 showNamesHolder := false asValue. |
1156 showNamesHolder addDependent:self. |
1227 showNamesHolder addDependent:self. |
|
1228 |
|
1229 "Modified: / 30-07-2013 / 09:20:08 / cg" |
1157 ! |
1230 ! |
1158 |
1231 |
1159 postBuildInspectorView:anInspector |
1232 postBuildInspectorView:anInspector |
1160 inspectorView := anInspector. |
1233 inspectorView := anInspector. |
1161 ! |
1234 ! |