82 "opens a Image Editor on aClass and aSelector" |
82 "opens a Image Editor on aClass and aSelector" |
83 " |
83 " |
84 self openOnClass: self andSelector: #leftMouseKeyIcon |
84 self openOnClass: self andSelector: #leftMouseKeyIcon |
85 " |
85 " |
86 |
86 |
87 ^self open loadFromMessage: aClass name, ' ', aSelector |
87 |editor| |
|
88 |
|
89 editor := self new. |
|
90 editor allButOpen. |
|
91 editor loadFromMessage: aClass name, ' ', aSelector. |
|
92 editor openWindow |
|
93 |
|
94 "Modified: / 16.3.1999 / 21:33:49 / cg" |
88 ! |
95 ! |
89 |
96 |
90 openOnFile: aFileName |
97 openOnFile: aFileName |
91 "opens a Image Editor on aFileName" |
98 "opens a Image Editor on aFileName" |
92 " |
99 " |
93 self openOnFile: 'bitmaps/SmalltalkX.xbm' |
100 self openOnFile: 'bitmaps/SmalltalkX.xbm' |
94 " |
101 " |
95 |
102 |
96 ^self open loadFromFile: aFileName |
103 |editor| |
|
104 |
|
105 editor := self new. |
|
106 editor allButOpen. |
|
107 editor loadFromFile: aFileName. |
|
108 editor openWindow |
|
109 |
|
110 "Modified: / 16.3.1999 / 21:33:25 / cg" |
97 ! |
111 ! |
98 |
112 |
99 openOnImage: anImage |
113 openOnImage: anImage |
100 "opens a Image Editor on anImage" |
114 "opens a Image Editor on anImage" |
101 " |
115 " |
1738 ] ifFalse:[ |
1752 ] ifFalse:[ |
1739 self listOfColors removeAll. |
1753 self listOfColors removeAll. |
1740 ]. |
1754 ]. |
1741 self findColorMapMode. |
1755 self findColorMapMode. |
1742 self updateLabelsAndHistory. |
1756 self updateLabelsAndHistory. |
|
1757 imageEditView image:img. |
1743 ] ifFalse:[ |
1758 ] ifFalse:[ |
1744 self updateForNoImage |
1759 self updateForNoImage |
1745 ] |
1760 ]. |
|
1761 self imagePreView image:img. |
1746 ] |
1762 ] |
1747 ] |
1763 ] |
1748 |
1764 |
1749 "Modified: / 18.8.1998 / 17:03:54 / cg" |
1765 "Modified: / 16.3.1999 / 21:44:26 / cg" |
1750 ! |
1766 ! |
1751 |
1767 |
1752 loadFromImage:anImage |
1768 loadFromImage:anImage |
1753 "loads an image from anImage and sets up color map list and other info labels" |
1769 "loads an image from anImage and sets up color map list and other info labels" |
1754 |
1770 |
1755 |img| |
|
1756 |
|
1757 imageEditView image:anImage. |
1771 imageEditView image:anImage. |
1758 (img := self image) notNil ifTrue:[ |
1772 self imagePreView image: anImage. |
1759 img colorMap notNil ifTrue:[ |
1773 anImage notNil ifTrue:[ |
1760 self listOfColors contents:(img usedColors asSet asOrderedCollection). |
1774 anImage colorMap notNil ifTrue:[ |
|
1775 self listOfColors contents:(anImage usedColors asSet asOrderedCollection). |
1761 ] ifFalse:[ |
1776 ] ifFalse:[ |
1762 self listOfColors removeAll. |
1777 self listOfColors removeAll. |
1763 ]. |
1778 ]. |
1764 self findColorMapMode. |
1779 self findColorMapMode. |
1765 self updateLabelsAndHistory. |
1780 self updateLabelsAndHistory. |
1766 ] ifFalse:[ |
1781 ] ifFalse:[ |
1767 self updateForNoImage |
1782 self updateForNoImage |
1768 ] |
1783 ] |
1769 |
1784 |
1770 "Modified: / 18.8.1998 / 17:04:46 / cg" |
1785 "Modified: / 16.3.1999 / 21:43:56 / cg" |
1771 ! |
1786 ! |
1772 |
1787 |
1773 loadFromMessage: aMessage |
1788 loadFromMessage: aMessage |
1774 "loads an image by evaluating aMessage and sets up color map list and other info labels" |
1789 "loads an image by evaluating aMessage and sets up color map list and other info labels" |
1775 |
1790 |
1778 (imageEditView loadFromMessage: aMessage) notNil ifTrue:[ |
1793 (imageEditView loadFromMessage: aMessage) notNil ifTrue:[ |
1779 (img := self image) notNil ifTrue:[ |
1794 (img := self image) notNil ifTrue:[ |
1780 self listOfColors contents:(img usedColors asSet asOrderedCollection). |
1795 self listOfColors contents:(img usedColors asSet asOrderedCollection). |
1781 self findColorMapMode. |
1796 self findColorMapMode. |
1782 self updateLabelsAndHistory. |
1797 self updateLabelsAndHistory. |
|
1798 imageEditView image:img. |
|
1799 self imagePreView image:img. |
1783 ] ifFalse:[ |
1800 ] ifFalse:[ |
1784 self updateForNoImage |
1801 self updateForNoImage |
1785 ] |
1802 ] |
1786 ] |
1803 ] |
1787 |
1804 |
1788 "Modified: / 18.8.1998 / 17:03:01 / cg" |
1805 "Modified: / 16.3.1999 / 21:44:41 / cg" |
1789 ! |
1806 ! |
1790 |
1807 |
1791 loadFromOrPrepareForMessage: aMessage |
1808 loadFromOrPrepareForMessage: aMessage |
1792 "loads an image by evaluating aMessage; |
1809 "loads an image by evaluating aMessage; |
1793 if no image could extract from aMessage; do set the class and the selector from |
1810 if no image could extract from aMessage; do set the class and the selector from |
1957 ^ self |
1977 ^ self |
1958 ]. |
1978 ]. |
1959 (self confirm:'No space for more colors in colormap.\Change depth first.' withCRs) |
1979 (self confirm:'No space for more colors in colormap.\Change depth first.' withCRs) |
1960 ifFalse:[ |
1980 ifFalse:[ |
1961 ^ self |
1981 ^ self |
1962 ] |
1982 ]. |
|
1983 |
|
1984 imageEditView makeUndo. |
|
1985 newMode := (depth*2) printString , (colorMapMode value copyFrom:2). |
|
1986 self colorMapMode:newMode. |
|
1987 ] ifFalse:[ |
|
1988 imageEditView makeUndo. |
1963 ]. |
1989 ]. |
1964 |
1990 |
1965 imageEditView makeUndo. |
1991 self halt. |
1966 |
|
1967 cMap := cMap asArray. |
1992 cMap := cMap asArray. |
1968 oldCListSize := self listOfColors size. |
1993 oldCListSize := self listOfColors size. |
1969 |
1994 |
1970 "/ (colorMapMode value asString endsWith:'mask') ifTrue:[ |
1995 "/ (colorMapMode value asString endsWith:'mask') ifTrue:[ |
1971 "/ cMap last = Color noColor ifTrue:[ |
1996 "/ cMap last = Color noColor ifTrue:[ |
2050 ] ifFalse:[ |
2075 ] ifFalse:[ |
2051 quest := 'Keep colormap (or use standard)' |
2076 quest := 'Keep colormap (or use standard)' |
2052 ] |
2077 ] |
2053 ]. |
2078 ]. |
2054 ((prevMode = aMode) |
2079 ((prevMode = aMode) |
2055 or:[self confirm:(resources string:quest)]) ifTrue:[ |
2080 or:[depth > oldImage depth |
|
2081 or:[self confirm:(resources string:quest)]]) ifTrue:[ |
2056 |
2082 |
2057 "/ keep the colormap |
2083 "/ keep the colormap |
2058 newColorMap atAllPut:Color black. |
2084 newColorMap atAllPut:Color black. |
2059 depth > oldImage depth ifTrue:[ |
2085 depth > oldImage depth ifTrue:[ |
2060 "/ easy - simply copy the part |
2086 "/ easy - simply copy the part |