7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
|
12 |
|
13 "{ Package: 'stx:libtool2' }" |
12 |
14 |
13 ToolApplicationModel subclass:#ImageEditor |
15 ToolApplicationModel subclass:#ImageEditor |
14 instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode |
16 instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode |
15 selectedColorIndex postOpenAction' |
17 selectedColorIndex postOpenAction' |
16 classVariableNames:'LastDirectory' |
18 classVariableNames:'LastDirectory' |
1430 ! |
1432 ! |
1431 |
1433 |
1432 imageEditView |
1434 imageEditView |
1433 "returns the view of the image" |
1435 "returns the view of the image" |
1434 |
1436 |
1435 ^ imageEditView := (builder componentAt: #imageEditView) scrolledView |
1437 imageEditView isNil ifTrue:[ |
|
1438 imageEditView := (builder componentAt: #imageEditView) scrolledView. |
|
1439 imageEditView addDependent:self. |
|
1440 ]. |
|
1441 ^ imageEditView |
1436 |
1442 |
1437 "Modified: / 10.2.2000 / 23:19:20 / cg" |
1443 "Modified: / 10.2.2000 / 23:19:20 / cg" |
1438 ! |
1444 ! |
1439 |
1445 |
1440 imagePreView |
1446 imagePreView |
1441 "returns the preview of the image" |
1447 "returns the preview of the image" |
1442 |
1448 |
1443 ^(builder componentAt: #imagePreView) subViews first |
1449 ^ (builder componentAt: #imagePreView) subViews first |
1444 ! ! |
1450 ! ! |
1445 |
1451 |
1446 !ImageEditor methodsFor:'aspects'! |
1452 !ImageEditor methodsFor:'aspects'! |
1447 |
1453 |
1448 activityInfoHolder |
1454 activityInfoHolder |
1765 !ImageEditor methodsFor:'help'! |
1774 !ImageEditor methodsFor:'help'! |
1766 |
1775 |
1767 defaultInfoLabel |
1776 defaultInfoLabel |
1768 "returns the default info label" |
1777 "returns the default info label" |
1769 |
1778 |
1770 (imageEditView resourceClass isSymbol and: [(Smalltalk at: imageEditView resourceClass) isClass]) |
1779 |resourceClass| |
1771 ifTrue: |
1780 |
1772 [ |
1781 resourceClass := imageEditView resourceClass. |
1773 ^imageEditView resourceClass, ' >> ', imageEditView resourceSelector |
1782 (resourceClass isSymbol and: [(Smalltalk at:resourceClass) isClass]) |
1774 ]. |
1783 ifTrue:[ |
1775 ^'No class and selector defined.' |
1784 ^ resourceClass, ' >> ', imageEditView resourceSelector |
|
1785 ]. |
|
1786 ^ 'No class and selector defined.' |
1776 ! |
1787 ! |
1777 |
1788 |
1778 openDocumentation |
1789 openDocumentation |
1779 "opens the documentation file of the Image Editor" |
1790 "opens the documentation file of the Image Editor" |
1780 |
1791 |
1797 ] ifFalse:[ |
1808 ] ifFalse:[ |
1798 self listOfColors removeAll. |
1809 self listOfColors removeAll. |
1799 ]. |
1810 ]. |
1800 self findColorMapMode. |
1811 self findColorMapMode. |
1801 self updateLabelsAndHistory. |
1812 self updateLabelsAndHistory. |
|
1813 img := img onDevice:device. |
1802 imageEditView image:img. |
1814 imageEditView image:img. |
1803 ] ifFalse:[ |
1815 ] ifFalse:[ |
1804 self updateForNoImage |
1816 self updateForNoImage |
1805 ]. |
1817 ]. |
1806 self imagePreView image:img. |
|
1807 ] |
1818 ] |
1808 ] |
1819 ] |
1809 |
1820 |
1810 "Modified: / 16.3.1999 / 21:44:26 / cg" |
1821 "Modified: / 16.3.1999 / 21:44:26 / cg" |
1811 ! |
1822 ! |
1812 |
1823 |
1813 loadFromImage:anImage |
1824 loadFromImage:anImage |
1814 "loads an image from anImage and sets up color map list and other info labels" |
1825 "loads an image from anImage and sets up color map list and other info labels" |
1815 |
1826 |
1816 imageEditView image:anImage. |
1827 |img| |
1817 self imagePreView image: anImage. |
1828 |
1818 anImage notNil ifTrue:[ |
1829 anImage notNil ifTrue:[ |
1819 anImage colorMap notNil ifTrue:[ |
1830 img := anImage onDevice:device. |
1820 self listOfColors contents:(anImage usedColors asSet asOrderedCollection). |
1831 ]. |
|
1832 |
|
1833 imageEditView image:img. |
|
1834 |
|
1835 img notNil ifTrue:[ |
|
1836 img colorMap notNil ifTrue:[ |
|
1837 self listOfColors contents:(img usedColors asSet asOrderedCollection). |
1821 ] ifFalse:[ |
1838 ] ifFalse:[ |
1822 self listOfColors removeAll. |
1839 self listOfColors removeAll. |
1823 ]. |
1840 ]. |
1824 self findColorMapMode. |
1841 self findColorMapMode. |
1825 self updateLabelsAndHistory. |
1842 self updateLabelsAndHistory. |
1835 |
1852 |
1836 |img| |
1853 |img| |
1837 |
1854 |
1838 (imageEditView loadFromMessage: aMessage) notNil ifTrue:[ |
1855 (imageEditView loadFromMessage: aMessage) notNil ifTrue:[ |
1839 (img := self image) notNil ifTrue:[ |
1856 (img := self image) notNil ifTrue:[ |
|
1857 img := img onDevice:device. |
1840 self listOfColors contents:(img usedColors asSet asOrderedCollection). |
1858 self listOfColors contents:(img usedColors asSet asOrderedCollection). |
1841 self findColorMapMode. |
1859 self findColorMapMode. |
1842 self updateLabelsAndHistory. |
1860 self updateLabelsAndHistory. |
1843 imageEditView image:img. |
1861 imageEditView image:img. |
1844 self imagePreView image:img. |
|
1845 ] ifFalse:[ |
1862 ] ifFalse:[ |
1846 self updateForNoImage |
1863 self updateForNoImage |
1847 ] |
1864 ] |
1848 ] |
1865 ] |
1849 |
1866 |
1854 "loads an image by evaluating aMessage; |
1871 "loads an image by evaluating aMessage; |
1855 if no image could extract from aMessage; do set the class and the selector from |
1872 if no image could extract from aMessage; do set the class and the selector from |
1856 the aMessage for a saving at the end of editing" |
1873 the aMessage for a saving at the end of editing" |
1857 |
1874 |
1858 (imageEditView loadFromMessage: aMessage) notNil |
1875 (imageEditView loadFromMessage: aMessage) notNil |
1859 ifTrue: |
1876 ifTrue: [ |
1860 [ |
|
1861 self listOfColors contents: self image usedColors asSet asOrderedCollection. |
1877 self listOfColors contents: self image usedColors asSet asOrderedCollection. |
1862 self findColorMapMode. |
1878 self findColorMapMode. |
1863 ] |
1879 ] ifFalse: [ |
1864 ifFalse: |
|
1865 [ |
|
1866 imageEditView resourceMessage: aMessage. |
1880 imageEditView resourceMessage: aMessage. |
1867 ]. |
1881 ]. |
1868 self updateLabelsAndHistory. |
1882 self updateLabelsAndHistory. |
1869 self imagePreView image:(self image). |
|
1870 |
1883 |
1871 "Modified: / 16.3.1999 / 21:45:07 / cg" |
1884 "Modified: / 16.3.1999 / 21:45:07 / cg" |
1872 ! ! |
1885 ! ! |
1873 |
1886 |
1874 !ImageEditor methodsFor:'menu modes'! |
1887 !ImageEditor methodsFor:'menu modes'! |
2725 |
2739 |
2726 (imageEditView loadFromClass) notNil ifTrue:[ |
2740 (imageEditView loadFromClass) notNil ifTrue:[ |
2727 (img := self image) notNil ifTrue: [ |
2741 (img := self image) notNil ifTrue: [ |
2728 self listOfColors contents: img usedColors asSet asOrderedCollection. |
2742 self listOfColors contents: img usedColors asSet asOrderedCollection. |
2729 self findColorMapMode. |
2743 self findColorMapMode. |
2730 self updateLabelsAndHistory |
2744 self updateLabelsAndHistory. |
2731 ] ifFalse: [ |
2745 ] ifFalse: [ |
2732 self updateForNoImage |
2746 self updateForNoImage |
2733 ] |
2747 ]. |
2734 ] |
2748 ] |
2735 ! |
2749 ! |
2736 |
2750 |
2737 doLoadFromFile |
2751 doLoadFromFile |
2738 "opens a dialog for loading an image from a file" |
2752 "opens a dialog for loading an image from a file" |