134 |
134 |
135 buttonTranslation:anArray |
135 buttonTranslation:anArray |
136 "set the button translation, #(1 2 3) is no-translation, |
136 "set the button translation, #(1 2 3) is no-translation, |
137 #(3 2 1) is ok for left-handers" |
137 #(3 2 1) is ok for left-handers" |
138 |
138 |
139 ButtonTranslation := anArray |
139 ButtonTranslation := anArray. |
|
140 Display notNil ifTrue:[ |
|
141 Display buttonTranslation:anArray |
|
142 ]. |
140 ! ! |
143 ! ! |
141 |
144 |
142 !DeviceWorkstation methodsFor:'initialize / release'! |
145 !DeviceWorkstation methodsFor:'initialize / release'! |
143 |
146 |
144 initialize |
147 initialize |
791 |curs p| |
794 |curs p| |
792 |
795 |
793 curs := Cursor crossHair on:self. |
796 curs := Cursor crossHair on:self. |
794 |
797 |
795 self ungrabPointer. |
798 self ungrabPointer. |
796 self grabPointerIn:RootView id withCursor:curs id |
799 self grabPointerIn:(RootView id) withCursor:(curs id) |
797 pointerMode:#async keyboardMode:#sync confineTo:nil. |
800 pointerMode:#async keyboardMode:#sync confineTo:nil. |
798 ActiveGrab := RootView. |
801 ActiveGrab := RootView. |
799 |
802 |
800 [self leftButtonPressed] whileFalse:[]. |
803 [self leftButtonPressed] whileFalse:[]. |
801 p := self pointerPosition. |
804 p := self pointerPosition. |
802 |
805 |
820 |
823 |
821 curs1 := Cursor origin on:self. |
824 curs1 := Cursor origin on:self. |
822 curs2 := Cursor corner on:self. |
825 curs2 := Cursor corner on:self. |
823 |
826 |
824 self ungrabPointer. |
827 self ungrabPointer. |
825 self grabPointerIn:RootView id withCursor:curs1 id |
828 self grabPointerIn:(RootView id) withCursor:(curs1 id) |
826 pointerMode:#async keyboardMode:#sync confineTo:nil. |
829 pointerMode:#async keyboardMode:#sync confineTo:nil. |
827 ActiveGrab := RootView. |
830 ActiveGrab := RootView. |
828 |
831 |
829 [self leftButtonPressed] whileFalse:[]. |
832 [self leftButtonPressed] whileFalse:[]. |
830 origin := self pointerPosition. |
833 origin := self pointerPosition. |
831 |
834 |
832 self ungrabPointer. |
835 self ungrabPointer. |
833 self grabPointerIn:RootView id withCursor:curs1 id |
836 self grabPointerIn:(RootView id) withCursor:(curs1 id) |
834 pointerMode:#async keyboardMode:#sync confineTo:nil. |
837 pointerMode:#async keyboardMode:#sync confineTo:nil. |
835 |
838 |
836 |
839 |
837 RootView noClipByChildren. |
840 RootView noClipByChildren. |
838 |
841 |
1626 "release the keyboard" |
1630 "release the keyboard" |
1627 |
1631 |
1628 ^ self subclassResponsibility |
1632 ^ self subclassResponsibility |
1629 ! |
1633 ! |
1630 |
1634 |
|
1635 grabPointerIn:aWindowId withCursor:cursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
|
1636 "grap the pointer - all pointer events will be reported to aWindowId. The cursor will be set to cursorId |
|
1637 for the duration of the grab. For pMode/kMode, see X documentation. The pointer is restricted to |
|
1638 confineId - if non-nil." |
|
1639 |
|
1640 ^ self subclassResponsibility |
|
1641 ! |
|
1642 |
1631 grabPointerIn:aWindowId |
1643 grabPointerIn:aWindowId |
1632 "grap the pointer" |
1644 "grap the pointer - return true if ok" |
1633 |
1645 |
1634 ^ self subclassResponsibility |
1646 ^ self grabPointerIn:aWindowId withCursor:nil pointerMode:#async keyboardMode:#sync confineTo:nil |
1635 ! |
1647 ! |
1636 |
1648 |
1637 ungrabPointer |
1649 ungrabPointer |
1638 "release the pointer" |
1650 "release the pointer" |
1639 |
1651 |
1946 ^ self subclassResponsibility |
1958 ^ self subclassResponsibility |
1947 ! ! |
1959 ! ! |
1948 |
1960 |
1949 !DeviceWorkstation methodsFor:'drawing'! |
1961 !DeviceWorkstation methodsFor:'drawing'! |
1950 |
1962 |
1951 displayString:aString x:x y:y in:aDrawableId with:aGCId round:round opaque:opaque |
1963 displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
1952 "draw a string" |
1964 "draw a string" |
1953 |
1965 |
1954 ^ self subclassResponsibility |
1966 ^ self subclassResponsibility |
1955 ! |
1967 ! |
1956 |
1968 |
1957 displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId round:round opaque:opaque |
1969 displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
1958 "draw part of a string" |
1970 "draw part of a string" |
1959 |
1971 |
1960 "should be redefined to avoid creation of throw-away string" |
1972 " |
|
1973 should be redefined in concrete subclasses |
|
1974 to avoid creation of throw-away string |
|
1975 " |
1961 self displayString:(aString copyFrom:i1 to:i2) |
1976 self displayString:(aString copyFrom:i1 to:i2) |
1962 x:x |
1977 x:x |
1963 y:y |
1978 y:y |
1964 in:aDrawableId |
1979 in:aDrawableId |
1965 with:aGCId |
1980 with:aGCId |
1966 round:round |
|
1967 opaque:opaque |
1981 opaque:opaque |
1968 ! |
1982 ! |
1969 |
1983 |
1970 displayString:aString x:x y:y in:aDrawableId with:aGCId |
1984 displayString:aString x:x y:y in:aDrawableId with:aGCId |
1971 "draw a string - draw foreground only. |
1985 "draw a string - draw foreground only. |
|
1986 If the coordinates are not integers, retry with rounded." |
|
1987 |
|
1988 self |
|
1989 displayString:aString |
|
1990 x:x |
|
1991 y:y |
|
1992 in:aDrawableId |
|
1993 with:aGCId |
|
1994 opaque:false |
|
1995 ! |
|
1996 |
|
1997 displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
1998 "draw a sub-string - draw foreground only. |
|
1999 If the coordinates are not integers, retry with rounded." |
|
2000 |
|
2001 self |
|
2002 displayString:aString |
|
2003 from:index1 |
|
2004 to:index2 |
|
2005 x:x |
|
2006 y:y |
|
2007 in:aDrawableId |
|
2008 with:aGCId |
|
2009 opaque:false |
|
2010 ! |
|
2011 |
|
2012 displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
|
2013 "draw a string - draw foreground on background. |
1972 If the coordinates are not integers, retry with rounded." |
2014 If the coordinates are not integers, retry with rounded." |
1973 |
2015 |
1974 self displayString:aString |
2016 self displayString:aString |
1975 x:x |
2017 x:x |
1976 y:y |
2018 y:y |
1977 in:aDrawableId |
2019 in:aDrawableId |
1978 with:aGCId |
2020 with:aGCId |
1979 round:true |
2021 opaque:true |
1980 opaque:false |
2022 ! |
1981 ! |
2023 |
1982 |
2024 displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
1983 displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
2025 "draw a sub-string - draw foreground on background. |
1984 "draw a sub-string - draw foreground only. |
|
1985 If the coordinates are not integers, retry with rounded." |
2026 If the coordinates are not integers, retry with rounded." |
1986 |
2027 |
1987 self displayString:aString |
2028 self displayString:aString |
1988 from:index1 |
2029 from:index1 |
1989 to:index2 |
2030 to:index2 |
1990 x:x |
2031 x:x |
1991 y:y |
2032 y:y |
1992 in:aDrawableId |
2033 in:aDrawableId |
1993 with:aGCId |
2034 with:aGCId |
1994 round:true |
|
1995 opaque:false |
|
1996 ! |
|
1997 |
|
1998 displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
|
1999 "draw a string - draw foreground on background. |
|
2000 If the coordinates are not integers, retry with rounded." |
|
2001 |
|
2002 self displayString:aString |
|
2003 x:x |
|
2004 y:y |
|
2005 in:aDrawableId |
|
2006 with:aGCId |
|
2007 round:true |
|
2008 opaque:true |
|
2009 ! |
|
2010 |
|
2011 displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
2012 "draw a sub-string - draw foreground on background. |
|
2013 If the coordinates are not integers, retry with rounded." |
|
2014 |
|
2015 self displayString:aString |
|
2016 from:index1 |
|
2017 to:index2 |
|
2018 x:x |
|
2019 y:y |
|
2020 in:aDrawableId |
|
2021 with:aGCId |
|
2022 round:true |
|
2023 opaque:true |
2035 opaque:true |
2024 ! |
2036 ! |
2025 |
2037 |
2026 displayPointX:x y:y in:aDrawableId with:aGCId |
2038 displayPointX:x y:y in:aDrawableId with:aGCId |
2027 "draw a point" |
2039 "draw a point" |
2037 ! |
2049 ! |
2038 |
2050 |
2039 displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
2051 displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
2040 "draw a rectangle" |
2052 "draw a rectangle" |
2041 |
2053 |
2042 "should draw four lines here" |
2054 " |
|
2055 should draw four lines here |
|
2056 but then, we have to reimplement all line styles here |
|
2057 " |
2043 ^ self subclassResponsibility |
2058 ^ self subclassResponsibility |
2044 ! |
2059 ! |
2045 |
2060 |
2046 displayPolygon:aPolygon in:aDrawableId with:aGCId |
2061 displayPolygon:aPolygon in:aDrawableId with:aGCId |
2047 "draw a polygon" |
2062 "draw a polygon" |
2048 |
2063 |
2049 "should draw the lines here" |
2064 " |
|
2065 should draw the lines here |
|
2066 but then, we have to reimplement all line styles here |
|
2067 " |
2050 ^ self subclassResponsibility |
2068 ^ self subclassResponsibility |
2051 ! |
2069 ! |
2052 |
2070 |
2053 copyFromFaxImage:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
2071 copyFromFaxImage:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
2054 width:w height:h with:aGCId scaleX:scaleX scaleY:scaleY |
2072 width:w height:h with:aGCId scaleX:scaleX scaleY:scaleY |