641 |
641 |
642 (lyt intersects:damage) ifTrue:[ |
642 (lyt intersects:damage) ifTrue:[ |
643 savLyt := selTab layout. |
643 savLyt := selTab layout. |
644 selTab layout:lyt. |
644 selTab layout:lyt. |
645 selTab redrawAt:direction selected:true on:self. |
645 selTab redrawAt:direction selected:true on:self. |
|
646 |
|
647 (self hasFocus and:[styleSheet name == #win95]) ifTrue:[ |
|
648 selTab drawWin95FocusFrameOn:self |
|
649 ]. |
646 selTab layout:savLyt. |
650 selTab layout:savLyt. |
647 ] |
651 ] |
648 ]. |
652 ]. |
649 self clippingRectangle:savClip |
653 self clippingRectangle:savClip |
650 ! ! |
654 ! ! |
666 ! |
670 ! |
667 |
671 |
668 keyPress:aKey x:x y:y |
672 keyPress:aKey x:x y:y |
669 "selection might change; look for corresponding list entry |
673 "selection might change; look for corresponding list entry |
670 " |
674 " |
671 <resource: #keyboard (#CursorRight #CursorLeft)> |
675 <resource: #keyboard (#CursorRight #CursorLeft #CursorUp #CursorDown)> |
672 |
676 |
673 |sensor size index n| |
677 |sensor size index n key isHorizontal| |
674 |
678 |
675 (enabled and:[(size := list size) > 1]) ifFalse:[ |
679 (enabled and:[(size := list size) > 1]) ifFalse:[ |
676 ^ super keyPress:aKey x:x y:y |
680 ^ super keyPress:aKey x:x y:y |
677 ]. |
681 ]. |
678 |
682 |
696 ^ self selection:n |
700 ^ self selection:n |
697 ] |
701 ] |
698 ]. |
702 ]. |
699 ^ self |
703 ^ self |
700 ]. |
704 ]. |
701 |
705 (aKey isSymbol and:[aKey startsWith:'Cursor']) ifFalse:[ |
702 (aKey == #CursorRight or:[aKey == #CursorLeft]) ifFalse:[ |
|
703 ^ super keyPress:aKey x:x y:y |
706 ^ super keyPress:aKey x:x y:y |
|
707 ]. |
|
708 |
|
709 self isHorizontal ifTrue:[ |
|
710 (aKey == #CursorRight or:[aKey == #CursorLeft]) ifFalse:[ |
|
711 ^ self |
|
712 ]. |
|
713 key := aKey. |
|
714 ] ifFalse:[ |
|
715 aKey == #CursorUp ifTrue:[key := #CursorLeft] |
|
716 ifFalse:[aKey == #CursorDown ifTrue:[key := #CursorRight] |
|
717 ifFalse:[ ^ self]]. |
704 ]. |
718 ]. |
705 |
719 |
706 (sensor := self sensor) notNil ifTrue:[ |
720 (sensor := self sensor) notNil ifTrue:[ |
707 n := 1 + (sensor compressKeyPressEventsWithKey:aKey). |
721 n := 1 + (sensor compressKeyPressEventsWithKey:aKey). |
708 n := (n \\ size) max:1. |
722 n := (n \\ size) max:1. |
709 |
723 |
710 aKey == #CursorRight ifTrue:[ |
724 key == #CursorRight ifTrue:[ |
711 index := selection ? 1. |
725 index := selection ? 1. |
712 [ (index := index + 1) > size ifTrue:[index := 1]. |
726 [ (index := index + 1) > size ifTrue:[index := 1]. |
713 (self isSelectable:index) ifTrue:[n := n - 1]. |
727 (self isSelectable:index) ifTrue:[n := n - 1]. |
714 n ~~ 0 |
728 n ~~ 0 |
715 ] whileTrue. |
729 ] whileTrue. |
732 list notEmpty ifTrue:[ |
746 list notEmpty ifTrue:[ |
733 lastComputedExtent ~= self extent ifTrue:[ |
747 lastComputedExtent ~= self extent ifTrue:[ |
734 numberOfLines := nil. |
748 numberOfLines := nil. |
735 shown ifTrue:[self invalidate] |
749 shown ifTrue:[self invalidate] |
736 ] |
750 ] |
|
751 ] |
|
752 ! ! |
|
753 |
|
754 !NoteBookView methodsFor:'focus handling'! |
|
755 |
|
756 showFocus:explicit |
|
757 "got the keyboard focus |
|
758 " |
|
759 |tab| |
|
760 |
|
761 styleSheet name == #win95 ifTrue:[ |
|
762 (tab := self selectedTab) notNil ifTrue:[ |
|
763 self invalidateTab:tab |
|
764 ] |
|
765 ] ifFalse:[ |
|
766 super showFocus:explicit |
|
767 ] |
|
768 |
|
769 ! |
|
770 |
|
771 showNoFocus:explicit |
|
772 "lost the keyboard focus |
|
773 " |
|
774 |tab| |
|
775 |
|
776 styleSheet name == #win95 ifTrue:[ |
|
777 (tab := self selectedTab) notNil ifTrue:[ |
|
778 self invalidateTab:tab |
|
779 ] |
|
780 ] ifFalse:[ |
|
781 super showNoFocus:explicit |
737 ] |
782 ] |
738 ! ! |
783 ! ! |
739 |
784 |
740 !NoteBookView methodsFor:'initialize / release'! |
785 !NoteBookView methodsFor:'initialize / release'! |
741 |
786 |
1581 |
1626 |
1582 |
1627 |
1583 |
1628 |
1584 ! |
1629 ! |
1585 |
1630 |
|
1631 drawWin95FocusFrameOn:aGC |
|
1632 |
|
1633 "/aGC notNil ifTrue:[^ self]. |
|
1634 |
|
1635 aGC displayDottedRectangleX:(layout left + 4) |
|
1636 y:(layout top + 4) |
|
1637 width:(layout width - 8) |
|
1638 height:(layout height - 8). |
|
1639 ! |
|
1640 |
1586 redrawAt:aDirection selected:isSelected on:aGC |
1641 redrawAt:aDirection selected:isSelected on:aGC |
1587 "redraw tab |
1642 "redraw tab |
1588 " |
1643 " |
1589 |dispObj fgColor |
1644 |dispObj fgColor |
1590 y "{ Class:SmallInteger }" |
1645 y "{ Class:SmallInteger }" |
1591 x "{ Class:SmallInteger }" |
1646 x "{ Class:SmallInteger }" |
1592 dI "{ Class:SmallInteger }" |
|
1593 | |
1647 | |
1594 |
1648 |
1595 isSelected ifTrue:[ |
1649 isSelected ifTrue:[ |
1596 aGC paint:(aGC backgroundColor). |
1650 aGC paint:(aGC backgroundColor). |
1597 layout displayFilledOn:aGC. |
1651 layout displayFilledOn:aGC. |
1598 ]. |
1652 ]. |
1599 aDirection == #top ifTrue:[self drawAtTopOn:aGC selected:isSelected] |
1653 aDirection == #top ifTrue:[self drawAtTopOn:aGC selected:isSelected] |
1600 ifFalse:[aDirection == #bottom ifTrue:[self drawAtBottomOn:aGC selected:isSelected] |
1654 ifFalse:[aDirection == #bottom ifTrue:[self drawAtBottomOn:aGC selected:isSelected] |
1601 ifFalse:[aDirection == #right ifTrue:[self drawAtRightOn:aGC selected:isSelected] |
1655 ifFalse:[aDirection == #right ifTrue:[self drawAtRightOn:aGC selected:isSelected] |
1602 ifFalse:[aDirection == #left ifTrue:[self drawAtLeftOn:aGC selected:isSelected] |
1656 ifFalse:[ self drawAtLeftOn:aGC selected:isSelected]]]. |
1603 ifFalse:[^ self]]]]. |
|
1604 |
1657 |
1605 "/ REDRAW LABEL |
1658 "/ REDRAW LABEL |
1606 (aGC isEnabled and:[self isEnabled]) ifTrue:[ |
1659 (aGC isEnabled and:[self isEnabled]) ifTrue:[ |
1607 dispObj := printableLabel. |
1660 dispObj := printableLabel. |
1608 fgColor := aGC foregroundColor. |
1661 fgColor := aGC foregroundColor. |
1623 isSelected ifTrue:[ |
1676 isSelected ifTrue:[ |
1624 fgColor := aGC activeForegroundColor. |
1677 fgColor := aGC activeForegroundColor. |
1625 ]. |
1678 ]. |
1626 |
1679 |
1627 aGC paint:fgColor. |
1680 aGC paint:fgColor. |
1628 dI := 4. |
1681 |
1629 (aDirection == #top or:[aDirection == #bottom]) ifTrue:[ |
1682 (aDirection == #top or:[aDirection == #bottom]) ifTrue:[ |
1630 x := (layout left) + (layout width - extent x // 2). |
1683 x := layout left + (layout width - extent x // 2). |
1631 |
1684 y := layout top + (layout height - extent y // 2). |
1632 y := aDirection == #top ifTrue:[layout top + dI] |
1685 |
1633 ifFalse:[layout bottom - extent y - dI]. |
1686 aDirection == #bottom ifTrue:[y := y - 1] ifFalse:[y := y + 1]. |
1634 |
1687 |
1635 dispObj isImageOrForm ifFalse:[ |
1688 dispObj isImageOrForm ifFalse:[ |
1636 y := y + aGC font ascent |
1689 y := y + aGC font ascent |
1637 ]. |
1690 ] |
1638 ] ifFalse:[ |
1691 ] ifFalse:[ |
1639 y := (layout top) + (layout height - extent x // 2). |
1692 x := layout left + (layout width - extent y // 2). |
1640 |
1693 y := layout top + (layout height - extent x // 2). |
1641 x := aDirection == #left ifTrue:[layout left + dI] |
1694 |
1642 ifFalse:[layout right - extent y - dI]. |
1695 aDirection == #left ifTrue:[x := x + 1] ifFalse:[x := x - 1]. |
1643 |
1696 |
1644 dispObj isImageOrForm ifFalse:[ |
1697 dispObj isImageOrForm ifFalse:[ |
1645 x := x + aGC font descent. |
1698 x := x + aGC font descent. |
1646 "/ workaround for a bug in display-with-angle, |
1699 "/ workaround for a bug in display-with-angle, |
1647 "/ iff displayed string is a labelAndIcon. |
1700 "/ iff displayed string is a labelAndIcon. |