236 Icon flushCachedIcons |
236 Icon flushCachedIcons |
237 " |
237 " |
238 <resource: #image> |
238 <resource: #image> |
239 |
239 |
240 ^Icon |
240 ^Icon |
241 constantNamed:'Tools::ViewTreeInspectorApplication releaseViewIcon' |
241 constantNamed:'Tools::ViewTreeInspectorApplication releaseViewIcon' |
242 ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
242 ifAbsentPut:[(Depth8Image new) width: 24; height: 24; photometric:(#palette); bitsPerSample:(#[8]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
243 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
243 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
244 @@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@@''D#48"1.CX5H@(J@@@@@@@@@@@@B (@@@@@@" |
244 @@@@@@@@@@@@@@A8^G!!7O3ACP5*P@@A8^G @@@@@@@@@@@A8^@@@OE0/!!P0S#0@@^G @@@@@@@@@@@B (@@''D#48"1.CX5H@(J@@@@@@@@@@@@B (@@@@@@" |
245 ''%!!/P7,@(J@@@@@@@@@@@@@%I@@@@BH%IRTQV5P@IRT@@@@@@@@@@@ANSP@@@@ANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN |
245 ''%!!/P7,@(J@@@@@@@@@@@@@%I@@@@BH%IRTQV5P@IRT@@@@@@@@@@@ANSP@@@@ANS$8:T80@S$8@@@@@@@@@@@AN&UYWK(EYQ@\FUPQHXT8@@@@@@@@@@@AN |
246 HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@ |
246 HC2!!TVY:Y#-%I*IKMD8@@@@@@@@@@@A$\@83XBEG%).GGX _!!&P@@@@@@@@@@@AO[P5+ &(WPYN@["!!E\$<@@@@@@@@@@@B_F''FQPAXX_!!&TGH4HB9<@@@@@ |
247 @@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_ |
247 @@@@@@B_%3HCJ7=BKPU,Q)01B9<@@@@@@@@@@@@PBP8T_F!!''JPI)_Y"D&!!@@@@@@@@@@@@@$B)I9TGXO''WQIWQ93W0@@@@@@@@@@@@@$"U=JR$)JR$)JR$)_ |
264 Tools::ViewTreeInspectorApplication open |
264 Tools::ViewTreeInspectorApplication open |
265 " |
265 " |
266 |
266 |
267 <resource: #canvas> |
267 <resource: #canvas> |
268 |
268 |
269 ^ |
269 ^ |
270 #(FullSpec |
270 #(FullSpec |
271 name: windowSpec |
271 name: windowSpec |
272 window: |
272 window: |
273 (WindowSpec |
273 (WindowSpec |
274 label: 'View Tree Inspector' |
274 label: 'View Tree Inspector' |
275 name: 'View Tree Inspector' |
275 name: 'View Tree Inspector' |
276 min: (Point 10 10) |
276 min: (Point 10 10) |
277 max: (Point 1024 9999) |
277 max: (Point 1024 9999) |
278 bounds: (Rectangle 0 0 693 643) |
278 bounds: (Rectangle 0 0 693 643) |
279 menu: menu |
279 menu: menu |
280 ) |
280 ) |
281 component: |
281 component: |
282 (SpecCollection |
282 (SpecCollection |
283 collection: ( |
283 collection: ( |
284 (MenuPanelSpec |
284 (MenuPanelSpec |
285 name: 'toolbarMenu' |
285 name: 'toolbarMenu' |
286 layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0) |
286 layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0) |
287 menu: toolbarMenu |
287 menu: toolbarMenu |
288 textDefault: true |
288 textDefault: true |
289 ) |
289 ) |
290 (VariableVerticalPanelSpec |
290 (VariableVerticalPanelSpec |
291 name: 'VariableVerticalPanel1' |
291 name: 'VariableVerticalPanel1' |
292 layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0) |
292 layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0) |
293 component: |
293 component: |
294 (SpecCollection |
294 (SpecCollection |
295 collection: ( |
295 collection: ( |
296 (ViewSpec |
296 (ViewSpec |
297 name: 'PathAndListPane' |
297 name: 'PathAndListPane' |
298 component: |
298 component: |
299 (SpecCollection |
299 (SpecCollection |
300 collection: ( |
300 collection: ( |
301 (ViewSpec |
301 (ViewSpec |
302 name: 'PathPane' |
302 name: 'PathPane' |
303 layout: (LayoutFrame 0 0 0 0 0 1 25 0) |
303 layout: (LayoutFrame 0 0 0 0 0 1 25 0) |
304 component: |
304 component: |
305 (SpecCollection |
305 (SpecCollection |
306 collection: ( |
306 collection: ( |
307 (InputFieldSpec |
307 (InputFieldSpec |
308 name: 'Path' |
308 name: 'Path' |
309 layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
309 layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
310 model: path |
310 model: path |
311 acceptOnReturn: true |
311 acceptOnReturn: true |
312 acceptOnTab: true |
312 acceptOnTab: true |
313 acceptOnPointerLeave: true |
313 acceptOnPointerLeave: true |
314 emptyFieldReplacementText: 'No View Selected' |
314 emptyFieldReplacementText: 'No View Selected' |
315 ) |
315 ) |
316 ) |
316 ) |
317 |
317 |
318 ) |
318 ) |
319 ) |
319 ) |
320 (HierarchicalListViewSpec |
320 (HierarchicalListViewSpec |
321 name: 'List' |
321 name: 'List' |
322 layout: (LayoutFrame 0 0 25 0 0 1 0 1) |
322 layout: (LayoutFrame 0 0 25 0 0 1 0 1) |
323 level: 1 |
323 level: 1 |
324 model: model |
324 model: model |
325 menu: middleButtonMenu |
325 menu: middleButtonMenu |
326 hasHorizontalScrollBar: true |
326 hasHorizontalScrollBar: true |
327 hasVerticalScrollBar: true |
327 hasVerticalScrollBar: true |
328 miniScrollerHorizontal: true |
328 miniScrollerHorizontal: true |
329 miniScrollerVertical: false |
329 miniScrollerVertical: false |
330 listModel: listOfItems |
330 listModel: listOfItems |
331 multipleSelectOk: true |
331 multipleSelectOk: true |
332 useIndex: false |
332 useIndex: false |
333 highlightMode: label |
333 highlightMode: label |
334 showLeftIndicators: false |
334 showLeftIndicators: false |
335 indicatorSelector: indicatorClicked: |
335 indicatorSelector: indicatorClicked: |
336 useDefaultIcons: false |
336 useDefaultIcons: false |
337 postBuildCallback: postBuildTree: |
337 postBuildCallback: postBuildTree: |
338 ) |
338 ) |
339 ) |
339 ) |
340 |
340 |
341 ) |
341 ) |
342 ) |
342 ) |
343 (ViewSpec |
343 (ViewSpec |
344 name: 'Box2' |
344 name: 'Box2' |
345 component: |
345 component: |
346 (SpecCollection |
346 (SpecCollection |
347 collection: ( |
347 collection: ( |
348 (TabViewSpec |
348 (TabViewSpec |
349 name: 'TabHeader1' |
349 name: 'TabHeader1' |
350 layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
350 layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
351 model: inspectorModeIndexHolder |
351 model: inspectorModeIndexHolder |
352 menu: inspectorModes |
352 menu: inspectorModes |
353 useIndex: true |
353 useIndex: true |
354 translateLabel: true |
354 translateLabel: true |
355 ) |
355 ) |
356 (SubCanvasSpec |
356 (SubCanvasSpec |
357 name: 'Browser' |
357 name: 'Browser' |
358 layout: (LayoutFrame 0 0 26 0 0 1 0 1) |
358 layout: (LayoutFrame 0 0 26 0 0 1 0 1) |
359 visibilityChannel: browserVisibleHolder |
359 visibilityChannel: browserVisibleHolder |
360 hasHorizontalScrollBar: true |
360 hasHorizontalScrollBar: true |
361 hasVerticalScrollBar: true |
361 hasVerticalScrollBar: true |
362 majorKey: #'Tools::NewSystemBrowser' |
362 majorKey: #'Tools::NewSystemBrowser' |
363 minorKey: singleClassWithoutVariableListBrowserSpec |
363 minorKey: singleClassWithoutVariableListBrowserSpec |
364 createNewApplication: true |
364 createNewApplication: true |
365 createNewBuilder: true |
365 createNewBuilder: true |
366 postBuildCallback: postBuildBrowserCanvas: |
366 postBuildCallback: postBuildBrowserCanvas: |
367 ) |
367 ) |
368 (ViewSpec |
368 (ViewSpec |
369 name: 'Inspector' |
369 name: 'Inspector' |
370 layout: (LayoutFrame 0 0 26 0 0 1 0 1) |
370 layout: (LayoutFrame 0 0 26 0 0 1 0 1) |
371 visibilityChannel: inspectorVisibleHolder |
371 visibilityChannel: inspectorVisibleHolder |
372 postBuildCallback: postBuildInspectorView: |
372 postBuildCallback: postBuildInspectorView: |
373 viewClassName: 'InspectorView' |
373 viewClassName: 'InspectorView' |
374 ) |
374 ) |
375 ) |
375 ) |
376 |
376 |
377 ) |
377 ) |
378 ) |
378 ) |
379 ) |
379 ) |
380 |
380 |
381 ) |
381 ) |
382 handles: (Any 0.5 1.0) |
382 handles: (Any 0.5 1.0) |
383 ) |
383 ) |
384 ) |
384 ) |
385 |
385 |
386 ) |
386 ) |
387 ) |
387 ) |
388 ! ! |
388 ! ! |
389 |
389 |
390 !ViewTreeInspectorApplication class methodsFor:'menu specs'! |
390 !ViewTreeInspectorApplication class methodsFor:'menu specs'! |
392 menu |
392 menu |
393 "This resource specification was automatically generated |
393 "This resource specification was automatically generated |
394 by the MenuEditor of ST/X." |
394 by the MenuEditor of ST/X." |
395 |
395 |
396 "Do not manually edit this!! If it is corrupted, |
396 "Do not manually edit this!! If it is corrupted, |
397 the MenuEditor may not be able to read the specification." |
397 the MenuEditor may not be able to read the specification." |
398 |
398 |
399 |
399 |
400 " |
400 " |
401 MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu |
401 MenuEditor new openOnClass:Tools::ViewTreeInspectorApplication andSelector:#menu |
402 (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp |
402 (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication menu)) startUp |
403 " |
403 " |
404 |
404 |
405 <resource: #menu> |
405 <resource: #menu> |
406 |
406 |
407 ^ |
407 ^ |
408 #(Menu |
408 #(Menu |
409 ( |
409 ( |
410 (MenuItem |
410 (MenuItem |
411 label: 'File' |
411 label: 'File' |
412 submenu: |
412 submenu: |
413 (Menu |
413 (Menu |
414 ( |
414 ( |
415 (MenuItem |
415 (MenuItem |
416 label: 'Pick a View' |
416 label: 'Pick a View' |
417 itemValue: doPickView |
417 itemValue: doPickView |
418 ) |
418 ) |
419 (MenuItem |
419 (MenuItem |
420 enabled: hasTargetWidgetChannel |
420 enabled: hasTargetWidgetChannel |
421 label: 'Release Picked View' |
421 label: 'Release Picked View' |
422 itemValue: doUnpick |
422 itemValue: doUnpick |
423 ) |
423 ) |
424 (MenuItem |
424 (MenuItem |
425 label: '-' |
425 label: '-' |
426 ) |
426 ) |
427 (MenuItem |
427 (MenuItem |
428 label: 'Settings' |
428 label: 'Settings' |
429 submenu: |
429 submenu: |
430 (Menu |
430 (Menu |
431 ( |
431 ( |
432 (MenuItem |
432 (MenuItem |
433 label: 'Test Mode' |
433 label: 'Test Mode' |
434 hideMenuOnActivated: false |
434 hideMenuOnActivated: false |
435 indication: testModeChannel |
435 indication: testModeChannel |
436 ) |
436 ) |
437 (MenuItem |
437 (MenuItem |
438 enabled: testModeChannel |
438 enabled: testModeChannel |
439 label: 'Follow Focus' |
439 label: 'Follow Focus' |
440 hideMenuOnActivated: false |
440 hideMenuOnActivated: false |
441 indication: followFocusChannel |
441 indication: followFocusChannel |
442 ) |
442 ) |
443 (MenuItem |
443 (MenuItem |
444 label: '-' |
444 label: '-' |
445 ) |
445 ) |
446 (MenuItem |
446 (MenuItem |
447 label: 'Select on Click' |
447 label: 'Select on Click' |
448 hideMenuOnActivated: false |
448 hideMenuOnActivated: false |
449 indication: selectOnClickHolder |
449 indication: selectOnClickHolder |
450 ) |
450 ) |
451 (MenuItem |
451 (MenuItem |
452 label: '-' |
452 label: '-' |
453 ) |
453 ) |
454 (MenuItem |
454 (MenuItem |
455 label: 'Show Name of Widgets' |
455 label: 'Show Name of Widgets' |
456 hideMenuOnActivated: false |
456 hideMenuOnActivated: false |
457 indication: showNamesHolder |
457 indication: showNamesHolder |
458 ) |
458 ) |
459 ) |
459 ) |
460 nil |
460 nil |
461 nil |
461 nil |
462 ) |
462 ) |
463 ) |
463 ) |
464 (MenuItem |
464 (MenuItem |
465 label: '-' |
465 label: '-' |
466 ) |
466 ) |
467 (MenuItem |
467 (MenuItem |
468 label: 'Exit' |
468 label: 'Exit' |
469 itemValue: closeRequest |
469 itemValue: closeRequest |
470 ) |
470 ) |
471 ) |
471 ) |
472 nil |
472 nil |
473 nil |
473 nil |
474 ) |
474 ) |
475 ) |
475 ) |
476 (MenuItem |
476 (MenuItem |
477 enabled: hasSingleSelectionHolder |
477 enabled: hasSingleSelectionHolder |
478 label: 'Selection' |
478 label: 'Selection' |
479 submenuChannel: middleButtonMenu |
479 submenuChannel: middleButtonMenu |
480 ) |
480 ) |
481 (MenuItem |
481 (MenuItem |
482 label: 'Widget' |
482 label: 'Widget' |
483 submenu: |
483 submenu: |
484 (Menu |
484 (Menu |
485 ( |
485 ( |
486 (MenuItem |
486 (MenuItem |
487 enabled: hasSingleSelectionHolder |
487 enabled: hasSingleSelectionHolder |
488 label: 'Browse' |
488 label: 'Browse' |
489 itemValue: doBrowse: |
489 itemValue: doBrowse: |
490 argument: view |
490 argument: view |
491 ) |
491 ) |
492 (MenuItem |
492 (MenuItem |
493 enabled: hasSingleSelectionHolder |
493 enabled: hasSingleSelectionHolder |
494 label: 'Inspect' |
494 label: 'Inspect' |
495 itemValue: doInspect: |
495 itemValue: doInspect: |
496 argument: view |
496 argument: view |
497 ) |
497 ) |
498 (MenuItem |
498 (MenuItem |
499 label: '-' |
499 label: '-' |
500 ) |
500 ) |
501 (MenuItem |
501 (MenuItem |
502 enabled: hasTargetWidgetChannel |
502 enabled: hasTargetWidgetChannel |
503 label: 'All Components' |
503 label: 'All Components' |
504 startGroup: right |
504 startGroup: right |
505 submenuChannel: submenuComponents: |
505 submenuChannel: submenuComponents: |
506 ) |
506 ) |
507 ) |
507 ) |
508 nil |
508 nil |
509 nil |
509 nil |
510 ) |
510 ) |
511 ) |
511 ) |
512 (MenuItem |
512 (MenuItem |
513 label: 'Application' |
513 label: 'Application' |
514 submenu: |
514 submenu: |
515 (Menu |
515 (Menu |
516 ( |
516 ( |
517 (MenuItem |
517 (MenuItem |
518 label: 'Redraw' |
518 label: 'Redraw' |
519 itemValue: doRedraw |
519 itemValue: doRedraw |
520 ) |
520 ) |
521 (MenuItem |
521 (MenuItem |
522 label: '-' |
522 label: '-' |
523 ) |
523 ) |
524 (MenuItem |
524 (MenuItem |
525 enabled: hasSingleSelectionHolder |
525 enabled: hasSingleSelectionHolder |
526 label: 'Browse' |
526 label: 'Browse' |
527 itemValue: doBrowse: |
527 itemValue: doBrowse: |
528 argument: application |
528 argument: application |
529 ) |
529 ) |
530 (MenuItem |
530 (MenuItem |
531 enabled: hasSingleSelectionHolder |
531 enabled: hasSingleSelectionHolder |
532 label: 'Inspect' |
532 label: 'Inspect' |
533 itemValue: doInspect: |
533 itemValue: doInspect: |
534 argument: application |
534 argument: application |
535 ) |
535 ) |
536 (MenuItem |
536 (MenuItem |
537 label: '-' |
537 label: '-' |
538 ) |
538 ) |
539 (MenuItem |
539 (MenuItem |
540 enabled: canBrowseWindowSpecMethod |
540 enabled: canBrowseWindowSpecMethod |
541 label: 'Browse Window Spec Method' |
541 label: 'Browse Window Spec Method' |
542 itemValue: doBrowseWindowSpecMethod |
542 itemValue: doBrowseWindowSpecMethod |
543 ) |
543 ) |
544 (MenuItem |
544 (MenuItem |
545 enabled: canEditWindowSpec |
545 enabled: canEditWindowSpec |
546 label: 'Edit Window Spec' |
546 label: 'Edit Window Spec' |
547 itemValue: doEditWindowSpec |
547 itemValue: doEditWindowSpec |
548 ) |
548 ) |
549 (MenuItem |
549 (MenuItem |
550 label: '-' |
550 label: '-' |
551 ) |
551 ) |
552 (MenuItem |
552 (MenuItem |
553 enabled: hasTargetWidgetChannel |
553 enabled: hasTargetWidgetChannel |
554 label: 'All Applications' |
554 label: 'All Applications' |
555 submenuChannel: submenuApplications: |
555 submenuChannel: submenuApplications: |
556 ) |
556 ) |
557 ) |
557 ) |
558 nil |
558 nil |
559 nil |
559 nil |
560 ) |
560 ) |
561 ) |
561 ) |
562 (MenuItem |
562 (MenuItem |
563 label: 'Process' |
563 label: 'Process' |
564 submenu: |
564 submenu: |
565 (Menu |
565 (Menu |
566 ( |
566 ( |
567 (MenuItem |
567 (MenuItem |
568 enabled: hasSingleSelectionHolder |
568 enabled: hasSingleSelectionHolder |
569 label: 'Debug' |
569 label: 'Debug' |
570 itemValue: doDebugProcess |
570 itemValue: doDebugProcess |
571 ) |
571 ) |
572 (MenuItem |
572 (MenuItem |
573 enabled: hasSingleSelectionHolder |
573 enabled: hasSingleSelectionHolder |
574 label: 'Inspect' |
574 label: 'Inspect' |
575 itemValue: doInspect: |
575 itemValue: doInspect: |
576 argument: process |
576 argument: process |
577 ) |
577 ) |
578 (MenuItem |
578 (MenuItem |
579 label: '-' |
579 label: '-' |
580 ) |
580 ) |
581 (MenuItem |
581 (MenuItem |
582 label: 'Open Process Monitor' |
582 label: 'Open Process Monitor' |
583 itemValue: doOpenProcessMonitor |
583 itemValue: doOpenProcessMonitor |
584 ) |
584 ) |
585 ) |
585 ) |
586 nil |
586 nil |
587 nil |
587 nil |
588 ) |
588 ) |
589 ) |
589 ) |
590 (MenuItem |
590 (MenuItem |
591 label: 'Help' |
591 label: 'Help' |
592 startGroup: conditionalRight |
592 startGroup: conditionalRight |
593 submenu: |
593 submenu: |
594 (Menu |
594 (Menu |
595 ( |
595 ( |
596 (MenuItem |
596 (MenuItem |
597 label: 'Documentation' |
597 label: 'Documentation' |
598 itemValue: openDocumentation |
598 itemValue: openDocumentation |
599 ) |
599 ) |
600 (MenuItem |
600 (MenuItem |
601 label: '-' |
601 label: '-' |
602 ) |
602 ) |
603 (MenuItem |
603 (MenuItem |
604 label: 'About this Application...' |
604 label: 'About this Application...' |
605 itemValue: openAboutThisApplication |
605 itemValue: openAboutThisApplication |
606 ) |
606 ) |
607 ) |
607 ) |
608 nil |
608 nil |
609 nil |
609 nil |
610 ) |
610 ) |
611 ) |
611 ) |
612 ) |
612 ) |
613 nil |
613 nil |
614 nil |
614 nil |
615 ) |
615 ) |
616 ! |
616 ! |
617 |
617 |
618 middleButtonMenu |
618 middleButtonMenu |
619 "This resource specification was automatically generated |
619 "This resource specification was automatically generated |
628 (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication middleButtonMenu)) startUp |
628 (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication middleButtonMenu)) startUp |
629 " |
629 " |
630 |
630 |
631 <resource: #menu> |
631 <resource: #menu> |
632 |
632 |
633 ^ |
633 ^ |
634 #(Menu |
634 #(Menu |
635 ( |
635 ( |
636 (MenuItem |
636 (MenuItem |
637 label: 'Browse View Class' |
637 label: 'Browse View Class' |
638 itemValue: doBrowse: |
638 itemValue: doBrowse: |
639 argument: view |
639 argument: view |
640 ) |
640 ) |
641 (MenuItem |
641 (MenuItem |
642 label: 'Browse Model Class' |
642 label: 'Browse Model Class' |
643 itemValue: doBrowse: |
643 itemValue: doBrowse: |
644 isVisible: hasModel |
644 isVisible: hasModel |
645 argument: model |
645 argument: model |
646 ) |
646 ) |
647 (MenuItem |
647 (MenuItem |
648 label: 'Browse Application Class' |
648 label: 'Browse Application Class' |
649 itemValue: doBrowse: |
649 itemValue: doBrowse: |
650 isVisible: hasApplication |
650 isVisible: hasApplication |
651 argument: application |
651 argument: application |
652 ) |
652 ) |
653 (MenuItem |
653 (MenuItem |
654 label: 'Browse Controller Class' |
654 label: 'Browse Controller Class' |
655 itemValue: doBrowse: |
655 itemValue: doBrowse: |
656 isVisible: hasController |
656 isVisible: hasController |
657 argument: controller |
657 argument: controller |
658 ) |
658 ) |
659 (MenuItem |
659 (MenuItem |
660 label: '-' |
660 label: '-' |
661 ) |
661 ) |
662 (MenuItem |
662 (MenuItem |
663 label: 'Inspect View' |
663 label: 'Inspect View' |
664 itemValue: doInspect: |
664 itemValue: doInspect: |
665 argument: view |
665 argument: view |
666 ) |
666 ) |
667 (MenuItem |
667 (MenuItem |
668 label: 'Inspect Window Group' |
668 label: 'Inspect Window Group' |
669 itemValue: doInspect: |
669 itemValue: doInspect: |
670 argument: group |
670 argument: group |
671 ) |
671 ) |
672 (MenuItem |
672 (MenuItem |
673 label: 'Inspect Model' |
673 label: 'Inspect Model' |
674 itemValue: doInspect: |
674 itemValue: doInspect: |
675 isVisible: hasModel |
675 isVisible: hasModel |
676 argument: model |
676 argument: model |
677 ) |
677 ) |
678 (MenuItem |
678 (MenuItem |
679 label: 'Inspect Application' |
679 label: 'Inspect Application' |
680 itemValue: doInspect: |
680 itemValue: doInspect: |
681 isVisible: hasApplication |
681 isVisible: hasApplication |
682 argument: application |
682 argument: application |
683 ) |
683 ) |
684 (MenuItem |
684 (MenuItem |
685 label: 'Inspect Controller' |
685 label: 'Inspect Controller' |
686 itemValue: doInspect: |
686 itemValue: doInspect: |
687 isVisible: hasController |
687 isVisible: hasController |
688 argument: controller |
688 argument: controller |
689 ) |
689 ) |
690 (MenuItem |
690 (MenuItem |
691 label: '-' |
691 label: '-' |
692 ) |
692 ) |
693 (MenuItem |
693 (MenuItem |
694 label: 'Flash' |
694 label: 'Flash' |
695 itemValue: doFlash |
695 itemValue: doFlash |
696 ) |
696 ) |
697 (MenuItem |
697 (MenuItem |
698 label: '-' |
698 label: '-' |
699 ) |
699 ) |
700 (MenuItem |
700 (MenuItem |
701 label: 'Destroy' |
701 label: 'Destroy' |
702 itemValue: doDestroy |
702 itemValue: doDestroy |
703 labelImage: (ResourceRetriever ToolbarIconLibrary erase16x16Icon 'Destroy') |
703 labelImage: (ResourceRetriever ToolbarIconLibrary erase16x16Icon 'Destroy') |
704 ) |
704 ) |
705 (MenuItem |
705 (MenuItem |
706 label: '-' |
706 label: '-' |
707 ) |
707 ) |
708 (MenuItem |
708 (MenuItem |
709 label: 'Geometry' |
709 label: 'Geometry' |
710 submenuChannel: submenuGeometry: |
710 submenuChannel: submenuGeometry: |
711 keepLinkedMenu: true |
711 keepLinkedMenu: true |
712 ) |
712 ) |
713 (MenuItem |
713 (MenuItem |
714 label: 'Interface' |
714 label: 'Interface' |
715 submenuChannel: submenuInterface: |
715 submenuChannel: submenuInterface: |
716 keepLinkedMenu: true |
716 keepLinkedMenu: true |
717 ) |
717 ) |
718 (MenuItem |
718 (MenuItem |
719 label: 'Visibility' |
719 label: 'Visibility' |
720 submenuChannel: submenuVisibility: |
720 submenuChannel: submenuVisibility: |
721 keepLinkedMenu: true |
721 keepLinkedMenu: true |
722 ) |
722 ) |
723 (MenuItem |
723 (MenuItem |
724 label: 'Instance Variables' |
724 label: 'Instance Variables' |
725 submenuChannel: submenuInspector: |
725 submenuChannel: submenuInspector: |
726 keepLinkedMenu: true |
726 keepLinkedMenu: true |
727 ) |
727 ) |
728 (MenuItem |
728 (MenuItem |
729 label: '=' |
729 label: '=' |
730 ) |
730 ) |
731 (MenuItem |
731 (MenuItem |
732 label: '' |
732 label: '' |
733 ) |
733 ) |
734 (MenuItem |
734 (MenuItem |
735 enabled: selectedComponentHasChildren |
735 enabled: selectedComponentHasChildren |
736 label: 'Applications' |
736 label: 'Applications' |
737 nameKey: single |
737 nameKey: single |
738 submenuChannel: submenuApplications: |
738 submenuChannel: submenuApplications: |
739 keepLinkedMenu: true |
739 keepLinkedMenu: true |
740 ) |
740 ) |
741 (MenuItem |
741 (MenuItem |
742 enabled: selectedComponentHasChildren |
742 enabled: selectedComponentHasChildren |
743 label: 'Components' |
743 label: 'Components' |
744 nameKey: single |
744 nameKey: single |
745 submenuChannel: submenuComponents: |
745 submenuChannel: submenuComponents: |
746 keepLinkedMenu: true |
746 keepLinkedMenu: true |
747 ) |
747 ) |
748 ) |
748 ) |
749 nil |
749 nil |
750 nil |
750 nil |
751 ) |
751 ) |
752 ! |
752 ! |
753 |
753 |
754 middleButtonMenuForMenuItems |
754 middleButtonMenuForMenuItems |
755 "This resource specification was automatically generated |
755 "This resource specification was automatically generated |
811 (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp |
811 (Menu new fromLiteralArrayEncoding:(Tools::ViewTreeInspectorApplication toolbarMenu)) startUp |
812 " |
812 " |
813 |
813 |
814 <resource: #menu> |
814 <resource: #menu> |
815 |
815 |
816 ^ |
816 ^ |
817 #(Menu |
817 #(Menu |
818 ( |
818 ( |
819 (MenuItem |
819 (MenuItem |
820 enabled: hasTargetWidgetChannel |
820 enabled: hasTargetWidgetChannel |
821 label: 'Redraw' |
821 label: 'Redraw' |
822 itemValue: doRedraw |
822 itemValue: doRedraw |
823 isButton: true |
823 isButton: true |
824 labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon) |
824 labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon) |
825 ) |
825 ) |
826 (MenuItem |
826 (MenuItem |
827 label: '-' |
827 label: '-' |
828 ) |
828 ) |
829 (MenuItem |
829 (MenuItem |
830 label: 'Pick a View and Catch Events' |
830 label: 'Pick a View and Catch Events' |
831 itemValue: doPickView |
831 itemValue: doPickView |
832 translateLabel: false |
832 translateLabel: false |
833 isButton: true |
833 isButton: true |
834 hideMenuOnActivated: false |
834 hideMenuOnActivated: false |
835 labelImage: (ResourceRetriever ToolbarIconLibrary pickWindowIcon) |
835 labelImage: (ResourceRetriever ToolbarIconLibrary pickWindowIcon) |
836 ) |
836 ) |
837 (MenuItem |
837 (MenuItem |
838 enabled: hasTargetWidgetChannel |
838 enabled: hasTargetWidgetChannel |
839 isVisible: isNotCatchingEventsChannel |
839 isVisible: isNotCatchingEventsChannel |
840 label: 'Catch Events of Picked View' |
840 label: 'Catch Events of Picked View' |
841 activeHelpKey: doCatchEvents |
841 activeHelpKey: doCatchEvents |
842 itemValue: doCatchEvents |
842 itemValue: doCatchEvents |
843 nameKey: doCatchEvents |
843 nameKey: doCatchEvents |
844 isButton: true |
844 isButton: true |
845 labelImage: (ResourceRetriever nil releaseViewIcon) |
845 labelImage: (ResourceRetriever nil releaseViewIcon) |
846 ) |
846 ) |
847 (MenuItem |
847 (MenuItem |
848 enabled: hasTargetWidgetChannel |
848 enabled: hasTargetWidgetChannel |
849 isVisible: isCatchingEventsChannel |
849 isVisible: isCatchingEventsChannel |
850 label: 'Release Picked View and Uncatch Events' |
850 label: 'Release Picked View and Uncatch Events' |
851 activeHelpKey: doUncatchEvents |
851 activeHelpKey: doUncatchEvents |
852 itemValue: doUncatchEvents |
852 itemValue: doUncatchEvents |
853 nameKey: doUncatchEvents |
853 nameKey: doUncatchEvents |
854 isButton: true |
854 isButton: true |
855 labelImage: (ResourceRetriever nil lockViewIcon) |
855 labelImage: (ResourceRetriever nil lockViewIcon) |
856 ) |
856 ) |
857 (MenuItem |
857 (MenuItem |
858 label: '-' |
858 label: '-' |
859 ) |
859 ) |
860 (MenuItem |
860 (MenuItem |
861 activeHelpKey: doBrowseApplication |
861 activeHelpKey: doBrowseApplication |
862 enabled: hasSingleSelectionHolder |
862 enabled: hasSingleSelectionHolder |
863 label: 'Browse Application' |
863 label: 'Browse Application' |
864 itemValue: doBrowse: |
864 itemValue: doBrowse: |
865 translateLabel: false |
865 translateLabel: false |
866 isButton: true |
866 isButton: true |
867 hideMenuOnActivated: false |
867 hideMenuOnActivated: false |
868 labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2) |
868 labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2) |
869 argument: application |
869 argument: application |
870 ) |
870 ) |
871 (MenuItem |
871 (MenuItem |
872 activeHelpKey: doInspectApplication |
872 activeHelpKey: doInspectApplication |
873 enabled: hasSingleSelectionHolder |
873 enabled: hasSingleSelectionHolder |
874 label: 'Inspect Application' |
874 label: 'Inspect Application' |
875 itemValue: doInspect: |
875 itemValue: doInspect: |
876 translateLabel: false |
876 translateLabel: false |
877 isButton: true |
877 isButton: true |
878 hideMenuOnActivated: false |
878 hideMenuOnActivated: false |
879 labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon) |
879 labelImage: (ResourceRetriever ToolbarIconLibrary inspect22x24Icon) |
880 argument: application |
880 argument: application |
881 ) |
881 ) |
882 ) |
882 ) |
883 nil |
883 nil |
884 nil |
884 nil |
885 ) |
885 ) |
886 ! ! |
886 ! ! |
887 |
887 |
888 !ViewTreeInspectorApplication class methodsFor:'startup'! |
888 !ViewTreeInspectorApplication class methodsFor:'startup'! |
889 |
889 |
1097 windowSpecMethodOfSelection |
1097 windowSpecMethodOfSelection |
1098 |item view app nonMeta meta masterApp |
1098 |item view app nonMeta meta masterApp |
1099 spec builder specSelector implementors| |
1099 spec builder specSelector implementors| |
1100 |
1100 |
1101 item := model selectedItem. |
1101 item := model selectedItem. |
1102 item isNil ifTrue:[^ nil]. |
1102 item isNil ifTrue:[^ nil]. |
1103 |
1103 |
1104 view := item widget. |
1104 view := item widget. |
1105 view isNil ifTrue:[^ nil]. |
1105 view isNil ifTrue:[^ nil]. |
1106 |
1106 |
1107 app := view application. |
1107 app := view application. |
1108 app isNil ifTrue:[^ nil]. |
1108 app isNil ifTrue:[^ nil]. |
1109 |
1109 |
1110 builder := app builder. |
1110 builder := app builder. |
1111 builder isNil ifTrue:[^ nil]. |
1111 builder isNil ifTrue:[^ nil]. |
1112 |
1112 |
1113 spec := builder spec. |
1113 spec := builder spec. |
1114 spec isNil ifTrue:[^ nil]. |
1114 spec isNil ifTrue:[^ nil]. |
1115 |
1115 |
1116 specSelector := spec name. |
1116 specSelector := spec name. |
1117 specSelector isNil ifTrue:[^ nil]. |
1117 specSelector isNil ifTrue:[^ nil]. |
1118 |
1118 |
1119 ((nonMeta := app class theNonMetaclass) canUnderstand:specSelector) ifTrue:[ |
1119 ((nonMeta := app class theNonMetaclass) canUnderstand:specSelector) ifTrue:[ |
1120 ^ nonMeta lookupMethodFor:specSelector. |
1120 ^ nonMeta lookupMethodFor:specSelector. |
1121 ]. |
1121 ]. |
1122 ((meta := app class theMetaclass) canUnderstand:specSelector) ifTrue:[ |
1122 ((meta := app class theMetaclass) canUnderstand:specSelector) ifTrue:[ |
1123 ^ meta lookupMethodFor:specSelector. |
1123 ^ meta lookupMethodFor:specSelector. |
1124 ]. |
1124 ]. |
1125 |
1125 |
1126 "/ maybe a simple dialog given a spec |
1126 "/ maybe a simple dialog given a spec |
1127 (masterApp := app masterApplication) notNil ifTrue:[ |
1127 (masterApp := app masterApplication) notNil ifTrue:[ |
1128 ((nonMeta := masterApp class theNonMetaclass) canUnderstand:specSelector) ifTrue:[ |
1128 ((nonMeta := masterApp class theNonMetaclass) canUnderstand:specSelector) ifTrue:[ |
1129 ^ nonMeta lookupMethodFor:specSelector. |
1129 ^ nonMeta lookupMethodFor:specSelector. |
1130 ]. |
1130 ]. |
1131 ((meta := masterApp class theMetaclass) canUnderstand:specSelector) ifTrue:[ |
1131 ((meta := masterApp class theMetaclass) canUnderstand:specSelector) ifTrue:[ |
1132 ^ meta lookupMethodFor:specSelector. |
1132 ^ meta lookupMethodFor:specSelector. |
1133 ]. |
1133 ]. |
1134 ]. |
1134 ]. |
1135 |
1135 |
1136 implementors := Smalltalk allImplementorsOf: specSelector. |
1136 implementors := Smalltalk allImplementorsOf: specSelector. |
1137 implementors size == 1 ifTrue:[ |
1137 implementors size == 1 ifTrue:[ |
1138 ^ implementors first compiledMethodAt:specSelector. |
1138 ^ implementors first compiledMethodAt:specSelector. |
1139 ]. |
1139 ]. |
1140 |
1140 |
1141 ^ nil |
1141 ^ nil |
1142 ! ! |
1142 ! ! |
1143 |
1143 |
1184 |
1184 |
1185 update:something with:someArgument from:aModel |
1185 update:something with:someArgument from:aModel |
1186 |oldSelection| |
1186 |oldSelection| |
1187 |
1187 |
1188 aModel == showNamesHolder ifTrue:[ |
1188 aModel == showNamesHolder ifTrue:[ |
1189 oldSelection := model selectedItem. |
1189 oldSelection := model selectedItem. |
1190 model selectedItem:nil. |
1190 model selectedItem:nil. |
1191 self listOfItems showWidgetNames:(aModel value). |
1191 self listOfItems showWidgetNames:(aModel value). |
1192 model selectedItem:oldSelection. |
1192 model selectedItem:oldSelection. |
1193 ^ self |
1193 ^ self |
1194 ]. |
1194 ]. |
1195 |
1195 |
1196 aModel == model ifTrue:[ |
1196 aModel == model ifTrue:[ |
1197 self selectionChanged. |
1197 self selectionChanged. |
1198 ^ self |
1198 ^ self |
1199 ]. |
1199 ]. |
1200 |
1200 |
1201 super update:something with:someArgument from:aModel. |
1201 super update:something with:someArgument from:aModel. |
1202 ! |
1202 ! |
1203 |
1203 |
1204 updateBrowser |
1204 updateBrowser |
1205 |cls widget| |
1205 |cls widget| |
1206 |
1206 |
1207 widget := self selectedView. |
1207 widget := self selectedView. |
1208 |
1208 |
1209 "/ update the browser |
1209 "/ update the browser |
1210 self inspectorMode == #widgetClass ifTrue:[ |
1210 self inspectorMode == #widgetClass ifTrue:[ |
1211 cls := widget class. |
1211 cls := widget class. |
1212 ] ifFalse:[ |
1212 ] ifFalse:[ |
1213 cls := widget application class |
1213 cls := widget application class |
1214 ]. |
1214 ]. |
1215 browser switchToClass:cls selector:nil. |
1215 browser switchToClass:cls selector:nil. |
1216 ! |
1216 ! |
1217 |
1217 |
1218 updateInspector |
1218 updateInspector |
1219 |view mode obj| |
1219 |view mode obj| |
1220 |
1220 |
1221 view := self selectedView. |
1221 view := self selectedView. |
1222 mode := self inspectorMode. |
1222 mode := self inspectorMode. |
1223 |
1223 |
1224 ((mode == #widgetClass) or:[(mode == #applicationClass)]) ifTrue:[ |
1224 ((mode == #widgetClass) or:[(mode == #applicationClass)]) ifTrue:[ |
1225 "/ update the browser |
1225 "/ update the browser |
1226 view notNil ifTrue:[ |
1226 view notNil ifTrue:[ |
1227 self updateBrowser. |
1227 self updateBrowser. |
1228 ]. |
1228 ]. |
1229 ^ self. |
1229 ^ self. |
1230 ]. |
1230 ]. |
1231 |
1231 |
1232 (view isNil or:[mode == #widget]) ifTrue:[ |
1232 (view isNil or:[mode == #widget]) ifTrue:[ |
1233 obj := view. |
1233 obj := view. |
1234 ] ifFalse:[ (mode == #group) ifTrue:[ |
1234 ] ifFalse:[ (mode == #group) ifTrue:[ |
1235 obj := view windowGroup |
1235 obj := view windowGroup |
1236 ] ifFalse:[ (mode == #sensor) ifTrue:[ |
1236 ] ifFalse:[ (mode == #sensor) ifTrue:[ |
1237 obj := view sensor |
1237 obj := view sensor |
1238 ] ifFalse:[ (mode == #model) ifTrue:[ |
1238 ] ifFalse:[ (mode == #model) ifTrue:[ |
1239 obj := view model |
1239 obj := view model |
1240 ] ifFalse:[ |
1240 ] ifFalse:[ |
1241 obj := view application. |
1241 obj := view application. |
1242 ]]]]. |
1242 ]]]]. |
1243 inspectorView inspect:obj. |
1243 inspectorView inspect:obj. |
1244 inspectorView headLineLabel:(obj class nameWithoutPrefix) |
1244 inspectorView headLineLabel:(obj class nameWithoutPrefix) |
1245 |
1245 |
1246 "Created: / 30-07-2013 / 09:21:16 / cg" |
1246 "Created: / 30-07-2013 / 09:21:16 / cg" |
1276 rootView := model rootView. |
1276 rootView := model rootView. |
1277 sensor := model rootView sensor. |
1277 sensor := model rootView sensor. |
1278 clickedItem := model listOfItems detectItemRespondsToView:(ev view). |
1278 clickedItem := model listOfItems detectItemRespondsToView:(ev view). |
1279 |
1279 |
1280 (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[ |
1280 (sensor ctrlDown or:[sensor shiftDown]) ifTrue:[ |
1281 clickedItem notNil ifTrue:[ |
1281 clickedItem notNil ifTrue:[ |
1282 self selectOnClickHolder value ifTrue:[ |
1282 self selectOnClickHolder value ifTrue:[ |
1283 model toggleSelectItem:clickedItem |
1283 model toggleSelectItem:clickedItem |
1284 ]. |
1284 ]. |
1285 ]. |
1285 ]. |
1286 clickedItem := motionAction := nil. |
1286 clickedItem := motionAction := nil. |
1287 ^ self |
1287 ^ self |
1288 ]. |
1288 ]. |
1289 |
1289 |
1290 clickedPoint := rootView device translatePoint:((ev x)@ (ev y)) fromView:(ev view) toView:rootView. |
1290 clickedPoint := rootView device translatePoint:((ev x)@ (ev y)) fromView:(ev view) toView:rootView. |
1291 lastRectangle := nil. |
1291 lastRectangle := nil. |
1292 |
1292 |
1293 motionAction :=[:p| |
1293 motionAction :=[:p| |
1294 rootView := model rootView device rootView. |
1294 rootView := model rootView device rootView. |
1295 rootView := model rootView. |
1295 rootView := model rootView. |
1296 clickedItem := nil. |
1296 clickedItem := nil. |
1297 |
1297 |
1298 rootView xoring:[ |
1298 rootView xoring:[ |
1299 lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ] |
1299 lastRectangle notNil ifTrue:[ rootView displayRectangle:lastRectangle ] |
1300 ifFalse:[ rootView clippedByChildren:false ]. |
1300 ifFalse:[ rootView clippedByChildren:false ]. |
1301 |
1301 |
1302 p isNil ifTrue:[ |
1302 p isNil ifTrue:[ |
1303 rootView clippedByChildren:true. |
1303 rootView clippedByChildren:true. |
1304 motionAction := nil. |
1304 motionAction := nil. |
1305 ] ifFalse:[ |
1305 ] ifFalse:[ |
1306 lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p). |
1306 lastRectangle := Rectangle origin:(clickedPoint min:p) corner:(clickedPoint max:p). |
1307 rootView displayRectangle:lastRectangle. |
1307 rootView displayRectangle:lastRectangle. |
1308 ]. |
1308 ]. |
1309 rootView flush. |
1309 rootView flush. |
1310 ]. |
1310 ]. |
1311 lastRectangle |
1311 lastRectangle |
1312 ]. |
1312 ]. |
1313 ! |
1313 ! |
1314 |
1314 |
1315 processButtonReleaseEvent:anEvent |
1315 processButtonReleaseEvent:anEvent |
1316 |rootView rectangle newItems widget origin| |
1316 |rootView rectangle newItems widget origin| |
1317 |
1317 |
1318 (rootView := model rootView) isNil ifTrue:[ |
1318 (rootView := model rootView) isNil ifTrue:[ |
1319 clickedItem := motionAction := nil. |
1319 clickedItem := motionAction := nil. |
1320 ^ self |
1320 ^ self |
1321 ]. |
1321 ]. |
1322 motionAction isNil ifTrue:[ ^ self ]. |
1322 motionAction isNil ifTrue:[ ^ self ]. |
1323 clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ]. |
1323 clickedItem notNil ifTrue:[ ^ model selectItem:clickedItem ]. |
1324 |
1324 |
1325 rectangle := motionAction value:nil. |
1325 rectangle := motionAction value:nil. |
1326 rectangle isNil ifTrue:[^ self]. |
1326 rectangle isNil ifTrue:[^ self]. |
1327 |
1327 |
1328 newItems := OrderedCollection new. |
1328 newItems := OrderedCollection new. |
1329 |
1329 |
1330 model rootItem recursiveDo:[:anItem| |
1330 model rootItem recursiveDo:[:anItem| |
1331 widget := anItem widget. |
1331 widget := anItem widget. |
1332 widget notNil ifTrue:[ |
1332 widget notNil ifTrue:[ |
1333 origin := widget originRelativeTo:rootView. |
1333 origin := widget originRelativeTo:rootView. |
1334 |
1334 |
1335 (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[ |
1335 (rectangle containsRect:(Rectangle origin:origin extent:(widget extent))) ifTrue:[ |
1336 newItems add:anItem. |
1336 newItems add:anItem. |
1337 ] |
1337 ] |
1338 ]. |
1338 ]. |
1339 ]. |
1339 ]. |
1340 model value:newItems. |
1340 model value:newItems. |
1341 |
1341 |
1342 "Modified: / 11-11-2017 / 17:24:59 / cg" |
1342 "Modified: / 11-11-2017 / 17:24:59 / cg" |
1343 ! |
1343 ! |
1349 anEvent isButtonEvent ifFalse:[ ^ self ]. |
1349 anEvent isButtonEvent ifFalse:[ ^ self ]. |
1350 |
1350 |
1351 button := anEvent button. |
1351 button := anEvent button. |
1352 |
1352 |
1353 (button == 2 or:[button == #menu]) ifTrue:[ |
1353 (button == 2 or:[button == #menu]) ifTrue:[ |
1354 motionAction isNil ifTrue:[ |
1354 motionAction isNil ifTrue:[ |
1355 anEvent isButtonPressEvent ifTrue:[ |
1355 anEvent isButtonPressEvent ifTrue:[ |
1356 self selectOnClickHolder value ifTrue:[ |
1356 self selectOnClickHolder value ifTrue:[ |
1357 menu := self middleButtonMenu value. |
1357 menu := self middleButtonMenu value. |
1358 menu notNil ifTrue:[ |
1358 menu notNil ifTrue:[ |
1359 menu := MenuPanel |
1359 menu := MenuPanel |
1360 menu:(Menu new fromLiteralArrayEncoding:menu) |
1360 menu:(Menu new fromLiteralArrayEncoding:menu) |
1361 receiver:self. |
1361 receiver:self. |
1362 menu startUp. |
1362 menu startUp. |
1363 ] |
1363 ] |
1364 ]. |
1364 ]. |
1365 ]. |
1365 ]. |
1366 clickedItem := nil. |
1366 clickedItem := nil. |
1367 ]. |
1367 ]. |
1368 ^ self |
1368 ^ self |
1369 ]. |
1369 ]. |
1370 |
1370 |
1371 anEvent isButtonPressEvent ifTrue:[ self processButtonPressEvent:anEvent. ^ self ]. |
1371 anEvent isButtonPressEvent ifTrue:[ self processButtonPressEvent:anEvent. ^ self ]. |
1372 anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ]. |
1372 anEvent isButtonMotionEvent ifTrue:[ self processButtonMotionEvent:anEvent. ^ self ]. |
1373 |
1373 |
1374 anEvent isButtonReleaseEvent ifTrue:[ |
1374 anEvent isButtonReleaseEvent ifTrue:[ |
1375 self selectOnClickHolder value ifTrue:[ |
1375 self selectOnClickHolder value ifTrue:[ |
1376 self processButtonReleaseEvent:anEvent |
1376 self processButtonReleaseEvent:anEvent |
1377 ]. |
1377 ]. |
1378 ]. |
1378 ]. |
1379 clickedItem := motionAction := nil. |
1379 clickedItem := motionAction := nil. |
1380 |
1380 |
1381 anEvent type == #'buttonMultiPress:x:y:' ifTrue:[ |
1381 anEvent type == #'buttonMultiPress:x:y:' ifTrue:[ |
1382 self selectOnClickHolder value ifTrue:[ |
1382 self selectOnClickHolder value ifTrue:[ |
1383 self doInspect:#view. |
1383 self doInspect:#view. |
1384 ]. |
1384 ]. |
1385 ]. |
1385 ]. |
1386 ! |
1386 ! |
1387 |
1387 |
1388 processKeyPressEvent:anEvent |
1388 processKeyPressEvent:anEvent |
1389 |item prnt idx key max next| |
1389 |item prnt idx key max next| |
1397 ( key == #CursorUp |
1397 ( key == #CursorUp |
1398 or:[key == #CursorDown |
1398 or:[key == #CursorDown |
1399 or:[key == #CursorLeft |
1399 or:[key == #CursorLeft |
1400 or:[key == #CursorRight]]] |
1400 or:[key == #CursorRight]]] |
1401 ) ifFalse:[ |
1401 ) ifFalse:[ |
1402 ^ self |
1402 ^ self |
1403 ]. |
1403 ]. |
1404 item := model selectedItem. |
1404 item := model selectedItem. |
1405 |
1405 |
1406 item isNil ifTrue:[ |
1406 item isNil ifTrue:[ |
1407 ^ model selectedItem:(model first ? model rootItem) |
1407 ^ model selectedItem:(model first ? model rootItem) |
1408 ]. |
1408 ]. |
1409 |
1409 |
1410 prnt := item parent. |
1410 prnt := item parent. |
1411 prnt isNil ifTrue:[ |
1411 prnt isNil ifTrue:[ |
1412 "/ is the root item |
1412 "/ is the root item |
1413 (key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last] |
1413 (key == #CursorUp or:[key == #CursorLeft]) ifTrue:[item := model listOfItems last] |
1414 ifFalse:[item := item at:1 ifAbsent:item]. |
1414 ifFalse:[item := item at:1 ifAbsent:item]. |
1415 |
1415 |
1416 ^ model selectedItem:item |
1416 ^ model selectedItem:item |
1417 ]. |
1417 ]. |
1418 key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ]. |
1418 key == #CursorLeft ifTrue:[ ^ model selectedItem:prnt ]. |
1419 |
1419 |
1420 key == #CursorRight ifTrue:[ |
1420 key == #CursorRight ifTrue:[ |
1421 next := item at:1 ifAbsent:nil. |
1421 next := item at:1 ifAbsent:nil. |
1422 next notNil ifTrue:[ model selectedItem:next ]. |
1422 next notNil ifTrue:[ model selectedItem:next ]. |
1423 ^ self |
1423 ^ self |
1424 ]. |
1424 ]. |
1425 |
1425 |
1426 max := prnt size. |
1426 max := prnt size. |
1427 |
1427 |
1428 key == #CursorUp ifTrue:[ |
1428 key == #CursorUp ifTrue:[ |
1429 idx := prnt identityIndexOf:item. |
1429 idx := prnt identityIndexOf:item. |
1430 idx == 1 ifTrue:[idx := max + 1]. |
1430 idx == 1 ifTrue:[idx := max + 1]. |
1431 model selectedItem:(prnt at:idx - 1). |
1431 model selectedItem:(prnt at:idx - 1). |
1432 ^ self. |
1432 ^ self. |
1433 ]. |
1433 ]. |
1434 |
1434 |
1435 key == #CursorDown ifTrue:[ |
1435 key == #CursorDown ifTrue:[ |
1436 idx := prnt identityIndexOf:item. |
1436 idx := prnt identityIndexOf:item. |
1437 idx == max ifTrue:[idx := 0]. |
1437 idx == max ifTrue:[idx := 0]. |
1438 model selectedItem:(prnt at:idx + 1). |
1438 model selectedItem:(prnt at:idx + 1). |
1439 ^ self. |
1439 ^ self. |
1440 ]. |
1440 ]. |
1441 ! |
1441 ! |
1442 |
1442 |
1443 processMappedView:aView |
1443 processMappedView:aView |
1444 |parent anchor| |
1444 |parent anchor| |
1445 |
1445 |
1446 parent := self listOfItems detectItemRespondsToView:aView. |
1446 parent := self listOfItems detectItemRespondsToView:aView. |
1447 parent isNil ifTrue:[ ^ self ]. |
1447 parent isNil ifTrue:[ ^ self ]. |
1448 |
1448 |
1449 NotFoundSignal handle:[:ex| |
1449 NotFoundSignal handle:[:ex| |
1450 "contained subvies used by spec are not yet created; |
1450 "contained subvies used by spec are not yet created; |
1451 thus we have to wait until last used subview is build |
1451 thus we have to wait until last used subview is build |
1452 " |
1452 " |
1453 anchor := nil. |
1453 anchor := nil. |
1454 ] do:[ |
1454 ] do:[ |
1455 anchor := parent class buildViewsFrom:(parent widget). |
1455 anchor := parent class buildViewsFrom:(parent widget). |
1456 ]. |
1456 ]. |
1457 anchor notNil ifTrue:[ |
1457 anchor notNil ifTrue:[ |
1458 parent updateFromChildren:anchor children. |
1458 parent updateFromChildren:anchor children. |
1459 ]. |
1459 ]. |
1460 ! ! |
1460 ! ! |
1461 |
1461 |
1462 !ViewTreeInspectorApplication methodsFor:'initialization & release'! |
1462 !ViewTreeInspectorApplication methodsFor:'initialization & release'! |
1463 |
1463 |
1554 !ViewTreeInspectorApplication methodsFor:'menu specs'! |
1554 !ViewTreeInspectorApplication methodsFor:'menu specs'! |
1555 |
1555 |
1556 middleButtonMenu |
1556 middleButtonMenu |
1557 "returns the middleButton menu for the single selected item or nil" |
1557 "returns the middleButton menu for the single selected item or nil" |
1558 |
1558 |
1559 ^ [ |
1559 ^ [ |
1560 model selectedItem notNil ifTrue:[ |
1560 model selectedItem notNil ifTrue:[ |
1561 model selectedItem isView ifTrue:[ |
1561 model selectedItem isView ifTrue:[ |
1562 self class middleButtonMenu |
1562 self class middleButtonMenu |
1563 ] ifFalse:[ |
1563 ] ifFalse:[ |
1564 self class middleButtonMenuForMenuItems |
1564 self class middleButtonMenuForMenuItems |
1565 ]. |
1565 ]. |
1566 ] ifFalse:[ |
1566 ] ifFalse:[ |
1567 nil |
1567 nil |
1568 ] |
1568 ] |
1569 ] |
1569 ] |
1570 |
1570 |
1571 "Modified: / 16-08-2017 / 13:48:31 / cg" |
1571 "Modified: / 16-08-2017 / 13:48:31 / cg" |
1572 ! |
1572 ! |
1573 |
1573 |
1574 submenuApplications:aMenu |
1574 submenuApplications:aMenu |
1575 |applications menu item list addBlock| |
1575 |applications menu item list addBlock| |
1576 |
1576 |
1577 item := aMenu selection nameKey == #single ifTrue:[model selectedItem] |
1577 item := aMenu selection nameKey == #single ifTrue:[model selectedItem] |
1578 ifFalse:[model rootItem]. |
1578 ifFalse:[model rootItem]. |
1579 item isNil ifTrue:[^ nil]. |
1579 item isNil ifTrue:[^ nil]. |
1580 |
1580 |
1581 applications := IdentityDictionary new. |
1581 applications := IdentityDictionary new. |
1582 |
1582 |
1583 addBlock := [:el| |cls ctr| |
1583 addBlock := [:el| |cls ctr| |
1584 cls := self resolveApplicationClassFor:el. |
1584 cls := self resolveApplicationClassFor:el. |
1585 |
1585 |
1586 cls notNil ifTrue:[ |
1586 cls notNil ifTrue:[ |
1587 ctr := applications at:cls ifAbsent:0. |
1587 ctr := applications at:cls ifAbsent:0. |
1588 applications at:cls put:(ctr + 1). |
1588 applications at:cls put:(ctr + 1). |
1589 ]. |
1589 ]. |
1590 ]. |
1590 ]. |
1591 item recursiveDo:addBlock. |
1591 item recursiveDo:addBlock. |
1592 addBlock value:item. |
1592 addBlock value:item. |
1593 |
1593 |
1594 applications isEmpty ifTrue:[^ nil ]. |
1594 applications isEmpty ifTrue:[^ nil ]. |
1595 list := SortedCollection sortBlock:[:a :b| a title < b title ]. |
1595 list := SortedCollection sortBlock:[:a :b| a title < b title ]. |
1596 |
1596 |
1597 applications keysAndValuesDo:[:cls :ctr| |
1597 applications keysAndValuesDo:[:cls :ctr| |
1598 list add:(MenuDesc title:(cls name) |
1598 list add:(MenuDesc title:(cls name) |
1599 value:(ctr printString) |
1599 value:(ctr printString) |
1600 action:[self doSelectNextOfApplicationClass:cls startingIn:item] |
1600 action:[self doSelectNextOfApplicationClass:cls startingIn:item] |
1601 ). |
1601 ). |
1602 ]. |
1602 ]. |
1603 |
1603 |
1604 menu := MenuDesc buildFromList:list onGC:aMenu. |
1604 menu := MenuDesc buildFromList:list onGC:aMenu. |
1605 menu do:[:el| |
1605 menu do:[:el| |
1606 el hideMenuOnActivated:false |
1606 el hideMenuOnActivated:false |
1607 ]. |
1607 ]. |
1608 ^ menu |
1608 ^ menu |
1609 ! |
1609 ! |
1610 |
1610 |
1611 submenuComponents:aMenu |
1611 submenuComponents:aMenu |
1612 |widgets list total menu item| |
1612 |widgets list total menu item| |
1613 |
1613 |
1614 item := aMenu selection nameKey == #single ifTrue:[model selectedItem] |
1614 item := aMenu selection nameKey == #single ifTrue:[model selectedItem] |
1615 ifFalse:[model rootItem]. |
1615 ifFalse:[model rootItem]. |
1616 item isNil ifTrue:[^ nil]. |
1616 item isNil ifTrue:[^ nil]. |
1617 |
1617 |
1618 widgets := IdentityDictionary new. |
1618 widgets := IdentityDictionary new. |
1619 total := 0. |
1619 total := 0. |
1620 |
1620 |
1621 item recursiveDo:[:el| |cls ctr| |
1621 item recursiveDo:[:el| |cls ctr| |
1622 cls := el widget. |
1622 cls := el widget. |
1623 |
1623 |
1624 cls notNil ifTrue:[ |
1624 cls notNil ifTrue:[ |
1625 cls := cls class. |
1625 cls := cls class. |
1626 ctr := widgets at:cls ifAbsent:0. |
1626 ctr := widgets at:cls ifAbsent:0. |
1627 widgets at:cls put:(ctr + 1). |
1627 widgets at:cls put:(ctr + 1). |
1628 total := total + 1. |
1628 total := total + 1. |
1629 ]. |
1629 ]. |
1630 ]. |
1630 ]. |
1631 total == 0 ifTrue:[^ nil]. |
1631 total == 0 ifTrue:[^ nil]. |
1632 list := SortedCollection sortBlock:[:a :b| a title < b title ]. |
1632 list := SortedCollection sortBlock:[:a :b| a title < b title ]. |
1633 |
1633 |
1634 widgets keysAndValuesDo:[:cls :ctr| |
1634 widgets keysAndValuesDo:[:cls :ctr| |
1635 list add:(MenuDesc title:(cls name) |
1635 list add:(MenuDesc title:(cls name) |
1636 value:(ctr printString) |
1636 value:(ctr printString) |
1637 action:[self doSelectNextOfClass:cls startingIn:item] |
1637 action:[self doSelectNextOfClass:cls startingIn:item] |
1638 ). |
1638 ). |
1639 ]. |
1639 ]. |
1640 list := list asOrderedCollection. |
1640 list := list asOrderedCollection. |
1641 list add:(MenuDesc separator). |
1641 list add:(MenuDesc separator). |
1642 list add:(MenuDesc title:'Total' value:(total printString)). |
1642 list add:(MenuDesc title:'Total' value:(total printString)). |
1643 menu := MenuDesc buildFromList:list onGC:aMenu. |
1643 menu := MenuDesc buildFromList:list onGC:aMenu. |
1644 menu do:[:el| |
1644 menu do:[:el| |
1645 el hideMenuOnActivated:false |
1645 el hideMenuOnActivated:false |
1646 ]. |
1646 ]. |
1647 ^ menu |
1647 ^ menu |
1648 ! |
1648 ! |
1649 |
1649 |
1650 submenuGeometry:aMenu |
1650 submenuGeometry:aMenu |
1705 |
1705 |
1706 (inst := view transformation) notNil ifTrue:[ inst := inst displayString ]. |
1706 (inst := view transformation) notNil ifTrue:[ inst := inst displayString ]. |
1707 list add:(MenuDesc title:'transformation' value:inst). |
1707 list add:(MenuDesc title:'transformation' value:inst). |
1708 |
1708 |
1709 (view isKindOf:Label) ifTrue:[ |
1709 (view isKindOf:Label) ifTrue:[ |
1710 list add:(MenuDesc separator). |
1710 list add:(MenuDesc separator). |
1711 (inst := view adjust) notNil ifTrue:[ inst := inst displayString ]. |
1711 (inst := view adjust) notNil ifTrue:[ inst := inst displayString ]. |
1712 list add:(MenuDesc title:'adjust' value:inst). |
1712 list add:(MenuDesc title:'adjust' value:inst). |
1713 ]. |
1713 ]. |
1714 (view isKindOf:PanelView) ifTrue:[ |
1714 (view isKindOf:PanelView) ifTrue:[ |
1715 list add:(MenuDesc separator). |
1715 list add:(MenuDesc separator). |
1716 (inst := view horizontalLayout ) notNil ifTrue:[ inst := inst displayString ]. |
1716 (inst := view horizontalLayout ) notNil ifTrue:[ inst := inst displayString ]. |
1717 list add:(MenuDesc title:'horizontalLayout' value:inst). |
1717 list add:(MenuDesc title:'horizontalLayout' value:inst). |
1718 (inst := view verticalLayout ) notNil ifTrue:[ inst := inst displayString ]. |
1718 (inst := view verticalLayout ) notNil ifTrue:[ inst := inst displayString ]. |
1719 list add:(MenuDesc title:'verticalLayout' value:inst). |
1719 list add:(MenuDesc title:'verticalLayout' value:inst). |
1720 ]. |
1720 ]. |
1721 |
1721 |
1722 ^ MenuDesc buildFromList:list onGC:aMenu |
1722 ^ MenuDesc buildFromList:list onGC:aMenu |
1723 ! |
1723 ! |
1724 |
1724 |
1768 |
1768 |
1769 inst := view controller. |
1769 inst := view controller. |
1770 value := nil. |
1770 value := nil. |
1771 |
1771 |
1772 inst isNil ifTrue:[ |
1772 inst isNil ifTrue:[ |
1773 label := nil |
1773 label := nil |
1774 ] ifFalse:[ |
1774 ] ifFalse:[ |
1775 inst == view ifTrue:[ |
1775 inst == view ifTrue:[ |
1776 label := '== view itself' |
1776 label := '== view itself' |
1777 ] ifFalse:[ |
1777 ] ifFalse:[ |
1778 label := inst displayString. |
1778 label := inst displayString. |
1779 value := [view controller inspect]. |
1779 value := [view controller inspect]. |
1780 ]. |
1780 ]. |
1781 ]. |
1781 ]. |
1782 list add:(MenuDesc title:'controller' value:label action:value). |
1782 list add:(MenuDesc title:'controller' value:label action:value). |
1783 |
1783 |
1784 inst := view delegate. |
1784 inst := view delegate. |
1785 inst notNil ifTrue:[ |
1785 inst notNil ifTrue:[ |
1786 list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]). |
1786 list add:(MenuDesc title:'delegate' value:(inst displayString) action:[ view delegate inspect ]). |
1787 ]. |
1787 ]. |
1788 |
1788 |
1789 inst := view application. |
1789 inst := view application. |
1790 |
1790 |
1791 inst notNil ifTrue:[ |
1791 inst notNil ifTrue:[ |
1792 |topAppl| |
1792 |topAppl| |
1793 |
1793 |
1794 list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]). |
1794 list add:(MenuDesc title:'application' value:inst action:[ view application inspect ]). |
1795 |
1795 |
1796 topAppl := inst topApplication. |
1796 topAppl := inst topApplication. |
1797 |
1797 |
1798 (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[ |
1798 (topAppl notNil and:[topAppl ~~ inst]) ifTrue:[ |
1799 list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]). |
1799 list add:(MenuDesc title:'topApplication' value:topAppl action:[ inst topApplication inspect ]). |
1800 ]. |
1800 ]. |
1801 ]. |
1801 ]. |
1802 list add:(MenuDesc separator). |
1802 list add:(MenuDesc separator). |
1803 |
1803 |
1804 (view respondsTo:#'model') ifTrue:[ |
1804 (view respondsTo:#'model') ifTrue:[ |
1805 inst := view model. |
1805 inst := view model. |
1806 |
1806 |
1807 inst isNil |
1807 inst isNil |
1808 ifTrue:[ label := value := nil ] |
1808 ifTrue:[ label := value := nil ] |
1809 ifFalse:[ label := inst displayString. |
1809 ifFalse:[ label := inst displayString. |
1810 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1810 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1811 value := [ view model inspect ]. |
1811 value := [ view model inspect ]. |
1812 ]. |
1812 ]. |
1813 |
1813 |
1814 list add:(MenuDesc title:'model' value:label action:value). |
1814 list add:(MenuDesc title:'model' value:label action:value). |
1815 |
1815 |
1816 (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[ |
1816 (inst notNil and:[view respondsTo:#modelInterface]) ifTrue:[ |
1817 view modelInterface keysAndValuesDo:[:key : val| |
1817 view modelInterface keysAndValuesDo:[:key : val| |
1818 val isNil ifTrue:[ label := nil ] |
1818 val isNil ifTrue:[ label := nil ] |
1819 ifFalse:[ label := val displayString ]. |
1819 ifFalse:[ label := val displayString ]. |
1820 |
1820 |
1821 list add:(MenuDesc title:(' - ', key) value:label ). |
1821 list add:(MenuDesc title:(' - ', key) value:label ). |
1822 ] |
1822 ] |
1823 ]. |
1823 ]. |
1824 ]. |
1824 ]. |
1825 |
1825 |
1826 (view respondsTo:#enableChannel) ifTrue:[ |
1826 (view respondsTo:#enableChannel) ifTrue:[ |
1827 inst := view enableChannel. |
1827 inst := view enableChannel. |
1828 |
1828 |
1829 inst isNil ifTrue:[ label := value := nil ] |
1829 inst isNil ifTrue:[ label := value := nil ] |
1830 ifFalse:[ label := inst displayString. |
1830 ifFalse:[ label := inst displayString. |
1831 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1831 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1832 value := [ view enableChannel inspect ]. |
1832 value := [ view enableChannel inspect ]. |
1833 ]. |
1833 ]. |
1834 |
1834 |
1835 list add:(MenuDesc title:'enableChannel' value:label action:value). |
1835 list add:(MenuDesc title:'enableChannel' value:label action:value). |
1836 ]. |
1836 ]. |
1837 |
1837 |
1838 #( #action #pressAction #releaseAction ) do:[:actionSelector | |
1838 #( #action #pressAction #releaseAction ) do:[:actionSelector | |
1839 (view respondsTo:actionSelector) ifTrue:[ |
1839 (view respondsTo:actionSelector) ifTrue:[ |
1840 inst := view perform:actionSelector. |
1840 inst := view perform:actionSelector. |
1841 |
1841 |
1842 inst isNil |
1842 inst isNil |
1843 ifTrue:[ label := value := nil ] |
1843 ifTrue:[ label := value := nil ] |
1844 ifFalse:[ label := inst displayString. |
1844 ifFalse:[ label := inst displayString. |
1845 value := [ (view perform:actionSelector) inspect ]. |
1845 value := [ (view perform:actionSelector) inspect ]. |
1846 ]. |
1846 ]. |
1847 |
1847 |
1848 list add:(MenuDesc title:actionSelector"'action'" value:label action:value). |
1848 list add:(MenuDesc title:actionSelector"'action'" value:label action:value). |
1849 ]. |
1849 ]. |
1850 ]. |
1850 ]. |
1851 |
1851 |
1852 list last isSeparator ifFalse:[ list add:(MenuDesc separator) ]. |
1852 list last isSeparator ifFalse:[ list add:(MenuDesc separator) ]. |
1853 |
1853 |
1854 (view respondsTo:#listHolder) ifTrue:[ |
1854 (view respondsTo:#listHolder) ifTrue:[ |
1855 inst := view listHolder. |
1855 inst := view listHolder. |
1856 |
1856 |
1857 inst isNil ifTrue:[ label := value := nil ] |
1857 inst isNil ifTrue:[ label := value := nil ] |
1858 ifFalse:[ label := inst class printString. |
1858 ifFalse:[ label := inst class printString. |
1859 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1859 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1860 value := [ view listHolder inspect ]. |
1860 value := [ view listHolder inspect ]. |
1861 ]. |
1861 ]. |
1862 list add:(MenuDesc title:'listHolder' value:label action:value). |
1862 list add:(MenuDesc title:'listHolder' value:label action:value). |
1863 ]. |
1863 ]. |
1864 |
1864 |
1865 (view respondsTo:#list) ifTrue:[ |
1865 (view respondsTo:#list) ifTrue:[ |
1866 inst := view list. |
1866 inst := view list. |
1867 |
1867 |
1868 inst isNil ifTrue:[ label := value := nil ] |
1868 inst isNil ifTrue:[ label := value := nil ] |
1869 ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size). |
1869 ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size). |
1870 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1870 label := label,(self aspectLabelFor:inst inApplicationOf:view). |
1871 value := [ view list inspect ]. |
1871 value := [ view list inspect ]. |
1872 ]. |
1872 ]. |
1873 |
1873 |
1874 list add:(MenuDesc title:'list' value:label action:value). |
1874 list add:(MenuDesc title:'list' value:label action:value). |
1875 ]. |
1875 ]. |
1876 |
1876 |
1877 list last isSeparator ifTrue:[ list removeLast ]. |
1877 list last isSeparator ifTrue:[ list removeLast ]. |
1878 ^ MenuDesc buildFromList:list onGC:aMenu |
1878 ^ MenuDesc buildFromList:list onGC:aMenu |
1879 |
1879 |
1974 |currentItem viewItem| |
1974 |currentItem viewItem| |
1975 |
1975 |
1976 currentItem := model selectedItem. |
1976 currentItem := model selectedItem. |
1977 |
1977 |
1978 (currentItem notNil and:[currentItem widget == aView]) ifTrue:[ |
1978 (currentItem notNil and:[currentItem widget == aView]) ifTrue:[ |
1979 ^ self |
1979 ^ self |
1980 ]. |
1980 ]. |
1981 viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ]. |
1981 viewItem := model listOfItems recursiveDetect:[:el| el widget == aView ]. |
1982 |
1982 |
1983 viewItem notNil ifTrue:[ |
1983 viewItem notNil ifTrue:[ |
1984 model selectItem:viewItem. |
1984 model selectItem:viewItem. |
1985 ]. |
1985 ]. |
1986 ! |
1986 ! |
1987 |
1987 |
1988 setRootItem:aRootItemOrNil |
1988 setRootItem:aRootItemOrNil |
1989 |theProcess| |
1989 |theProcess| |
1990 |
1990 |
1991 aRootItemOrNil isNil ifTrue:[ |
1991 aRootItemOrNil isNil ifTrue:[ |
1992 process := nil. |
1992 process := nil. |
1993 ] ifFalse:[ |
1993 ] ifFalse:[ |
1994 "/ expand tree to level 3 |
1994 "/ expand tree to level 3 |
1995 aRootItemOrNil do:[:aRootChild| |
1995 aRootItemOrNil do:[:aRootChild| |
1996 aRootChild do:[:aSubChild| aSubChild expand ]. |
1996 aRootChild do:[:aSubChild| aSubChild expand ]. |
1997 aRootChild expand. |
1997 aRootChild expand. |
1998 ]. |
1998 ]. |
1999 aRootItemOrNil expand. |
1999 aRootItemOrNil expand. |
2000 |
2000 |
2001 process isNil ifTrue:[ |
2001 process isNil ifTrue:[ |
2002 theProcess := process := |
2002 theProcess := process := |
2003 Process |
2003 Process |
2004 for:[ |
2004 for:[ |
2005 |update testModeChannel| |
2005 |update testModeChannel| |
2006 |
2006 |
2007 update := false. |
2007 update := false. |
2008 testModeChannel := model testModeChannel. |
2008 testModeChannel := model testModeChannel. |
2009 |
2009 |
2010 [process == theProcess] whileTrue:[ |
2010 [process == theProcess] whileTrue:[ |
2011 Delay waitForSeconds:0.5. |
2011 Delay waitForSeconds:0.5. |
2012 |
2012 |
2013 (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[ |
2013 (treeView notNil and:[process == theProcess and:[treeView shown]]) ifTrue:[ |
2014 (testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[ |
2014 (testModeChannel value == true and:[followFocusChannel value == true]) ifTrue:[ |
2015 self selectFocusView. |
2015 self selectFocusView. |
2016 ]. |
2016 ]. |
2017 update ifTrue:[ |
2017 update ifTrue:[ |
2018 self updateShownStatus. |
2018 self updateShownStatus. |
2019 ]. |
2019 ]. |
2020 update := update not. |
2020 update := update not. |
2021 ]. |
2021 ]. |
2022 ]. |
2022 ]. |
2023 ] |
2023 ] |
2024 priority:(Processor userSchedulingPriority). |
2024 priority:(Processor userSchedulingPriority). |
2025 theProcess name:'ViewTreeInspector - Focus Follower'. |
2025 theProcess name:'ViewTreeInspector - Focus Follower'. |
2026 theProcess resume. |
2026 theProcess resume. |
2027 ]. |
2027 ]. |
2028 ]. |
2028 ]. |
2029 model rootItem:aRootItemOrNil. |
2029 model rootItem:aRootItemOrNil. |
2030 |
2030 |
2031 "Modified: / 25-07-2013 / 12:03:44 / cg" |
2031 "Modified: / 25-07-2013 / 12:03:44 / cg" |
2032 ! |
2032 ! |
2039 |
2039 |
2040 max := 0. |
2040 max := 0. |
2041 min := 9999999. |
2041 min := 9999999. |
2042 |
2042 |
2043 rootItem recursiveEachVisibleItemDo:[:anItem| |
2043 rootItem recursiveEachVisibleItemDo:[:anItem| |
2044 anItem widget notNil ifTrue:[ |
2044 anItem widget notNil ifTrue:[ |
2045 visState := (anItem widget shown). |
2045 visState := (anItem widget shown). |
2046 |
2046 |
2047 visState ~~ anItem isDrawnShown ifTrue:[ |
2047 visState ~~ anItem isDrawnShown ifTrue:[ |
2048 anItem isDrawnShown:visState. |
2048 anItem isDrawnShown:visState. |
2049 listIdx := treeView identityIndexOf:anItem. |
2049 listIdx := treeView identityIndexOf:anItem. |
2050 |
2050 |
2051 listIdx > 0 ifTrue:[ |
2051 listIdx > 0 ifTrue:[ |
2052 max := max max:listIdx. |
2052 max := max max:listIdx. |
2053 min := min min:listIdx. |
2053 min := min min:listIdx. |
2054 ]. |
2054 ]. |
2055 ]. |
2055 ]. |
2056 ]. |
2056 ]. |
2057 ]. |
2057 ]. |
2058 max < min ifTrue:[^ self]. |
2058 max < min ifTrue:[^ self]. |
2059 max := max + 1. |
2059 max := max + 1. |
2060 |
2060 |
2061 visY0 := (treeView yVisibleOfLine:min) max:0. |
2061 visY0 := (treeView yVisibleOfLine:min) max:0. |
2062 visY1 := (treeView yVisibleOfLine:max) min:(treeView height). |
2062 visY1 := (treeView yVisibleOfLine:max) min:(treeView height). |
2063 height := visY1 - visY0. |
2063 height := visY1 - visY0. |
2064 |
2064 |
2065 height > 2 ifTrue:[ |
2065 height > 2 ifTrue:[ |
2066 treeView shown ifTrue:[ |
2066 treeView shown ifTrue:[ |
2067 damage := Rectangle left:0 top:visY0 width:(treeView width) height:height. |
2067 damage := Rectangle left:0 top:visY0 width:(treeView width) height:height. |
2068 treeView invalidateDeviceRectangle:damage repairNow:false. |
2068 treeView invalidateDeviceRectangle:damage repairNow:false. |
2069 ]. |
2069 ]. |
2070 ]. |
2070 ]. |
2071 |
2071 |
2072 "Modified: / 16-08-2017 / 12:29:15 / cg" |
2072 "Modified: / 16-08-2017 / 12:29:15 / cg" |
2073 ! ! |
2073 ! ! |
2074 |
2074 |
2256 topWindow := clickedView topView. |
2256 topWindow := clickedView topView. |
2257 |
2257 |
2258 ( topWindow == Screen current rootView |
2258 ( topWindow == Screen current rootView |
2259 or:[topWindow == self window topView] |
2259 or:[topWindow == self window topView] |
2260 ) ifTrue:[ |
2260 ) ifTrue:[ |
2261 ^ self |
2261 ^ self |
2262 ]. |
2262 ]. |
2263 |
2263 |
2264 self showWindow:clickedView. |
2264 self showWindow:clickedView. |
2265 ! |
2265 ! |
2266 |
2266 |
2267 doRedraw |
2267 doRedraw |
2268 "redraw the app" |
2268 "redraw the app" |
2269 |
2269 |
2270 |rootView| |
2270 |rootView| |
2271 |
2271 |
2272 (rootView := model rootView) notNil ifTrue:[ |
2272 (rootView := model rootView) notNil ifTrue:[ |
2273 rootView withAllSubViewsDo:[:v | v "redraw; "invalidate]. |
2273 rootView withAllSubViewsDo:[:v | v "redraw; "invalidate]. |
2274 ] |
2274 ] |
2275 |
2275 |
2276 "Modified: / 16-08-2017 / 12:02:11 / cg" |
2276 "Modified: / 16-08-2017 / 12:02:11 / cg" |
2277 ! |
2277 ! |
2278 |
2278 |
2279 doSelectNextElementStartingIn:anItem forWhich:aBlock |
2279 doSelectNextElementStartingIn:anItem forWhich:aBlock |
2280 |startItem firstFound searchNext| |
2280 |startItem firstFound searchNext| |
2281 |
2281 |
2282 startItem := model last. |
2282 startItem := model last. |
2283 searchNext := startItem notNil. |
2283 searchNext := startItem notNil. |
2284 firstFound := nil. |
2284 firstFound := nil. |
2285 |
2285 |
2286 anItem recursiveDo:[:el| |
2286 anItem recursiveDo:[:el| |
2287 el == startItem ifTrue:[ |
2287 el == startItem ifTrue:[ |
2288 searchNext := false |
2288 searchNext := false |
2289 ] ifFalse:[ |
2289 ] ifFalse:[ |
2290 (aBlock value:el) ifTrue:[ |
2290 (aBlock value:el) ifTrue:[ |
2291 searchNext ifFalse:[^ model selectItem:el]. |
2291 searchNext ifFalse:[^ model selectItem:el]. |
2292 |
2292 |
2293 firstFound isNil ifTrue:[ |
2293 firstFound isNil ifTrue:[ |
2294 firstFound := el |
2294 firstFound := el |
2295 ] |
2295 ] |
2296 ] |
2296 ] |
2297 ] |
2297 ] |
2298 ]. |
2298 ]. |
2299 firstFound notNil ifTrue:[ |
2299 firstFound notNil ifTrue:[ |
2300 self window beep. |
2300 self window beep. |
2301 model selectItem:firstFound |
2301 model selectItem:firstFound |
2302 ]. |
2302 ]. |
2303 ! |
2303 ! |
2304 |
2304 |
2305 doSelectNextOfApplicationClass:aClass startingIn:anItem |
2305 doSelectNextOfApplicationClass:aClass startingIn:anItem |
2306 self doSelectNextElementStartingIn:anItem forWhich:[:el | (self resolveApplicationClassFor:el) == aClass]. |
2306 self doSelectNextElementStartingIn:anItem forWhich:[:el | (self resolveApplicationClassFor:el) == aClass]. |
2328 self setRootItem:nil. |
2328 self setRootItem:nil. |
2329 ! |
2329 ! |
2330 |
2330 |
2331 objectToInspectOrBrowse:what |
2331 objectToInspectOrBrowse:what |
2332 "return one of: |
2332 "return one of: |
2333 #view for inspect/browse view/widget |
2333 #view for inspect/browse view/widget |
2334 #group for inspect/browse windowGroup |
2334 #group for inspect/browse windowGroup |
2335 #model for inspect/browse model |
2335 #model for inspect/browse model |
2336 #application for inspect/browse application |
2336 #application for inspect/browse application |
2337 #controller for inspect/browse controller |
2337 #controller for inspect/browse controller |
2338 #process for inspect/browse application's process |
2338 #process for inspect/browse application's process |
2339 #widgetClass for inspect/browse widget's class |
2339 #widgetClass for inspect/browse widget's class |
2340 #menuItem for inspect/browse menuItem |
2340 #menuItem for inspect/browse menuItem |
2341 " |
2341 " |
2342 |view| |
2342 |view| |
2343 |
2343 |
2344 what == #menuItem ifTrue:[ |
2344 what == #menuItem ifTrue:[ |
2345 ^ model selectedItem menuItem |
2345 ^ model selectedItem menuItem |
2346 ]. |
2346 ]. |
2347 |
2347 |
2348 view := self selectedView. |
2348 view := self selectedView. |
2349 view isNil ifTrue:[^ nil]. |
2349 view isNil ifTrue:[^ nil]. |
2350 |
2350 |
2682 superView cannot resize its sub widgets |
2682 superView cannot resize its sub widgets |
2683 " |
2683 " |
2684 |layout specClass superView| |
2684 |layout specClass superView| |
2685 |
2685 |
2686 (superView := widget superView) isNil ifTrue:[ |
2686 (superView := widget superView) isNil ifTrue:[ |
2687 ^ #Extent |
2687 ^ #Extent |
2688 ]. |
2688 ]. |
2689 |
2689 |
2690 specClass := superView specClass. |
2690 specClass := superView specClass. |
2691 |
2691 |
2692 (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[ |
2692 (specClass notNil and:[specClass isLayoutContainer]) ifTrue:[ |
2693 ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil] |
2693 ^ specClass canResizeSubComponents ifTrue:[#Extent] ifFalse:[nil] |
2694 ]. |
2694 ]. |
2695 |
2695 |
2696 (layout := widget geometryLayout) isNil ifTrue:[ |
2696 (layout := widget geometryLayout) isNil ifTrue:[ |
2697 ^ #Extent |
2697 ^ #Extent |
2698 ]. |
2698 ]. |
2699 |
2699 |
2700 layout isLayout ifTrue:[ |
2700 layout isLayout ifTrue:[ |
2701 layout isLayoutFrame ifTrue:[ ^ #LayoutFrame ]. |
2701 layout isLayoutFrame ifTrue:[ ^ #LayoutFrame ]. |
2702 layout isAlignmentOrigin ifTrue:[ ^ #AlignmentOrigin ]. |
2702 layout isAlignmentOrigin ifTrue:[ ^ #AlignmentOrigin ]. |
2703 layout isLayoutOrigin ifTrue:[ ^ #LayoutOrigin ]. |
2703 layout isLayoutOrigin ifTrue:[ ^ #LayoutOrigin ]. |
2704 ] ifFalse:[ |
2704 ] ifFalse:[ |
2705 layout isRectangle ifTrue:[ ^ #Rectangle ]. |
2705 layout isRectangle ifTrue:[ ^ #Rectangle ]. |
2706 layout isPoint ifTrue:[ ^ #Point ]. |
2706 layout isPoint ifTrue:[ ^ #Point ]. |
2707 |
2707 |
2708 ]. |
2708 ]. |
2709 Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString. |
2709 Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString. |
2710 ^ nil |
2710 ^ nil |
2711 ! |
2711 ! |
2728 "not only a query; also builds" |
2728 "not only a query; also builds" |
2729 |
2729 |
2730 |subViews list item subMenu| |
2730 |subViews list item subMenu| |
2731 |
2731 |
2732 children isNil ifTrue:[ |
2732 children isNil ifTrue:[ |
2733 isExpanded := false. |
2733 isExpanded := false. |
2734 |
2734 |
2735 list := OrderedCollection new. |
2735 list := OrderedCollection new. |
2736 |
2736 |
2737 "/ it's either a widget or a menuItem |
2737 "/ it's either a widget or a menuItem |
2738 widget notNil ifTrue:[ |
2738 widget notNil ifTrue:[ |
2739 subViews := widget subViews. |
2739 subViews := widget subViews. |
2740 subViews notEmptyOrNil ifTrue:[ |
2740 subViews notEmptyOrNil ifTrue:[ |
2741 subViews do:[:aSubView| |
2741 subViews do:[:aSubView| |
2742 item := self class buildViewsFrom:aSubView. |
2742 item := self class buildViewsFrom:aSubView. |
2743 item parent:self. |
2743 item parent:self. |
2744 list add:item. |
2744 list add:item. |
2745 ]. |
2745 ]. |
2746 ]. |
2746 ]. |
2747 ]. |
2747 ]. |
2748 |
2748 |
2749 menuItem notNil ifTrue:[ |
2749 menuItem notNil ifTrue:[ |
2750 (subMenu := menuItem submenuOrNil) notNil ifTrue:[ |
2750 (subMenu := menuItem submenuOrNil) notNil ifTrue:[ |
2751 subMenu items do:[:aSubItem| |
2751 subMenu items do:[:aSubItem| |
2752 item := self class buildMenuItemsFrom:aSubItem. |
2752 item := self class buildMenuItemsFrom:aSubItem. |
2753 item parent:self. |
2753 item parent:self. |
2754 list add:item. |
2754 list add:item. |
2755 ]. |
2755 ]. |
2756 ]. |
2756 ]. |
2757 ]. |
2757 ]. |
2758 children := list. |
2758 children := list. |
2759 ]. |
2759 ]. |
2760 ^ children notEmpty |
2760 ^ children notEmpty |
2761 |
2761 |
2762 "Modified: / 16-08-2017 / 12:27:23 / cg" |
2762 "Modified: / 16-08-2017 / 12:27:23 / cg" |
2763 ! |
2763 ! |
2772 |
2772 |
2773 additionalLabelForItem:anItem |
2773 additionalLabelForItem:anItem |
2774 "answer an additional label for an Item" |
2774 "answer an additional label for an Item" |
2775 |
2775 |
2776 parent notNil ifTrue:[ |
2776 parent notNil ifTrue:[ |
2777 ^ parent additionalLabelForItem:anItem |
2777 ^ parent additionalLabelForItem:anItem |
2778 ]. |
2778 ]. |
2779 ^ nil |
2779 ^ nil |
2780 ! |
2780 ! |
2781 |
2781 |
2782 displayIcon:anIcon atX:x y:y on:aGC |
2782 displayIcon:anIcon atX:x y:y on:aGC |
2783 |x0 y0 y1 w| |
2783 |x0 y0 y1 w| |
2784 |
2784 |
2785 super displayIcon:anIcon atX:x y:y on:aGC. |
2785 super displayIcon:anIcon atX:x y:y on:aGC. |
2786 |
2786 |
2787 self exists ifFalse:[ |
2787 self exists ifFalse:[ |
2788 aGC paint:(Color red). |
2788 aGC paint:(Color red). |
2789 |
2789 |
2790 y0 := y + 1. |
2790 y0 := y + 1. |
2791 y1 := y + anIcon height - 2. |
2791 y1 := y + anIcon height - 2. |
2792 |
2792 |
2793 x0 := x - 1. |
2793 x0 := x - 1. |
2794 w := anIcon width. |
2794 w := anIcon width. |
2795 |
2795 |
2796 2 timesRepeat:[ |
2796 2 timesRepeat:[ |
2797 aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1. |
2797 aGC displayLineFromX:x0 y:y0 toX:(x0 + w) y:y1. |
2798 aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0. |
2798 aGC displayLineFromX:x0 y:y1 toX:(x0 + w) y:y0. |
2799 x0 := x0 + 1. |
2799 x0 := x0 + 1. |
2800 ]. |
2800 ]. |
2801 ]. |
2801 ]. |
2802 ! |
2802 ! |
2803 |
2803 |
2804 displayOn:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected |
2804 displayOn:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected |
2805 |labelHeight additionalName label isValidAndShown| |
2805 |labelHeight additionalName label isValidAndShown| |
2806 |
2806 |
2807 label := self label. |
2807 label := self label. |
2808 label isEmptyOrNil ifTrue:[^ self]. |
2808 label isEmptyOrNil ifTrue:[^ self]. |
2809 |
2809 |
2810 widget isNil ifTrue:[ |
2810 widget isNil ifTrue:[ |
2811 isValidAndShown := true. |
2811 isValidAndShown := true. |
2812 ] ifFalse:[ |
2812 ] ifFalse:[ |
2813 widget id isNil ifTrue:[ |
2813 widget id isNil ifTrue:[ |
2814 isDrawnShown := false. |
2814 isDrawnShown := false. |
2815 |
2815 |
2816 self exists ifFalse:[ |
2816 self exists ifFalse:[ |
2817 xOffsetAdditionalName := nil. |
2817 xOffsetAdditionalName := nil. |
2818 ]. |
2818 ]. |
2819 isValidAndShown := false. |
2819 isValidAndShown := false. |
2820 ] ifFalse:[ |
2820 ] ifFalse:[ |
2821 isValidAndShown := widget shown. |
2821 isValidAndShown := widget shown. |
2822 ]. |
2822 ]. |
2823 ]. |
2823 ]. |
2824 |
2824 |
2825 isValidAndShown ifFalse:[ |
2825 isValidAndShown ifFalse:[ |
2826 label := Text string:label emphasis:#italic. |
2826 label := Text string:label emphasis:#italic. |
2827 label colorizeAllWith:Color gray. |
2827 label colorizeAllWith:Color gray. |
2828 ]. |
2828 ]. |
2829 |
2829 |
2830 labelHeight := self heightOn:aGC. |
2830 labelHeight := self heightOn:aGC. |
2831 self displayLabel:label h:labelHeight on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected. |
2831 self displayLabel:label h:labelHeight on:aGC x:x y:y h:h isHighlightedAsSelected:isHighlightedAsSelected. |
2832 |
2832 |
2833 xOffsetAdditionalName notNil ifTrue:[ |
2833 xOffsetAdditionalName notNil ifTrue:[ |
2834 additionalName := self additionalLabelForItem:self. |
2834 additionalName := self additionalLabelForItem:self. |
2835 |
2835 |
2836 additionalName notNil ifTrue:[ |
2836 additionalName notNil ifTrue:[ |
2837 self displayLabel:additionalName |
2837 self displayLabel:additionalName |
2838 h:labelHeight on:aGC |
2838 h:labelHeight on:aGC |
2839 x:(x + xOffsetAdditionalName) y:y |
2839 x:(x + xOffsetAdditionalName) y:y |
2840 h:h. |
2840 h:h. |
2841 ] ifFalse:[ |
2841 ] ifFalse:[ |
2842 xOffsetAdditionalName := nil. |
2842 xOffsetAdditionalName := nil. |
2843 ]. |
2843 ]. |
2844 ]. |
2844 ]. |
2845 |
2845 |
2846 "Modified (format): / 16-08-2017 / 12:57:39 / cg" |
2846 "Modified (format): / 16-08-2017 / 12:57:39 / cg" |
2847 ! |
2847 ! |
2848 |
2848 |
2849 recursiveAdditionalNameBehaviourChanged |
2849 recursiveAdditionalNameBehaviourChanged |
2850 width := xOffsetAdditionalName := nil. |
2850 width := xOffsetAdditionalName := nil. |
2851 |
2851 |
2852 children notNil ifTrue:[ |
2852 children notNil ifTrue:[ |
2853 children do:[:each| each recursiveAdditionalNameBehaviourChanged ] |
2853 children do:[:each| each recursiveAdditionalNameBehaviourChanged ] |
2854 ]. |
2854 ]. |
2855 ! |
2855 ! |
2856 |
2856 |
2857 widthOn:aGC |
2857 widthOn:aGC |
2858 "return the width of the receiver, if it is to be displayed on aGC |
2858 "return the width of the receiver, if it is to be displayed on aGC |
2859 " |
2859 " |
2860 |additionalName| |
2860 |additionalName| |
2861 |
2861 |
2862 width isNil ifTrue:[ |
2862 width isNil ifTrue:[ |
2863 width := self widthOf:(self label) on:aGC. |
2863 width := self widthOf:(self label) on:aGC. |
2864 width := width + 2. |
2864 width := width + 2. |
2865 |
2865 |
2866 additionalName := self additionalLabelForItem:self. |
2866 additionalName := self additionalLabelForItem:self. |
2867 |
2867 |
2868 additionalName notNil ifTrue:[ |
2868 additionalName notNil ifTrue:[ |
2869 xOffsetAdditionalName := width + 10. |
2869 xOffsetAdditionalName := width + 10. |
2870 width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC). |
2870 width := xOffsetAdditionalName + (self widthOf:additionalName on:aGC). |
2871 width := width + 2. |
2871 width := width + 2. |
2872 ] ifFalse:[ |
2872 ] ifFalse:[ |
2873 xOffsetAdditionalName := nil. |
2873 xOffsetAdditionalName := nil. |
2874 ]. |
2874 ]. |
2875 ]. |
2875 ]. |
2876 ^ width |
2876 ^ width |
2877 ! ! |
2877 ! ! |
2878 |
2878 |
2879 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'! |
2879 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'enumerating'! |
2927 type := self layoutType. |
2927 type := self layoutType. |
2928 w := HandleExtent x. |
2928 w := HandleExtent x. |
2929 h := HandleExtent y. |
2929 h := HandleExtent y. |
2930 |
2930 |
2931 (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[ |
2931 (type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[ |
2932 aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT. |
2932 aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:#LT. |
2933 aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC. |
2933 aTwoArgAction value:(Rectangle left:xL top:yC width:w height:h) value:#LC. |
2934 aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB. |
2934 aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:#LB. |
2935 aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT. |
2935 aTwoArgAction value:(Rectangle left:xC top:yT width:w height:h) value:#CT. |
2936 aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB. |
2936 aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB. |
2937 aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT. |
2937 aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:#RT. |
2938 aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC. |
2938 aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC. |
2939 aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB. |
2939 aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB. |
2940 ^ self |
2940 ^ self |
2941 ]. |
2941 ]. |
2942 |
2942 |
2943 aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil. |
2943 aTwoArgAction value:(Rectangle left:xL top:yT width:w height:h) value:nil. |
2944 aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil. |
2944 aTwoArgAction value:(Rectangle left:xL top:yB width:w height:h) value:nil. |
2945 aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil. |
2945 aTwoArgAction value:(Rectangle left:xR top:yT width:w height:h) value:nil. |
2946 |
2946 |
2947 type == #Extent ifTrue:[ |
2947 type == #Extent ifTrue:[ |
2948 aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB. |
2948 aTwoArgAction value:(Rectangle left:xC top:yB width:w height:h) value:#CB. |
2949 aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC. |
2949 aTwoArgAction value:(Rectangle left:xR top:yC width:w height:h) value:#RC. |
2950 aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB. |
2950 aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:#RB. |
2951 ^ self |
2951 ^ self |
2952 ]. |
2952 ]. |
2953 aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil. |
2953 aTwoArgAction value:(Rectangle left:xR top:yB width:w height:h) value:nil. |
2954 |
2954 |
2955 "Modified: / 16-08-2017 / 13:04:27 / cg" |
2955 "Modified: / 16-08-2017 / 13:04:27 / cg" |
3034 |extent layout newLyt lftFrc lftOff topFrc topOff| |
3034 |extent layout newLyt lftFrc lftOff topFrc topOff| |
3035 |
3035 |
3036 layout := widget geometryLayout. |
3036 layout := widget geometryLayout. |
3037 |
3037 |
3038 layout isNil ifTrue:[ |
3038 layout isNil ifTrue:[ |
3039 ^ widget bounds asLayout |
3039 ^ widget bounds asLayout |
3040 ]. |
3040 ]. |
3041 |
3041 |
3042 layout isLayout ifFalse:[ |
3042 layout isLayout ifFalse:[ |
3043 layout isRectangle ifTrue:[ |
3043 layout isRectangle ifTrue:[ |
3044 ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right) |
3044 ^ LayoutFrame leftOffset:(layout left) rightOffset:(layout right) |
3045 topOffset:(layout top) bottomOffset:(layout bottom) |
3045 topOffset:(layout top) bottomOffset:(layout bottom) |
3046 ]. |
3046 ]. |
3047 layout isPoint ifTrue:[ |
3047 layout isPoint ifTrue:[ |
3048 extent := widget extent. |
3048 extent := widget extent. |
3049 ^ LayoutFrame leftOffset:(layout x) rightOffset:(layout x + extent x) |
3049 ^ LayoutFrame leftOffset:(layout x) rightOffset:(layout x + extent x) |
3050 topOffset:(layout y) bottomOffset:(layout y + extent y) |
3050 topOffset:(layout y) bottomOffset:(layout y + extent y) |
3051 ]. |
3051 ]. |
3052 |
3052 |
3053 Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString. |
3053 Transcript showCR:'UNSUPPORTRD LAYOUT: ', layout printString. |
3054 ^ nil |
3054 ^ nil |
3055 ]. |
3055 ]. |
3056 |
3056 |
3057 layout isLayoutFrame ifTrue:[ ^ layout copy ]. |
3057 layout isLayoutFrame ifTrue:[ ^ layout copy ]. |
3058 |
3058 |
3059 lftFrc := layout leftFraction. |
3059 lftFrc := layout leftFraction. |
3060 lftOff := layout leftOffset. |
3060 lftOff := layout leftOffset. |
3061 topFrc := layout topFraction. |
3061 topFrc := layout topFraction. |
3062 topOff := layout topOffset. |
3062 topOff := layout topOffset. |
3063 extent := widget extent. |
3063 extent := widget extent. |
3064 |
3064 |
3065 newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff |
3065 newLyt := LayoutFrame leftFraction:lftFrc offset:lftOff |
3066 rightFraction:lftFrc offset:(lftOff + extent x) |
3066 rightFraction:lftFrc offset:(lftOff + extent x) |
3067 topFraction:topFrc offset:topOff |
3067 topFraction:topFrc offset:topOff |
3068 bottomFraction:topFrc offset:(topOff + extent y). |
3068 bottomFraction:topFrc offset:(topOff + extent y). |
3069 |
3069 |
3070 ( layout isAlignmentOrigin |
3070 ( layout isAlignmentOrigin |
3071 and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])] |
3071 and:[(layout leftAlignmentFraction ~= 0 or:[layout topAlignmentFraction ~= 0])] |
3072 ) ifTrue:[ |
3072 ) ifTrue:[ |
3073 |svRc prBd dlta| |
3073 |svRc prBd dlta| |
3074 |
3074 |
3075 svRc := widget superView viewRectangle. |
3075 svRc := widget superView viewRectangle. |
3076 prBd := widget preferredBounds. |
3076 prBd := widget preferredBounds. |
3077 |
3077 |
3078 dlta := ( ((layout rectangleRelativeTo:svRc preferred:prBd) corner) |
3078 dlta := ( ((layout rectangleRelativeTo:svRc preferred:prBd) corner) |
3079 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner) |
3079 - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner) |
3080 ) rounded. |
3080 ) rounded. |
3081 |
3081 |
3082 newLyt leftOffset:(lftOff + dlta x). |
3082 newLyt leftOffset:(lftOff + dlta x). |
3083 newLyt rightOffset:(lftOff + extent x + dlta x). |
3083 newLyt rightOffset:(lftOff + extent x + dlta x). |
3084 newLyt topOffset:(topOff + dlta y). |
3084 newLyt topOffset:(topOff + dlta y). |
3085 newLyt bottomOffset:(topOff + extent y + dlta y). |
3085 newLyt bottomOffset:(topOff + extent y + dlta y). |
3086 ]. |
3086 ]. |
3087 ^ newLyt |
3087 ^ newLyt |
3088 ! |
3088 ! |
3089 |
3089 |
3090 moveLeft:l top:t |
3090 moveLeft:l top:t |
3093 |layout| |
3093 |layout| |
3094 |
3094 |
3095 self isMoveable ifFalse:[ ^ self ]. |
3095 self isMoveable ifFalse:[ ^ self ]. |
3096 |
3096 |
3097 (layout := widget geometryLayout) isNil ifTrue:[ |
3097 (layout := widget geometryLayout) isNil ifTrue:[ |
3098 "Extent" |
3098 "Extent" |
3099 widget origin:(widget origin + (l@t)). |
3099 widget origin:(widget origin + (l@t)). |
3100 ^ self |
3100 ^ self |
3101 ]. |
3101 ]. |
3102 |
3102 |
3103 layout := layout copy. |
3103 layout := layout copy. |
3104 |
3104 |
3105 layout isLayout ifTrue:[ |
3105 layout isLayout ifTrue:[ |
3106 layout leftOffset:(layout leftOffset + l) |
3106 layout leftOffset:(layout leftOffset + l) |
3107 topOffset:(layout topOffset + t). |
3107 topOffset:(layout topOffset + t). |
3108 |
3108 |
3109 layout isLayoutFrame ifTrue:[ |
3109 layout isLayoutFrame ifTrue:[ |
3110 layout rightOffset:(layout rightOffset + l). |
3110 layout rightOffset:(layout rightOffset + l). |
3111 layout bottomOffset:(layout bottomOffset + t). |
3111 layout bottomOffset:(layout bottomOffset + t). |
3112 ] |
3112 ] |
3113 |
3113 |
3114 ] ifFalse:[ |
3114 ] ifFalse:[ |
3115 layout isRectangle ifTrue:[ |
3115 layout isRectangle ifTrue:[ |
3116 layout setLeft:(layout left + l). |
3116 layout setLeft:(layout left + l). |
3117 layout setTop:(layout top + t). |
3117 layout setTop:(layout top + t). |
3118 ] ifFalse:[ |
3118 ] ifFalse:[ |
3119 layout isPoint ifFalse:[^ self]. |
3119 layout isPoint ifFalse:[^ self]. |
3120 layout x:(layout x + l) y:(layout y + t). |
3120 layout x:(layout x + l) y:(layout y + t). |
3121 ] |
3121 ] |
3122 ]. |
3122 ]. |
3123 widget geometryLayout:layout. |
3123 widget geometryLayout:layout. |
3124 ! |
3124 ! |
3125 |
3125 |
3126 resizeLeft:l top:t right:r bottom:b |
3126 resizeLeft:l top:t right:r bottom:b |
3127 "resize the widget measured in pixels |
3127 "resize the widget measured in pixels |
3128 " |
3128 " |
3129 |layout| |
3129 |layout| |
3130 |
3130 |
3131 self isResizeable ifFalse:[ |
3131 self isResizeable ifFalse:[ |
3132 ^ self |
3132 ^ self |
3133 ]. |
3133 ]. |
3134 |
3134 |
3135 (layout := widget geometryLayout) isNil ifTrue:[ |
3135 (layout := widget geometryLayout) isNil ifTrue:[ |
3136 "Extent" |
3136 "Extent" |
3137 (r == l and:[b == t]) ifFalse:[ |
3137 (r == l and:[b == t]) ifFalse:[ |
3138 widget extent:(widget computeExtent + ((r-l) @ (b-t))). |
3138 widget extent:(widget computeExtent + ((r-l) @ (b-t))). |
3139 ]. |
3139 ]. |
3140 ^ self |
3140 ^ self |
3141 ]. |
3141 ]. |
3142 |
3142 |
3143 layout isLayout ifTrue:[ |
3143 layout isLayout ifTrue:[ |
3144 layout := layout copy. |
3144 layout := layout copy. |
3145 |
3145 |
3146 layout leftOffset:(layout leftOffset + l) |
3146 layout leftOffset:(layout leftOffset + l) |
3147 topOffset:(layout topOffset + t). |
3147 topOffset:(layout topOffset + t). |
3148 |
3148 |
3149 layout isLayoutFrame ifTrue:[ |
3149 layout isLayoutFrame ifTrue:[ |
3150 layout bottomOffset:(layout bottomOffset + b). |
3150 layout bottomOffset:(layout bottomOffset + b). |
3151 layout rightOffset:(layout rightOffset + r). |
3151 layout rightOffset:(layout rightOffset + r). |
3152 ] |
3152 ] |
3153 ] ifFalse:[ |
3153 ] ifFalse:[ |
3154 layout isRectangle ifFalse:[^ self]. |
3154 layout isRectangle ifFalse:[^ self]. |
3155 layout := layout copy. |
3155 layout := layout copy. |
3156 |
3156 |
3157 layout left:(layout left + l) |
3157 layout left:(layout left + l) |
3158 right:(layout right + r) |
3158 right:(layout right + r) |
3159 top:(layout top + t) |
3159 top:(layout top + t) |
3160 bottom:(layout bottom + b). |
3160 bottom:(layout bottom + b). |
3161 ]. |
3161 ]. |
3162 widget geometryLayout:layout. |
3162 widget geometryLayout:layout. |
3163 ! ! |
3163 ! ! |
3164 |
3164 |
3165 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'! |
3165 !ViewTreeInspectorApplication::ViewTreeItem methodsFor:'operations update'! |
3409 and subviews (ViewTreeItems) and the selection, a list of selected ViewTreeItems's. |
3409 and subviews (ViewTreeItems) and the selection, a list of selected ViewTreeItems's. |
3410 It shows the selected items highlighted. |
3410 It shows the selected items highlighted. |
3411 |
3411 |
3412 |
3412 |
3413 [Instance variables:] |
3413 [Instance variables:] |
3414 lockSema <Semaphore> lock selection notifications and redraws |
3414 lockSema <Semaphore> lock selection notifications and redraws |
3415 |
3415 |
3416 testModeChannel <ValueHolder> true, than running in test mode. |
3416 testModeChannel <ValueHolder> true, than running in test mode. |
3417 |
3417 |
3418 hasTargetWidgetChannel <ValueHolder> true, than any target view is grapped |
3418 hasTargetWidgetChannel <ValueHolder> true, than any target view is grapped |
3419 |
3419 |
3420 selection <Sequence or nil> selected items or nil |
3420 selection <Sequence or nil> selected items or nil |
3421 |
3421 |
3422 hiddenLevel <Integer> internal use; redrawing the selection |
3422 hiddenLevel <Integer> internal use; redrawing the selection |
3423 only is done if the counter is 0. |
3423 only is done if the counter is 0. |
3424 |
3424 |
3425 listOfItems <HierarchicalList> hiearchical list build from existing items. |
3425 listOfItems <HierarchicalList> hiearchical list build from existing items. |
3426 |
3426 |
3427 selectedSuperItems <Sequence> list of selected super items; items selected |
3427 selectedSuperItems <Sequence> list of selected super items; items selected |
3428 but not contained in another selected item. |
3428 but not contained in another selected item. |
3429 |
3429 |
3430 inputEventAction <Action> called for each InputEvent |
3430 inputEventAction <Action> called for each InputEvent |
3431 |
3431 |
3432 mappedViewAction <Action> called for a new mapped view which |
3432 mappedViewAction <Action> called for a new mapped view which |
3433 can not be found in the current item list. |
3433 can not be found in the current item list. |
3434 |
3434 |
3435 beforeSelectionChangedAction <Action> called before the selection changed |
3435 beforeSelectionChangedAction <Action> called before the selection changed |
3436 |
3436 |
3437 [author:] |
3437 [author:] |
3438 Claus Atzkern |
3438 Claus Atzkern |
3439 |
3439 |
3440 [see also:] |
3440 [see also:] |
3441 ViewTreeItem |
3441 ViewTreeItem |
3442 " |
3442 " |
3443 ! |
3443 ! |
3444 |
3444 |
3445 examples |
3445 examples |
3446 " |
3446 " |
3447 example 1: pick any window and show views and contained views |
3447 example 1: pick any window and show views and contained views |
3448 [exBegin] |
3448 [exBegin] |
3449 |top sel model panel| |
3449 |top sel model panel| |
3450 |
3450 |
3451 model := ViewTreeModel new. |
3451 model := ViewTreeModel new. |
3452 top := StandardSystemView new; extent:440@400. |
3452 top := StandardSystemView new; extent:440@400. |
3453 sel := ScrollableView for:HierarchicalListView miniScroller:true origin:0.0@0.0 corner:1.0@1.0 in:top. |
3453 sel := ScrollableView for:HierarchicalListView miniScroller:true origin:0.0@0.0 corner:1.0@1.0 in:top. |
3457 panel topInset:-24. |
3457 panel topInset:-24. |
3458 panel horizontalLayout:#fitSpace. |
3458 panel horizontalLayout:#fitSpace. |
3459 |
3459 |
3460 Button label:'Exit' action:[model rootItem:nil. top destroy] in:panel. |
3460 Button label:'Exit' action:[model rootItem:nil. top destroy] in:panel. |
3461 Button label:'Pick Views' action:[ |win| |
3461 Button label:'Pick Views' action:[ |win| |
3462 ( (win := Screen current viewFromUser) notNil |
3462 ( (win := Screen current viewFromUser) notNil |
3463 and:[(win := win topView) ~~ Screen current rootView |
3463 and:[(win := win topView) ~~ Screen current rootView |
3464 and:[win ~~ top]] |
3464 and:[win ~~ top]] |
3465 ) ifTrue:[ |
3465 ) ifTrue:[ |
3466 model rootItem:(ViewTreeItem buildViewsFrom:win) |
3466 model rootItem:(ViewTreeItem buildViewsFrom:win) |
3467 ] ifFalse:[ |
3467 ] ifFalse:[ |
3468 model rootItem:nil |
3468 model rootItem:nil |
3469 ] |
3469 ] |
3470 ] in:panel. |
3470 ] in:panel. |
3471 |
3471 |
3472 sel multipleSelectOk:true. |
3472 sel multipleSelectOk:true. |
3473 sel list:model listOfItems. |
3473 sel list:model listOfItems. |
3474 sel model:model. |
3474 sel model:model. |
3475 sel useIndex:false. |
3475 sel useIndex:false. |
3476 |
3476 |
3477 sel doubleClickAction:[:i| |el| |
3477 sel doubleClickAction:[:i| |el| |
3478 el := model listOfItems at:i. |
3478 el := model listOfItems at:i. |
3479 el spec notNil ifTrue:[ el spec inspect ] ifFalse:[ el widget inspect ] |
3479 el spec notNil ifTrue:[ el spec inspect ] ifFalse:[ el widget inspect ] |
3480 ]. |
3480 ]. |
3481 sel indicatorAction:[:i| (model listOfItems at:i) toggleExpand ]. |
3481 sel indicatorAction:[:i| (model listOfItems at:i) toggleExpand ]. |
3482 |
3482 |
3483 model inputEventAction:[:anEvent| |item| |
3483 model inputEventAction:[:anEvent| |item| |
3484 anEvent isButtonEvent ifTrue:[ |
3484 anEvent isButtonEvent ifTrue:[ |
3485 anEvent isButtonPressEvent ifTrue:[ |
3485 anEvent isButtonPressEvent ifTrue:[ |
3486 model selectedItem:(model listOfItems detectItemRespondsToView:(anEvent view)). |
3486 model selectedItem:(model listOfItems detectItemRespondsToView:(anEvent view)). |
3487 ] ifFalse:[ |
3487 ] ifFalse:[ |
3488 anEvent type == #'buttonMultiPress:x:y:' ifTrue:[ |
3488 anEvent type == #'buttonMultiPress:x:y:' ifTrue:[ |
3489 (item := model selectedItem) notNil ifTrue:[item widget inspect] |
3489 (item := model selectedItem) notNil ifTrue:[item widget inspect] |
3490 ] |
3490 ] |
3491 ] |
3491 ] |
3492 ] |
3492 ] |
3493 ]. |
3493 ]. |
3494 |
3494 |
3495 top openAndWait. |
3495 top openAndWait. |
3496 [[top shown] whileTrue:[Delay waitForSeconds:0.5]. model rootItem:nil] forkAt:8 |
3496 [[top shown] whileTrue:[Delay waitForSeconds:0.5]. model rootItem:nil] forkAt:8 |
3497 |
3497 |
3498 [exEnd] |
3498 [exEnd] |
3499 " |
3499 " |
3500 ! ! |
3500 ! ! |
3501 |
3501 |
3502 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'accessing'! |
3502 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'accessing'! |
3503 |
3503 |
3506 ! |
3506 ! |
3507 |
3507 |
3508 catchEvents:aBoolean |
3508 catchEvents:aBoolean |
3509 catchEvents := aBoolean. |
3509 catchEvents := aBoolean. |
3510 aBoolean ifFalse:[ |
3510 aBoolean ifFalse:[ |
3511 self redrawUnselected:selection andLock:false checkTestMode:false. |
3511 self redrawUnselected:selection andLock:false checkTestMode:false. |
3512 ]. |
3512 ]. |
3513 ! |
3513 ! |
3514 |
3514 |
3515 path |
3515 path |
3516 "Return a XPath like path to this item" |
3516 "Return a XPath like path to this item" |
3517 |
3517 |
3518 | view views| |
3518 | view views| |
3519 |
3519 |
3520 selection isNil ifTrue:[ ^ nil ]. |
3520 selection isNil ifTrue:[ ^ nil ]. |
3521 selection isCollection ifTrue:[ |
3521 selection isCollection ifTrue:[ |
3522 selection size ~~ 1 ifTrue:[ ^ nil ]. |
3522 selection size ~~ 1 ifTrue:[ ^ nil ]. |
3523 view := selection anElement widget. |
3523 view := selection anElement widget. |
3524 ] ifFalse:[ |
3524 ] ifFalse:[ |
3525 view := selection widget. |
3525 view := selection widget. |
3526 ]. |
3526 ]. |
3527 view isNil ifTrue:[^ nil]. |
3527 view isNil ifTrue:[^ nil]. |
3528 |
3528 |
3529 views := OrderedCollection new. |
3529 views := OrderedCollection new. |
3530 [ view notNil ] whileTrue:[ |
3530 [ view notNil ] whileTrue:[ |
3531 views add: view. |
3531 views add: view. |
3532 view := view superView. |
3532 view := view superView. |
3533 ]. |
3533 ]. |
3534 views removeLast. |
3534 views removeLast. |
3535 ^ String streamContents:[ :s| |
3535 ^ String streamContents:[ :s| |
3536 views reverseDo:[:each | |
3536 views reverseDo:[:each | |
3537 s nextPutAll:'/'. |
3537 s nextPutAll:'/'. |
3538 s nextPutAll: each name asString "storeString". |
3538 s nextPutAll: each name asString "storeString". |
3539 ]. |
3539 ]. |
3540 ] |
3540 ] |
3541 |
3541 |
3542 "Created: / 19-05-2014 / 18:15:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3542 "Created: / 19-05-2014 / 18:15:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3543 "Modified: / 16-08-2017 / 13:03:47 / cg" |
3543 "Modified: / 16-08-2017 / 13:03:47 / cg" |
3544 ! |
3544 ! |
3720 |view myTaskId| |
3720 |view myTaskId| |
3721 |
3721 |
3722 myTaskId := timedUpdateTask. |
3722 myTaskId := timedUpdateTask. |
3723 |
3723 |
3724 listOfItems root notNil ifTrue:[ |
3724 listOfItems root notNil ifTrue:[ |
3725 view := listOfItems root widget. |
3725 view := listOfItems root widget. |
3726 ]. |
3726 ]. |
3727 |
3727 |
3728 [ view notNil ] whileTrue:[ |
3728 [ view notNil ] whileTrue:[ |
3729 Delay waitForSeconds:0.5. |
3729 Delay waitForSeconds:0.5. |
3730 |
3730 |
3731 (myTaskId == timedUpdateTask and:[view id notNil]) ifFalse:[ |
3731 (myTaskId == timedUpdateTask and:[view id notNil]) ifFalse:[ |
3732 view := nil. |
3732 view := nil. |
3733 ] ifTrue:[ |
3733 ] ifTrue:[ |
3734 (view sensor hasUserEvent:#updateChildren for:self) ifFalse:[ |
3734 (view sensor hasUserEvent:#updateChildren for:self) ifFalse:[ |
3735 view sensor pushUserEvent:#updateChildren for:self. |
3735 view sensor pushUserEvent:#updateChildren for:self. |
3736 ]. |
3736 ]. |
3737 ]. |
3737 ]. |
3738 ]. |
3738 ]. |
3739 timedUpdateTask == myTaskId ifTrue:[ |
3739 timedUpdateTask == myTaskId ifTrue:[ |
3740 timedUpdateTask := nil. |
3740 timedUpdateTask := nil. |
3741 listOfItems root:nil. |
3741 listOfItems root:nil. |
3742 ]. |
3742 ]. |
3743 ! |
3743 ! |
3744 |
3744 |
3745 update:something with:someArgument from:aModel |
3745 update:something with:someArgument from:aModel |
3746 |
3746 |
3747 aModel == testModeChannel ifTrue:[ |
3747 aModel == testModeChannel ifTrue:[ |
3748 (hiddenLevel == 0 and:[selection size > 0]) ifTrue:[ |
3748 (hiddenLevel == 0 and:[selection size > 0]) ifTrue:[ |
3749 testModeChannel value ifTrue:[ |
3749 testModeChannel value ifTrue:[ |
3750 self redrawUnselected:selection andLock:false checkTestMode:false. |
3750 self redrawUnselected:selection andLock:false checkTestMode:false. |
3751 ] ifFalse:[ |
3751 ] ifFalse:[ |
3752 self invalidateSelection. |
3752 self invalidateSelection. |
3753 ]. |
3753 ]. |
3754 ]. |
3754 ]. |
3755 ^ self |
3755 ^ self |
3756 ]. |
3756 ]. |
3757 super update:something with:someArgument from:aModel. |
3757 super update:something with:someArgument from:aModel. |
3758 ! |
3758 ! |
3759 |
3759 |
3760 updateChildren |
3760 updateChildren |
3781 |
3781 |
3782 catchEvents ifFalse:[^ false]. |
3782 catchEvents ifFalse:[^ false]. |
3783 |
3783 |
3784 evView := anEvent view. |
3784 evView := anEvent view. |
3785 evView isNil ifTrue:[ |
3785 evView isNil ifTrue:[ |
3786 (anEvent isMessageSendEvent not or:[anEvent receiver ~~ self]) ifTrue:[ |
3786 (anEvent isMessageSendEvent not or:[anEvent receiver ~~ self]) ifTrue:[ |
3787 ^ false |
3787 ^ false |
3788 ]. |
3788 ]. |
3789 anEvent value. |
3789 anEvent value. |
3790 ^ true. |
3790 ^ true. |
3791 ]. |
3791 ]. |
3792 rootView := listOfItems rootView. |
3792 rootView := listOfItems rootView. |
3793 rootView isNil ifTrue:[ ^ false ]. |
3793 rootView isNil ifTrue:[ ^ false ]. |
3794 |
3794 |
3795 anEvent isConfigureEvent ifTrue:[ |
3795 anEvent isConfigureEvent ifTrue:[ |
3796 hiddenLevel == 0 ifTrue:[ |
3796 hiddenLevel == 0 ifTrue:[ |
3797 self redrawUnselected:selection andLock:false. |
3797 self redrawUnselected:selection andLock:false. |
3798 ]. |
3798 ]. |
3799 ^ false |
3799 ^ false |
3800 ]. |
3800 ]. |
3801 |
3801 |
3802 "/ check whether view is contained within the rootView |
3802 "/ check whether view is contained within the rootView |
3803 (evView == rootView or:[evView isComponentOf:rootView]) ifFalse:[ |
3803 (evView == rootView or:[evView isComponentOf:rootView]) ifFalse:[ |
3804 ^ false |
3804 ^ false |
3805 ]. |
3805 ]. |
3806 |
3806 |
3807 anEvent isInputEvent ifFalse:[ |
3807 anEvent isInputEvent ifFalse:[ |
3808 anEvent isDamage ifTrue:[ |
3808 anEvent isDamage ifTrue:[ |
3809 hiddenLevel == 0 ifTrue:[self invalidateSelection]. |
3809 hiddenLevel == 0 ifTrue:[self invalidateSelection]. |
3810 ^ false |
3810 ^ false |
3811 ]. |
3811 ]. |
3812 |
3812 |
3813 anEvent isMapEvent ifTrue:[ |
3813 anEvent isMapEvent ifTrue:[ |
3814 mappedViewAction notNil ifTrue:[ |
3814 mappedViewAction notNil ifTrue:[ |
3815 item := listOfItems recursiveDetect:[:el| el widget == evView]. |
3815 item := listOfItems recursiveDetect:[:el| el widget == evView]. |
3816 item isNil ifTrue:[ mappedViewAction value:evView ] |
3816 item isNil ifTrue:[ mappedViewAction value:evView ] |
3817 ]. |
3817 ]. |
3818 ^ false |
3818 ^ false |
3819 ]. |
3819 ]. |
3820 |
3820 |
3821 anEvent type == #terminate ifTrue:[ |
3821 anEvent type == #terminate ifTrue:[ |
3822 item := listOfItems recursiveDetect:[:el| el widget == evView]. |
3822 item := listOfItems recursiveDetect:[:el| el widget == evView]. |
3823 item notNil ifTrue:[ self processTerminateForItem:item ]. |
3823 item notNil ifTrue:[ self processTerminateForItem:item ]. |
3824 ^ false |
3824 ^ false |
3825 ]. |
3825 ]. |
3826 ^ false |
3826 ^ false |
3827 ]. |
3827 ]. |
3828 testMode := testModeChannel value. |
3828 testMode := testModeChannel value. |
3829 |
3829 |
3830 anEvent isFocusEvent ifTrue:[ |
3830 anEvent isFocusEvent ifTrue:[ |
3831 evView == rootView ifTrue:[ |
3831 evView == rootView ifTrue:[ |
3832 self invalidateSelection |
3832 self invalidateSelection |
3833 ]. |
3833 ]. |
3834 ^ testMode not. |
3834 ^ testMode not. |
3835 ]. |
3835 ]. |
3836 anEvent isPointerEnterLeaveEvent ifTrue:[ ^ testMode not ]. |
3836 anEvent isPointerEnterLeaveEvent ifTrue:[ ^ testMode not ]. |
3837 |
3837 |
3838 testMode ifFalse:[ |
3838 testMode ifFalse:[ |
3839 inputEventAction notNil ifTrue:[ inputEventAction value:anEvent ]. |
3839 inputEventAction notNil ifTrue:[ inputEventAction value:anEvent ]. |
3840 ] ifTrue:[ |
3840 ] ifTrue:[ |
3841 anEvent isButtonPressEvent ifTrue:[ |
3841 anEvent isButtonPressEvent ifTrue:[ |
3842 selectOnClickHolder value ifTrue:[ |
3842 selectOnClickHolder value ifTrue:[ |
3843 self selectItem:(listOfItems detectItemRespondsToView:evView). |
3843 self selectItem:(listOfItems detectItemRespondsToView:evView). |
3844 ]. |
3844 ]. |
3845 ] |
3845 ] |
3846 ]. |
3846 ]. |
3847 |
3847 |
3848 (hiddenLevel ~~ 0 and:[anEvent isButtonReleaseEvent]) ifTrue:[ |
3848 (hiddenLevel ~~ 0 and:[anEvent isButtonReleaseEvent]) ifTrue:[ |
3849 hiddenLevel := 1. |
3849 hiddenLevel := 1. |
3850 self signalHiddenLevel. |
3850 self signalHiddenLevel. |
3851 ]. |
3851 ]. |
3852 |
3852 |
3853 ^ testMode not |
3853 ^ testMode not |
3854 ! |
3854 ! |
3855 |
3855 |
3932 relOrgY := relOrg y - bwWidth. |
3932 relOrgY := relOrg y - bwWidth. |
3933 width := aView width + bwWidth + bwWidth. |
3933 width := aView width + bwWidth + bwWidth. |
3934 height := aView height + bwWidth + bwWidth. |
3934 height := aView height + bwWidth + bwWidth. |
3935 |
3935 |
3936 size to:1 by:-1 do:[:anIndex| |
3936 size to:1 by:-1 do:[:anIndex| |
3937 repaired := damage := theDamages at:anIndex. |
3937 repaired := damage := theDamages at:anIndex. |
3938 |
3938 |
3939 "/ compute the rectangle into the view |
3939 "/ compute the rectangle into the view |
3940 y := damage top - relOrgY. |
3940 y := damage top - relOrgY. |
3941 x := damage left - relOrgX. |
3941 x := damage left - relOrgX. |
3942 w := damage width. |
3942 w := damage width. |
3943 h := damage height. |
3943 h := damage height. |
3944 |
3944 |
3945 x < 0 ifTrue:[ w := w + x. x := 0. repaired := nil ]. |
3945 x < 0 ifTrue:[ w := w + x. x := 0. repaired := nil ]. |
3946 y < 0 ifTrue:[ h := h + y. y := 0. repaired := nil ]. |
3946 y < 0 ifTrue:[ h := h + y. y := 0. repaired := nil ]. |
3947 x + w > width ifTrue:[ w := width - x. repaired := nil ]. |
3947 x + w > width ifTrue:[ w := width - x. repaired := nil ]. |
3948 y + h > height ifTrue:[ h := height - y. repaired := nil ]. |
3948 y + h > height ifTrue:[ h := height - y. repaired := nil ]. |
3949 |
3949 |
3950 (w > 0 and:[h > 0]) ifTrue:[ |
3950 (w > 0 and:[h > 0]) ifTrue:[ |
3951 bwWidth ~~ 0 ifTrue:[ |
3951 bwWidth ~~ 0 ifTrue:[ |
3952 color isNil ifTrue:[ |
3952 color isNil ifTrue:[ |
3953 "/ must force redraw of border |
3953 "/ must force redraw of border |
3954 color := aView borderColor. |
3954 color := aView borderColor. |
3955 aView borderColor:(Color colorId:1). |
3955 aView borderColor:(Color colorId:1). |
3956 aView borderColor:color. |
3956 aView borderColor:color. |
3957 ]. |
3957 ]. |
3958 w := w - bwWidth. |
3958 w := w - bwWidth. |
3959 h := h - bwWidth. |
3959 h := h - bwWidth. |
3960 |
3960 |
3961 (x := x - bwWidth) < 0 ifTrue:[w := w + x. x := 0]. |
3961 (x := x - bwWidth) < 0 ifTrue:[w := w + x. x := 0]. |
3962 (y := y - bwWidth) < 0 ifTrue:[h := h + y. y := 0]. |
3962 (y := y - bwWidth) < 0 ifTrue:[h := h + y. y := 0]. |
3963 |
3963 |
3964 h > 0 ifFalse:[w := 0]. "/ later testing on width only |
3964 h > 0 ifFalse:[w := 0]. "/ later testing on width only |
3965 ]. |
3965 ]. |
3966 |
3966 |
3967 w > 0 ifTrue:[ |
3967 w > 0 ifTrue:[ |
3968 aView clearRectangleX:x y:y width:w height:h. |
3968 aView clearRectangleX:x y:y width:w height:h. |
3969 aView exposeX:x y:y width:w height:h |
3969 aView exposeX:x y:y width:w height:h |
3970 ]. |
3970 ]. |
3971 repaired notNil ifTrue:[ theDamages removeFromIndex:anIndex toIndex:anIndex ]. |
3971 repaired notNil ifTrue:[ theDamages removeFromIndex:anIndex toIndex:anIndex ]. |
3972 ] |
3972 ] |
3973 ]. |
3973 ]. |
3974 ! |
3974 ! |
3975 |
3975 |
3976 redrawSelection |
3976 redrawSelection |
3977 "redraw all items selected |
3977 "redraw all items selected |
3984 and:[(size := selection size) > 0 |
3984 and:[(size := selection size) > 0 |
3985 and:[(topView := listOfItems rootView) notNil |
3985 and:[(topView := listOfItems rootView) notNil |
3986 and:[topView shown |
3986 and:[topView shown |
3987 and:[(topView sensor hasEvent:#redrawSelection for:self) not]]]] |
3987 and:[(topView sensor hasEvent:#redrawSelection for:self) not]]]] |
3988 ) ifFalse:[ |
3988 ) ifFalse:[ |
3989 ^ self |
3989 ^ self |
3990 ]. |
3990 ]. |
3991 |
3991 |
3992 lockSema critical:[ |
3992 lockSema critical:[ |
3993 |list| |
3993 |list| |
3994 |
3994 |
3995 list := selection. |
3995 list := selection. |
3996 |
3996 |
3997 list size > 0 ifTrue:[ |
3997 list size > 0 ifTrue:[ |
3998 topView paint:(Color black). |
3998 topView paint:(Color black). |
3999 topView clippedByChildren:false. |
3999 topView clippedByChildren:false. |
4000 |
4000 |
4001 list keysAndValuesReverseDo:[:anIndex :anItem| |
4001 list keysAndValuesReverseDo:[:anIndex :anItem| |
4002 (anIndex == 1 and:[size > 1]) ifTrue:[ topView paint:(Color red) ]. |
4002 (anIndex == 1 and:[size > 1]) ifTrue:[ topView paint:(Color red) ]. |
4003 |
4003 |
4004 anItem handlesDo:[:aRect :what| |
4004 anItem handlesDo:[:aRect :what| |
4005 what isNil ifTrue:[topView displayRectangle:aRect] |
4005 what isNil ifTrue:[topView displayRectangle:aRect] |
4006 ifFalse:[topView fillRectangle:aRect] |
4006 ifFalse:[topView fillRectangle:aRect] |
4007 ] |
4007 ] |
4008 ]. |
4008 ]. |
4009 topView clippedByChildren:true. |
4009 topView clippedByChildren:true. |
4010 ]. |
4010 ]. |
4011 ]. |
4011 ]. |
4012 ! |
4012 ! |
4013 |
4013 |
4014 redrawUnselected:aList andLock:doLock |
4014 redrawUnselected:aList andLock:doLock |
4015 "redraw all items unselected; if doLock is true, the hiddenLevel |
4015 "redraw all items unselected; if doLock is true, the hiddenLevel |
4023 is incremented and thus the select mechanism is locked. |
4023 is incremented and thus the select mechanism is locked. |
4024 " |
4024 " |
4025 |rootView damages subViews x y w h| |
4025 |rootView damages subViews x y w h| |
4026 |
4026 |
4027 doLock ifTrue:[ |
4027 doLock ifTrue:[ |
4028 hiddenLevel := hiddenLevel + 1. |
4028 hiddenLevel := hiddenLevel + 1. |
4029 hiddenLevel ~~ 1 ifTrue:[^ self]. |
4029 hiddenLevel ~~ 1 ifTrue:[^ self]. |
4030 ] ifFalse:[ |
4030 ] ifFalse:[ |
4031 hiddenLevel ~~ 0 ifTrue:[^ self]. |
4031 hiddenLevel ~~ 0 ifTrue:[^ self]. |
4032 ]. |
4032 ]. |
4033 checkTestMode ifTrue:[ |
4033 checkTestMode ifTrue:[ |
4034 testModeChannel value ifTrue:[ ^ self ]. "/ test whether running testMode |
4034 testModeChannel value ifTrue:[ ^ self ]. "/ test whether running testMode |
4035 ]. |
4035 ]. |
4036 |
4036 |
4037 ( aList size ~~ 0 |
4037 ( aList size ~~ 0 |
4038 and:[(rootView := listOfItems rootView) notNil |
4038 and:[(rootView := listOfItems rootView) notNil |
4039 and:[rootView shown]] |
4039 and:[rootView shown]] |
4040 ) ifFalse:[ |
4040 ) ifFalse:[ |
4041 ^ self |
4041 ^ self |
4042 ]. |
4042 ]. |
4043 |
4043 |
4044 lockSema critical:[ |
4044 lockSema critical:[ |
4045 damages := OrderedCollection new:(8 * aList size). |
4045 damages := OrderedCollection new:(8 * aList size). |
4046 |
4046 |
4047 aList do:[:item| |
4047 aList do:[:item| |
4048 item handlesDo:[:handle :what| |
4048 item handlesDo:[:handle :what| |
4049 damages reverseDo:[:el| |
4049 damages reverseDo:[:el| |
4050 (el intersects:handle) ifTrue:[ |
4050 (el intersects:handle) ifTrue:[ |
4051 damages removeIdentical:el. |
4051 damages removeIdentical:el. |
4052 |
4052 |
4053 handle left:(handle left min:el left) |
4053 handle left:(handle left min:el left) |
4054 right:(handle right max:el right) |
4054 right:(handle right max:el right) |
4055 top:(handle top min:el top) |
4055 top:(handle top min:el top) |
4056 bottom:(handle bottom max:el bottom) |
4056 bottom:(handle bottom max:el bottom) |
4057 ] |
4057 ] |
4058 ]. |
4058 ]. |
4059 damages add:handle |
4059 damages add:handle |
4060 ] |
4060 ] |
4061 ]. |
4061 ]. |
4062 |
4062 |
4063 damages do:[:el| |
4063 damages do:[:el| |
4064 x := el left. |
4064 x := el left. |
4065 y := el top. |
4065 y := el top. |
4066 w := el width. |
4066 w := el width. |
4067 h := el height. |
4067 h := el height. |
4068 |
4068 |
4069 rootView clearRectangleX:x y:y width:w height:h. |
4069 rootView clearRectangleX:x y:y width:w height:h. |
4070 rootView exposeX:x y:y width:w height:h. |
4070 rootView exposeX:x y:y width:w height:h. |
4071 ]. |
4071 ]. |
4072 |
4072 |
4073 (subViews := rootView subViews) notNil ifTrue:[ |
4073 (subViews := rootView subViews) notNil ifTrue:[ |
4074 subViews reverseDo:[:v| self recursiveRepair:damages startIn:v relativeTo:rootView ]. |
4074 subViews reverseDo:[:v| self recursiveRepair:damages startIn:v relativeTo:rootView ]. |
4075 ]. |
4075 ]. |
4076 ]. |
4076 ]. |
4077 ! ! |
4077 ! ! |
4078 |
4078 |
4079 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'queries'! |
4079 !ViewTreeInspectorApplication::ViewTreeModel methodsFor:'queries'! |
4080 |
4080 |
4359 |unselected rootView rootItem selSize| |
4359 |unselected rootView rootItem selSize| |
4360 |
4360 |
4361 selSize := selection size. |
4361 selSize := selection size. |
4362 |
4362 |
4363 selSize == 0 ifTrue:[ |
4363 selSize == 0 ifTrue:[ |
4364 selectedSuperItems := #(). |
4364 selectedSuperItems := #(). |
4365 ] ifFalse:[ |
4365 ] ifFalse:[ |
4366 selSize == 1 ifTrue:[ |
4366 selSize == 1 ifTrue:[ |
4367 selectedSuperItems := Array with:(selection at:1). |
4367 selectedSuperItems := Array with:(selection at:1). |
4368 ] ifFalse:[ |
4368 ] ifFalse:[ |
4369 rootItem := listOfItems root. |
4369 rootItem := listOfItems root. |
4370 |
4370 |
4371 (selection includesIdentical:rootItem) ifTrue:[ |
4371 (selection includesIdentical:rootItem) ifTrue:[ |
4372 selectedSuperItems := Array with:rootItem. |
4372 selectedSuperItems := Array with:rootItem. |
4373 ] ifFalse:[ |
4373 ] ifFalse:[ |
4374 selectedSuperItems := OrderedCollection new:selSize. |
4374 selectedSuperItems := OrderedCollection new:selSize. |
4375 |
4375 |
4376 selection do:[:anItem| |
4376 selection do:[:anItem| |
4377 anItem parentsDetect:[:el| selection includesIdentical:el ] |
4377 anItem parentsDetect:[:el| selection includesIdentical:el ] |
4378 ifNone:[ selectedSuperItems add:anItem ]. |
4378 ifNone:[ selectedSuperItems add:anItem ]. |
4379 ]. |
4379 ]. |
4380 ] |
4380 ] |
4381 ] |
4381 ] |
4382 ]. |
4382 ]. |
4383 |
4383 |
4384 ( hiddenLevel == 0 |
4384 ( hiddenLevel == 0 |
4385 and:[(rootView := listOfItems rootView) notNil |
4385 and:[(rootView := listOfItems rootView) notNil |
4386 and:[rootView shown]] |
4386 and:[rootView shown]] |
4387 ) ifTrue:[ |
4387 ) ifTrue:[ |
4388 selSize == 0 ifTrue:[ |
4388 selSize == 0 ifTrue:[ |
4389 "/ must redraw the old selection unselected |
4389 "/ must redraw the old selection unselected |
4390 self redrawUnselected:oldSelection andLock:false |
4390 self redrawUnselected:oldSelection andLock:false |
4391 ] ifFalse:[ |
4391 ] ifFalse:[ |
4392 self invalidateSelection. |
4392 self invalidateSelection. |
4393 |
4393 |
4394 oldSelection size ~~ 0 ifTrue:[ |
4394 oldSelection size ~~ 0 ifTrue:[ |
4395 "/ must redraw all elements no longer in the selection |
4395 "/ must redraw all elements no longer in the selection |
4396 unselected := oldSelection select:[:el| (selection includesIdentical:el) not ]. |
4396 unselected := oldSelection select:[:el| (selection includesIdentical:el) not ]. |
4397 self redrawUnselected:unselected andLock:false. |
4397 self redrawUnselected:unselected andLock:false. |
4398 ] |
4398 ] |
4399 ] |
4399 ] |
4400 ]. |
4400 ]. |
4401 super changed:aParameter with:oldSelection. |
4401 super changed:aParameter with:oldSelection. |
4402 ! |
4402 ! |
4403 |
4403 |
4404 setValue:aNewSelection |
4404 setValue:aNewSelection |
4405 "set the selection without notifying |
4405 "set the selection without notifying |
4406 " |
4406 " |
4407 |newSelect idx| |
4407 |newSelect idx| |
4408 |
4408 |
4409 newSelect := nil. |
4409 newSelect := nil. |
4410 |
4410 |
4411 aNewSelection notNil ifTrue:[ |
4411 aNewSelection notNil ifTrue:[ |
4412 lockSema critical:[ |
4412 lockSema critical:[ |
4413 aNewSelection isCollection ifFalse:[ |
4413 aNewSelection isCollection ifFalse:[ |
4414 (selection size == 1 and:[selection first == aNewSelection]) ifTrue:[ |
4414 (selection size == 1 and:[selection first == aNewSelection]) ifTrue:[ |
4415 newSelect := selection |
4415 newSelect := selection |
4416 ] ifFalse:[ |
4416 ] ifFalse:[ |
4417 newSelect := Array with:aNewSelection. |
4417 newSelect := Array with:aNewSelection. |
4418 ] |
4418 ] |
4419 ] ifTrue:[ |
4419 ] ifTrue:[ |
4420 aNewSelection notEmpty ifTrue:[ |
4420 aNewSelection notEmpty ifTrue:[ |
4421 aNewSelection size ~~ selection size ifTrue:[ |
4421 aNewSelection size ~~ selection size ifTrue:[ |
4422 newSelect := aNewSelection copy. |
4422 newSelect := aNewSelection copy. |
4423 ] ifFalse:[ |
4423 ] ifFalse:[ |
4424 idx := selection findFirst:[:el| (aNewSelection includesIdentical:el) not ]. |
4424 idx := selection findFirst:[:el| (aNewSelection includesIdentical:el) not ]. |
4425 |
4425 |
4426 idx ~~ 0 ifTrue:[newSelect := aNewSelection copy] |
4426 idx ~~ 0 ifTrue:[newSelect := aNewSelection copy] |
4427 ifFalse:[newSelect := selection ]. |
4427 ifFalse:[newSelect := selection ]. |
4428 ] |
4428 ] |
4429 ] |
4429 ] |
4430 ] |
4430 ] |
4431 ]. |
4431 ]. |
4432 ]. |
4432 ]. |
4433 newSelect ~~ selection ifTrue:[ |
4433 newSelect ~~ selection ifTrue:[ |
4434 beforeSelectionChangedAction value. |
4434 beforeSelectionChangedAction value. |
4435 selection := newSelect. |
4435 selection := newSelect. |
4436 selection notNil ifTrue:[selection do:[:el| el makeVisible]] |
4436 selection notNil ifTrue:[selection do:[:el| el makeVisible]] |
4437 ]. |
4437 ]. |
4438 ! |
4438 ! |
4439 |
4439 |
4440 triggerValue:aValue |
4440 triggerValue:aValue |
4441 "set my value & send change notifications to my dependents. |
4441 "set my value & send change notifications to my dependents. |
4442 Send the change message even if the value didn't change. |
4442 Send the change message even if the value didn't change. |
4443 " |
4443 " |
4444 |oldSelection| |
4444 |oldSelection| |
4445 |
4445 |
4446 lockSema critical:[ |
4446 lockSema critical:[ |
4447 oldSelection := selection. |
4447 oldSelection := selection. |
4448 self setValue:aValue. |
4448 self setValue:aValue. |
4449 self changed:#value with:oldSelection |
4449 self changed:#value with:oldSelection |
4450 ] |
4450 ] |
4451 ! |
4451 ! |
4452 |
4452 |
4453 value |
4453 value |
4454 "returns the current selection |
4454 "returns the current selection |
4627 |
4627 |
4628 rootView := self rootView. |
4628 rootView := self rootView. |
4629 super root:theRoot. |
4629 super root:theRoot. |
4630 |
4630 |
4631 rootView notNil ifTrue:[ |wgrp| |
4631 rootView notNil ifTrue:[ |wgrp| |
4632 wgrp := rootView windowGroup. |
4632 wgrp := rootView windowGroup. |
4633 |
4633 |
4634 wgrp notNil ifTrue:[ |
4634 wgrp notNil ifTrue:[ |
4635 wgrp removePreEventHook:treeModel. |
4635 wgrp removePreEventHook:treeModel. |
4636 wgrp removePostEventHook:self. |
4636 wgrp removePostEventHook:self. |
4637 ]. |
4637 ]. |
4638 ]. |
4638 ]. |
4639 |
4639 |
4640 super root:theRoot. |
4640 super root:theRoot. |
4641 rootView := self rootView. |
4641 rootView := self rootView. |
4642 |
4642 |
4643 rootView notNil ifTrue:[ |
4643 rootView notNil ifTrue:[ |
4644 "must setup a task because there might not exist a windowGroup at the moment |
4644 "must setup a task because there might not exist a windowGroup at the moment |
4645 " |
4645 " |
4646 [ |wgrp| |
4646 [ |wgrp| |
4647 |
4647 |
4648 [rootView == self rootView] whileTrue:[ |
4648 [rootView == self rootView] whileTrue:[ |
4649 wgrp := rootView windowGroup. |
4649 wgrp := rootView windowGroup. |
4650 wgrp notNil ifTrue:[ |
4650 wgrp notNil ifTrue:[ |
4651 rootView := nil. |
4651 rootView := nil. |
4652 wgrp addPreEventHook:treeModel. |
4652 wgrp addPreEventHook:treeModel. |
4653 wgrp addPostEventHook:self. |
4653 wgrp addPostEventHook:self. |
4654 ] ifFalse:[ |
4654 ] ifFalse:[ |
4655 Delay waitForMilliseconds:100. |
4655 Delay waitForMilliseconds:100. |
4656 ]. |
4656 ]. |
4657 ]. |
4657 ]. |
4658 |
4658 |
4659 ] forkAt:(Processor userSchedulingPriority + 2). |
4659 ] forkAt:(Processor userSchedulingPriority + 2). |
4660 ]. |
4660 ]. |
4661 treeModel notNil ifTrue:[ |
4661 treeModel notNil ifTrue:[ |
4662 treeModel targetWidgetChanged. |
4662 treeModel targetWidgetChanged. |
4663 ]. |
4663 ]. |
4664 |
4664 |
4665 ^ root. |
4665 ^ root. |
4666 ! |
4666 ! |
4667 |
4667 |
4668 rootView |
4668 rootView |
4669 "returns the widget assigned to the root or nil |
4669 "returns the widget assigned to the root or nil |
4684 |
4684 |
4685 |widget l applClass applClassName key| |
4685 |widget l applClass applClassName key| |
4686 |
4686 |
4687 l := nil. |
4687 l := nil. |
4688 showWidgetNames == true ifTrue:[ |
4688 showWidgetNames == true ifTrue:[ |
4689 (widget := anItem widget) notNil ifTrue:[ |
4689 (widget := anItem widget) notNil ifTrue:[ |
4690 l := '"', widget name, '"' |
4690 l := '"', widget name, '"' |
4691 ] ifFalse:[ |
4691 ] ifFalse:[ |
4692 l := '"', anItem menuItem label asString, '"' |
4692 l := '"', anItem menuItem label asString, '"' |
4693 ]. |
4693 ]. |
4694 ]. |
4694 ]. |
4695 |
4695 |
4696 anItem isApplicationClass ifTrue:[ |
4696 anItem isApplicationClass ifTrue:[ |
4697 applClass := anItem applicationClass. |
4697 applClass := anItem applicationClass. |
4698 applClass notNil ifTrue:[ |
4698 applClass notNil ifTrue:[ |
4699 applClassName := '[', applClass name allBold, ']'. |
4699 applClassName := '[', applClass name allBold, ']'. |
4700 l := (l isNil ifTrue:[''] ifFalse:[l , ' ']) , applClassName |
4700 l := (l isNil ifTrue:[''] ifFalse:[l , ' ']) , applClassName |
4701 ]. |
4701 ]. |
4702 ]. |
4702 ]. |
4703 |
4703 |
4704 application notNil ifTrue:[ |
4704 application notNil ifTrue:[ |
4705 key := application builder namedComponents keyAtValue:widget ifAbsent:nil. |
4705 key := application builder namedComponents keyAtValue:widget ifAbsent:nil. |
4706 key notNil ifTrue:[ |
4706 key notNil ifTrue:[ |
4707 l := l , ' #',key |
4707 l := l , ' #',key |
4708 ]. |
4708 ]. |
4709 ]. |
4709 ]. |
4710 |
4710 |
4711 ^ l |
4711 ^ l |
4712 |
4712 |
4713 "Modified: / 16-08-2017 / 12:47:12 / cg" |
4713 "Modified: / 16-08-2017 / 12:47:12 / cg" |
4759 "returns the bottom-most item which contains the view |
4759 "returns the bottom-most item which contains the view |
4760 " |
4760 " |
4761 |view item topView| |
4761 |view item topView| |
4762 |
4762 |
4763 root notNil ifTrue:[ |
4763 root notNil ifTrue:[ |
4764 view := aView. |
4764 view := aView. |
4765 topView := root widget. |
4765 topView := root widget. |
4766 |
4766 |
4767 [ view notNil ] whileTrue:[ |
4767 [ view notNil ] whileTrue:[ |
4768 topView == view ifTrue:[^ root]. |
4768 topView == view ifTrue:[^ root]. |
4769 item := root recursiveDetect:[:el| el widget == view ]. |
4769 item := root recursiveDetect:[:el| el widget == view ]. |
4770 item notNil ifTrue:[^ item]. |
4770 item notNil ifTrue:[^ item]. |
4771 view := view superView |
4771 view := view superView |
4772 ] |
4772 ] |
4773 ]. |
4773 ]. |
4774 ^ nil |
4774 ^ nil |
4775 ! |
4775 ! |
4776 |
4776 |
4777 recursiveDetect:aOneOrgBlock |
4777 recursiveDetect:aOneOrgBlock |
4778 "recursive find the first child, for which evaluation |
4778 "recursive find the first child, for which evaluation |
4779 of the block returns true; if none nil is returned |
4779 of the block returns true; if none nil is returned |
4780 " |
4780 " |
4781 root notNil ifTrue:[ |
4781 root notNil ifTrue:[ |
4782 (aOneOrgBlock value:root) ifTrue:[ ^ root ]. |
4782 (aOneOrgBlock value:root) ifTrue:[ ^ root ]. |
4783 ^ root recursiveDetect:aOneOrgBlock |
4783 ^ root recursiveDetect:aOneOrgBlock |
4784 ]. |
4784 ]. |
4785 ^ nil |
4785 ^ nil |
4786 ! ! |
4786 ! ! |
4787 |
4787 |