15 classVariableNames:'HandCursor' |
15 classVariableNames:'HandCursor' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Interface-UIPainter' |
17 category:'Interface-UIPainter' |
18 ! |
18 ! |
19 |
19 |
|
20 Object subclass:#ViewProperty |
|
21 instanceVariableNames:'view spec identifier' |
|
22 classVariableNames:'Identifier' |
|
23 poolDictionaries:'' |
|
24 privateIn:UIPainterView |
|
25 ! |
|
26 |
20 MultiSelectionInList subclass:#ListHolder |
27 MultiSelectionInList subclass:#ListHolder |
21 instanceVariableNames:'painter propertyList masterElement disabledChanged' |
28 instanceVariableNames:'painter propertyList masterElement disabledChanged' |
22 classVariableNames:'' |
29 classVariableNames:'' |
23 poolDictionaries:'' |
|
24 privateIn:UIPainterView |
|
25 ! |
|
26 |
|
27 Object subclass:#ViewProperty |
|
28 instanceVariableNames:'view spec identifier' |
|
29 classVariableNames:'Identifier' |
|
30 poolDictionaries:'' |
30 poolDictionaries:'' |
31 privateIn:UIPainterView |
31 privateIn:UIPainterView |
32 ! |
32 ! |
33 |
33 |
34 UIPainterView::ViewProperty subclass:#GroupProperties |
34 UIPainterView::ViewProperty subclass:#GroupProperties |
327 selectionChanged |
332 selectionChanged |
328 "selection has changed |
333 "selection has changed |
329 " |
334 " |
330 |newSel| |
335 |newSel| |
331 |
336 |
332 selection notNil ifTrue:[ |
337 self selectionDo:[:aView||p| |
333 self selectionDo:[:aView||p| |
338 (p := self propertyOfView:aView) notNil ifTrue:[ |
334 (p := self propertyOfView:aView) notNil ifTrue:[ |
339 newSel isNil ifTrue:[ |
335 newSel isNil ifTrue:[ |
340 newSel := OrderedCollection new |
336 newSel := OrderedCollection new |
341 ]. |
337 ]. |
342 newSel add:(listHolder indexOfName:(p name)) |
338 newSel add:(listHolder indexOfName:(p name)) |
|
339 ] |
|
340 ] |
343 ] |
341 ]. |
344 ]. |
342 listHolder removeDependent:self. |
345 listHolder removeDependent:self. |
343 listHolder selectionIndex:newSel. |
346 listHolder selectionIndex:newSel. |
344 listHolder addDependent:self. |
347 listHolder addDependent:self. |
353 loIdx := listHolder selectionIndex. |
356 loIdx := listHolder selectionIndex. |
354 |
357 |
355 loIdx size ~~ 0 ifTrue:[ |
358 loIdx size ~~ 0 ifTrue:[ |
356 newSel := loIdx collect:[:i|(listHolder propertyAt:i) view] |
359 newSel := loIdx collect:[:i|(listHolder propertyAt:i) view] |
357 ]. |
360 ]. |
358 self withSelectionHiddenDo:[ |
361 self updateSelectionFrom:newSel. |
359 selection := newSel |
362 ! |
360 ]. |
363 |
361 |
364 updateSelectionFrom:aSel |
|
365 "update selection from a new selection |
|
366 " |
|
367 |csel| |
|
368 |
|
369 selectionHiddenLevel == 0 ifTrue:[ |
|
370 aSel isCollection ifTrue:[ |
|
371 self selectionDo:[:el| |
|
372 (aSel includes:el) ifFalse:[self showUnselected:el] |
|
373 ] |
|
374 ] ifFalse:[ |
|
375 self selectionDo:[:el| |
|
376 aSel == el ifFalse:[self showUnselected:el] |
|
377 ] |
|
378 ] |
|
379 ]. |
|
380 self setSelection:aSel withRedraw:false. |
|
381 self showSelection |
362 ! ! |
382 ! ! |
363 |
383 |
364 !UIPainterView methodsFor:'copy & cut & paste'! |
384 !UIPainterView methodsFor:'copy & cut & paste'! |
365 |
385 |
366 copySelection |
386 copySelection |
367 "copy the selection into the cut&paste-buffer |
387 "copy the selection into the cut&paste-buffer |
368 " |
388 " |
369 |specs coll| |
389 |specs coll| |
370 |
390 |
371 coll := self minSetOfSuperViews:selection. |
391 coll := self minSetOfSuperViews:(self selection). |
372 |
392 |
373 coll notNil ifTrue:[ |
393 coll notNil ifTrue:[ |
374 self unselect. |
394 self unselect. |
375 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
395 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
376 self setSelection:specs |
396 self setSelection:specs |
383 "delete the selection; copy the selection into the cut&paste-buffer |
403 "delete the selection; copy the selection into the cut&paste-buffer |
384 and open a transaction |
404 and open a transaction |
385 " |
405 " |
386 |text specs coll| |
406 |text specs coll| |
387 |
407 |
388 coll := self minSetOfSuperViews:selection. |
408 coll := self minSetOfSuperViews:(self selection). |
389 |
409 |
390 coll notNil ifTrue:[ |
410 coll notNil ifTrue:[ |
391 listHolder disableNotificationsWhileEvaluating:[ |
411 listHolder disableNotificationsWhileEvaluating:[ |
392 self unselect. |
412 self unselect. |
393 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
413 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
877 !UIPainterView methodsFor:'group manipulations'! |
897 !UIPainterView methodsFor:'group manipulations'! |
878 |
898 |
879 groupEnterFields |
899 groupEnterFields |
880 |props group objects| |
900 |props group objects| |
881 |
901 |
882 selection isNil ifTrue:[^ self]. |
902 self hasSelection ifFalse:[ |
|
903 ^ self |
|
904 ]. |
883 self selectionDo:[:aView | |
905 self selectionDo:[:aView | |
884 (aView isKindOf:EditField) ifFalse:[ |
906 (aView isKindOf:EditField) ifFalse:[ |
885 self warn:'select EditFields only !!'. |
907 self warn:'select EditFields only !!'. |
886 ^ self |
908 ^ self |
887 ] |
909 ] |
907 ! |
929 ! |
908 |
930 |
909 groupRadioButtons |
931 groupRadioButtons |
910 |props name group objects| |
932 |props name group objects| |
911 |
933 |
912 selection isNil ifTrue:[^ self]. |
934 self hasSelection ifFalse:[ |
|
935 ^ self |
|
936 ]. |
913 self selectionDo:[:aView | |
937 self selectionDo:[:aView | |
914 (aView isKindOf:RadioButton) ifFalse:[ |
938 (aView isKindOf:RadioButton) ifFalse:[ |
915 self warn:'select RadioButtons only !!'. |
939 self warn:'select RadioButtons only !!'. |
916 ^ self |
940 ^ self |
917 ] |
941 ] |
993 !UIPainterView methodsFor:'menus'! |
1017 !UIPainterView methodsFor:'menus'! |
994 |
1018 |
995 showFontPanel |
1019 showFontPanel |
996 |action theFont fontPanel| |
1020 |action theFont fontPanel| |
997 |
1021 |
998 fontPanel := FontPanel new. |
1022 self hasSelection ifTrue:[ |
999 |
1023 fontPanel := FontPanel new. |
1000 selection notNil ifTrue:[ |
|
1001 action := [:aFontDescription | theFont := aFontDescription]. |
1024 action := [:aFontDescription | theFont := aFontDescription]. |
1002 fontPanel action:action. |
1025 fontPanel action:action. |
1003 fontPanel showAtPointer. |
1026 fontPanel showAtPointer. |
1004 fontPanel destroy. |
1027 fontPanel destroy. |
1005 theFont notNil ifTrue:[ |
1028 theFont notNil ifTrue:[ |
1006 self changeFont:theFont |
1029 self changeFont:theFont |
1007 ] |
1030 ] |
1008 ] |
1031 ] |
1009 |
|
1010 "Modified: 10.4.1997 / 10:06:15 / cg" |
|
1011 ! |
1032 ! |
1012 |
1033 |
1013 showMiddleButtonMenu |
1034 showMiddleButtonMenu |
1014 "show the middle button menu; this returns nil |
1035 "show the middle button menu; this returns nil |
1015 " |
1036 " |
1020 ]. |
1041 ]. |
1021 menu := MenuPanel fromSpec:(self class menu) receiver:self. |
1042 menu := MenuPanel fromSpec:(self class menu) receiver:self. |
1022 |
1043 |
1023 canPaste := self canPaste:(self getSelection). |
1044 canPaste := self canPaste:(self getSelection). |
1024 |
1045 |
1025 selection isNil ifTrue:[ |
1046 self hasSelection ifTrue:[ |
|
1047 canPaste := (canPaste and:[self canPasteInto:(self selection)]) |
|
1048 ] ifFalse:[ |
1026 menu disableAll |
1049 menu disableAll |
1027 ] ifFalse:[ |
1050 ]. |
1028 canPaste := (canPaste and:[self canPasteInto:selection]) |
1051 menu enabledAt:#paste put:canPaste. |
1029 ]. |
1052 menu enabledAt:#undo put:(undoHistory notEmpty). |
1030 menu enabledAt:#paste put:[|can| |
|
1031 can := self canPaste:(self getSelection). |
|
1032 selection isNil ifTrue:[can] |
|
1033 ifFalse:[(can and:[self canPasteInto:selection])] |
|
1034 ]. |
|
1035 |
|
1036 menu enabledAt:#undo put:(undoHistory notEmpty). |
|
1037 menu startUp. |
1053 menu startUp. |
1038 ^ nil |
1054 ^ nil |
1039 |
1055 |
1040 |
1056 |
1041 |
1057 |
1272 ] ifFalse:[ |
1288 ] ifFalse:[ |
1273 self addTreeFrom:startAtView to:aCollection |
1289 self addTreeFrom:startAtView to:aCollection |
1274 ]. |
1290 ]. |
1275 |
1291 |
1276 aCollection size > 1 ifTrue:[ |
1292 aCollection size > 1 ifTrue:[ |
1277 self withSelectionHiddenDo:[ |
1293 self updateSelectionFrom:aCollection. |
1278 selection := aCollection |
|
1279 ]. |
|
1280 self selectionChanged |
1294 self selectionChanged |
1281 ] |
1295 ] |
1282 ! ! |
1296 ! ! |
1283 |
1297 |
1284 !UIPainterView methodsFor:'specification'! |
1298 !UIPainterView methodsFor:'specification'! |
1598 ] |
1612 ] |
1599 ]. |
1613 ]. |
1600 |
1614 |
1601 |
1615 |
1602 |
1616 |
|
1617 ! ! |
|
1618 |
|
1619 !UIPainterView::ViewProperty class methodsFor:'documentation'! |
|
1620 |
|
1621 version |
|
1622 ^ '$Header$' |
|
1623 ! ! |
|
1624 |
|
1625 !UIPainterView::ViewProperty class methodsFor:'instance creation'! |
|
1626 |
|
1627 new |
|
1628 Identifier notNil ifTrue:[Identifier := Identifier + 1] |
|
1629 ifFalse:[Identifier := 1]. |
|
1630 |
|
1631 ^ self basicNew initialize |
|
1632 ! ! |
|
1633 |
|
1634 !UIPainterView::ViewProperty methodsFor:'accessing'! |
|
1635 |
|
1636 group |
|
1637 ^ nil |
|
1638 ! |
|
1639 |
|
1640 identifier |
|
1641 "return the unique identifier assigned to property |
|
1642 " |
|
1643 ^ identifier |
|
1644 ! |
|
1645 |
|
1646 spec |
|
1647 "return the value of the instance variable 'spec' (automatically generated)" |
|
1648 |
|
1649 ^ spec! |
|
1650 |
|
1651 spec:something |
|
1652 "set the value of the instance variable 'spec' (automatically generated)" |
|
1653 |
|
1654 spec := something.! |
|
1655 |
|
1656 view |
|
1657 "return the value of the instance variable 'view' (automatically generated)" |
|
1658 |
|
1659 ^ view! |
|
1660 |
|
1661 view:something |
|
1662 "set the value of the instance variable 'view' (automatically generated)" |
|
1663 |
|
1664 view := something.! ! |
|
1665 |
|
1666 !UIPainterView::ViewProperty methodsFor:'initialization'! |
|
1667 |
|
1668 initialize |
|
1669 super initialize. |
|
1670 identifier := Identifier |
|
1671 ! ! |
|
1672 |
|
1673 !UIPainterView::ViewProperty methodsFor:'misc'! |
|
1674 |
|
1675 extractNumberStartingAt:anIndex |
|
1676 "return the number from the name starting at anIndex or 0. |
|
1677 " |
|
1678 |val| |
|
1679 |
|
1680 val := 0. |
|
1681 |
|
1682 self name from:anIndex do:[:c| |
|
1683 c isDigit ifTrue:[val := val * 10 + c digitValue] |
|
1684 ifFalse:[^ 0] |
|
1685 ]. |
|
1686 ^ val |
|
1687 |
|
1688 ! ! |
|
1689 |
|
1690 !UIPainterView::ViewProperty methodsFor:'spec messages'! |
|
1691 |
|
1692 doesNotUnderstand:aMessage |
|
1693 spec notNil ifTrue:[ |
|
1694 (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec] |
|
1695 ]. |
|
1696 ^ nil |
|
1697 ! |
|
1698 |
|
1699 layout |
|
1700 spec layout |
|
1701 ! |
|
1702 |
|
1703 layout:aLayout |
|
1704 spec layout:aLayout |
|
1705 ! |
|
1706 |
|
1707 name |
|
1708 ^ spec name |
|
1709 ! |
|
1710 |
|
1711 name:aName |
|
1712 spec name:aName |
1603 ! ! |
1713 ! ! |
1604 |
1714 |
1605 !UIPainterView::ListHolder class methodsFor:'instance creation'! |
1715 !UIPainterView::ListHolder class methodsFor:'instance creation'! |
1606 |
1716 |
1607 for:aPainter |
1717 for:aPainter |
1931 |
2041 |
1932 self masterElement:masterIndex. |
2042 self masterElement:masterIndex. |
1933 super selectionIndex:aSel |
2043 super selectionIndex:aSel |
1934 ! ! |
2044 ! ! |
1935 |
2045 |
1936 !UIPainterView::ViewProperty class methodsFor:'documentation'! |
2046 !UIPainterView::GroupProperties methodsFor:'accessing'! |
|
2047 |
|
2048 controlledObjects |
|
2049 "return the value of the instance variable 'controlledObjects' (automatically generated)" |
|
2050 |
|
2051 ^ controlledObjects! |
|
2052 |
|
2053 controlledObjects:something |
|
2054 "set the value of the instance variable 'controlledObjects' (automatically generated)" |
|
2055 |
|
2056 controlledObjects := something.! |
|
2057 |
|
2058 group |
|
2059 "return the value of the instance variable 'group' |
|
2060 " |
|
2061 ^ group |
|
2062 ! |
|
2063 |
|
2064 group:something |
|
2065 "set the value of the instance variable 'group' |
|
2066 " |
|
2067 group := something. |
|
2068 ! |
|
2069 |
|
2070 name |
|
2071 "return the value of the group name |
|
2072 " |
|
2073 ^ name |
|
2074 ! |
|
2075 |
|
2076 name:aName |
|
2077 "set the value of the group name |
|
2078 " |
|
2079 name := aName |
|
2080 ! ! |
|
2081 |
|
2082 !UIPainterView class methodsFor:'documentation'! |
1937 |
2083 |
1938 version |
2084 version |
1939 ^ '$Header$' |
2085 ^ '$Header$' |
1940 ! ! |
2086 ! ! |
1941 |
|
1942 !UIPainterView::ViewProperty class methodsFor:'instance creation'! |
|
1943 |
|
1944 new |
|
1945 Identifier notNil ifTrue:[Identifier := Identifier + 1] |
|
1946 ifFalse:[Identifier := 1]. |
|
1947 |
|
1948 ^ self basicNew initialize |
|
1949 ! ! |
|
1950 |
|
1951 !UIPainterView::ViewProperty methodsFor:'accessing'! |
|
1952 |
|
1953 group |
|
1954 ^ nil |
|
1955 ! |
|
1956 |
|
1957 identifier |
|
1958 "return the unique identifier assigned to property |
|
1959 " |
|
1960 ^ identifier |
|
1961 ! |
|
1962 |
|
1963 spec |
|
1964 "return the value of the instance variable 'spec' (automatically generated)" |
|
1965 |
|
1966 ^ spec! |
|
1967 |
|
1968 spec:something |
|
1969 "set the value of the instance variable 'spec' (automatically generated)" |
|
1970 |
|
1971 spec := something.! |
|
1972 |
|
1973 view |
|
1974 "return the value of the instance variable 'view' (automatically generated)" |
|
1975 |
|
1976 ^ view! |
|
1977 |
|
1978 view:something |
|
1979 "set the value of the instance variable 'view' (automatically generated)" |
|
1980 |
|
1981 view := something.! ! |
|
1982 |
|
1983 !UIPainterView::ViewProperty methodsFor:'initialization'! |
|
1984 |
|
1985 initialize |
|
1986 super initialize. |
|
1987 identifier := Identifier |
|
1988 ! ! |
|
1989 |
|
1990 !UIPainterView::ViewProperty methodsFor:'misc'! |
|
1991 |
|
1992 extractNumberStartingAt:anIndex |
|
1993 "return the number from the name starting at anIndex or 0. |
|
1994 " |
|
1995 |val| |
|
1996 |
|
1997 val := 0. |
|
1998 |
|
1999 self name from:anIndex do:[:c| |
|
2000 c isDigit ifTrue:[val := val * 10 + c digitValue] |
|
2001 ifFalse:[^ 0] |
|
2002 ]. |
|
2003 ^ val |
|
2004 |
|
2005 ! ! |
|
2006 |
|
2007 !UIPainterView::ViewProperty methodsFor:'spec messages'! |
|
2008 |
|
2009 doesNotUnderstand:aMessage |
|
2010 spec notNil ifTrue:[ |
|
2011 (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec] |
|
2012 ]. |
|
2013 ^ nil |
|
2014 ! |
|
2015 |
|
2016 layout |
|
2017 spec layout |
|
2018 ! |
|
2019 |
|
2020 layout:aLayout |
|
2021 spec layout:aLayout |
|
2022 ! |
|
2023 |
|
2024 name |
|
2025 ^ spec name |
|
2026 ! |
|
2027 |
|
2028 name:aName |
|
2029 spec name:aName |
|
2030 ! ! |
|
2031 |
|
2032 !UIPainterView::GroupProperties methodsFor:'accessing'! |
|
2033 |
|
2034 controlledObjects |
|
2035 "return the value of the instance variable 'controlledObjects' (automatically generated)" |
|
2036 |
|
2037 ^ controlledObjects! |
|
2038 |
|
2039 controlledObjects:something |
|
2040 "set the value of the instance variable 'controlledObjects' (automatically generated)" |
|
2041 |
|
2042 controlledObjects := something.! |
|
2043 |
|
2044 group |
|
2045 "return the value of the instance variable 'group' |
|
2046 " |
|
2047 ^ group |
|
2048 ! |
|
2049 |
|
2050 group:something |
|
2051 "set the value of the instance variable 'group' |
|
2052 " |
|
2053 group := something. |
|
2054 ! |
|
2055 |
|
2056 name |
|
2057 "return the value of the group name |
|
2058 " |
|
2059 ^ name |
|
2060 ! |
|
2061 |
|
2062 name:aName |
|
2063 "set the value of the group name |
|
2064 " |
|
2065 name := aName |
|
2066 ! ! |
|
2067 |
|
2068 !UIPainterView class methodsFor:'documentation'! |
|
2069 |
|
2070 version |
|
2071 ^ '$Header$' |
|
2072 ! ! |
|