equal
deleted
inserted
replaced
12 |
12 |
13 "{ Package: 'stx:libtool2' }" |
13 "{ Package: 'stx:libtool2' }" |
14 |
14 |
15 ToolApplicationModel subclass:#ImageEditor |
15 ToolApplicationModel subclass:#ImageEditor |
16 instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode |
16 instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode |
17 selectedColorIndex postOpenAction' |
17 selectedColorIndex postOpenAction imageSeqNr' |
18 classVariableNames:'LastDirectory' |
18 classVariableNames:'LastDirectory' |
19 poolDictionaries:'' |
19 poolDictionaries:'' |
20 category:'Interface-UIPainter' |
20 category:'Interface-UIPainter' |
21 ! |
21 ! |
22 |
22 |
906 #translateLabel: true |
906 #translateLabel: true |
907 #value: #grabScreenImage |
907 #value: #grabScreenImage |
908 #activeHelpKey: #fileGrabImage |
908 #activeHelpKey: #fileGrabImage |
909 ) |
909 ) |
910 #(#MenuItem |
910 #(#MenuItem |
|
911 #label: 'Next In Sequence' |
|
912 #translateLabel: true |
|
913 #value: #nextImageInSequence |
|
914 #enabled: #imageHasNextImage |
|
915 ) |
|
916 #(#MenuItem |
911 #label: '-' |
917 #label: '-' |
912 ) |
918 ) |
913 #(#MenuItem |
919 #(#MenuItem |
914 #label: 'Save' |
920 #label: 'Save' |
915 #translateLabel: true |
921 #translateLabel: true |
1490 ^ [self image notNil and:[self image colorMap notNil]] |
1496 ^ [self image notNil and:[self image colorMap notNil]] |
1491 |
1497 |
1492 "Created: / 30.9.1998 / 23:53:55 / cg" |
1498 "Created: / 30.9.1998 / 23:53:55 / cg" |
1493 ! |
1499 ! |
1494 |
1500 |
|
1501 imageHasNextImage |
|
1502 "returns whether an image is loaded as value holder" |
|
1503 |
|
1504 ^ [self image notNil |
|
1505 and:[self image imageSequence notNil]] |
|
1506 |
|
1507 "Created: / 31.7.1998 / 02:04:18 / cg" |
|
1508 ! |
|
1509 |
1495 imageInfoHolder |
1510 imageInfoHolder |
1496 |holder| |
1511 |holder| |
1497 (holder := builder bindingAt:#imageInfoHolder) isNil ifTrue:[ |
1512 (holder := builder bindingAt:#imageInfoHolder) isNil ifTrue:[ |
1498 builder aspectAt:#imageInfoHolder put:(holder := '' asValue). |
1513 builder aspectAt:#imageInfoHolder put:(holder := '' asValue). |
1499 ]. |
1514 ]. |
2736 "opens a dialog for loading an image from class and a (resource-) selector" |
2751 "opens a dialog for loading an image from class and a (resource-) selector" |
2737 |
2752 |
2738 |img| |
2753 |img| |
2739 |
2754 |
2740 (imageEditView loadFromClass) notNil ifTrue:[ |
2755 (imageEditView loadFromClass) notNil ifTrue:[ |
|
2756 imageSeqNr := nil. |
2741 (img := self image) notNil ifTrue: [ |
2757 (img := self image) notNil ifTrue: [ |
2742 self listOfColors contents: img usedColors asSet asOrderedCollection. |
2758 self listOfColors contents: img usedColors asSet asOrderedCollection. |
2743 self findColorMapMode. |
2759 self findColorMapMode. |
2744 self updateLabelsAndHistory. |
2760 self updateLabelsAndHistory. |
2745 ] ifFalse: [ |
2761 ] ifFalse: [ |
2751 doLoadFromFile |
2767 doLoadFromFile |
2752 "opens a dialog for loading an image from a file" |
2768 "opens a dialog for loading an image from a file" |
2753 |
2769 |
2754 |img file dir filters| |
2770 |img file dir filters| |
2755 |
2771 |
|
2772 imageSeqNr := nil. |
2756 img := self image. |
2773 img := self image. |
2757 img notNil ifTrue: [ |
2774 img notNil ifTrue: [ |
2758 file := img fileName |
2775 file := img fileName |
2759 ] ifFalse:[ |
2776 ] ifFalse:[ |
2760 dir := LastDirectory |
2777 dir := LastDirectory |
2825 |
2842 |
2826 Processor |
2843 Processor |
2827 addTimedBlock:[ |
2844 addTimedBlock:[ |
2828 |image d8image img| |
2845 |image d8image img| |
2829 |
2846 |
|
2847 imageSeqNr := nil. |
2830 image := Image fromUser. |
2848 image := Image fromUser. |
2831 image isNil ifFalse:[ |
2849 image isNil ifFalse:[ |
2832 image depth > 8 ifTrue:[ |
2850 image depth > 8 ifTrue:[ |
2833 Object errorSignal handle:[:ex | |sig| |
2851 Object errorSignal handle:[:ex | |sig| |
2834 (sig := ex signal) == Object haltSignal ifTrue:[ex reject]. |
2852 (sig := ex signal) == Object haltSignal ifTrue:[ex reject]. |
2853 ] |
2871 ] |
2854 afterSeconds:1 |
2872 afterSeconds:1 |
2855 |
2873 |
2856 "Created: / 29.7.1998 / 21:24:42 / cg" |
2874 "Created: / 29.7.1998 / 21:24:42 / cg" |
2857 "Modified: / 10.9.1998 / 16:01:23 / cg" |
2875 "Modified: / 10.9.1998 / 16:01:23 / cg" |
|
2876 ! |
|
2877 |
|
2878 nextImageInSequence |
|
2879 "display the next image in the image sequence" |
|
2880 |img seq frame| |
|
2881 |
|
2882 imageEditView releaseUndos. |
|
2883 |
|
2884 seq := self image imageSequence. |
|
2885 imageSeqNr isNil ifTrue:[ |
|
2886 imageSeqNr := 1. |
|
2887 ]. |
|
2888 imageSeqNr := imageSeqNr + 1. |
|
2889 imageSeqNr > seq size ifTrue:[ |
|
2890 self information:'Back to first image in sequence'. |
|
2891 imageSeqNr := 1. |
|
2892 ]. |
|
2893 frame := seq at:imageSeqNr. |
|
2894 imageEditView image:(frame image). |
|
2895 |
|
2896 (img := self image) notNil ifTrue:[ |
|
2897 img colorMap notNil ifTrue:[ |
|
2898 self listOfColors contents:(img usedColors asSet asOrderedCollection). |
|
2899 ] ifFalse:[ |
|
2900 self listOfColors removeAll. |
|
2901 ]. |
|
2902 self findColorMapMode. |
|
2903 self updateLabelsAndHistory. |
|
2904 img := img onDevice:device. |
|
2905 imageEditView image:img. |
|
2906 ] ifFalse:[ |
|
2907 self updateForNoImage |
|
2908 ]. |
|
2909 |
2858 ! ! |
2910 ! ! |
2859 |
2911 |
2860 !ImageEditor methodsFor:'user actions - saving'! |
2912 !ImageEditor methodsFor:'user actions - saving'! |
2861 |
2913 |
2862 doPrint |
2914 doPrint |