ImageEditView.st
author Claus Gittinger <cg@exept.de>
Mon, 11 Dec 2000 11:33:13 +0100
changeset 1903 b0c9fcf3155e
parent 1901 b4b286ec221f
child 1957 9a4347986d96
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
636
d53428252193 revised version
tz
parents: 633
diff changeset
     1
"
704
01140e14c065 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 694
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
     3
	      All Rights Reserved
636
d53428252193 revised version
tz
parents: 633
diff changeset
     4
d53428252193 revised version
tz
parents: 633
diff changeset
     5
 This software is furnished under a license and may be used
d53428252193 revised version
tz
parents: 633
diff changeset
     6
 only in accordance with the terms of that license and with the
d53428252193 revised version
tz
parents: 633
diff changeset
     7
 inclusion of the above copyright notice. This software may not
d53428252193 revised version
tz
parents: 633
diff changeset
     8
 be provided or otherwise made available to, or used by, any
d53428252193 revised version
tz
parents: 633
diff changeset
     9
 other person. No title to or ownership of the software is
d53428252193 revised version
tz
parents: 633
diff changeset
    10
 hereby transferred.
d53428252193 revised version
tz
parents: 633
diff changeset
    11
"
d53428252193 revised version
tz
parents: 633
diff changeset
    12
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
    13
"{ Package: 'stx:libwidg2' }"
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
    14
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    15
ImageView subclass:#ImageEditView
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
    16
	instanceVariableNames:'magnification imageReaderClass resourceClass resourceSelector
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
    17
		mouseKeyColorMode undoImages modified masterApplication editMode
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
    18
		lastPastePoint imageInfoHolder activityInfoHolder
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
    19
		pickedColorHolder drawingColors drawingPixels clickInfoCallBack'
1035
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    20
	classVariableNames:'Clipboard LastMagnification ClipboardMagnification
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    21
		GridMagnificationLimit MaxUndos'
1035
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    22
	poolDictionaries:''
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    23
	category:'Views-Misc'
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    24
!
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    25
636
d53428252193 revised version
tz
parents: 633
diff changeset
    26
!ImageEditView class methodsFor:'documentation'!
d53428252193 revised version
tz
parents: 633
diff changeset
    27
d53428252193 revised version
tz
parents: 633
diff changeset
    28
copyright
d53428252193 revised version
tz
parents: 633
diff changeset
    29
"
704
01140e14c065 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 694
diff changeset
    30
 COPYRIGHT (c) 1997 by eXept Software AG
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
    31
	      All Rights Reserved
636
d53428252193 revised version
tz
parents: 633
diff changeset
    32
d53428252193 revised version
tz
parents: 633
diff changeset
    33
 This software is furnished under a license and may be used
d53428252193 revised version
tz
parents: 633
diff changeset
    34
 only in accordance with the terms of that license and with the
d53428252193 revised version
tz
parents: 633
diff changeset
    35
 inclusion of the above copyright notice. This software may not
d53428252193 revised version
tz
parents: 633
diff changeset
    36
 be provided or otherwise made available to, or used by, any
d53428252193 revised version
tz
parents: 633
diff changeset
    37
 other person. No title to or ownership of the software is
d53428252193 revised version
tz
parents: 633
diff changeset
    38
 hereby transferred.
d53428252193 revised version
tz
parents: 633
diff changeset
    39
"
d53428252193 revised version
tz
parents: 633
diff changeset
    40
!
d53428252193 revised version
tz
parents: 633
diff changeset
    41
d53428252193 revised version
tz
parents: 633
diff changeset
    42
documentation
d53428252193 revised version
tz
parents: 633
diff changeset
    43
"
d53428252193 revised version
tz
parents: 633
diff changeset
    44
    The ImageEditView is a view class which can be used by applications
d53428252193 revised version
tz
parents: 633
diff changeset
    45
    like the Image Editor for modifying or inspecting images.
d53428252193 revised version
tz
parents: 633
diff changeset
    46
d53428252193 revised version
tz
parents: 633
diff changeset
    47
    [see also:]
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
    48
	ImageEditor Image
636
d53428252193 revised version
tz
parents: 633
diff changeset
    49
d53428252193 revised version
tz
parents: 633
diff changeset
    50
    [author:]
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
    51
	Thomas Zwick
636
d53428252193 revised version
tz
parents: 633
diff changeset
    52
"
d53428252193 revised version
tz
parents: 633
diff changeset
    53
! !
353
0442fc169b82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    54
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    55
!ImageEditView class methodsFor:'initialization'!
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    56
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    57
initialize
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    58
    MaxUndos := 5.
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    59
    GridMagnificationLimit := 8 @ 8.
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    60
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    61
    "
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    62
     self initialize
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    63
    "
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    64
! !
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
    65
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    66
!ImageEditView class methodsFor:'accessing'!
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    67
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    68
gridMagnificationLimit
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    69
    ^ GridMagnificationLimit
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    70
!
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    71
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    72
gridMagnificationLimit:anInteger
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    73
    GridMagnificationLimit := anInteger
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    74
! !
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    75
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    76
!ImageEditView class methodsFor:'utilities'!
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    77
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    78
generateImageSpecMethodFor:anImage comment:comment inClass:aClass selector:sel
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    79
    |imageStoreStream mthd imageKey category|
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    80
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    81
    anImage storeOn: (imageStoreStream := WriteStream on: '').
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    82
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    83
    "/ if that method already exists, do not overwrite the category
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    84
    category := 'image specs'.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    85
    (mthd := aClass compiledMethodAt:sel) notNil ifTrue:[
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    86
        category := mthd category.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    87
    ].
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    88
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    89
    imageKey :=  (aClass name, ' ', sel) asSymbol.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    90
    Icon constantNamed: imageKey put:nil.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    91
    aClass
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    92
        compile: ((sel,
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    93
            '\', comment,
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    94
            '\\' , 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    95
            '    "\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    96
            '     self ' , sel , ' inspect\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    97
            '     ImageEditor openOnClass:self andSelector:#', sel, 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    98
            '\    "',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
    99
            '\\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   100
            '    <resource: #image>',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   101
            '\\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   102
            '    ^Icon\') withCRs, 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   103
            '        constantNamed:#''', imageKey, '''\' withCRs,
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   104
            '        ifAbsentPut:[', imageStoreStream contents, ']')
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   105
       classified: category.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   106
! !
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
   107
7
19b36b78ee01 *** empty log message ***
claus
parents: 5
diff changeset
   108
!ImageEditView methodsFor:'accessing'!
19b36b78ee01 *** empty log message ***
claus
parents: 5
diff changeset
   109
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   110
activityInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   111
    "return the value of the instance variable 'activityInfoHolder' (automatically generated)"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   112
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   113
    ^ activityInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   114
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   115
    "Created: / 29.7.1998 / 18:49:39 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   116
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   117
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   118
activityInfoHolder:something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   119
    "set the value of the instance variable 'activityInfoHolder' (automatically generated)"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   120
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   121
    activityInfoHolder := something.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   122
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   123
    "Created: / 29.7.1998 / 18:49:39 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   124
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   125
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   126
clickInfoCallBack:aTwoArgBlock
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   127
     clickInfoCallBack := aTwoArgBlock
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   128
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   129
    "Created: / 10.2.2000 / 23:07:14 / cg"
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   130
!
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   131
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   132
imageInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   133
    "return the value of the instance variable 'imageInfoHolder' (automatically generated)"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   134
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   135
    ^ imageInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   136
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   137
    "Created: / 29.7.1998 / 18:29:50 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   138
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   139
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   140
imageInfoHolder:something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   141
    "set the value of the instance variable 'imageInfoHolder' (automatically generated)"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   142
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   143
    imageInfoHolder := something.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   144
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   145
    "Created: / 29.7.1998 / 18:29:50 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   146
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   147
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   148
magnification
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   149
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   150
    ^magnification
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   151
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   152
!
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   153
636
d53428252193 revised version
tz
parents: 633
diff changeset
   154
magnification: aPoint
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   155
    |oldOrg|
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   156
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   157
    magnification ~= aPoint
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   158
    ifTrue:
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   159
    [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   160
	oldOrg := self viewOrigin / magnification.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   161
	magnification := aPoint asPoint.
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   162
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   163
	self scrollTo:(oldOrg * magnification) rounded redraw:false.        
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   164
"/        self scrollToTopLeft.
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   165
	self contentsChanged.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   166
	self invalidate.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   167
	ClipboardMagnification := nil.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   168
    ]
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   169
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   170
    "Modified: / 31.7.1998 / 02:38:47 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   171
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   172
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   173
masterApplication
61b7601829ea with modal support
tz
parents: 636
diff changeset
   174
61b7601829ea with modal support
tz
parents: 636
diff changeset
   175
    ^masterApplication
61b7601829ea with modal support
tz
parents: 636
diff changeset
   176
!
61b7601829ea with modal support
tz
parents: 636
diff changeset
   177
61b7601829ea with modal support
tz
parents: 636
diff changeset
   178
masterApplication: anApplicationModel
61b7601829ea with modal support
tz
parents: 636
diff changeset
   179
61b7601829ea with modal support
tz
parents: 636
diff changeset
   180
    masterApplication := anApplicationModel
61b7601829ea with modal support
tz
parents: 636
diff changeset
   181
!
61b7601829ea with modal support
tz
parents: 636
diff changeset
   182
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   183
resourceClass
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   184
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   185
    ^resourceClass
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   186
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   187
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   188
resourceClass: aClassOrSymbol
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   189
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   190
    resourceClass := aClassOrSymbol isClass ifTrue: [aClassOrSymbol name] ifFalse: [aClassOrSymbol asSymbol]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   191
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   192
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   193
resourceMessage
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   194
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   195
    ^resourceClass, ' ', resourceSelector
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   196
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   197
636
d53428252193 revised version
tz
parents: 633
diff changeset
   198
resourceMessage: aString
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   199
636
d53428252193 revised version
tz
parents: 633
diff changeset
   200
    (aString isString and: [aString trimBlanks size > 0])
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   201
    ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   202
    [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   203
	resourceClass := (aString readStream upTo: Character space) asSymbol.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   204
	resourceSelector := (aString copy reverse readStream upTo: Character space) reverse asSymbol
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   205
    ]
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   206
    ifFalse:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   207
    [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   208
	^nil
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   209
    ]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   210
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   211
   
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   212
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   213
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   214
resourceSelector
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   215
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   216
    ^resourceSelector
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   217
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   218
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   219
resourceSelector: aStringOrSymbol
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   220
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   221
    resourceSelector := aStringOrSymbol asSymbol
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   222
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   223
840
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   224
selectColors
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   225
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   226
    ^drawingColors
840
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   227
!
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   228
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   229
selectColors: anArrayTwoColors
633
594edef86630 revised version
tz
parents: 632
diff changeset
   230
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   231
    drawingColors := anArrayTwoColors
633
594edef86630 revised version
tz
parents: 632
diff changeset
   232
!
594edef86630 revised version
tz
parents: 632
diff changeset
   233
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   234
selectedColor
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   235
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   236
   ^drawingColors at: mouseKeyColorMode
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   237
!
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   238
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   239
selectedColor: aColor
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   240
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   241
    drawingColors at: mouseKeyColorMode put: aColor
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   242
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   243
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   244
selectedColorIndex
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   245
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   246
   ^ drawingPixels at: mouseKeyColorMode
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   247
!
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   248
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   249
selectedColorIndex: aPixelIndex
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   250
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   251
    drawingPixels at: mouseKeyColorMode put: aPixelIndex
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   252
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   253
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   254
undoImages
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   255
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   256
   ^undoImages
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   257
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   258
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   259
!ImageEditView methodsFor:'drawing'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   260
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   261
drawFrame
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   262
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   263
    self paint:Color black.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   264
    self lineWidth: (magnification x//3 min: 3).
1104
a7101d656dab use margin in #drawFrame
tz
parents: 1103
diff changeset
   265
    self displayRectangle: ((0@0) extent:(image extent * magnification) + margin).
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   266
    self lineWidth:1.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   267
!
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   268
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   269
drawFramesIn: aRectangle
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   270
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   271
    magnification >= GridMagnificationLimit
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   272
    ifTrue:
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   273
    [   
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   274
        |origin lineStartingPoint lineEndingPoint oldColor|
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   275
        origin := aRectangle origin - 1.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   276
        lineStartingPoint := origin + (0@magnification y).
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   277
        lineEndingPoint   := lineStartingPoint + (aRectangle width@0).
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   278
        oldColor := self paint.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   279
        self xoring:
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   280
        [
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   281
            self displayLineFrom: lineStartingPoint to: lineEndingPoint.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   282
            lineStartingPoint x to: lineStartingPoint x + aRectangle width - magnification x by: magnification x do:
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   283
            [:x|   
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   284
                self displayLineFrom: x@(origin y) to: x@(origin y + magnification y)
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   285
            ].
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   286
        ].
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   287
        self paint: oldColor.
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   288
    ]
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   289
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   290
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   291
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   292
!
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   293
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   294
drawPasteRectangleAt: aPoint
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   295
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   296
    |currentPoint gridCorrection extent org|
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   297
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   298
    magnification >= GridMagnificationLimit ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1].
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   299
    currentPoint := aPoint // magnification*magnification + margin. 
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   300
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   301
    currentPoint ~= lastPastePoint ifTrue:[              
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   302
        ClipboardMagnification isNil ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   303
            ClipboardMagnification := (Clipboard magnifiedBy: magnification) onDevice: device
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   304
        ].   
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   305
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   306
        extent       := ClipboardMagnification extent.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   307
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   308
        currentPoint := currentPoint - self viewOrigin.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   309
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   310
        self redraw: ((lastPastePoint ? currentPoint) extent: extent).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   311
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   312
        (extent x > 200 or: [extent y > 200]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   313
            self xoring: [
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   314
                self fillRectangle: (currentPoint extent: extent)
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   315
            ]   
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   316
        ] ifFalse:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   317
            self displayDeviceForm: ClipboardMagnification x: currentPoint x y: currentPoint y.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   318
            editMode == #pasteUnder ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   319
                self redrawImageX:currentPoint x y:currentPoint y width:extent x height:extent y unmaskedOnly:true
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   320
            ]
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   321
        ]  
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   322
    ]. 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   323
    lastPastePoint := currentPoint.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   324
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   325
    "Modified: / 18.5.1999 / 20:23:33 / cg"
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   326
!
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   327
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   328
fillFramedRectangle: aRectangle
61b7601829ea with modal support
tz
parents: 636
diff changeset
   329
61b7601829ea with modal support
tz
parents: 636
diff changeset
   330
    self fillRectangle: aRectangle.
61b7601829ea with modal support
tz
parents: 636
diff changeset
   331
    self drawFramesIn: aRectangle
61b7601829ea with modal support
tz
parents: 636
diff changeset
   332
!
61b7601829ea with modal support
tz
parents: 636
diff changeset
   333
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   334
redraw:aRectangle
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   335
    super redraw:(aRectangle origin + self viewOrigin extent:aRectangle extent). 
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   336
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   337
!
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   338
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   339
redrawImageX:x y:y width:w height:h
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   340
    self redrawImageX:x y:y width:w height:h unmaskedOnly:false
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   341
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   342
    "Modified: / 18.5.1999 / 20:14:03 / cg"
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   343
!
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   344
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   345
redrawImageX:x y:y width:w height:h unmaskedOnly:unmaskedOnly
636
d53428252193 revised version
tz
parents: 633
diff changeset
   346
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   347
    |ih iw magX magY minX maxX minY maxY 
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   348
     color lastColor lastY runW x0 xI yI maskColor mask
1180
dcb9dede5128 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   349
     sizeOfMaskPoint useNearestColor|
dcb9dede5128 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   350
dcb9dede5128 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   351
    useNearestColor := device visualType == #PseudoColor.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   352
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   353
    mask := image mask.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   354
    ih := image height.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   355
    iw := image width.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   356
    magX := magnification x.
61b7601829ea with modal support
tz
parents: 636
diff changeset
   357
    magY := magnification y.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   358
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   359
    minX := (x // magX - 1) max: 0.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   360
    minX >= iw ifTrue:[minX := (iw - 1) max: 0].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   361
    minY := (y // magY - 1) max: 0.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   362
    minY >= ih ifTrue:[minY := (ih - 1) max: 0].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   363
    maxX := (x + w) // magX + 1.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   364
    maxX > iw ifTrue:[maxX := iw].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   365
    maxY := (y + h) // magY + 1.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   366
    maxY > ih ifTrue:[maxY := ih].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   367
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   368
    lastY := -1.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   369
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   370
    x0 := minX.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   371
    runW := 0.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   372
    maskColor := false.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   373
    sizeOfMaskPoint := magnification//3.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   374
    image 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   375
        colorsFromX:minX y:minY toX:maxX-1 y:maxY-1 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   376
        do:[:xx :yy :color|
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   377
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   378
            shown ifFalse:[^ self].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   379
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   380
            yy ~~ lastY ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   381
                runW ~~ 0 ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   382
                    |origin|
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   383
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   384
                    origin := (x0 * magX + margin)@(lastY * magY + margin).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   385
                    (unmaskedOnly not or:[maskColor not]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   386
                        self fillFramedRectangle: (origin extent: (runW@magY)).                    
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   387
                        maskColor ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   388
                            self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)]
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   389
                        ]
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   390
                    ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   391
                    runW := 0.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   392
                ]. 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   393
                x0 := xx.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   394
                lastY := yy.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   395
            ]. 
1160
5d89296c4b04 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1158
diff changeset
   396
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   397
            color ~= lastColor ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   398
                runW ~~ 0 ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   399
                    |origin|
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   400
                    origin := (x0 * magX + margin)@(yy * magY + margin).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   401
                    (unmaskedOnly not or:[maskColor not]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   402
                        self fillFramedRectangle: (origin extent: (runW@magY)).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   403
                        maskColor ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   404
                            self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)]
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   405
                        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   406
                    ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   407
                    runW := 0.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   408
                ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   409
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   410
                lastColor := color.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   411
                useNearestColor ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   412
                    lastColor := lastColor nearestOn:device
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   413
                ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   414
                self paint:lastColor.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   415
                mask notNil ifTrue:[  
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   416
                    maskColor := false.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   417
                    (mask pixelAtX:xx y:yy) == 0 ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   418
                        unmaskedOnly ifFalse:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   419
                            self paint: (lastColor := self viewBackground).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   420
                        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   421
                        maskColor := true.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   422
                    ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   423
                    lastColor := nil.
1160
5d89296c4b04 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1158
diff changeset
   424
                ].
5d89296c4b04 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1158
diff changeset
   425
                runW := 0.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   426
                x0 := xx.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   427
            ].  
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   428
            runW := runW + magX
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   429
        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   430
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   431
    runW ~~ 0 ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   432
        |origin|
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   433
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   434
        origin := (x0 * magX + margin)@(lastY * magY + margin).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   435
        (unmaskedOnly not or:[maskColor not]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   436
            self fillFramedRectangle: (origin extent: runW@magY).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   437
            maskColor ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   438
                self xoring:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   439
                    self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   440
                ]
1180
dcb9dede5128 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1160
diff changeset
   441
            ].
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   442
        ]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   443
    ].
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   444
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   445
    "Created: / 18.5.1999 / 20:13:39 / cg"
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
   446
    "Modified: / 18.5.1999 / 20:36:20 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   447
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   448
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   449
redrawX:x y:y width:w height:h
636
d53428252193 revised version
tz
parents: 633
diff changeset
   450
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   451
    |ih iw xI yI devImage|
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   452
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   453
    image isNil ifTrue:[^self].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   454
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   455
    magnification = (1@1) ifTrue: [
1510
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   456
        Object errorSignal handle:[:ex |
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   457
            Transcript showCR:'cannot convert image'.
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   458
        ] do:[
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   459
            devImage := image onDevice:device.
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   460
            devImage ~~ image ifTrue:[
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   461
                image := devImage.
1764
3dd553f8d9f0 oops - leftover halts
Claus Gittinger <cg@exept.de>
parents: 1763
diff changeset
   462
                self changed:#image.
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   463
            ].
1510
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   464
        ].
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   465
        image device == device ifTrue:[
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   466
            ^ super redrawX:x y:y width:w height:h
fd0cd6065dc6 catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents: 1449
diff changeset
   467
        ].
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   468
    ].
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   469
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   470
    self clippingRectangle: (x@y extent:w@h).
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   471
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   472
    self redrawImageX:x y:y width:w height:h.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   473
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   474
    "/ right of image ?
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   475
    adjust == #center ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   476
    [
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   477
        xI := (width - ih) // 2 - margin.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   478
        yI := (height - iw) // 2 - margin.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   479
    ]
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   480
    ifFalse:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   481
    [
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   482
        xI := yI := margin
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   483
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   484
    (x + w - 1) > (xI + (magnification x * image width)) ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   485
    [
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   486
        self clearRectangleX:(xI + (magnification x * image width))
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   487
                           y:y
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   488
                       width:(x + w - (magnification x * image width) - xI)
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   489
                      height:h
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   490
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   491
    (y + h - 1) > (yI + (magnification y * image height)) ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   492
    [
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   493
        self clearRectangleX:margin
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   494
                           y:(yI + (magnification y * image height))
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   495
                       width:w
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   496
                      height:(y + h - (magnification y * image height) - yI)  
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   497
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   498
    self drawFrame.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   499
    self clippingRectangle: nil.
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   500
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   501
    "Modified: / 31.7.1998 / 02:22:45 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   502
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   503
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   504
!ImageEditView methodsFor:'edit modes'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   505
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   506
editMode
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   507
1106
57c41df67ae5 support radio buttons of the ImageEditor
tz
parents: 1104
diff changeset
   508
    ^editMode
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   509
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   510
1106
57c41df67ae5 support radio buttons of the ImageEditor
tz
parents: 1104
diff changeset
   511
editMode: anEditMode
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   512
1106
57c41df67ae5 support radio buttons of the ImageEditor
tz
parents: 1104
diff changeset
   513
    editMode := anEditMode
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   514
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   515
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   516
mouseKeyColorMode
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   517
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   518
    ^mouseKeyColorMode printString
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   519
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   520
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   521
mouseKeyColorMode:aMode
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   522
1106
57c41df67ae5 support radio buttons of the ImageEditor
tz
parents: 1104
diff changeset
   523
    mouseKeyColorMode := aMode
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   524
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   525
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   526
!ImageEditView methodsFor:'event handling'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   527
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   528
buttonMotion:state x:x y:y
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   529
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   530
    |p|
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   531
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   532
    p := x@y.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   533
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   534
    state ~~ 0 ifTrue:[
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   535
        ("self selectedColor notNil" true 
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   536
        and:[(self imageContainsPoint:p) 
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   537
        and:[editMode == #point]])
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   538
        ifTrue:[
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   539
            self pointAt:p.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   540
            ^ self
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   541
        ].
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   542
        self drawCursorAt:p.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   543
    ] ifFalse:[
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   544
        self drawCursorAt:p.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   545
        (editMode == #paste or:[editMode == #pasteUnder]) ifTrue: [
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   546
            ("self selectedColor notNil" true and: [self imageContainsPastePoint:p]) 
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   547
                ifTrue:  [self drawPasteRectangleAt:p]
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   548
                ifFalse: [self cursor:Cursor stop. self releasePasteDrawing]
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   549
        ]
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   550
    ]
1019
e68414752bc9 only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
   551
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   552
    "Modified: / 10.2.2000 / 22:03:18 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   553
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   554
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   555
buttonPress:button x:x y:y
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   556
    |p mouseButtonColorToolBar clr|
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   557
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   558
    p := x@y.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   559
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   560
    self drawCursorAt:p.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   561
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   562
    ("self selectedColor notNil" true 
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   563
    and: [self imageContainsPoint:p])
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   564
    ifTrue:[   
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   565
        self sensor shiftDown ifTrue:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   566
            pickedColorHolder notNil ifTrue:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   567
                "/ select the color under the cursor, place it into the
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   568
                "/ pickedColorHolder/
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   569
                clr := image colorAt:(p // magnification).
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   570
                pickedColorHolder value:clr
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   571
            ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   572
        ] ifFalse:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   573
            mouseKeyColorMode := button.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   574
            self makeUndo.
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   575
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   576
"/            "/ cg: what a kludge - please change to use a valueHolder,
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   577
"/            "/ which gets the information ...
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   578
"/            mouseButtonColorToolBar := masterApplication builder componentAt: #MouseButtonColorToolBar.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   579
"/            mouseButtonColorToolBar notNil ifTrue:[
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   580
"/                (mouseButtonColorToolBar itemAt: mouseKeyColorMode) toggleIndication.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   581
"/                mouseButtonColorToolBar do: [:i| i updateIndicators].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   582
"/            ].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   583
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   584
            clickInfoCallBack notNil ifTrue:[
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   585
                "/ still a kludge, but less ugly ...
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   586
                clickInfoCallBack value:button value:p
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   587
            ].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   588
            "/ editMode is something like #point, #rectangle etc.
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   589
            self perform: (editMode, 'At:') asSymbol with:p
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   590
        ]
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   591
    ]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   592
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   593
    "Modified: / 10.2.2000 / 23:11:33 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   594
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   595
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   596
buttonRelease:button x:x y:y
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   597
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   598
    self drawCursorAt: x@y.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   599
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   600
    ("self selectedColor notNil" true and: [self imageContainsPoint: x@y])
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   601
    ifTrue: [   
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
   602
        image release.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   603
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   604
"/        "/ cg: what a kludge - please change to use a valueHolder,
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   605
"/        "/ which gets the information ...
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   606
"/        masterApplication imagePreView invalidate.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   607
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   608
        "/ cg: still a kludge - but less ugly
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   609
        self changed:#subImageIn with:(image bounds).
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   610
    ]
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   611
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   612
    "Modified: / 10.2.2000 / 23:41:41 / cg"
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   613
!
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   614
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   615
pointerLeave:state
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   616
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
   617
    super pointerLeave: state.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   618
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   619
    self updateImageInfo: self imageInfoString.
1019
e68414752bc9 only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
   620
    self cursor:Cursor normal.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   621
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   622
    (editMode == #paste or:[editMode == #pasteUnder]) ifTrue: [
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   623
        self releasePasteDrawing
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   624
    ]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   625
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   626
    "Modified: / 29.7.1998 / 18:27:42 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   627
! !
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   628
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   629
!ImageEditView methodsFor:'image - dragging & info'!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   630
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   631
dragRectangleStartingAt: aPointIn emphasis: emphasis
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   632
    "drag a rectangle (filled or unfilled)"
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   633
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   634
    |currentPoint currentExtent firstPoint lastCurrentPoint gridCorrection 
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   635
     mp lastMp p whichQuarter scrollX scrollY aPoint|
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   636
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   637
    aPoint := aPointIn.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   638
    firstPoint := currentPoint := lastCurrentPoint :=  aPoint//magnification*magnification.
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
   639
    magnification >= GridMagnificationLimit ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1].
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   640
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   641
    [device anyButtonPressed] whileTrue: [                                                  
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   642
        mp := self sensor mousePoint.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   643
        mp = lastMp ifTrue:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   644
            Delay waitForSeconds:0.05
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   645
        ] ifFalse:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   646
            lastMp := mp.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   647
            mp := device translatePoint:mp from:device rootView id to:self id.
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   648
            "/ mp is a device coordinate here ...
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   649
            scrollX := 0.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   650
            mp x > width ifTrue:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   651
                scrollX := mp x - width.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   652
            ] ifFalse:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   653
                mp x < 0 ifTrue:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   654
                    scrollX := mp x.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   655
                ]
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   656
            ].
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   657
            scrollY := 0.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   658
            mp y > height ifTrue:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   659
                scrollY := mp y - height.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   660
            ] ifFalse:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   661
                mp y < 0 ifTrue:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   662
                    scrollY := mp y.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   663
                ]
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   664
            ].
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   665
            (scrollX + scrollY) ~~ 0 ifTrue:[
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   666
                self scrollTo:(self viewOrigin + (scrollX @ scrollY)).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   667
                lastMp := nil.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   668
            ].
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   669
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   670
            mp := mp + self viewOrigin.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   671
            "/ mp is now a logical coordinate.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   672
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   673
            currentPoint := (0@0) max: (image extent * magnification min: (p := mp)).
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   674
            currentPoint := currentPoint//magnification*magnification.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   675
            currentExtent := (firstPoint - currentPoint) abs.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   676
            whichQuarter := (firstPoint x - currentPoint x) > 0 
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   677
                 ifTrue:  [(firstPoint y - currentPoint y) > 0 ifTrue: ["4"1@1] ifFalse: ["3"1@0]]
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   678
                 ifFalse: [(firstPoint y - currentPoint y) > 0 ifTrue: ["1"0@1] ifFalse: ["2"0@0]].
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   679
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   680
            self drawCursorAt: p withLabel: 
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   681
                ((firstPoint//magnification - whichQuarter + 1) printString, 
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   682
                ' to: ', 
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   683
                (currentPoint//magnification + whichQuarter) printString),
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   684
                ' (extent: ',
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   685
                (currentExtent//magnification) printString, ')'.
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   686
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   687
            currentPoint ~= lastCurrentPoint ifTrue:[   
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   688
                emphasis = #inverseFilledBox ifTrue: [
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   689
                    self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   690
                    self xoring: [self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection)]
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   691
                ].
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   692
                emphasis = #box
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   693
                ifTrue:[
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   694
                    |origin extent lineWidthY lineWidthX|
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   695
                    origin := (firstPoint min: lastCurrentPoint) - 1.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   696
                    extent := (firstPoint - lastCurrentPoint) abs + 2.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   697
                    lineWidthY := extent y min: (magnification y + 2).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   698
                    lineWidthX := extent x min: (magnification x + 2).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   699
                    self redraw: (origin extent: (extent x@lineWidthY)).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   700
                    self redraw: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   701
                    self redraw: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   702
                    self redraw: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   703
                    self selectedColor ~= Color noColor
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   704
                        ifTrue: [self paint: self selectedColor]
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   705
                        ifFalse: [self paint: self viewBackground]. 
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   706
                    origin := (firstPoint min: currentPoint) + margin.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   707
                    extent := currentExtent - gridCorrection.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   708
                    lineWidthY := extent y min: magnification y.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   709
                    lineWidthX := extent x min: magnification x.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   710
                    (lineWidthY > 0 and: [lineWidthX > 0])
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   711
                    ifTrue:[
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   712
                        self fillRectangle: (origin extent: (extent x@lineWidthY)).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   713
                        self fillRectangle: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   714
                        self fillRectangle: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   715
                        self fillRectangle: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   716
                    ]
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   717
                ].
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   718
                emphasis = #filledBox
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   719
                ifTrue:[
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   720
                    self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   721
                    self selectedColor ~= Color noColor
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   722
                        ifTrue: [self paint: self selectedColor]
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   723
                        ifFalse: [self paint: self viewBackground].
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   724
                    self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   725
                ].
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   726
            ]. 
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   727
            lastCurrentPoint := currentPoint.
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   728
        ].                  
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   729
    ].                  
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   730
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   731
    ^((0@0) max: (firstPoint min: currentPoint)) extent: (firstPoint - currentPoint) abs
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   732
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   733
    "Created: / 21.8.1998 / 20:17:07 / cg"
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   734
    "Modified: / 10.2.2000 / 21:46:05 / cg"
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   735
!
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   736
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   737
drawCursorAt:aPoint
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   738
    |clr imgPoint|
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   739
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   740
    image isNil ifTrue: [
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   741
        self updateImageInfo: self imageInfoString. 
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   742
        self cursor:Cursor stop.
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   743
        ^ self
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   744
    ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   745
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   746
    (aPoint x < (image width * magnification) 
1060
690045fd9032 drag rect with bad point
tz
parents: 1053
diff changeset
   747
    and:[aPoint y < (image height * magnification)
690045fd9032 drag rect with bad point
tz
parents: 1053
diff changeset
   748
    and:[aPoint x >= 0
690045fd9032 drag rect with bad point
tz
parents: 1053
diff changeset
   749
    and:[aPoint y >= 0]]])
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   750
    ifFalse:[
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   751
        self updateImageInfo: self imageInfoString. 
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   752
        self cursor:Cursor stop.
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   753
    ] ifTrue: [
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   754
        imgPoint := aPoint // magnification.
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   755
        clr := image colorAt:imgPoint.
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   756
        self updateImageInfo: imgPoint printString 
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   757
                        , ' (r:' 
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   758
                        , clr redByte printString
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   759
                        , ' g:' , clr greenByte printString
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   760
                        , ' b:' , clr blueByte printString
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   761
                        , ' pixel:' , (image pixelAt:imgPoint) printString
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   762
                        , ')'.
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
   763
        self cursor:Cursor crossHair
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   764
    ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   765
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   766
    "Modified: / 29.7.1998 / 18:26:01 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   767
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   768
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   769
drawCursorAt: aPoint withLabel: aLabel
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   770
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   771
    ((0@0 extent: image extent * magnification) containsPoint: aPoint)
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   772
	 ifFalse:[self cursor:Cursor stop]
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   773
	 ifTrue: [self cursor:Cursor crossHair].
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   774
     self updateImageInfo: aLabel.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   775
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   776
    "Modified: / 29.7.1998 / 18:26:04 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   777
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   778
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   779
updateActivity: something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   780
    |msg|
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   781
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   782
    msg := something printString.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   783
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   784
    "/ cg: new code:
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   785
    activityInfoHolder notNil ifTrue:[
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   786
	activityInfoHolder value:msg.
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   787
    ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   788
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   789
    "Modified: / 29.7.1998 / 18:41:47 / cg"
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   790
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   791
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   792
updateImageInfo: something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   793
    |msg coordLabel|
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   794
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   795
    msg := something printString.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   796
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   797
    "/ cg: new code:
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   798
    imageInfoHolder notNil ifTrue:[
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   799
	msg ~= imageInfoHolder value ifTrue:[
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   800
	    imageInfoHolder value:msg.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   801
	].
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   802
	^ self
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   803
    ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   804
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   805
"/    "/ cg: what a kludge - please change to use a valueHolder,
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   806
"/    "/ which gets the coordinate ...
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   807
"/
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   808
"/    (masterApplication respondsTo: #coordLabel)
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   809
"/    ifTrue:[  
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   810
"/        coordLabel := masterApplication coordLabel.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   811
"/
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   812
"/        coordLabel label ~= msg
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   813
"/        ifTrue:[         
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   814
"/            coordLabel label: msg.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   815
"/            "/ coordLabel redraw
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   816
"/        ]
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   817
"/    ]
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   818
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   819
    "Modified: / 29.7.1998 / 19:00:21 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   820
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   821
636
d53428252193 revised version
tz
parents: 633
diff changeset
   822
!ImageEditView methodsFor:'image editing'!
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   823
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   824
boxAt: aPoint
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   825
    "draw a rectangular outline with the currently selected color"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   826
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   827
    |choosedBox imageBox clr|
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   828
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   829
    (clr := self selectedColor) notNil ifTrue:[
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   830
        choosedBox := self dragRectangleStartingAt: aPoint emphasis: #box.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   831
        imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   832
        image rectangle:imageBox withColor:clr.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   833
        image restored.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   834
        self redraw: (choosedBox expandedBy: 1).
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   835
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   836
"/        "/ cg: what a kludge - please change to use a valueHolder,
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   837
"/        "/ which gets the information ...
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   838
"/        masterApplication imagePreView redraw: (imageBox expandedBy: 1).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   839
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   840
        "/ cg: still a kludge - but less ugly
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   841
        self changed:#subImageIn with:(imageBox expandedBy: 1).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   842
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   843
        modified := true
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   844
    ].
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   845
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   846
    "Modified: / 10.2.2000 / 23:42:08 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   847
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   848
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   849
copyAt: aPoint
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   850
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   851
    |choosenBox r|
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   852
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   853
    choosenBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   854
    ClipboardMagnification := nil.
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   855
    Clipboard := image subImageIn: (choosenBox origin//magnification extent: (choosenBox extent//magnification)).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   856
    r := (choosenBox expandedBy:1).
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   857
    self redraw:r
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   858
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   859
    "Modified: / 21.8.1998 / 20:16:41 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   860
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   861
1228
0aae4f7389ca renamed - crob -> crop
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   862
cropLeft:doLeft right:doRight top:doTop bottom:doBottom
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   863
    |yMinNew yMaxNew xMinNew xMaxNew
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   864
     pix stillCrobbing xMax yMax x y|
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   865
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   866
    xMax := image width - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   867
    yMax := image height - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   868
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   869
    xMinNew := 0.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   870
    doLeft ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   871
        pix := image pixelAtX:xMinNew y:0.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   872
        stillCrobbing := true.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   873
        [stillCrobbing] whileTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   874
            0 to:yMax do:[:y |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   875
                (image pixelAtX:xMinNew y:y) ~~ pix ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   876
                    stillCrobbing := false
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   877
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   878
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   879
            stillCrobbing ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   880
                xMinNew := xMinNew + 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   881
                xMinNew >= image width ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   882
                    self warn:'Image is all the same color - no crob.'.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   883
                    ^ self
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   884
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   885
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   886
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   887
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   888
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   889
    xMaxNew := xMax.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   890
    doRight ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   891
        stillCrobbing := true.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   892
        pix := image pixelAtX:xMaxNew y:0.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   893
        [stillCrobbing] whileTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   894
            0 to:yMax do:[:y |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   895
                (image pixelAtX:xMaxNew y:y) ~~ pix ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   896
                    stillCrobbing := false
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   897
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   898
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   899
            stillCrobbing ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   900
                xMaxNew := xMaxNew - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   901
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   902
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   903
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   904
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   905
    yMinNew := 0.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   906
    doTop ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   907
        pix := image pixelAtX:xMinNew y:yMinNew.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   908
        stillCrobbing := true.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   909
        [stillCrobbing] whileTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   910
            xMinNew to:xMaxNew do:[:x |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   911
                (image pixelAtX:x y:yMinNew) ~~ pix ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   912
                    stillCrobbing := false
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   913
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   914
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   915
            stillCrobbing ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   916
                yMinNew := yMinNew + 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   917
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   918
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   919
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   920
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   921
    yMaxNew := yMax.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   922
    doRight ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   923
        stillCrobbing := true.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   924
        pix := image pixelAtX:xMaxNew y:yMaxNew.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   925
        [stillCrobbing] whileTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   926
            xMinNew to:xMaxNew do:[:x |
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   927
                (image pixelAtX:x y:yMaxNew) ~~ pix ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   928
                    stillCrobbing := false
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   929
                ]
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   930
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   931
            stillCrobbing ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   932
                yMaxNew := yMaxNew - 1.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   933
            ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   934
        ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   935
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   936
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   937
    (xMinNew == 0
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   938
    and:[xMaxNew == (image width - 1)
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   939
    and:[yMinNew == 0
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   940
    and:[yMaxNew == (image height - 1)]]]) ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   941
        self warn:'No border found - no crob.'.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   942
        ^ self
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   943
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   944
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   945
"/    self warn:'extract subImage ' 
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   946
"/              , (xMinNew @ yMinNew) printString
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   947
"/              , ' -> '
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   948
"/              , (xMaxNew @ yMaxNew) printString.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   949
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   950
    self 
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   951
        makeSubImageX:xMinNew y:yMinNew 
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   952
        width:(xMaxNew - xMinNew + 1)
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   953
        height:(yMaxNew - yMinNew + 1)
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   954
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   955
    "Created: / 7.9.1998 / 14:25:52 / cg"
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   956
    "Modified: / 7.9.1998 / 16:35:35 / cg"
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   957
!
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   958
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   959
fillAt: aPoint
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   960
    "perform a flood-fill with the currently selected color"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   961
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   962
    windowGroup withExecuteCursorDo:[
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   963
        |filledPoints clr|
1002
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   964
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   965
        (clr := self selectedColor) notNil ifTrue:[
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   966
            self updateActivity:'Flood filling - press CTRL-y to abort ...'.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   967
            [
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   968
                filledPoints := image floodFillAt: aPoint//magnification withColor:clr.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   969
                image restored.
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   970
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   971
                "/ animation effect ...    
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   972
                filledPoints size < 300 ifTrue: [
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   973
                    filledPoints do: [:p| self redraw: ((p * magnification extent: magnification) expandedBy: 1)]
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   974
                ] ifFalse: [
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   975
                    self invalidate
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   976
                ].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   977
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   978
"/                "/ cg: what a kludge - please change to use a valueHolder,
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   979
"/                "/ which gets the information ...
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   980
"/                masterApplication imagePreView invalidate.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   981
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   982
                "/ cg: still a kludge - but less ugly
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   983
                self changed:#subImageIn with:(image bounds).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   984
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   985
                modified := true
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   986
            ] valueOnUnwindDo:[
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   987
                self updateActivity:'Flood fill aborted.'
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   988
            ].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   989
        ].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   990
        self updateActivity:''
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   991
    ]
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   992
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
   993
    "Modified: / 10.2.2000 / 23:40:58 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   994
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   995
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   996
filledBoxAt: aPoint
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   997
    "fill a rectangular area with the currently selected color"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   998
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
   999
    |choosedBox imageBox clr|
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1000
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1001
    (clr := self selectedColor) notNil ifTrue:[
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1002
        choosedBox := self dragRectangleStartingAt: aPoint emphasis: #filledBox.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1003
        imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1004
        image fillRectangle:imageBox withColor:clr.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1005
        image restored.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1006
        self redraw: (choosedBox expandedBy: 1).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1007
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1008
"/        "/ cg: what a kludge - please change to use a valueHolder,
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1009
"/        "/ which gets the information ...
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1010
"/        masterApplication imagePreView redraw: (imageBox expandedBy: 1).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1011
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1012
        "/ cg: still a kludge - but less ugly
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1013
        self changed:#subImageIn with:(imageBox expandedBy: 1).
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1014
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1015
        modified := true
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1016
    ]
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1017
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1018
    "Modified: / 10.2.2000 / 23:37:04 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1019
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1020
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1021
flipHorizontal
d53428252193 revised version
tz
parents: 633
diff changeset
  1022
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1023
    self makeUndo.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
  1024
    self image: image copy flipHorizontal
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1025
d53428252193 revised version
tz
parents: 633
diff changeset
  1026
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1027
d53428252193 revised version
tz
parents: 633
diff changeset
  1028
flipVertical
d53428252193 revised version
tz
parents: 633
diff changeset
  1029
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1030
    self makeUndo.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
  1031
    self image: image copy flipVertical
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1032
d53428252193 revised version
tz
parents: 633
diff changeset
  1033
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1034
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1035
magnifyImageTo:newSize
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1036
    self makeUndo.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1037
    self image: (image magnifiedBy: newSize/image extent)
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1038
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1039
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1040
makeGrayScale
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1041
    |xMax yMax r g b n_r n_g n_b clr pix map revMap n_clr n_pix anyChange
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1042
     newColors newColorArray newImage|
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1043
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1044
    anyChange := false.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1045
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1046
    xMax := image width - 1.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1047
    yMax := image height - 1.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1048
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1049
    newColors := Set new.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1050
    newColorArray := OrderedCollection new.
1903
b0c9fcf3155e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
  1051
    map := Array new:256.
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1052
    revMap := OrderedCollection new.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1053
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1054
    newImage := image class width:image width height:image height depth:image depth.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1055
    newImage photometric:image photometric.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1056
    newImage colorMap:(image colorMap copy).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1057
    newImage bits:(ByteArray new:(image bits size)).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1058
    newImage mask:(image mask copy).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1059
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1060
    0 to:yMax do:[:y |
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1061
        0 to:xMax do:[:x |
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1062
            pix := image pixelAtX:x y:y.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1063
            (n_pix := map at:pix+1) isNil ifTrue:[
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1064
                clr := image colorAtX:x y:y.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1065
                n_clr := Color brightness:(clr brightness).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1066
                (newColors includes:n_clr) ifFalse:[
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1067
                    newColors add:n_clr.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1068
                    newColorArray add:n_clr.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1069
                    revMap add:pix.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1070
                    map at:pix+1 put:(n_pix := revMap size - 1).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1071
                ] ifTrue:[
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1072
                    "/ mhmh - multiple pixels mapped to the same color
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1073
                    n_pix := (newColorArray indexOf:n_clr) - 1.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1074
                    map at:pix+1 put:n_pix.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1075
                ]
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1076
            ].
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1077
            newImage pixelAtX:x y:y put:n_pix.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1078
        ]
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1079
    ].
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1080
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1081
    newImage colorMap:(Colormap fromColors:newColorArray).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1082
    self makeUndo.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1083
    self image:newImage.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1084
    ^ true
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1085
!
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1086
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1087
makeSubImageX:oldX y:oldY width:newWidth height:newHeight
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1088
    |newImage|
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1089
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1090
    newImage := image class width:newWidth height:newHeight depth:image depth.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1091
    newImage photometric:image photometric.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1092
    newImage colorMap:image colorMap copy.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1093
    newImage bits:(ByteArray new:(newImage bytesPerRow * newHeight)).
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1094
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1095
    image mask notNil
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1096
    ifTrue:[
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1097
        |newMaskImage|
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1098
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1099
        newMaskImage := Depth1Image width:newWidth height:newHeight.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1100
        newMaskImage photometric: image mask photometric.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1101
        newMaskImage colorMap: image mask colorMap copy.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1102
        newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newHeight).
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1103
        newImage mask: newMaskImage
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1104
    ].
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1105
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1106
    newImage copyFrom:image x:oldX y:oldY toX:0 y:0 width:newWidth height:newHeight.
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1107
    self makeUndo.
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1108
    self image:newImage.
1121
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1109
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1110
    "Created: / 7.9.1998 / 13:00:16 / cg"
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1111
    "Modified: / 7.9.1998 / 14:15:32 / cg"
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1112
!
af09c616fb7b added crob operations.
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
  1113
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1114
negativeImage
d53428252193 revised version
tz
parents: 633
diff changeset
  1115
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1116
    self makeUndo.
1411
05ffc8ae696e methode negativeImage ivert bits of image
tm
parents: 1380
diff changeset
  1117
    self image: (image copy bits:(image bits invert))
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1118
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1119
d53428252193 revised version
tz
parents: 633
diff changeset
  1120
pasteAt: aPoint
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1121
    "paste the image in the clipboard at aPoint"
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1122
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1123
    self pasteAt:aPoint modeUnder:false.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1124
!
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1125
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1126
pasteAt: aPoint modeUnder:modeUnder
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1127
    "paste the image in the clipboard at aPoint"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1128
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1129
    |answer|
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1130
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1131
    ClipboardMagnification isNil ifTrue: [
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1132
        "/ ^self
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1133
    ].
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1134
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1135
    Object errorSignal handle:
d53428252193 revised version
tz
parents: 633
diff changeset
  1136
    [:ex|
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1137
        ex signal == Image unrepresentableColorSignal ifFalse:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1138
            ex reject
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1139
        ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1140
        self undo.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1141
        self warn: 'Paste failed !!\Increasing the images depth might help.' withCRs. 
1823
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1142
    ] do: [   
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1143
        windowGroup withExecuteCursorDo:[
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1144
            |anyColorMissing choosedBox imagePoint imgX imgY copiedImage imageBox presentClr newColorMap|
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1145
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1146
            choosedBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1147
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1148
            imagePoint := choosedBox origin//magnification.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1149
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1150
            copiedImage := Clipboard copy.
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1151
            true 
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1152
            "/ image photometric == #palette 
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1153
            ifTrue:[
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1154
                "/ for all colors in the pasted image,
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1155
                "/ check, if its in the colormap of the
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1156
                "/ target image.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1157
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1158
                anyColorMissing := false.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1159
                copiedImage usedValues do:[:pixel |
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1160
                    |pastedColor oldColorMap|
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1161
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1162
                    pastedColor := copiedImage colorFromValue:pixel.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1163
                    oldColorMap := image colorMap.
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1164
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1165
                    (oldColorMap detect: [:clr| clr = pastedColor] ifNone: nil) isNil
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1166
                    ifTrue:
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1167
                    [        
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1168
                        oldColorMap size < (1 bitShift:image depth) ifTrue:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1169
                            "/ add to colormap
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1170
                            newColorMap isNil ifTrue:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1171
                                newColorMap := oldColorMap asOrderedCollection.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1172
                            ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1173
                            newColorMap add:pastedColor.
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1174
    "/                        Transcript showCR:'adding color:' , pastedColor displayString , ' to targets colorMap'.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1175
                        ] ifFalse:[
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1176
    "/                        Transcript showCR:'color:' , pastedColor displayString , ' not found in targets colorMap'.
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1177
                            copiedImage colorMap notNil ifTrue:[
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1178
                                copiedImage colorMap at: pixel+1 put: Color black.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1179
                            ].
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1180
                            anyColorMissing := true.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1181
                        ]
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1182
                    ]
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1183
                ].
1888
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1184
                anyColorMissing ifTrue:[
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1185
                    answer := Dialog
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1186
                                confirmWithCancel:'Some color(s) cannot be represented (colorMap full). Use nearest or compute colorMap ?' 
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1187
                                labels:#('use nearest' 'new ColorMap' 'cancel')
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1188
                                values:#(nearest new nil)
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1189
                                default:1.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1190
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1191
                    answer isNil ifTrue:[^ self].
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1192
                    answer == #nearest ifTrue:[
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1193
                        0 to:copiedImage height-1 do:[:y |
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1194
                            0 to:copiedImage width-1 do:[:x |
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1195
                                |clr n_clr|
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1196
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1197
                                clr := copiedImage atX:x y:y.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1198
                                n_clr := clr nearestIn:image colorMap.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1199
                                copiedImage atX:x y:y put:n_clr
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1200
                            ]
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1201
                        ].
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1202
                    ] ifFalse:[
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1203
                        self warn:'Sorry: unimplemented function'.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1204
                        self undo.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1205
                        ^ self.
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1206
                    ].
ef622d292093 colormap conversion
Claus Gittinger <cg@exept.de>
parents: 1886
diff changeset
  1207
                ].
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1208
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1209
                newColorMap notNil ifTrue:[
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1210
                    image colorMap:(Colormap fromColors:newColorMap).
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1211
                ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1212
            ].
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1213
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1214
            copiedImage := image class fromImage: copiedImage.
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1215
            (newColorMap isNil 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1216
            and:[modeUnder not
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1217
            and:[copiedImage mask isNil]]) ifTrue:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1218
                "/ use images copy functionality
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1219
                "/ however, this copies the mask as well,
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1220
                "/ which is not useful here
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1221
                image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1222
            ] ifFalse:[
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
  1223
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1224
                imgX := imagePoint x.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1225
                imgY := imagePoint y.
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1226
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1227
                0 to:copiedImage height-1 do:[:y |
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1228
                    0 to:copiedImage width-1 do:[:x |
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1229
                        |wasMasked newMasked dstX dstY oldColor|
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1230
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1231
                        dstX := imgX + x.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1232
                        dstY := imgY + y.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1233
                        wasMasked := (image maskAtX:dstX y:dstY) == 0.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1234
                        newMasked := (copiedImage maskAtX:x y:y) == 0.
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
  1235
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1236
                        "/ with modeUnder, 
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1237
                        "/ only replace, if its either unmasked,
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1238
                        "/ or the current drawing color.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1239
                        (modeUnder not
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1240
                        or:[wasMasked
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1241
                        or:[(oldColor := image colorAtX:dstX y:dstY) = (drawingColors at:1)]])
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1242
                        ifTrue:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1243
                            newMasked ifFalse:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1244
                                image 
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1245
                                    colorAtX:dstX
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1246
                                           y:dstY
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1247
                                         put:(copiedImage colorAtX:x y:y).
1823
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1248
                                wasMasked ifTrue:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1249
                                    image mask pixelAtX:dstX y:dstY put:1
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1250
                                ].
1823
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1251
                            ] ifTrue:[
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1252
                                wasMasked ifFalse:[
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1253
                                    image mask pixelAtX:dstX y:dstY put:0
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1254
                                ]
d11286b90d3b paste mask
Claus Gittinger <cg@exept.de>
parents: 1781
diff changeset
  1255
                            ].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1256
                        ]
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1257
                    ]
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1258
                ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1259
            ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1260
            image restored.
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1261
            self redraw: (imageBox := (imagePoint * magnification extent: (Clipboard extent * magnification)) expandedBy: 1@1).
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1262
"/            masterApplication imagePreView redraw: (imageBox expandedBy: 1).
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1263
            modified := true
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1264
        ]
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1265
   ]
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1266
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1267
    "Modified: / 18.5.1999 / 20:40:37 / cg"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1268
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1269
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1270
pasteUnderAt: aPoint
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1271
    "pasteUnder the image in the clipboard at aPoint.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1272
     In this mode, only pixels which are not equal to
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1273
     the current color or masked are pasted."
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1274
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1275
    self pasteAt:aPoint modeUnder:true.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1276
!
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1277
1858
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1278
performSpecialOperationOn:imageBox withColor:clr
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1279
    |operation x0 y0 x1 y1 grey|
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1280
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1281
    operation := Dialog 
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1282
           choose:'Which Operation:' 
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1283
           fromList:#(
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1284
"/                       'brighten'
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1285
"/                       'darken'
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1286
"/                       '-'
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1287
"/                       'greying'
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1288
                       'grey pattern'
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1289
                     ) 
1859
c599344d7811 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1858
diff changeset
  1290
           values:#("brighten darken nil greying "greyPattern) 
1858
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1291
           lines:6
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1292
           cancel:nil.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1293
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1294
    self invalidate.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1295
    self windowGroup processExposeEvents.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1296
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1297
    operation isNil ifTrue:[^ false].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1298
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1299
    x0 := imageBox left.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1300
    y0 := imageBox top.
1861
ba1f1a884ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1859
diff changeset
  1301
    x1 := imageBox right - 1.
ba1f1a884ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1859
diff changeset
  1302
    y1 := imageBox bottom -1 .
1858
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1303
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1304
    operation == #brighten ifTrue:[
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1305
        self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr |
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1306
                                                           self image colorAtX:x y:y put:(clr lightened).
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1307
                                                      ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1308
        ^ true.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1309
    ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1310
    operation == #darken ifTrue:[
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1311
        self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr |
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1312
                                                           self image colorAtX:x y:y put:(clr darkened).
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1313
                                                      ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1314
        ^ true.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1315
    ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1316
    operation == #greying ifTrue:[
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1317
        self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr |
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1318
                                                           self image colorAtX:x y:y put:(clr blendWith:Color grey).
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1319
                                                      ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1320
        ^ true.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1321
    ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1322
    operation == #greyPattern ifTrue:[
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1323
        grey := Color grey nearestIn:(self image colorMap).
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1324
        self image colorsFromX:x0 y:y0 toX:x1 y:y1 do:[:x :y :clr |
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1325
                                                           (x + y )odd ifTrue:[
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1326
                                                               self image colorAtX:x y:y put:grey.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1327
                                                           ]
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1328
                                                      ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1329
        ^ true.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1330
    ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1331
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1332
    self halt.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1333
    ^ false.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1334
!
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1335
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1336
pointAt: aPoint
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1337
    "draw a single pixel with the currently selected color"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1338
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1339
    |imagePoint clr pix|
796
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
  1340
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1341
    imagePoint := aPoint // magnification.
1277
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1342
    (clr := self selectedColor) isNil ifTrue:[
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1343
        pix := self selectedColorIndex
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1344
    ].
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1345
    pix notNil ifTrue:[
1277
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1346
        image colorMap atImageAndMask:imagePoint putValue:pix.
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
  1347
        modified := true.
1277
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1348
    ] ifFalse:[     
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1349
        clr notNil ifTrue:[
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1350
            image atImageAndMask:imagePoint put:clr.
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1351
            modified := true.
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1352
        ].
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1353
    ].
1277
8c74c9cc6e22 fixed point-drawing
Claus Gittinger <cg@exept.de>
parents: 1261
diff changeset
  1354
    self invalidate:((imagePoint * magnification extent: magnification) expandedBy: 1).
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1355
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1356
    "Modified: / 5.9.1998 / 13:25:29 / cg"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1357
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1358
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1359
reduceColorResolutionBy:numBits
1885
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1360
    |xMax yMax r g b n_r n_g n_b clr pix map revMap n_clr n_pix mask anyChange
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1361
     newColors newColorArray newImage|
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1362
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1363
    anyChange := false.
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1364
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1365
    xMax := image width - 1.
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1366
    yMax := image height - 1.
1885
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1367
    mask := (16rFF bitShift:numBits) bitAnd:16rFF.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1368
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1369
    newColors := Set new.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1370
    newColorArray := OrderedCollection new.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1371
    map := Array new:255.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1372
    revMap := OrderedCollection new.
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1373
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1374
    newImage := image class width:image width height:image height depth:image depth.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1375
    newImage photometric:image photometric.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1376
    newImage colorMap:(image colorMap copy).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1377
    newImage bits:(ByteArray new:(image bits size)).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1378
    newImage mask:(image mask copy).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1379
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1380
    0 to:yMax do:[:y |
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1381
        0 to:xMax do:[:x |
1885
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1382
            pix := image pixelAtX:x y:y.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1383
            (n_pix := map at:pix+1) isNil ifTrue:[
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1384
                clr := image colorAtX:x y:y.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1385
                n_r := (r := clr redByte) bitAnd:mask.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1386
                n_g := (g := clr greenByte) bitAnd:mask.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1387
                n_b := (b := clr blueByte) bitAnd:mask.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1388
                n_clr := Color redByte:n_r greenByte:n_g blueByte:n_b.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1389
                (newColors includes:n_clr) ifFalse:[
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1390
                    newColors add:n_clr.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1391
                    newColorArray add:n_clr.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1392
                    revMap add:pix.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1393
                    map at:pix+1 put:(n_pix := revMap size - 1).
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1394
                ] ifTrue:[
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1395
                    "/ mhmh - multiple pixels mapped to the same color
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1396
                    n_pix := (newColorArray indexOf:n_clr) - 1.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1397
                    map at:pix+1 put:n_pix.
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1398
                ]
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1399
            ].
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1400
            newImage pixelAtX:x y:y put:n_pix.
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1401
        ]
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1402
    ].
1885
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1403
    revMap size == image colorMap size ifTrue:[
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1404
        revMap = (0 to:revMap size-1) ifTrue:[
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1405
            ^ false
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1406
        ]
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1407
    ].
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1408
1886
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1409
    newImage colorMap:(Colormap fromColors:newColorArray).
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1410
    self makeUndo.
e5b5a8850dc5 added make grayScale
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  1411
    self image:newImage.
1885
5f85501aaea9 reduce color-resolution fixed
Claus Gittinger <cg@exept.de>
parents: 1882
diff changeset
  1412
    ^ true
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1413
!
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1414
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1415
resizeImageTo:newSize
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1416
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1417
    |newImage newMaskImage|
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1418
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1419
    newImage := image class width: newSize x height: newSize y depth: image depth.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1420
    newImage photometric:image photometric.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1421
    newImage colorMap:image colorMap copy.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1422
    newImage bits: (ByteArray new: newImage bytesPerRow * newSize y).
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1423
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1424
    image mask notNil ifTrue:[
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1425
        newMaskImage := Depth1Image width: newSize x height: newSize y.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1426
        newMaskImage photometric: image mask photometric.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1427
        newMaskImage colorMap: image mask colorMap copy.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1428
        newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newSize y).
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1429
        newImage mask: newMaskImage
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1430
    ].
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1431
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1432
    newImage copyFrom:image x:0 y:0 toX:0 y:0 width: (image width min:newSize x) height: (image height min:newSize y).
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1433
    self makeUndo.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1434
    self image: newImage.
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1435
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1436
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1437
rotateImageBy:rotation
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1438
    "rotate by (degrees)"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1439
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1440
    Object errorSignal handle:[:ex|
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1441
        self warn: 'Image rotation failed!!\' withCRs, 'Increaing the image depth could help.'
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1442
    ] do:[   
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1443
        self makeUndo.
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1444
        self image: (image hardRotated: rotation)
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1445
    ]
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1446
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1447
    "Modified: / 29.7.1998 / 18:21:14 / cg"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1448
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1449
1858
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1450
specialOperationAt: aPoint
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1451
    "special operation on a rectangular area"
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1452
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1453
    |choosedBox imageBox clr|
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1454
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1455
    choosedBox := self dragRectangleStartingAt: aPoint emphasis: #filledBox.
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1456
    imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification).
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1457
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1458
    (self performSpecialOperationOn:imageBox withColor:self selectedColor) ifFalse:[
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1459
        ^ self
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1460
    ].
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1461
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1462
    image restored.
1861
ba1f1a884ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1859
diff changeset
  1463
    self invalidate. "/ : (choosedBox expandedBy: 1).
ba1f1a884ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1859
diff changeset
  1464
ba1f1a884ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1859
diff changeset
  1465
    "/ self redraw: (choosedBox expandedBy: 1).
1858
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1466
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1467
"/        "/ cg: what a kludge - please change to use a valueHolder,
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1468
"/        "/ which gets the information ...
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1469
"/        masterApplication imagePreView redraw: (imageBox expandedBy: 1).
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1470
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1471
        "/ cg: still a kludge - but less ugly
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1472
    self changed:#subImageIn with:(imageBox expandedBy: 1).
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1473
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1474
    modified := true
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1475
!
54138b1b3efd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1476
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1477
undo
d53428252193 revised version
tz
parents: 633
diff changeset
  1478
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1479
    undoImages notEmpty ifTrue:[           
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1480
        windowGroup withExecuteCursorDo:[
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1481
            modified := false. 
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1482
            self image: undoImages removeLast.
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1483
"/            "/ cg: what a kludge - please change to use a valueHolder,
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1484
"/            masterApplication notNil ifTrue:[
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1485
"/                masterApplication listOfColors contents: image colorMap.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1486
"/                masterApplication findColorMapMode.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1487
"/"/                undoImages isEmpty ifTrue: [
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1488
"/"/                    masterApplication valueOfCanUndo value: false
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1489
"/"/                ].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1490
"/            ].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1491
            self changed:#image.
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1492
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1493
            "/ cg: not needed - image: already does it.
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1494
"/            self invalidate
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1495
        ]
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1496
    ]
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1497
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1498
    "Modified: / 10.2.2000 / 23:21:24 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1499
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1500
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1501
!ImageEditView methodsFor:'image setting'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1502
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1503
image:anImage
1256
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1504
    |retVal fileName|
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1505
1256
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1506
    anImage isImage ifTrue:[           
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1507
        (image isNil or: [self checkModified]) ifTrue: [
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1508
"/ cg: that is too ugly ...
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1509
"/            masterApplication notNil ifTrue: [
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1510
"/"/                undoImages notEmpty ifTrue: [
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1511
"/"/                    masterApplication valueOfCanUndo value: true
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1512
"/"/                ].
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1513
"/                masterApplication imagePreView image: anImage
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1514
"/            ].
1256
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1515
            image notNil ifTrue: [
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1516
                fileName := image fileName.
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1517
                anImage fileName isNil ifTrue: [anImage fileName: fileName].
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1518
            ].
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1519
            super image: anImage.
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1520
            retVal := self.
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1521
        ].
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1522
    ] ifFalse: [
c4e0b9024475 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1523
        super image: nil.
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1524
    ].
1763
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
  1525
    "/cg: still a kludge, but less ugly
7d6d64622ee4 change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents: 1706
diff changeset
  1526
    self changed:#image.
1025
4470f3ad349f update the image label, when a new image is assigned.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
  1527
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1528
    self updateImageInfo: self imageInfoString. 
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1529
    ^ retVal
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1530
1693
5f8be1b4f856 de-uglified
Claus Gittinger <cg@exept.de>
parents: 1510
diff changeset
  1531
    "Modified: / 10.2.2000 / 23:33:12 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1532
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1533
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1534
loadFromFile: aFileName
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1535
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1536
    aFileName isNil ifTrue: [^nil].
1774
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1537
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1538
    Object errorSignal handle:[:exeption|
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1539
        modified := false.
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1540
        self warn: exeption errorString.
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1541
        ^nil
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1542
    ] do:[ 
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1543
        |imageFromFile|
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1544
        (imageFromFile := Image fromFile: aFileName) notNil
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1545
        ifTrue:[
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1546
            self releaseUndos.
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1547
            self image: imageFromFile. 
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1548
            imageReaderClass := ImageReader allSubclasses
1865
49a47761ec76 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1861
diff changeset
  1549
                detect: [:cls| cls isValidImageFile: aFileName asFilename pathName]
1774
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1550
                ifNone: [self error: 'Unknown image file format!!']
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1551
        ] ifFalse:[
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1552
            self error: 'Not an image file (or unrecognized format) !!'
3e9f6af51746 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1764
diff changeset
  1553
        ]
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1554
    ]
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1555
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1556
    "Modified: / 29.7.1998 / 18:09:13 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1557
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
  1558
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1559
loadFromMessage: aMessage
594edef86630 revised version
tz
parents: 632
diff changeset
  1560
1781
b1078497810f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1561
    (self resourceMessage: aMessage) isNil ifTrue:[
b1078497810f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1774
diff changeset
  1562
        ^ nil
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1563
    ].
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1564
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1565
    ^self loadfromClass: resourceClass andSelector: resourceSelector
594edef86630 revised version
tz
parents: 632
diff changeset
  1566
594edef86630 revised version
tz
parents: 632
diff changeset
  1567
   
594edef86630 revised version
tz
parents: 632
diff changeset
  1568
!
594edef86630 revised version
tz
parents: 632
diff changeset
  1569
594edef86630 revised version
tz
parents: 632
diff changeset
  1570
loadfromClass: aClassOrSymbol andSelector: aStringOrSymbol
594edef86630 revised version
tz
parents: 632
diff changeset
  1571
678
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1572
    |aClass| 
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1573
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1574
    imageReaderClass := nil.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1575
    self resourceClass: aClassOrSymbol.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1576
    self resourceSelector: aStringOrSymbol.
678
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1577
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1578
    ((aClass := Smalltalk at: resourceClass) isClass and: 
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1579
    [aClass class implements: resourceSelector])
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1580
    ifTrue:
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1581
    [ 
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1582
	self releaseUndos.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1583
	^self image: (aClass perform: resourceSelector) copy
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1584
    ]
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1585
    ifFalse:
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1586
    [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1587
	modified := false.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1588
	^nil
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1589
    ]
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1590
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1591
! !
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1592
1327
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1593
!ImageEditView methodsFor:'initialize / release'!
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1594
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1595
destroy
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1596
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1597
    ClipboardMagnification := Clipboard := nil.
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1598
    LastMagnification      := magnification.
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1599
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1600
    super destroy
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1601
ab99aad206dc category change
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
  1602
!
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1603
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1604
initialize
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1605
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1606
    super initialize.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1607
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1608
    self enableMotionEvents.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1609
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1610
    undoImages        := List new: MaxUndos.
1706
a954781f4440 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
  1611
    magnification     := LastMagnification ? (8@8).
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1612
    modified          := false.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1613
    mouseKeyColorMode := 1.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1614
    resourceClass     := resourceSelector := ''.
1246
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1615
    drawingColors     := Array with: nil with: nil.   "/ left/right mouse colors
0cd36bffc789 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
  1616
    drawingPixels     := Array with: nil with: nil.   "/ left/right mouse colors
1106
57c41df67ae5 support radio buttons of the ImageEditor
tz
parents: 1104
diff changeset
  1617
    editMode          := #point.
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
  1618
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1619
! !
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1620
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1621
!ImageEditView methodsFor:'printing & storing'!
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1622
724
d6f4b89940ed undo disabling
tz
parents: 704
diff changeset
  1623
loadFromClass
404
322e32d8f099 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1624
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1625
    ^self loadFromMessage: 
1184
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  1626
        (ResourceSelectionBrowser
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  1627
            request: 'Load Image From Class'
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  1628
            onSuperclass: nil
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  1629
            andClass: self resourceClass
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  1630
            andSelector: self resourceSelector
58e399d8c312 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  1631
            withResourceTypes: #(image fileImage programImage))
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1632
            
477
37f12d35c359 added #resize.
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
  1633
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1634
!
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1635
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1636
makeUndo
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1637
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1638
    image notNil ifTrue:[       
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1639
        undoImages size >= MaxUndos ifTrue:[
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1640
            undoImages removeFirst.
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1641
        ].
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1642
        undoImages add: image copy
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1643
    ]
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1644
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1645
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1646
print
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1647
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1648
    image notNil 
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1649
    ifTrue: 
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1650
    [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1651
	|stream|
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1652
	Printer supportsPostscript ifFalse:
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1653
	[
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1654
	    ^self warn:'No postscript printer detected!!'
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1655
	].
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1656
	stream := Printer newNative.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1657
	stream isNil ifTrue:
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1658
	[
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1659
	    ^self warn:'Cannot open printer stream!!'
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1660
	].
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1661
	self withWaitCursorDo:
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1662
	[
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1663
	    |psgc|
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1664
	    psgc := PSGraphicsContext on:stream.  
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1665
	    psgc displayForm: (image magnifiedBy: magnification) x:0 y:0.
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1666
	    psgc close
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1667
	]
398
7b7255a4db0d show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
  1668
    ]
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1669
!
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1670
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1671
save
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1672
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1673
    self saveImageOrMask: #image.
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1674
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1675
!
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1676
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1677
saveAs
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1678
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1679
    self saveImageFileAs
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1680
!
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1681
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1682
saveImageFileAs
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1683
    "ask for a fileName and save the image"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1684
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1685
    self saveImageFileAs:
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1686
        (FileSelectionBrowser
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1687
            request: 'Save Image To File'
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1688
            fileName: self image fileName
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1689
            withFileFilters: FileSelectionBrowser saveImageFileNameFilters)
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1690
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1691
    "Modified: / 30.9.1998 / 23:05:19 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1692
!
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1693
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1694
saveImageFileAs: aFileName
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1695
    "save the image in aFileName"
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1696
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1697
    aFileName isNil ifTrue: [^nil].
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1698
    image notNil ifTrue:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1699
        image fileName: aFileName.
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1700
        self saveImageOrMask: #image
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1701
    ] ifFalse:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1702
        self warn: 'No image or file name for saving detected!!'
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1703
    ]
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1704
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1705
    "Modified: / 30.9.1998 / 23:04:55 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1706
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1707
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1708
saveImageMaskFileAs
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1709
    "ask for a fileName and save the mask only"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1710
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1711
    self saveImageMaskFileAs:
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1712
        (FileSelectionBrowser
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1713
            request: 'Save Image Mask To File'
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1714
            fileName: self image fileName 
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1715
            withFileFilters: FileSelectionBrowser saveImageFileNameFilters)
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1716
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1717
    "Modified: / 30.9.1998 / 23:04:11 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1718
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1719
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1720
saveImageMaskFileAs: aFileName
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1721
    "save the mask only in aFileName"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1722
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1723
    aFileName isNil ifTrue: [^nil].
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1724
    (image notNil and:[image mask notNil]) ifTrue:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1725
        image mask fileName:aFileName.
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1726
        self saveImageOrMask: #mask
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1727
    ] ifFalse:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1728
        self warn: 'No image or image mask detected!!'
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1729
    ]
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1730
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1731
    "Modified: / 30.9.1998 / 23:06:24 / cg"
628
7f36d8a7735f popup menu starts image editor
tz
parents: 627
diff changeset
  1732
!
7f36d8a7735f popup menu starts image editor
tz
parents: 627
diff changeset
  1733
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1734
saveImageOrMask: what
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1735
    "save the image or the mask only (if what == #mask)"
628
7f36d8a7735f popup menu starts image editor
tz
parents: 627
diff changeset
  1736
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1737
    |fileName|
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1738
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1739
    Object errorSignal handle:[:ex|
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1740
        |msg|
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1741
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1742
        ex signal == Image fileCreationErrorSignal ifTrue:[
1896
0f430b35c451 asText allBold -> allBold
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1743
            msg := resources string:'Cannot create file: ''%1''' with:fileName asFilename pathName allBold
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1744
        ] ifFalse:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1745
            msg := ex errorString.
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1746
        ].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1747
        Dialog warn:msg.
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1748
    ] do:[   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1749
        Image informationLostQuerySignal handle:[:ex|
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1750
            "/ should make those warnings visible ...
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1751
            (self confirm:(ex errorString , '\\Save anyway ?') withCRs) ifTrue:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1752
                ex proceed.
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1753
            ]
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1754
        ] do:[   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1755
            windowGroup withCursor:Cursor write do:[
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1756
                |suff fn|
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1757
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1758
                image isNil ifTrue:[
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1759
                    ^ self error: 'No image to save!!'
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1760
                ].
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1761
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1762
                what = #image ifTrue:[   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1763
                    (fileName := image fileName) isNil ifTrue: [^self error: 'No file name for image detected!!'].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1764
                ].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1765
                what = #mask ifTrue:[   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1766
                    image mask isNil ifTrue: [^self error: 'No image mask to save!!'].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1767
                    (fileName := image mask fileName) isNil ifTrue: [^self error: 'No file name for image mask detected!!'].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1768
                ].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1769
                fileName := fileName asFilename.
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1770
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1771
                fileName name size = 0 ifTrue: [^self error: 'No file name detected!!'].
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1772
                suff := fileName suffix asLowercase.
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1773
                imageReaderClass := nil.
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1774
                imageReaderClass := MIMETypes imageReaderForSuffix:suff.
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1775
"/                (suff = 'tiff' or:[suff = 'tif']) ifTrue: [
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1776
"/                    imageReaderClass := TIFFReader
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1777
"/                ] ifFalse:[
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1778
"/                    suff = 'xpm' ifTrue: [
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1779
"/                        imageReaderClass := XPMReader
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1780
"/                    ] ifFalse:[
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1781
"/                        suff = 'xbm' ifTrue: [
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1782
"/                            imageReaderClass := XBMReader
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1783
"/                        ] ifFalse:[
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1784
"/                            suff = 'gif' ifTrue: [
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1785
"/                                imageReaderClass := GIFReader
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1786
"/                            ] ifFalse:[
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1787
"/                                (suff = 'jpg' or:[suff = 'jpeg']) ifTrue: [
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1788
"/                                    imageReaderClass := JPEGReader
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1789
"/                                ].
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1790
"/                            ]
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1791
"/                        ]
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1792
"/                    ]
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1793
"/                ].
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1794
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1795
                imageReaderClass isNil ifTrue: [
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1796
                    imageReaderClass := XPMReader. 
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1797
                    image fileName:(fileName := image fileName, '.xpm').
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1798
                    Dialog warn:(('Dont know how to write ''.' , suff , '''-files\\Saving in xpm format as ''%1''.') 
1896
0f430b35c451 asText allBold -> allBold
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1799
                                withCRs bindWith:image fileName allBold).
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1800
                ].
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1801
                (imageReaderClass canRepresent:image) ifFalse:[
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1802
                    imageReaderClass := XPMReader. 
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1803
                    image fileName:(fileName := image fileName, '.xpm').
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1804
                    Dialog warn:(('Saving in ''.' , suff , '''-format is not supported\\Saving in xpm format as ''%1''.') 
1896
0f430b35c451 asText allBold -> allBold
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1805
                                withCRs bindWith:image fileName allBold).
1373
c949e9f7757c give a warning, if saving in the given file-format is not
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  1806
                ].
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1807
                Transcript showCR:('saving as:' , fileName asFilename pathName).
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1808
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1809
                what = #image ifTrue: [image saveOn:fileName using: imageReaderClass. modified := false].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1810
                what = #mask ifTrue: [image mask saveOn:fileName using: imageReaderClass].
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1811
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1812
                fileName asFilename exists ifFalse:[
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1813
                    Dialog warn:'Oops image save failed.'
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1814
                ]
1158
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1815
            ]   
9b413954d34d issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents: 1121
diff changeset
  1816
        ]
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1817
    ]
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1818
1380
3b343d2e69ef fixed copy-paste with masked images.
Claus Gittinger <cg@exept.de>
parents: 1374
diff changeset
  1819
    "Modified: / 18.5.1999 / 19:46:54 / cg"
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1820
!
594edef86630 revised version
tz
parents: 632
diff changeset
  1821
594edef86630 revised version
tz
parents: 632
diff changeset
  1822
saveMethod
594edef86630 revised version
tz
parents: 632
diff changeset
  1823
594edef86630 revised version
tz
parents: 632
diff changeset
  1824
    Object errorSignal handle:
594edef86630 revised version
tz
parents: 632
diff changeset
  1825
    [:ex|
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1826
        self warn: ex errorString.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1827
        ^nil                                 
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1828
    ] 
594edef86630 revised version
tz
parents: 632
diff changeset
  1829
    do:
594edef86630 revised version
tz
parents: 632
diff changeset
  1830
    [   
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1831
        |category imageStoreStream cls sel mthd imageKey|
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1832
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1833
        windowGroup withExecuteCursorDo:[
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1834
            (self resourceSelector trimBlanks size = 0) | (cls := Smalltalk at: self resourceClass) isClass not 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1835
                ifTrue: [^self saveMethodAs].
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1836
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1837
            self class 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1838
                generateImageSpecMethodFor:self image 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1839
                comment:(ResourceSpecEditor codeGenerationCommentForClass: ImageEditor) 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1840
                inClass:cls class 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1841
                selector:self resourceSelector.
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1842
1901
b4b286ec221f flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents: 1896
diff changeset
  1843
            "/ flush cache images in the Icon class (kludge)
b4b286ec221f flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents: 1896
diff changeset
  1844
            Icon flushCachedIcons.
b4b286ec221f flush cached icons, when defining a new image-method
Claus Gittinger <cg@exept.de>
parents: 1896
diff changeset
  1845
1882
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1846
"/            self image storeOn: (imageStoreStream := WriteStream on: '').
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1847
"/            sel := self resourceSelector.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1848
"/
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1849
"/            "/ if that method already exists, do not overwrite the category
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1850
"/            category := 'image specs'.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1851
"/            (mthd := cls class compiledMethodAt:sel) notNil ifTrue:[
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1852
"/                category := mthd category.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1853
"/            ].
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1854
"/
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1855
"/            imageKey :=  (cls name, ' ', sel) asSymbol.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1856
"/            Icon constantNamed: imageKey put:nil.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1857
"/            ByteCodeCompiler 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1858
"/                compile: ((sel,
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1859
"/                    '\', (ResourceSpecEditor codeGenerationCommentForClass: ImageEditor),
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1860
"/                    '\\' , 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1861
"/                    '    "\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1862
"/                    '     self ' , self resourceSelector , ' inspect\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1863
"/                    '     ImageEditor openOnClass:self andSelector:#', self resourceSelector, 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1864
"/                    '\    "',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1865
"/                    '\\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1866
"/                    '    <resource: #image>',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1867
"/                    '\\',
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1868
"/                    '    ^Icon\') withCRs, 
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1869
"/                    '        constantNamed:#''', imageKey, '''\' withCRs,
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1870
"/                    '        ifAbsentPut:[', imageStoreStream contents, ']')
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1871
"/                forClass: cls class inCategory: category.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1872
            modified := false.
fbb4a3a869f1 made image-method generator a class method (for reusability)
martin
parents: 1875
diff changeset
  1873
        ]
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1874
    ]
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1875
1047
95f10ea8653d use #withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
  1876
    "Modified: / 31.7.1998 / 20:12:54 / cg"
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1877
!
594edef86630 revised version
tz
parents: 632
diff changeset
  1878
594edef86630 revised version
tz
parents: 632
diff changeset
  1879
saveMethodAs
594edef86630 revised version
tz
parents: 632
diff changeset
  1880
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1881
    (self resourceMessage:
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1882
	(ResourceSelectionBrowser
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1883
	    request: 'Save Image In Class'
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1884
	    onSuperclass: #Object
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1885
	    andClass: self resourceClass
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1886
	    andSelector: self resourceSelector
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1887
	    withResourceTypes: #(image fileImage))) notNil
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1888
    ifTrue:
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1889
    [   
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1890
	^self saveMethod
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1891
    ].  
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1892
    ^nil
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1893
! !
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1894
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1895
!ImageEditView methodsFor:'queries'!
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1896
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1897
heightOfContents
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1898
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1899
    image isNil ifTrue:[^0].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1900
    ^(image height * magnification y) rounded
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1901
!
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1902
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1903
imageContainsPastePoint: aPoint
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1904
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1905
    ^image notNil and: 
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1906
	[Clipboard notNil and:
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1907
	[((0@0 corner:(image extent) "- 1" - Clipboard extent) containsPoint: (((aPoint - margin + 1) / magnification) floor))]]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1908
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1909
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1910
imageContainsPoint: aPoint
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1911
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1912
    ^image notNil and:
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1913
	[((0@0 corner:(image extent) - 1) containsPoint: (((aPoint - margin + 1) / magnification) floor))]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1914
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1915
783
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1916
imageInfoString
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1917
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1918
    |imageInfoString usedColors|
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1919
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1920
    image isNil ifTrue: [imageInfoString := 'No image loaded.'] 
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1921
    ifFalse: [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1922
	image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := image usedColors size].
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1923
	imageInfoString := image width printString, 'x'
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1924
	    , image height printString, 'x'
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1925
	    , (2 raisedTo: image depth) printString
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1926
	    , (image mask notNil ifTrue: [' (mask + '] ifFalse: ['('])
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1927
	    , usedColors printString
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1928
	    , ' used colors)'].
783
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1929
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1930
    ^imageInfoString
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1931
!
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1932
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1933
widthOfContents
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1934
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1935
    image isNil ifTrue:[^0].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1936
    ^(image width * magnification x) rounded
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1937
! !
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1938
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1939
!ImageEditView methodsFor:'release'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1940
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1941
releasePasteDrawing
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1942
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1943
    (lastPastePoint notNil and: [ClipboardMagnification notNil]) 
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1944
    ifTrue: 
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1945
    [ 
1449
e5852c20c18a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1946
        self redraw: (lastPastePoint extent: (ClipboardMagnification extent)). 
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1947
    ].
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1948
    lastPastePoint := ClipboardMagnification := nil
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1949
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1950
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1951
releaseUndos
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1952
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1953
    undoImages removeAll.
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1954
    "/ cg: what a kludge - please change to use a valueHolder,
1374
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1955
"/    masterApplication notNil ifTrue:[
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1956
"/        masterApplication valueOfCanUndo value: false.
44f511c341c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1373
diff changeset
  1957
"/    ].
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1958
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1959
    "Modified: / 31.7.1998 / 02:47:21 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1960
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1961
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1962
!ImageEditView methodsFor:'testing'!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1963
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1964
checkModified
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1965
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1966
    modified
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1967
    ifTrue:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1968
    [
1116
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1969
	((YesNoBox title:(resources string:'Image was modified !!'))
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1970
	    noText:(resources string:'Cancel');
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1971
	    yesText:(resources string:'Forget it and proceed');
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1972
	    showAtPointer;
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1973
	    accepted) ifFalse: [^false].
441ff42c1472 fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents: 1106
diff changeset
  1974
	modified := false
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1975
    ].
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1976
    ^true
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1977
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1978
    "Modified: / 29.7.1998 / 18:55:24 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1979
! !
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1980
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
  1981
!ImageEditView class methodsFor:'documentation'!
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1982
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1983
version
1903
b0c9fcf3155e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1901
diff changeset
  1984
    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.142 2000-12-11 10:33:13 cg Exp $'
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1985
! !
1245
68581e6aaf23 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1228
diff changeset
  1986
ImageEditView initialize!