574 ! |
574 ! |
575 |
575 |
576 addView:aView |
576 addView:aView |
577 "add aView to the windowGroup" |
577 "add aView to the windowGroup" |
578 |
578 |
|
579 |sequence| |
|
580 |
579 views isNil ifTrue:[ |
581 views isNil ifTrue:[ |
580 views := OrderedCollection with:aView. |
582 views := OrderedCollection with:aView. |
581 ] ifFalse:[ |
583 ] ifFalse:[ |
582 (views includesIdentical:aView) ifFalse:[ |
584 (views includesIdentical:aView) ifFalse:[ |
583 views add:aView |
585 views add:aView |
584 ] |
586 ] |
585 ] |
587 ]. |
586 |
588 |
587 "Modified: 6.3.1996 / 15:35:41 / cg" |
589 aView canTab ifTrue:[ |
|
590 sequence := self focusSequence. |
|
591 |
|
592 (sequence includesIdentical:aView) ifFalse:[ |
|
593 sequence add:aView |
|
594 ] |
|
595 ]. |
|
596 |
588 ! |
597 ! |
589 |
598 |
590 mainView |
599 mainView |
591 "return the mainview. Thats the first topView by default" |
600 "return the mainview. Thats the first topView by default" |
592 |
601 |
601 (actually, only wake it up here - it will terminate itself |
610 (actually, only wake it up here - it will terminate itself |
602 when finding out that all views are gone)" |
611 when finding out that all views are gone)" |
603 |
612 |
604 |sema| |
613 |sema| |
605 |
614 |
|
615 self focusSequence removeIdentical:aView ifAbsent:nil. |
|
616 |
606 views notNil ifTrue:[ |
617 views notNil ifTrue:[ |
607 views removeIdentical:aView ifAbsent:nil. |
618 views removeIdentical:aView ifAbsent:nil. |
608 views isEmpty ifTrue:[ |
619 views isEmpty ifTrue:[ |
609 views := nil |
620 views := nil |
610 ] |
621 ] |
611 ]. |
622 ]. |
612 topViews notNil ifTrue:[ |
623 topViews notNil ifTrue:[ |
613 topViews removeIdentical:aView ifAbsent:nil. |
624 topViews removeIdentical:aView ifAbsent:nil. |
614 topViews isEmpty ifTrue:[ |
625 topViews isEmpty ifTrue:[ |
615 topViews := nil |
626 topViews := nil |
616 ] |
627 ] |
617 ]. |
628 ]. |
618 " |
629 " |
619 wakeup my process to look if last view has been |
630 wakeup my process to look if last view has been |
620 removed (modalBoxes terminate their modalLoop if so) |
631 removed (modalBoxes terminate their modalLoop if so) |
621 " |
632 " |
622 mySensor notNil ifTrue:[ |
633 mySensor notNil ifTrue:[ |
623 (sema := mySensor eventSemaphore) notNil ifTrue:[ |
634 (sema := mySensor eventSemaphore) notNil ifTrue:[ |
624 sema signal |
635 sema signal |
625 ] |
636 ] |
626 ] |
637 ] |
627 |
638 |
628 "Modified: 1.2.1997 / 12:13:26 / cg" |
639 "Modified: 1.2.1997 / 12:13:26 / cg" |
629 ! |
640 ! |
630 |
641 |
1544 lastIndex "{ Class: SmallInteger }" |
1555 lastIndex "{ Class: SmallInteger }" |
1545 index0 next sequence| |
1556 index0 next sequence| |
1546 |
1557 |
1547 sequence := self focusSequence. |
1558 sequence := self focusSequence. |
1548 (lastIndex := sequence size) == 0 ifTrue:[ |
1559 (lastIndex := sequence size) == 0 ifTrue:[ |
1549 ^ self |
1560 ^ self |
1550 ]. |
1561 ]. |
1551 |
1562 |
1552 focusView isNil ifTrue:[ |
1563 focusView isNil ifTrue:[ |
1553 index := 0 |
1564 index := 0 |
1554 ] ifFalse:[ |
1565 ] ifFalse:[ |
1555 index := index0 := self indexOfFocusViewInFocusSequence. |
1566 index := index0 := self indexOfFocusViewInFocusSequence. |
1556 ]. |
1567 ]. |
1557 |
1568 |
1558 [next isNil] whileTrue:[ |
1569 [next isNil] whileTrue:[ |
1559 index := index + 1. |
1570 index := index + 1. |
1560 index > lastIndex ifTrue:[ |
1571 index > lastIndex ifTrue:[ |
1561 index := 1. |
1572 index := 1. |
1562 index0 isNil ifTrue:[^ self ]. |
1573 index0 isNil ifTrue:[^ self ]. |
1563 ]. |
1574 ]. |
1564 index == index0 ifTrue:[ |
1575 index == index0 ifTrue:[ |
1565 ^ self |
1576 ^ self |
1566 ]. |
1577 ]. |
1567 |
1578 |
1568 next := (sequence at:index). |
1579 next := (sequence at:index). |
1569 next realized not ifTrue:[ |
1580 "/ next realized not ifTrue:[ |
1570 next := nil |
1581 next shown not ifTrue:[ |
1571 ] ifFalse:[ |
1582 next := nil |
1572 next enabled ifFalse:[ |
1583 ] ifFalse:[ |
1573 next := nil |
1584 next enabled ifFalse:[ |
1574 ] |
1585 next := nil |
1575 ] |
1586 ] |
|
1587 ] |
1576 ]. |
1588 ]. |
1577 |
1589 |
1578 self focusView:next byTab:true |
1590 self focusView:next byTab:true |
1579 |
1591 |
1580 " |
1592 " |
1611 |
1623 |
1612 sequence := self focusSequence. |
1624 sequence := self focusSequence. |
1613 (lastIndex := sequence size) == 0 ifTrue:[^ self]. |
1625 (lastIndex := sequence size) == 0 ifTrue:[^ self]. |
1614 |
1626 |
1615 focusView isNil ifTrue:[ |
1627 focusView isNil ifTrue:[ |
1616 index := 0 |
1628 index := 0 |
1617 ] ifFalse:[ |
1629 ] ifFalse:[ |
1618 index := self indexOfFocusViewInFocusSequence. |
1630 index := self indexOfFocusViewInFocusSequence. |
1619 index0 := index. |
1631 index0 := index. |
1620 ]. |
1632 ]. |
1621 index == 0 ifTrue:[ |
1633 index == 0 ifTrue:[ |
1622 index := lastIndex + 1. |
1634 index := lastIndex + 1. |
1623 ]. |
1635 ]. |
1624 |
1636 |
1625 [prev isNil] whileTrue:[ |
1637 [prev isNil] whileTrue:[ |
1626 index := index - 1. |
1638 index := index - 1. |
1627 index < 1 ifTrue:[ |
1639 index < 1 ifTrue:[ |
1628 index := lastIndex. |
1640 index := lastIndex. |
1629 index0 isNil ifTrue:[^ self]. |
1641 index0 isNil ifTrue:[^ self]. |
1630 ]. |
1642 ]. |
1631 index == index0 ifTrue:[^ self]. |
1643 index == index0 ifTrue:[^ self]. |
1632 |
1644 |
1633 prev := (sequence at:index). |
1645 prev := (sequence at:index). |
1634 prev realized not ifTrue:[ |
1646 "/ prev realized not ifTrue:[ |
1635 prev := nil |
1647 prev shown not ifTrue:[ |
1636 ] ifFalse:[ |
1648 prev := nil |
1637 prev enabled ifFalse:[ |
1649 ] ifFalse:[ |
1638 prev := nil |
1650 prev enabled ifFalse:[ |
1639 ] |
1651 prev := nil |
1640 ]. |
1652 ] |
|
1653 ]. |
1641 ]. |
1654 ]. |
1642 |
1655 |
1643 self focusView:prev byTab:true |
1656 self focusView:prev byTab:true |
1644 |
1657 |
1645 "Modified: / 31.10.1997 / 19:21:50 / cg" |
1658 "Modified: / 31.10.1997 / 19:21:50 / cg" |
1693 Focus is stepped in the order in which subviews occur in |
1706 Focus is stepped in the order in which subviews occur in |
1694 the sequence" |
1707 the sequence" |
1695 |
1708 |
1696 |sequence| |
1709 |sequence| |
1697 |
1710 |
1698 "/ a fix focusSequence ... |
|
1699 focusSequence notNil ifTrue:[^ focusSequence]. |
1711 focusSequence notNil ifTrue:[^ focusSequence]. |
1700 topViews isNil ifTrue:[ |
1712 |
1701 "/ mhmh - a topView-less windowGroup ... |
1713 topViews notNil ifTrue:[ |
1702 ^ nil. |
1714 topViews do:[:top | |
1703 ]. |
1715 (sequence := top focusSequence) notNil ifTrue:[ |
1704 |
1716 focusSequence := sequence asOrderedCollection. |
1705 topViews do:[:top | |
1717 ^ focusSequence |
1706 sequence := top focusSequence. |
1718 ] |
1707 sequence notNil ifTrue:[^ sequence]. |
1719 ]. |
1708 ]. |
1720 ]. |
1709 |
1721 focusSequence := OrderedCollection new. |
1710 ^ nil |
1722 ^ focusSequence |
1711 |
1723 |
1712 "Modified: / 31.10.1997 / 20:37:54 / cg" |
1724 "Modified: / 31.10.1997 / 20:37:54 / cg" |
1713 ! |
1725 ! |
1714 |
1726 |
1715 focusSequence:aSequenceableCollection |
1727 focusSequence:aSequenceableCollection |
1716 "define the focus sequence for focusNext/focusPrevious. |
1728 "define the focus sequence for focusNext/focusPrevious. |
1717 Focus is stepped in the order in which subviews occur in |
1729 Focus is stepped in the order in which subviews occur in |
1718 the sequence." |
1730 the sequence." |
1719 |
1731 |
1720 focusSequence := aSequenceableCollection |
1732 aSequenceableCollection size ~~ 0 ifTrue:[ |
1721 |
1733 focusSequence isNil ifTrue:[ |
1722 "Modified: / 31.10.1997 / 20:40:04 / cg" |
1734 focusSequence := aSequenceableCollection asOrderedCollection. |
|
1735 ] ifFalse:[ |
|
1736 aSequenceableCollection do:[:aView| |
|
1737 (focusSequence includesIdentical:aView) ifFalse:[ |
|
1738 focusSequence add:aView |
|
1739 ] |
|
1740 ] |
|
1741 ] |
|
1742 ]. |
|
1743 |
1723 ! |
1744 ! |
1724 |
1745 |
1725 focusToView:aViewOrNil |
1746 focusToView:aViewOrNil |
1726 "give focus to aViewOrNil - if its in my focusSequence" |
1747 "give focus to aViewOrNil - if its in my focusSequence" |
1727 |
1748 |