ImageEditView.st
author tz
Mon, 31 Aug 1998 15:29:38 +0200
changeset 1103 62fb33e2e17b
parent 1084 87c661e6c333
child 1104 a7101d656dab
permissions -rw-r--r--
checkin from browser
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
636
d53428252193 revised version
tz
parents: 633
diff changeset
     3
              All Rights Reserved
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
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    13
ImageView subclass:#ImageEditView
1035
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    14
	instanceVariableNames:'magnification selectColors imageReaderClass resourceClass
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    15
		resourceSelector mouseKeyColorMode undoImages modified
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    16
		masterApplication editMode lastPastePoint imageInfoHolder
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    17
		activityInfoHolder pickedColorHolder'
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    18
	classVariableNames:'Clipboard LastMagnification ClipboardMagnification
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    19
		GridMagnification MaxUndos'
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    20
	poolDictionaries:''
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
    21
	category:'Views-Misc'
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    22
!
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
    23
636
d53428252193 revised version
tz
parents: 633
diff changeset
    24
!ImageEditView class methodsFor:'documentation'!
d53428252193 revised version
tz
parents: 633
diff changeset
    25
d53428252193 revised version
tz
parents: 633
diff changeset
    26
copyright
d53428252193 revised version
tz
parents: 633
diff changeset
    27
"
704
01140e14c065 Fix copyright.
Stefan Vogel <sv@exept.de>
parents: 694
diff changeset
    28
 COPYRIGHT (c) 1997 by eXept Software AG
636
d53428252193 revised version
tz
parents: 633
diff changeset
    29
              All Rights Reserved
d53428252193 revised version
tz
parents: 633
diff changeset
    30
d53428252193 revised version
tz
parents: 633
diff changeset
    31
 This software is furnished under a license and may be used
d53428252193 revised version
tz
parents: 633
diff changeset
    32
 only in accordance with the terms of that license and with the
d53428252193 revised version
tz
parents: 633
diff changeset
    33
 inclusion of the above copyright notice. This software may not
d53428252193 revised version
tz
parents: 633
diff changeset
    34
 be provided or otherwise made available to, or used by, any
d53428252193 revised version
tz
parents: 633
diff changeset
    35
 other person. No title to or ownership of the software is
d53428252193 revised version
tz
parents: 633
diff changeset
    36
 hereby transferred.
d53428252193 revised version
tz
parents: 633
diff changeset
    37
"
d53428252193 revised version
tz
parents: 633
diff changeset
    38
!
d53428252193 revised version
tz
parents: 633
diff changeset
    39
d53428252193 revised version
tz
parents: 633
diff changeset
    40
documentation
d53428252193 revised version
tz
parents: 633
diff changeset
    41
"
d53428252193 revised version
tz
parents: 633
diff changeset
    42
    The ImageEditView is a view class which can be used by applications
d53428252193 revised version
tz
parents: 633
diff changeset
    43
    like the Image Editor for modifying or inspecting images.
d53428252193 revised version
tz
parents: 633
diff changeset
    44
d53428252193 revised version
tz
parents: 633
diff changeset
    45
    [see also:]
d53428252193 revised version
tz
parents: 633
diff changeset
    46
        ImageEditor Image
d53428252193 revised version
tz
parents: 633
diff changeset
    47
d53428252193 revised version
tz
parents: 633
diff changeset
    48
    [author:]
d53428252193 revised version
tz
parents: 633
diff changeset
    49
        Thomas Zwick
d53428252193 revised version
tz
parents: 633
diff changeset
    50
"
d53428252193 revised version
tz
parents: 633
diff changeset
    51
! !
353
0442fc169b82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 322
diff changeset
    52
7
19b36b78ee01 *** empty log message ***
claus
parents: 5
diff changeset
    53
!ImageEditView methodsFor:'accessing'!
19b36b78ee01 *** empty log message ***
claus
parents: 5
diff changeset
    54
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    55
activityInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    56
    "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
    57
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    58
    ^ activityInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    59
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    60
    "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
    61
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    62
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    63
activityInfoHolder:something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    64
    "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
    65
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    66
    activityInfoHolder := something.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    67
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    68
    "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
    69
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    70
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    71
imageInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    72
    "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
    73
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    74
    ^ imageInfoHolder
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    75
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    76
    "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
    77
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    78
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    79
imageInfoHolder:something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    80
    "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
    81
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    82
    imageInfoHolder := something.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    83
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    84
    "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
    85
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    86
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
    87
magnification
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
    88
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
    89
    ^magnification
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
    90
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    91
!
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    92
636
d53428252193 revised version
tz
parents: 633
diff changeset
    93
magnification: aPoint
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
    94
    |oldOrg|
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    95
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
    96
    magnification ~= aPoint
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
    97
    ifTrue:
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
    98
    [
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
    99
        oldOrg := self viewOrigin / magnification.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   100
        magnification := aPoint asPoint.
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   101
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   102
        self scrollTo:(oldOrg * magnification) rounded redraw:false.        
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   103
"/        self scrollToTopLeft.
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   104
        self contentsChanged.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   105
        self invalidate.
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   106
        ClipboardMagnification := nil.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   107
    ]
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   108
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   109
    "Modified: / 31.7.1998 / 02:38:47 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   110
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   111
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   112
masterApplication
61b7601829ea with modal support
tz
parents: 636
diff changeset
   113
61b7601829ea with modal support
tz
parents: 636
diff changeset
   114
    ^masterApplication
61b7601829ea with modal support
tz
parents: 636
diff changeset
   115
!
61b7601829ea with modal support
tz
parents: 636
diff changeset
   116
61b7601829ea with modal support
tz
parents: 636
diff changeset
   117
masterApplication: anApplicationModel
61b7601829ea with modal support
tz
parents: 636
diff changeset
   118
61b7601829ea with modal support
tz
parents: 636
diff changeset
   119
    masterApplication := anApplicationModel
61b7601829ea with modal support
tz
parents: 636
diff changeset
   120
!
61b7601829ea with modal support
tz
parents: 636
diff changeset
   121
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   122
resourceClass
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   123
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   124
    ^resourceClass
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   125
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   126
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   127
resourceClass: aClassOrSymbol
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   128
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   129
    resourceClass := aClassOrSymbol isClass ifTrue: [aClassOrSymbol name] ifFalse: [aClassOrSymbol asSymbol]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   130
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   131
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   132
resourceMessage
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   133
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   134
    ^resourceClass, ' ', resourceSelector
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   135
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   136
636
d53428252193 revised version
tz
parents: 633
diff changeset
   137
resourceMessage: aString
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   138
636
d53428252193 revised version
tz
parents: 633
diff changeset
   139
    (aString isString and: [aString trimBlanks size > 0])
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   140
    ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   141
    [
636
d53428252193 revised version
tz
parents: 633
diff changeset
   142
        resourceClass := (aString readStream upTo: Character space) asSymbol.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   143
        resourceSelector := (aString copy reverse readStream upTo: Character space) reverse asSymbol
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   144
    ]
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   145
    ifFalse:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   146
    [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   147
        ^nil
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   148
    ]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   149
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   150
   
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   151
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   152
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   153
resourceSelector
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   154
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   155
    ^resourceSelector
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   156
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   157
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   158
resourceSelector: aStringOrSymbol
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   159
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   160
    resourceSelector := aStringOrSymbol asSymbol
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   161
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   162
840
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   163
selectColors
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   164
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   165
    ^selectColors
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   166
!
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   167
93f209fc0f7a selectColors
tz
parents: 839
diff changeset
   168
selectColors: anArrayTwoColors
633
594edef86630 revised version
tz
parents: 632
diff changeset
   169
594edef86630 revised version
tz
parents: 632
diff changeset
   170
    selectColors := anArrayTwoColors
594edef86630 revised version
tz
parents: 632
diff changeset
   171
!
594edef86630 revised version
tz
parents: 632
diff changeset
   172
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   173
selectedColor
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   174
633
594edef86630 revised version
tz
parents: 632
diff changeset
   175
   ^selectColors at: mouseKeyColorMode
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   176
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   177
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   178
selectedColor: aColor
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   179
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   180
    selectColors at: mouseKeyColorMode put: aColor
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   181
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   182
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   183
undoImages
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   184
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   185
   ^undoImages
627
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
!ImageEditView methodsFor:'drawing'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   189
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   190
drawFrame
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   191
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   192
    self paint:Color black.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   193
    self lineWidth: (magnification x//3 min: 3).
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   194
    self displayRectangle: ((0@0) extent:(image extent * magnification) + 2).
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   195
    self lineWidth:1.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   196
!
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   197
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   198
drawFramesIn: aRectangle
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   199
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   200
    magnification >= GridMagnification
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   201
    ifTrue:
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   202
    [   
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   203
        |origin lineStartingPoint lineEndingPoint oldColor|
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   204
        origin := aRectangle origin - 1.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   205
        lineStartingPoint := origin + (0@magnification y).
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   206
        lineEndingPoint   := lineStartingPoint + (aRectangle width@0).
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   207
        oldColor := self paint.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   208
        self xoring:
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   209
        [
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   210
            self displayLineFrom: lineStartingPoint to: lineEndingPoint.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   211
            lineStartingPoint x to: lineStartingPoint x + aRectangle width - magnification x by: magnification x do:
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   212
            [:x|   
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   213
                self displayLineFrom: x@(origin y) to: x@(origin y + magnification y)
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   214
            ].
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   215
        ].
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   216
        self paint: oldColor.
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   217
    ]
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   218
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   219
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   220
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   221
!
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
   222
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   223
fillFramedRectangle: aRectangle
61b7601829ea with modal support
tz
parents: 636
diff changeset
   224
61b7601829ea with modal support
tz
parents: 636
diff changeset
   225
    self fillRectangle: aRectangle.
61b7601829ea with modal support
tz
parents: 636
diff changeset
   226
    self drawFramesIn: aRectangle
61b7601829ea with modal support
tz
parents: 636
diff changeset
   227
!
61b7601829ea with modal support
tz
parents: 636
diff changeset
   228
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   229
redrawImageX:x y:y width:w height:h
636
d53428252193 revised version
tz
parents: 633
diff changeset
   230
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   231
    |ih iw magX magY minX maxX minY maxY 
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   232
     color lastColor lastY runW x0 xI yI maskColor mask
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   233
     sizeOfMaskPoint|
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   234
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   235
    mask := image mask.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   236
    ih := image height.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   237
    iw := image width.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   238
    magX := magnification x.
61b7601829ea with modal support
tz
parents: 636
diff changeset
   239
    magY := magnification y.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   240
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   241
    minX := (x // magX - 1) max: 0.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   242
    minX >= iw ifTrue:[minX := (iw - 1) max: 0].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   243
    minY := (y // magY - 1) max: 0.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   244
    minY >= ih ifTrue:[minY := (ih - 1) max: 0].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   245
    maxX := (x + w) // magX + 1.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   246
    maxX > iw ifTrue:[maxX := iw].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   247
    maxY := (y + h) // magY + 1.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   248
    maxY > ih ifTrue:[maxY := ih].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   249
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   250
    lastY := -1.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   251
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   252
    x0 := minX.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   253
    runW := 0.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   254
    maskColor := false.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   255
    sizeOfMaskPoint := magnification//3.
61b7601829ea with modal support
tz
parents: 636
diff changeset
   256
    image colorsFromX: minX y: minY toX: maxX-1 y: maxY-1 do:
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   257
    [:xx :yy :color|
633
594edef86630 revised version
tz
parents: 632
diff changeset
   258
        yy ~~ lastY
594edef86630 revised version
tz
parents: 632
diff changeset
   259
        ifTrue:
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   260
        [
633
594edef86630 revised version
tz
parents: 632
diff changeset
   261
            runW ~~ 0
594edef86630 revised version
tz
parents: 632
diff changeset
   262
            ifTrue:
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   263
            [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   264
                |origin|
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   265
                origin := (x0 * magX + margin)@(lastY * magY + margin).
61b7601829ea with modal support
tz
parents: 636
diff changeset
   266
                self fillFramedRectangle: (origin extent: (runW@magY)).                    
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   267
                maskColor ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   268
                [
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   269
                    self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   270
                ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   271
                runW := 0.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   272
            ]. 
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   273
            x0 := xx.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   274
            lastY := yy.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   275
        ]. 
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   276
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   277
        color ~~ lastColor
633
594edef86630 revised version
tz
parents: 632
diff changeset
   278
        ifTrue:
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   279
        [
633
594edef86630 revised version
tz
parents: 632
diff changeset
   280
            runW ~~ 0
594edef86630 revised version
tz
parents: 632
diff changeset
   281
            ifTrue:
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   282
            [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   283
                |origin|
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   284
                origin := (x0 * magX + margin)@(yy * magY + margin).
61b7601829ea with modal support
tz
parents: 636
diff changeset
   285
                self fillFramedRectangle: (origin extent: (runW@magY)).
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   286
                maskColor ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   287
                [
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   288
                    self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   289
                ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   290
                runW := 0.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   291
            ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   292
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   293
            self paint: (lastColor := color).
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   294
            mask notNil ifTrue:
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   295
            [  
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   296
                maskColor := false.
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   297
                (mask colorAtX:xx y:yy) = Color black ifTrue:
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   298
                [
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   299
                    self paint: (lastColor := self viewBackground).
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   300
                    maskColor := true.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   301
                ].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   302
                lastColor := nil.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   303
            ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   304
            runW := 0.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   305
            x0 := xx.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   306
        ].  
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   307
        runW := runW + magX
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   308
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   309
    runW ~~ 0 ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   310
    [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   311
        |origin|
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   312
        origin := (x0 * magX + margin)@(lastY * magY + margin).
61b7601829ea with modal support
tz
parents: 636
diff changeset
   313
        self fillFramedRectangle: (origin extent: runW@magY).
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   314
        maskColor ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   315
        [
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   316
            self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   317
        ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   318
        runW := 0.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   319
    ].
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   320
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   321
    "Modified: / 31.7.1998 / 02:33:42 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   322
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   323
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   324
redrawX:x y:y width:w height:h
636
d53428252193 revised version
tz
parents: 633
diff changeset
   325
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   326
    |ih iw xI yI|
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   327
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   328
    image isNil ifTrue:[^self].
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   329
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   330
    magnification = (1@1) ifTrue: [
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   331
        ^ super redrawX:x y:y width:w height:h
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   332
    ].
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   333
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   334
    self clippingRectangle: (x@y extent: w@h).
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   335
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   336
    self redrawImageX:x y:y width:w height:h.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   337
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   338
    "/ right of image ?
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   339
    adjust == #center ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   340
    [
633
594edef86630 revised version
tz
parents: 632
diff changeset
   341
        xI := (width - ih) // 2 - margin.
594edef86630 revised version
tz
parents: 632
diff changeset
   342
        yI := (height - iw) // 2 - margin.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   343
    ]
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   344
    ifFalse:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   345
    [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   346
        xI := yI := margin
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   347
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   348
    (x + w - 1) > (xI + (magnification x * image width)) ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   349
    [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   350
        self clearRectangleX:(xI + (magnification x * image width))
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   351
                           y:y
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   352
                       width:(x + w - (magnification x * image width) - xI)
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   353
                      height:h
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   354
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   355
    (y + h - 1) > (yI + (magnification y * image height)) ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   356
    [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   357
        self clearRectangleX:margin
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   358
                           y:(yI + (magnification y * image height))
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   359
                       width:w
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   360
                      height:(y + h - (magnification y * image height) - yI)  
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   361
    ].
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   362
    self drawFrame.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   363
    self clippingRectangle: nil.
1037
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   364
3735af6b5b24 remmeber scrollOffset
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   365
    "Modified: / 31.7.1998 / 02:22:45 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   366
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   367
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   368
!ImageEditView methodsFor:'edit modes'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   369
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   370
editMode
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   371
737
b703128f2f60 no class var EditMode
tz
parents: 725
diff changeset
   372
    ^editMode ? (editMode := 'point')
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   373
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   374
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   375
editMode:aMode
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   376
    "this is concatenated with 'At:' to form the click-
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   377
     operation. I.e. any of 'point', 'box', 'filledBox' ..."
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   378
737
b703128f2f60 no class var EditMode
tz
parents: 725
diff changeset
   379
    editMode := aMode
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   380
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   381
    "Modified: / 29.7.1998 / 18:36:30 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   382
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   383
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   384
mouseKeyColorMode
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   385
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   386
    ^mouseKeyColorMode printString
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   387
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   388
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   389
mouseKeyColorMode:aMode
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   390
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   391
    mouseKeyColorMode := aMode asInteger
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   392
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   393
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   394
!ImageEditView methodsFor:'event handling'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   395
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   396
buttonMotion:state x:x y:y
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   397
    self drawCursorAt: x@y.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   398
    state ~~ 0 ifTrue: [
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   399
        (self selectedColor notNil and: [(self imageContainsPoint: x@y) and: [editMode = 'point']])
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   400
            ifTrue: [^self pointAt: x@y]
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   401
    ] ifFalse:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   402
        (editMode = 'paste' or:[editMode = 'pasteUnder']) ifTrue: [
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   403
            (self selectedColor notNil and: [self imageContainsPastePoint: x@y]) 
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   404
                ifTrue:  [self drawPasteRectangleAt: x@y]
1019
e68414752bc9 only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
   405
                ifFalse: [self cursor:Cursor stop. self releasePasteDrawing]
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   406
        ]
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   407
    ]
1019
e68414752bc9 only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
   408
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   409
    "Modified: / 21.8.1998 / 20:16:01 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
   410
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   411
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   412
buttonPress:button x:x y:y
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   413
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   414
    self drawCursorAt: x@y.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   415
    (self selectedColor notNil and: [self imageContainsPoint: x@y])
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   416
    ifTrue:
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
   417
    [   
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   418
        |mouseButtonColorToolBar clr|
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   419
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   420
        self sensor shiftDown ifTrue:[
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   421
            pickedColorHolder notNil ifTrue:[
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   422
                "/ select the color under the cursor, place it into the
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   423
                "/ pickedColorHolder/
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   424
                clr := image colorAt:((x@y)//magnification).
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   425
                pickedColorHolder value:clr
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   426
            ].
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   427
        ] ifFalse:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   428
            "/ cg: what a kludge - please change to use a valueHolder,
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   429
            "/ which gets the information ...
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   430
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   431
            mouseKeyColorMode := button.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   432
            mouseButtonColorToolBar := masterApplication builder componentAt: #MouseButtonColorToolBar.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   433
            self makeUndo.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   434
            masterApplication valueOfCanUndo value: true.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   435
            (mouseButtonColorToolBar itemAt: mouseKeyColorMode) toggleIndication.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   436
            mouseButtonColorToolBar do: [:i| i updateIndicators].
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   437
            self perform: (editMode, 'At:') asSymbol with: x@y
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   438
        ]
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   439
    ]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   440
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   441
    "Modified: / 29.7.1998 / 18:39:05 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   442
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   443
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   444
buttonRelease:button x:x y:y
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   445
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   446
    self drawCursorAt: x@y.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   447
    (self selectedColor notNil and: [self imageContainsPoint: x@y])
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   448
    ifTrue:
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   449
    [   
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   450
        image restored.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   451
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   452
        "/ cg: what a kludge - please change to use a valueHolder,
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   453
        "/ which gets the information ...
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   454
        masterApplication imagePreView invalidate
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   455
    ]
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   456
!
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   457
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   458
pointerLeave:state
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   459
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
   460
    super pointerLeave: state.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   461
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   462
    self updateImageInfo: self imageInfoString.
1019
e68414752bc9 only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents: 1013
diff changeset
   463
    self cursor:Cursor normal.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   464
1013
758cfa70edc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1011
diff changeset
   465
    (editMode = 'paste' or:[editMode = 'pasteUnder']) ifTrue: [self releasePasteDrawing]
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   466
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   467
    "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
   468
! !
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   469
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   470
!ImageEditView methodsFor:'image - dragging & info'!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   471
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   472
dragRectangleStartingAt: aPoint emphasis: emphasis
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   473
    "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
   474
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   475
    |currentPoint currentExtent firstPoint lastCurrentPoint gridCorrection 
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   476
     mp lastMp p whichQuarter scrollX scrollY|
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   477
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   478
    firstPoint := currentPoint := lastCurrentPoint := aPoint//magnification*magnification.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   479
    magnification >= GridMagnification ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   480
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   481
    [device anyButtonPressed] whileTrue: [                                                  
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   482
        mp := self sensor mousePoint.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   483
        mp = lastMp ifTrue:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   484
            Delay waitForSeconds:0.05
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   485
        ] ifFalse:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   486
            lastMp := mp.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   487
            mp := device translatePoint:mp from:device rootView id to:self id.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   488
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   489
            scrollX := 0.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   490
            mp x > width ifTrue:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   491
                scrollX := mp x - width.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   492
            ] ifFalse:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   493
                mp x < 0 ifTrue:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   494
                    scrollX := mp x.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   495
                ]
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   496
            ].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   497
            scrollY := 0.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   498
            mp y > height ifTrue:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   499
                scrollY := mp y - height.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   500
            ] ifFalse:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   501
                mp y < 0 ifTrue:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   502
                    scrollY := mp y.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   503
                ]
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   504
            ].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   505
            (scrollX + scrollY) ~~ 0 ifTrue:[
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   506
                self scrollTo:(self viewOrigin + (scrollX @ scrollY)).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   507
                lastMp := nil.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   508
            ].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   509
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   510
            currentPoint := (0@0) max: (image extent * magnification min: (p :=  self translation negated + mp)).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   511
            currentPoint := currentPoint//magnification*magnification.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   512
            currentExtent := (firstPoint - currentPoint) abs.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   513
            whichQuarter := (firstPoint x - currentPoint x) > 0 
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   514
                 ifTrue:  [(firstPoint y - currentPoint y) > 0 ifTrue: ["4"1@1] ifFalse: ["3"1@0]]
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   515
                 ifFalse: [(firstPoint y - currentPoint y) > 0 ifTrue: ["1"0@1] ifFalse: ["2"0@0]].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   516
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   517
            self drawCursorAt: p withLabel: 
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   518
                ((firstPoint//magnification - whichQuarter + 1) printString, 
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   519
                ' to: ', 
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   520
                (currentPoint//magnification + whichQuarter) printString),
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   521
                ' (extent: ',
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   522
                (currentExtent//magnification) printString, ')'.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   523
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   524
            currentPoint ~= lastCurrentPoint ifTrue:
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   525
            [   
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   526
                emphasis = #inverseFilledBox
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   527
                ifTrue:
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   528
                [
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   529
                    self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   530
                    self xoring: [self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection)]
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   531
                ].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   532
                emphasis = #box
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   533
                ifTrue:
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   534
                [
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   535
                    |origin extent lineWidthY lineWidthX|
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   536
                    origin := (firstPoint min: lastCurrentPoint) - 1.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   537
                    extent := (firstPoint - lastCurrentPoint) abs + 2.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   538
                    lineWidthY := extent y min: (magnification y + 2).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   539
                    lineWidthX := extent x min: (magnification x + 2).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   540
                    self redraw: (origin extent: (extent x@lineWidthY)).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   541
                    self redraw: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   542
                    self redraw: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   543
                    self redraw: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   544
                    self selectedColor ~= Color noColor
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   545
                        ifTrue: [self paint: self selectedColor]
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   546
                        ifFalse: [self paint: self viewBackground]. 
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   547
                    origin := (firstPoint min: currentPoint) + margin.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   548
                    extent := currentExtent - gridCorrection.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   549
                    lineWidthY := extent y min: magnification y.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   550
                    lineWidthX := extent x min: magnification x.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   551
                    (lineWidthY > 0 and: [lineWidthX > 0])
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   552
                    ifTrue:
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   553
                    [
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   554
                        self fillRectangle: (origin extent: (extent x@lineWidthY)).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   555
                        self fillRectangle: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   556
                        self fillRectangle: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   557
                        self fillRectangle: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   558
                    ]
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   559
                ].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   560
                emphasis = #filledBox
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   561
                ifTrue:
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   562
                [
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   563
                    self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   564
                    self selectedColor ~= Color noColor
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   565
                        ifTrue: [self paint: self selectedColor]
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   566
                        ifFalse: [self paint: self viewBackground].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   567
                    self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection).
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   568
                ].
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   569
            ]. 
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   570
            lastCurrentPoint := currentPoint.
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   571
        ].                  
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   572
    ].                  
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   573
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   574
    ^((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
   575
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   576
    "Created: / 21.8.1998 / 20:17:07 / cg"
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   577
    "Modified: / 21.8.1998 / 20:34:42 / cg"
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   578
!
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   579
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   580
drawCursorAt: aPoint
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   581
    |clr|
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   582
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   583
    image isNil ifTrue: [
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   584
        self updateImageInfo: self imageInfoString. 
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   585
        self cursor:Cursor stop.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   586
        ^ self
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   587
    ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   588
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   589
    (aPoint x < (image width * magnification) 
1060
690045fd9032 drag rect with bad point
tz
parents: 1053
diff changeset
   590
    and:[aPoint y < (image height * magnification)
690045fd9032 drag rect with bad point
tz
parents: 1053
diff changeset
   591
    and:[aPoint x >= 0
690045fd9032 drag rect with bad point
tz
parents: 1053
diff changeset
   592
    and:[aPoint y >= 0]]])
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   593
    ifFalse:[
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   594
        self updateImageInfo: self imageInfoString. 
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   595
        self cursor:Cursor stop.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   596
    ] ifTrue: [
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   597
        clr := image colorAt:aPoint//magnification.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   598
        self updateImageInfo: (aPoint//magnification) printString 
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   599
                        , ' (red:' 
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   600
                        , clr redByte printString
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   601
                        , ' green:' , clr greenByte printString
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   602
                        , ' blue:' , clr blueByte printString
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   603
                        , ')'.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   604
        self cursor:Cursor crossHair
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   605
    ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   606
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   607
    "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
   608
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   609
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   610
drawCursorAt: aPoint withLabel: aLabel
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   611
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   612
    ((0@0 extent: image extent * magnification) containsPoint: aPoint)
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   613
         ifFalse:[self cursor:Cursor stop]
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   614
         ifTrue: [self cursor:Cursor crossHair].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   615
     self updateImageInfo: aLabel.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   616
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   617
    "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
   618
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   619
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   620
updateActivity: something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   621
    |msg|
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   622
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   623
    msg := something printString.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   624
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   625
    "/ cg: new code:
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   626
    activityInfoHolder notNil ifTrue:[
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   627
        activityInfoHolder value:msg.
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
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   630
    "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
   631
!
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   632
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   633
updateImageInfo: something
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   634
    |msg coordLabel|
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   635
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   636
    msg := something printString.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   637
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   638
    "/ cg: new code:
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   639
    imageInfoHolder notNil ifTrue:[
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   640
        msg ~= imageInfoHolder value ifTrue:[
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   641
            imageInfoHolder value:msg.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   642
        ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   643
        ^ self
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   644
    ].
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   645
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   646
"/    "/ 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
   647
"/    "/ which gets the coordinate ...
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   648
"/
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   649
"/    (masterApplication respondsTo: #coordLabel)
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   650
"/    ifTrue:[  
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   651
"/        coordLabel := masterApplication coordLabel.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   652
"/
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   653
"/        coordLabel label ~= msg
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   654
"/        ifTrue:[         
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   655
"/            coordLabel label: msg.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   656
"/            "/ coordLabel redraw
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   657
"/        ]
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   658
"/    ]
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   659
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   660
    "Modified: / 29.7.1998 / 19:00:21 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   661
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   662
636
d53428252193 revised version
tz
parents: 633
diff changeset
   663
!ImageEditView methodsFor:'image editing'!
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   664
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   665
boxAt: aPoint
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   666
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   667
    |choosedBox imageBox|
1103
62fb33e2e17b checkin from browser
tz
parents: 1084
diff changeset
   668
    choosedBox := self dragRectangleStartingAt: aPoint emphasis: #box.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   669
    image rectangle: (imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification)) withColor: self selectedColor.
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   670
    image restored.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   671
    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
   672
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   673
    "/ cg: what a kludge - please change to use a valueHolder,
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   674
    "/ which gets the information ...
724
d6f4b89940ed undo disabling
tz
parents: 704
diff changeset
   675
    masterApplication imagePreView redraw: (imageBox expandedBy: 1).
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
   676
    modified := true
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   677
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   678
    "Modified: / 31.7.1998 / 02:46:02 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   679
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   680
1002
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   681
changeGridMagnification
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   682
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   683
    |box newGridMagnification|
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   684
    box := EnterBox new.
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   685
    box title:'Grid Magnification:'.
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   686
    box okText:'OK'.
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   687
    box abortText:'Cancel'.
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   688
    box initialText:GridMagnification x printString.
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   689
    box showAtPointer.
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   690
    (box accepted and: [(newGridMagnification := Number readFromString: box contents onError:[2]) notNil])
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   691
    ifTrue:
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   692
    [
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   693
        GridMagnification := (99 min: (2 max: newGridMagnification)) asPoint.
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   694
        self invalidate
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   695
    ]
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   696
!
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   697
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   698
copyAt: aPoint
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   699
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   700
    |choosedBox|
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   701
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   702
    choosedBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   703
    ClipboardMagnification := nil.
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   704
    Clipboard := image subImageIn: (choosedBox origin//magnification extent: (choosedBox extent//magnification)).
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   705
    self redraw: (choosedBox expandedBy: 1)
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   706
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   707
    "Modified: / 21.8.1998 / 20:16:41 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   708
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   709
1035
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   710
drawPasteRectangleAt: aPoint
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   711
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   712
    |currentPoint gridCorrection extent|
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   713
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   714
    magnification >= GridMagnification ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1].
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   715
    currentPoint := aPoint//magnification*magnification + margin. 
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   716
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   717
    currentPoint ~= lastPastePoint
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   718
    ifTrue:
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   719
    [              
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   720
        ClipboardMagnification isNil ifTrue: [ClipboardMagnification := (Clipboard magnifiedBy: magnification) onDevice: device].   
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   721
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   722
        extent       := ClipboardMagnification extent.
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   723
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   724
        currentPoint := currentPoint - self viewOrigin.
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   725
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   726
        self redraw: ((lastPastePoint ? currentPoint) extent: extent).
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   727
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   728
        (extent x > 200 or: [extent y > 200])
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   729
        ifTrue:
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   730
        [
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   731
            self xoring: [self fillRectangle: (currentPoint extent: extent)]   
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   732
        ]
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   733
        ifFalse:
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   734
        [
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   735
            self displayDeviceForm: ClipboardMagnification x: currentPoint x y: currentPoint y
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   736
        ]  
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   737
    ]. 
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   738
    lastPastePoint := currentPoint.
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   739
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   740
    "Modified: / 29.7.1998 / 02:18:11 / cg"
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   741
!
5da83bdbd65e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1031
diff changeset
   742
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   743
fillAt: aPoint
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
   744
1047
95f10ea8653d use #withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
   745
    windowGroup withExecuteCursorDo:
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   746
    [
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   747
        |filledPoints|
1002
5d2e4c03a78e grid magnification can be changed
tz
parents: 996
diff changeset
   748
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   749
        self updateActivity:'Flood filling - press CTRL-y to abort ...'.
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   750
        [
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   751
            filledPoints := image floodFillAt: aPoint//magnification withColor: self selectedColor.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   752
            image restored.
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   753
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   754
            "/ animation effect ...    
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   755
            filledPoints size < 300
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   756
            ifTrue:
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   757
            [
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   758
                filledPoints do: [:p| self redraw: ((p * magnification extent: magnification) expandedBy: 1)]
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   759
            ]
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   760
            ifFalse:
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   761
            [
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   762
                self invalidate
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   763
            ].
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   764
            "/ cg: what a kludge - please change to use a valueHolder,
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   765
            "/ which gets the information ...
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   766
            masterApplication imagePreView invalidate.
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   767
            modified := true
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   768
        ] valueOnUnwindDo:[
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   769
            self updateActivity:'Flood fill aborted.'
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   770
        ].
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   771
        self updateActivity:''
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   772
    ]
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   773
1047
95f10ea8653d use #withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
   774
    "Modified: / 31.7.1998 / 20:12:45 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   775
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   776
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   777
filledBoxAt: aPoint
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   778
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   779
    |choosedBox imageBox|
1103
62fb33e2e17b checkin from browser
tz
parents: 1084
diff changeset
   780
    choosedBox := self dragRectangleStartingAt: aPoint emphasis: #filledBox.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   781
    image fillRectangle: (imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification)) withColor: self selectedColor.
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   782
    image restored.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   783
    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
   784
    "/ cg: what a kludge - please change to use a valueHolder,
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   785
    "/ which gets the information ...
724
d6f4b89940ed undo disabling
tz
parents: 704
diff changeset
   786
    masterApplication imagePreView redraw: (imageBox expandedBy: 1).
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   787
    modified := true
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   788
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   789
    "Modified: / 31.7.1998 / 02:46:20 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   790
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
   791
636
d53428252193 revised version
tz
parents: 633
diff changeset
   792
flipHorizontal
d53428252193 revised version
tz
parents: 633
diff changeset
   793
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   794
    self makeUndo.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   795
    self image: image copy flipHorizontal
636
d53428252193 revised version
tz
parents: 633
diff changeset
   796
d53428252193 revised version
tz
parents: 633
diff changeset
   797
!
d53428252193 revised version
tz
parents: 633
diff changeset
   798
d53428252193 revised version
tz
parents: 633
diff changeset
   799
flipVertical
d53428252193 revised version
tz
parents: 633
diff changeset
   800
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   801
    self makeUndo.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   802
    self image: image copy flipVertical
636
d53428252193 revised version
tz
parents: 633
diff changeset
   803
d53428252193 revised version
tz
parents: 633
diff changeset
   804
!
d53428252193 revised version
tz
parents: 633
diff changeset
   805
d53428252193 revised version
tz
parents: 633
diff changeset
   806
magnifyImage
d53428252193 revised version
tz
parents: 633
diff changeset
   807
d53428252193 revised version
tz
parents: 633
diff changeset
   808
    |box newSize|
d53428252193 revised version
tz
parents: 633
diff changeset
   809
    box := EnterBox new.
d53428252193 revised version
tz
parents: 633
diff changeset
   810
    box title:'Image new size:'.
d53428252193 revised version
tz
parents: 633
diff changeset
   811
    box okText:'OK'.
d53428252193 revised version
tz
parents: 633
diff changeset
   812
    box abortText:'Cancel'.
d53428252193 revised version
tz
parents: 633
diff changeset
   813
    box initialText:image extent printString.
d53428252193 revised version
tz
parents: 633
diff changeset
   814
    box showAtPointer.
d53428252193 revised version
tz
parents: 633
diff changeset
   815
    (box accepted and: [(newSize := Object readFromString: box contents onError:nil) notNil])
d53428252193 revised version
tz
parents: 633
diff changeset
   816
    ifTrue:
d53428252193 revised version
tz
parents: 633
diff changeset
   817
    [
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   818
        self makeUndo.
636
d53428252193 revised version
tz
parents: 633
diff changeset
   819
        self image: (image magnifiedBy: newSize/image extent)
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   820
    ]
636
d53428252193 revised version
tz
parents: 633
diff changeset
   821
!
d53428252193 revised version
tz
parents: 633
diff changeset
   822
d53428252193 revised version
tz
parents: 633
diff changeset
   823
negativeImage
d53428252193 revised version
tz
parents: 633
diff changeset
   824
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   825
    self makeUndo.
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
   826
    self image: image copy negative
636
d53428252193 revised version
tz
parents: 633
diff changeset
   827
!
d53428252193 revised version
tz
parents: 633
diff changeset
   828
d53428252193 revised version
tz
parents: 633
diff changeset
   829
pasteAt: aPoint
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   830
    "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
   831
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   832
    self pasteAt:aPoint modeUnder:false.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   833
!
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   834
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   835
pasteAt: aPoint modeUnder:modeUnder
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   836
    "paste the image in the clipboard at aPoint"
636
d53428252193 revised version
tz
parents: 633
diff changeset
   837
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   838
    ClipboardMagnification isNil ifTrue: [^self].
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   839
636
d53428252193 revised version
tz
parents: 633
diff changeset
   840
    Object errorSignal handle:
d53428252193 revised version
tz
parents: 633
diff changeset
   841
    [:ex|
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   842
        ex signal == Image unrepresentableColorSignal ifFalse:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   843
            ex reject
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   844
        ].
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   845
        self undo.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   846
        self warn: 'Paste failed!!\Increasing the images depth might help.' withCRs. 
636
d53428252193 revised version
tz
parents: 633
diff changeset
   847
    ] 
d53428252193 revised version
tz
parents: 633
diff changeset
   848
    do:
d53428252193 revised version
tz
parents: 633
diff changeset
   849
    [   
1047
95f10ea8653d use #withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
   850
        windowGroup withExecuteCursorDo:[
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   851
            |choosedBox imagePoint imgX imgY copiedImage imageBox presentClr newColorMap|
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   852
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   853
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   854
            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
   855
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   856
            imagePoint := choosedBox origin//magnification.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   857
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   858
            copiedImage := Clipboard copy.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   859
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   860
            copiedImage usedValues do:[:pixel |
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   861
                |pastedColor oldColorMap|
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   862
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   863
                pastedColor := (copiedImage colorMap at: pixel+1).
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   864
                oldColorMap := image colorMap.
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   865
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   866
                (oldColorMap detect: [:clr| clr = pastedColor] ifNone: nil) isNil
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   867
                ifTrue:
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   868
                [        
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   869
                    oldColorMap size < (1 bitShift:image depth) ifTrue:[
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   870
                        "/ add to colormap
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   871
                        newColorMap isNil ifTrue:[
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   872
                            newColorMap := oldColorMap asOrderedCollection.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   873
                        ].
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   874
                        newColorMap add:pastedColor.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   875
"/                        Transcript showCR:'adding color:' , pastedColor displayString , ' to targets colorMap'.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   876
                    ] ifFalse:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   877
"/                        Transcript showCR:'color:' , pastedColor displayString , ' not found in targets colorMap'.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   878
                        copiedImage colorMap at: pixel+1 put: Color black
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   879
                    ]
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   880
                ]
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   881
            ].
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   882
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   883
            newColorMap notNil ifTrue:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   884
                image colorMap:(Colormap fromColors:newColorMap).
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   885
            ].
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   886
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   887
            copiedImage := image class fromImage: copiedImage.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   888
            (newColorMap isNil and:[modeUnder not]) ifTrue:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   889
                image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   890
            ] ifFalse:[
994
5727c2484ecd bugs fixed in undo/mask and point painting/preview and pasting
tz
parents: 877
diff changeset
   891
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   892
                imgX := imagePoint x.
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   893
                imgY := imagePoint y.
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   894
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   895
                0 to:copiedImage height-1 do:[:y |
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   896
                    0 to:copiedImage width-1 do:[:x |
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   897
                        |wasMasked newMasked dstX dstY oldColor|
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   898
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   899
                        dstX := imgX + x.
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   900
                        dstY := imgY + y.
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   901
                        wasMasked := (image maskAtX:dstX y:dstY) == 0.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   902
                        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
   903
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   904
                        "/ with modeUnder, 
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   905
                        "/ only replace, if its either unmasked,
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   906
                        "/ or the current drawing color.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   907
                        (modeUnder not
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   908
                        or:[wasMasked
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   909
                        or:[(oldColor := image colorAtX:dstX y:dstY) = (selectColors at:1)]])
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   910
                        ifTrue:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   911
                            image 
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   912
                                colorAtX:dstX
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   913
                                       y:dstY
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   914
                                     put:(copiedImage colorAtX:x y:y).
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   915
                            (wasMasked and:[newMasked not]) ifTrue:[
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   916
                                image mask pixelAtX:dstX y:dstY put:1
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   917
                            ].
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   918
                        ]
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   919
                    ]
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   920
                ].
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   921
            ].
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   922
            image restored.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   923
            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
   924
"/            masterApplication imagePreView redraw: (imageBox expandedBy: 1).
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   925
            modified := true
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   926
        ]
1028
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   927
   ]
4dfe1c6cbc48 fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
   928
1084
87c661e6c333 scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   929
    "Modified: / 21.8.1998 / 20:16:50 / cg"
636
d53428252193 revised version
tz
parents: 633
diff changeset
   930
!
d53428252193 revised version
tz
parents: 633
diff changeset
   931
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   932
pasteUnderAt: aPoint
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   933
    "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
   934
     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
   935
     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
   936
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   937
    self pasteAt:aPoint modeUnder:true.
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   938
!
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
   939
636
d53428252193 revised version
tz
parents: 633
diff changeset
   940
pointAt: aPoint
d53428252193 revised version
tz
parents: 633
diff changeset
   941
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   942
    |imagePoint imageBox|
636
d53428252193 revised version
tz
parents: 633
diff changeset
   943
    imagePoint := aPoint//magnification.
d53428252193 revised version
tz
parents: 633
diff changeset
   944
    image atImageAndMask: imagePoint put: self selectedColor.
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
   945
    self redraw: (imageBox := (imagePoint * magnification extent: magnification) expandedBy: 1).
796
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
   946
    modified := true.
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
   947
636
d53428252193 revised version
tz
parents: 633
diff changeset
   948
!
d53428252193 revised version
tz
parents: 633
diff changeset
   949
d53428252193 revised version
tz
parents: 633
diff changeset
   950
resizeImage
d53428252193 revised version
tz
parents: 633
diff changeset
   951
d53428252193 revised version
tz
parents: 633
diff changeset
   952
    |box newSize|
d53428252193 revised version
tz
parents: 633
diff changeset
   953
    box := EnterBox new.
d53428252193 revised version
tz
parents: 633
diff changeset
   954
    box title:'Image new size:'.
d53428252193 revised version
tz
parents: 633
diff changeset
   955
    box okText:'OK'.
d53428252193 revised version
tz
parents: 633
diff changeset
   956
    box abortText:'Cancel'.
d53428252193 revised version
tz
parents: 633
diff changeset
   957
    box initialText:image extent printString.
d53428252193 revised version
tz
parents: 633
diff changeset
   958
    box showAtPointer.
d53428252193 revised version
tz
parents: 633
diff changeset
   959
    (box accepted and: [(newSize := Object readFromString: box contents onError:nil) notNil])
d53428252193 revised version
tz
parents: 633
diff changeset
   960
    ifTrue:
d53428252193 revised version
tz
parents: 633
diff changeset
   961
    [
d53428252193 revised version
tz
parents: 633
diff changeset
   962
        |newImage|
d53428252193 revised version
tz
parents: 633
diff changeset
   963
        newImage := image class width: newSize x height: newSize y depth: image depth.
d53428252193 revised version
tz
parents: 633
diff changeset
   964
        newImage photometric:image photometric.
d53428252193 revised version
tz
parents: 633
diff changeset
   965
        newImage colorMap:image colorMap copy.
d53428252193 revised version
tz
parents: 633
diff changeset
   966
        newImage bits: (ByteArray new: newImage bytesPerRow * newSize y).
d53428252193 revised version
tz
parents: 633
diff changeset
   967
d53428252193 revised version
tz
parents: 633
diff changeset
   968
        image mask notNil
d53428252193 revised version
tz
parents: 633
diff changeset
   969
        ifTrue: 
d53428252193 revised version
tz
parents: 633
diff changeset
   970
        [
d53428252193 revised version
tz
parents: 633
diff changeset
   971
            |newMaskImage|
d53428252193 revised version
tz
parents: 633
diff changeset
   972
            newMaskImage := Depth1Image width: newSize x height: newSize y.
d53428252193 revised version
tz
parents: 633
diff changeset
   973
            newMaskImage photometric: image mask photometric.
d53428252193 revised version
tz
parents: 633
diff changeset
   974
            newMaskImage colorMap: image mask colorMap copy.
d53428252193 revised version
tz
parents: 633
diff changeset
   975
            newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newSize y).
d53428252193 revised version
tz
parents: 633
diff changeset
   976
            newImage mask: newMaskImage
d53428252193 revised version
tz
parents: 633
diff changeset
   977
        ].
d53428252193 revised version
tz
parents: 633
diff changeset
   978
d53428252193 revised version
tz
parents: 633
diff changeset
   979
        newImage copyFrom:image x:0 y:0 toX:0 y:0 width: (image width min:newSize x) height: (image height min:newSize y).
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
   980
        self makeUndo.
827
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
   981
        self image: newImage.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
   982
    ]
636
d53428252193 revised version
tz
parents: 633
diff changeset
   983
!
d53428252193 revised version
tz
parents: 633
diff changeset
   984
d53428252193 revised version
tz
parents: 633
diff changeset
   985
rotateImage
d53428252193 revised version
tz
parents: 633
diff changeset
   986
d53428252193 revised version
tz
parents: 633
diff changeset
   987
    |box rotation|
d53428252193 revised version
tz
parents: 633
diff changeset
   988
    box := EnterBox new.
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   989
    box title:'Rotate by (degrees, clockwise):'.
636
d53428252193 revised version
tz
parents: 633
diff changeset
   990
    box okText:'OK'.
d53428252193 revised version
tz
parents: 633
diff changeset
   991
    box abortText:'Cancel'.
d53428252193 revised version
tz
parents: 633
diff changeset
   992
    box initialText: '0'.
d53428252193 revised version
tz
parents: 633
diff changeset
   993
    box showAtPointer.
d53428252193 revised version
tz
parents: 633
diff changeset
   994
    (box accepted and: [(rotation := Object readFromString: box contents onError:nil) notNil])
d53428252193 revised version
tz
parents: 633
diff changeset
   995
    ifTrue:
d53428252193 revised version
tz
parents: 633
diff changeset
   996
    [   Object errorSignal handle:
d53428252193 revised version
tz
parents: 633
diff changeset
   997
        [:ex|
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   998
            self warn: 'Image rotation failed!!\' withCRs, 'Increaing the image depth could help.'
636
d53428252193 revised version
tz
parents: 633
diff changeset
   999
        ] 
d53428252193 revised version
tz
parents: 633
diff changeset
  1000
        do:
d53428252193 revised version
tz
parents: 633
diff changeset
  1001
        [   
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1002
            self makeUndo.
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1003
            self image: (image hardRotated: rotation)
d53428252193 revised version
tz
parents: 633
diff changeset
  1004
        ]
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1005
    ]
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1006
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1007
    "Modified: / 29.7.1998 / 18:21:14 / cg"
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1008
!
d53428252193 revised version
tz
parents: 633
diff changeset
  1009
d53428252193 revised version
tz
parents: 633
diff changeset
  1010
undo
d53428252193 revised version
tz
parents: 633
diff changeset
  1011
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1012
    undoImages notEmpty
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1013
    ifTrue:
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
  1014
    [           
1047
95f10ea8653d use #withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
  1015
        windowGroup withExecuteCursorDo:[
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1016
            modified := false. 
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1017
            self image: undoImages removeLast.
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1018
            "/ cg: what a kludge - please change to use a valueHolder,
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1019
            masterApplication notNil ifTrue:[
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1020
                masterApplication listOfColors contents: image colorMap.
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1021
                masterApplication findColorMapMode.
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1022
                undoImages isEmpty ifTrue: [masterApplication valueOfCanUndo value: false].
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1023
            ].
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1024
            "/ cg: not needed - image: already does it.
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1025
"/            self invalidate
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
  1026
        ]
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1027
    ]
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1028
1047
95f10ea8653d use #withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
  1029
    "Modified: / 31.7.1998 / 20:12:58 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1030
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1031
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1032
!ImageEditView methodsFor:'image setting'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1033
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1034
image:anImage
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1035
    |retVal|
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1036
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
  1037
    anImage isImage
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1038
    ifTrue:
725
0e051202859d checkin from browser
tz
parents: 724
diff changeset
  1039
    [           
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
  1040
        (image isNil or: [self checkModified])
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
  1041
        ifTrue:
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
  1042
        [
827
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1043
            |fileName|
796
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
  1044
            masterApplication notNil 
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
  1045
            ifTrue: 
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
  1046
            [
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1047
                undoImages notEmpty ifTrue: [masterApplication valueOfCanUndo value: true].
796
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
  1048
                masterApplication imagePreView image: anImage
b68b09ddc62b preview redrawing
tz
parents: 783
diff changeset
  1049
            ].
827
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1050
            image notNil
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1051
            ifTrue:
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1052
            [
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1053
                fileName := image fileName.
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1054
                anImage fileName isNil ifTrue: [anImage fileName: fileName].
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1055
            ].
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
  1056
            super image: anImage.
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1057
            retVal := self.
688
e1c30adb37bf updates coord info label while defining boxes
tz
parents: 686
diff changeset
  1058
        ].
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1059
    ]
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1060
    ifFalse:
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1061
    [
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1062
        super image: nil.
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1063
    ].
1025
4470f3ad349f update the image label, when a new image is assigned.
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
  1064
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1065
    self updateImageInfo: self imageInfoString. 
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1066
    ^ retVal
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1067
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1068
    "Modified: / 29.7.1998 / 18:27:31 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1069
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1070
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1071
loadFromFile: aFileName
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1072
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1073
    aFileName isNil ifTrue: [^nil].
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1074
    Object errorSignal handle:
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1075
    [:exeption|
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1076
        modified := false.
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1077
        self warn: exeption errorString.
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1078
        ^nil
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1079
    ] 
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1080
    do:
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1081
    [ 
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1082
        |imageFromFile|
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1083
        (imageFromFile := Image fromFile: aFileName) notNil
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1084
        ifTrue:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1085
        [
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1086
            self releaseUndos.
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1087
            self image: imageFromFile. 
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1088
            imageReaderClass := ImageReader allSubclasses
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1089
                detect: [:cls| cls isValidImageFile: aFileName]
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1090
                ifNone: [self error: 'Unknown image file format!!']
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1091
        ]
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1092
        ifFalse:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1093
        [
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1094
            self error: 'Not an image file (or unrecognized format) !!'
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1095
        ]
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1096
    ]
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1097
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1098
    "Modified: / 29.7.1998 / 18:09:13 / cg"
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1099
!
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
  1100
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1101
loadFromMessage: aMessage
594edef86630 revised version
tz
parents: 632
diff changeset
  1102
594edef86630 revised version
tz
parents: 632
diff changeset
  1103
    (self resourceMessage: aMessage) isNil
594edef86630 revised version
tz
parents: 632
diff changeset
  1104
    ifTrue:
594edef86630 revised version
tz
parents: 632
diff changeset
  1105
    [
594edef86630 revised version
tz
parents: 632
diff changeset
  1106
        ^nil
594edef86630 revised version
tz
parents: 632
diff changeset
  1107
    ].
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1108
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1109
    ^self loadfromClass: resourceClass andSelector: resourceSelector
594edef86630 revised version
tz
parents: 632
diff changeset
  1110
594edef86630 revised version
tz
parents: 632
diff changeset
  1111
   
594edef86630 revised version
tz
parents: 632
diff changeset
  1112
!
594edef86630 revised version
tz
parents: 632
diff changeset
  1113
594edef86630 revised version
tz
parents: 632
diff changeset
  1114
loadfromClass: aClassOrSymbol andSelector: aStringOrSymbol
594edef86630 revised version
tz
parents: 632
diff changeset
  1115
678
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1116
    |aClass| 
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1117
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1118
    imageReaderClass := nil.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1119
    self resourceClass: aClassOrSymbol.
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1120
    self resourceSelector: aStringOrSymbol.
678
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1121
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1122
    ((aClass := Smalltalk at: resourceClass) isClass and: 
9afa8810a8be image must not be nil after load failure
tz
parents: 676
diff changeset
  1123
    [aClass class implements: resourceSelector])
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1124
    ifTrue:
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1125
    [ 
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1126
        self releaseUndos.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1127
        ^self image: (aClass perform: resourceSelector) copy
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1128
    ]
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1129
    ifFalse:
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1130
    [
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1131
        modified := false.
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1132
        ^nil
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1133
    ]
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1134
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1135
! !
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1136
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1137
!ImageEditView methodsFor:'initialization'!
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1138
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1139
initialize
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1140
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1141
    super initialize.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1142
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1143
    self enableMotionEvents.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1144
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
  1145
    GridMagnification := GridMagnification ? (8@8).
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1146
    MaxUndos          := MaxUndos ? 3.
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1147
    undoImages        := OrderedCollection new: MaxUndos.
1003
c0958fda9993 remember the old magnification
tz
parents: 1002
diff changeset
  1148
    magnification     := LastMagnification ? GridMagnification.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1149
    modified          := false.
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1150
    mouseKeyColorMode := 1.
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1151
    resourceClass     := resourceSelector := ''.
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1152
    selectColors      := Array with: nil with: nil.
1036
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
  1153
d860072f3b49 gridMag default.
Claus Gittinger <cg@exept.de>
parents: 1035
diff changeset
  1154
    "Modified: / 31.7.1998 / 02:15:14 / cg"
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1155
! !
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1156
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1157
!ImageEditView methodsFor:'printing & storing'!
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1158
724
d6f4b89940ed undo disabling
tz
parents: 704
diff changeset
  1159
loadFromClass
404
322e32d8f099 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
  1160
676
fd7918a3e6e6 load + preview redraw errors removed
tz
parents: 674
diff changeset
  1161
    ^self loadFromMessage: 
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1162
        (ResourceSelectionBrowser
662
61b7601829ea with modal support
tz
parents: 636
diff changeset
  1163
            request: 'Load Image From Class'
724
d6f4b89940ed undo disabling
tz
parents: 704
diff changeset
  1164
            onSuperclass: nil
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1165
            andClass: self resourceClass
d53428252193 revised version
tz
parents: 633
diff changeset
  1166
            andSelector: self resourceSelector
d53428252193 revised version
tz
parents: 633
diff changeset
  1167
            withResourceTypes: #(image fileImage))
d53428252193 revised version
tz
parents: 633
diff changeset
  1168
            
477
37f12d35c359 added #resize.
Claus Gittinger <cg@exept.de>
parents: 430
diff changeset
  1169
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1170
!
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1171
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1172
makeUndo
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1173
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1174
    image notNil
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1175
    ifTrue:
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1176
    [       
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1177
        MaxUndos <= undoImages size
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1178
            ifTrue:  [undoImages contents: (undoImages copyFrom: 2 to: MaxUndos)].
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1179
        undoImages add: image copy
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1180
    ]
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1181
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1182
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1183
print
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1184
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1185
    image notNil 
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1186
    ifTrue: 
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1187
    [
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1188
        |stream|
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1189
        Printer supportsPostscript ifFalse:
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1190
        [
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1191
            ^self warn:'No postscript printer detected!!'
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1192
        ].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1193
        stream := Printer newNative.
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1194
        stream isNil ifTrue:
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1195
        [
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1196
            ^self warn:'Cannot open printer stream!!'
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1197
        ].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1198
        self withWaitCursorDo:
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1199
        [
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1200
            |psgc|
823
a290d145a09f resource method comment
tz
parents: 822
diff changeset
  1201
            psgc := PSGraphicsContext on:stream.  
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1202
            psgc displayForm: (image magnifiedBy: magnification) x:0 y:0.
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1203
            psgc close
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1204
        ]
398
7b7255a4db0d show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
  1205
    ]
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1206
!
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1207
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1208
save
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1209
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1210
    self saveImageOrMask: #image.
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1211
624
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1212
!
d98fe4700fc2 checkin from browser
tz
parents: 606
diff changeset
  1213
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1214
saveAs
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1215
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1216
    self saveImageFileAs
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1217
!
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1218
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1219
saveImageFileAs
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1220
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1221
    self saveImageFileAs:
594edef86630 revised version
tz
parents: 632
diff changeset
  1222
        (FileSelectionBrowser
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1223
            request: 'Save Image To File'
827
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1224
            fileName: self image fileName
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1225
            withFileFilters: FileSelectionBrowser saveImageFileNameFilters)
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1226
!
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1227
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1228
saveImageFileAs: aFileName
297
d733af1b0ffe better saving functions;
Claus Gittinger <cg@exept.de>
parents: 296
diff changeset
  1229
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1230
    aFileName isNil ifTrue: [^nil].
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1231
    image notNil
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1232
    ifTrue:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1233
    [
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1234
        image fileName: aFileName.
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1235
        self saveImageOrMask: #image
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1236
    ]
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1237
    ifFalse:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1238
    [
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1239
        self warn: 'No image or file name for saving detected!!'
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1240
    ]
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1241
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1242
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1243
saveImageMaskFileAs
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1244
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1245
    self saveImageMaskFileAs:
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1246
        (FileSelectionBrowser
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1247
            request: 'Save Image Mask To File'
827
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1248
            fileName: self image fileName 
155b4ed10c7c remember the file name if changed
tz
parents: 823
diff changeset
  1249
            withFileFilters: FileSelectionBrowser saveImageFileNameFilters)
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1250
!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1251
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1252
saveImageMaskFileAs: aFileName
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1253
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1254
    aFileName isNil ifTrue: [^nil].
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1255
    (image notNil and: [image mask notNil])
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1256
    ifTrue:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1257
    [
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1258
        image mask fileName: aFileName.
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1259
        self saveImageOrMask: #mask
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1260
    ]
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1261
    ifFalse:
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1262
    [
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1263
        self warn: 'No image or image mask detected!!'
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1264
    ]
628
7f36d8a7735f popup menu starts image editor
tz
parents: 627
diff changeset
  1265
!
7f36d8a7735f popup menu starts image editor
tz
parents: 627
diff changeset
  1266
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1267
saveImageOrMask: what
628
7f36d8a7735f popup menu starts image editor
tz
parents: 627
diff changeset
  1268
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1269
    Object errorSignal handle:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1270
    [:ex|
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1271
        self warn: ex errorString.
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1272
        ^nil                                 
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1273
    ] 
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1274
    do:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1275
    [   
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1276
        |fileName|
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1277
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1278
        windowGroup withCursor:Cursor write do:[
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1279
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1280
            image isNil ifTrue: [^self error: 'No image to save!!'].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1281
            what = #image
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1282
            ifTrue:
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1283
            [   
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1284
                image fileName isNil ifTrue: [^self error: 'No file name for image detected!!'].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1285
                fileName := image fileName asFilename
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1286
            ].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1287
            what = #mask
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1288
            ifTrue:
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1289
            [   
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1290
                image mask isNil ifTrue: [^self error: 'No image mask to save!!'].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1291
                image mask fileName isNil ifTrue: [^self error: 'No file name for image mask detected!!'].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1292
                fileName := image mask fileName asFilename
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1293
            ].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1294
            fileName name size = 0 ifTrue: [^self error: 'No file name detected!!'].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1295
            (fileName suffix = 'tiff') | (fileName suffix = 'tif') ifTrue: [imageReaderClass := TIFFReader].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1296
            fileName suffix = 'xpm' ifTrue: [imageReaderClass := XPMReader].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1297
            fileName suffix = 'xbm' ifTrue: [imageReaderClass := XBMReader].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1298
            fileName suffix = 'gif' ifTrue: [imageReaderClass := GIFReader].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1299
            (fileName suffix = 'jpg') | (fileName suffix = 'jpeg') ifTrue: [imageReaderClass := JPEGReader].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1300
            imageReaderClass isNil ifTrue: [imageReaderClass := XPMReader. image fileName: image fileName, '.xpm'].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1301
            what = #image ifTrue: [image saveOn: image fileName using: imageReaderClass. modified := false].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1302
            what = #mask ifTrue: [image mask saveOn: image mask fileName using: imageReaderClass].
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1303
        ]   
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1304
    ]
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1305
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1306
    "Modified: / 28.7.1998 / 21:57:14 / cg"
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1307
!
594edef86630 revised version
tz
parents: 632
diff changeset
  1308
594edef86630 revised version
tz
parents: 632
diff changeset
  1309
saveMethod
594edef86630 revised version
tz
parents: 632
diff changeset
  1310
594edef86630 revised version
tz
parents: 632
diff changeset
  1311
    Object errorSignal handle:
594edef86630 revised version
tz
parents: 632
diff changeset
  1312
    [:ex|
594edef86630 revised version
tz
parents: 632
diff changeset
  1313
        self warn: ex errorString.
594edef86630 revised version
tz
parents: 632
diff changeset
  1314
        ^nil                                 
594edef86630 revised version
tz
parents: 632
diff changeset
  1315
    ] 
594edef86630 revised version
tz
parents: 632
diff changeset
  1316
    do:
594edef86630 revised version
tz
parents: 632
diff changeset
  1317
    [   
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1318
        |category imageStoreStream cls sel mthd imageKey|
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1319
1050
85ee282325fc checkin from browser
tz
parents: 1049
diff changeset
  1320
        windowGroup withExecuteCursorDo:[
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1321
            (self resourceSelector trimBlanks size = 0) | (cls := Smalltalk at: self resourceClass) isClass not 
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1322
                ifTrue: [^self saveMethodAs].
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1323
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1324
            self image storeOn: (imageStoreStream := WriteStream on: '').
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1325
            sel := self resourceSelector.
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1326
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1327
            "/ if that method already exists, do not overwrite the category
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1328
            category := 'image specs'.
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1329
            (mthd := cls class compiledMethodAt:sel) notNil ifTrue:[
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1330
                category := mthd category.
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1331
            ].
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1332
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1333
            imageKey :=  (cls name, ' ', sel) asSymbol.
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1334
            Icon constantNamed: imageKey put:nil.
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1335
            ByteCodeCompiler 
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1336
                compile: ((sel,
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1337
                    '\', (ResourceSpecEditor codeGenerationCommentForClass: ImageEditor),
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1338
                    '\\' , 
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1339
                    '    "\',
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1340
                    '     self ' , self resourceSelector , ' inspect\',
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1341
                    '     ImageEditor openOnClass:self andSelector:#', self resourceSelector, 
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1342
                    '\    "',
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1343
                    '\\',
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1344
                    '    <resource: #image>',
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1345
                    '\\',
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1346
                    '    ^Icon\') withCRs, 
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1347
                    '        constantNamed:#''', imageKey, '''\' withCRs,
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1348
                    '        ifAbsentPut:[', imageStoreStream contents, ']')
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1349
                forClass: cls class inCategory: category.
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1350
            modified := false.
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1351
        ]
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1352
    ]
1027
5bffbe90b8e2 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  1353
1047
95f10ea8653d use #withExecuteCursorDo:
Claus Gittinger <cg@exept.de>
parents: 1038
diff changeset
  1354
    "Modified: / 31.7.1998 / 20:12:54 / cg"
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1355
!
594edef86630 revised version
tz
parents: 632
diff changeset
  1356
594edef86630 revised version
tz
parents: 632
diff changeset
  1357
saveMethodAs
594edef86630 revised version
tz
parents: 632
diff changeset
  1358
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1359
    (self resourceMessage:
d53428252193 revised version
tz
parents: 633
diff changeset
  1360
        (ResourceSelectionBrowser
822
cace81f0a86b do not overwrite method categories + toggle between mouse button colors
tz
parents: 796
diff changeset
  1361
            request: 'Save Image In Class'
693
e229810e61fb save method as with superclass #Object
tz
parents: 691
diff changeset
  1362
            onSuperclass: #Object
636
d53428252193 revised version
tz
parents: 633
diff changeset
  1363
            andClass: self resourceClass
d53428252193 revised version
tz
parents: 633
diff changeset
  1364
            andSelector: self resourceSelector
d53428252193 revised version
tz
parents: 633
diff changeset
  1365
            withResourceTypes: #(image fileImage))) notNil
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1366
    ifTrue:
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1367
    [   
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1368
        ^self saveMethod
674
f24ca336b717 if none image found for loading clear image
tz
parents: 662
diff changeset
  1369
    ].  
633
594edef86630 revised version
tz
parents: 632
diff changeset
  1370
    ^nil
1
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1371
! !
c6ca7bfedf31 Initial revision
claus
parents:
diff changeset
  1372
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1373
!ImageEditView methodsFor:'queries'!
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1374
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1375
heightOfContents
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1376
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1377
    image isNil ifTrue:[^0].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1378
    ^(image height * magnification y) rounded
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1379
!
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1380
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1381
imageContainsPastePoint: aPoint
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1382
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1383
    ^image notNil and: 
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1384
        [Clipboard notNil and:
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1385
        [((0@0 corner:(image extent) "- 1" - Clipboard extent) containsPoint: (((aPoint - margin + 1) / magnification) floor))]]
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1386
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1387
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1388
imageContainsPoint: aPoint
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1389
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1390
    ^image notNil and:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1391
        [((0@0 corner:(image extent) - 1) containsPoint: (((aPoint - margin + 1) / magnification) floor))]
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1392
!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1393
783
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1394
imageInfoString
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1395
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1396
    |imageInfoString usedColors|
1011
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1397
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1398
    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
  1399
    ifFalse: [
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1400
        image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := image usedColors size].
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1401
        imageInfoString := image width printString, 'x'
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1402
            , image height printString, 'x'
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1403
            , (2 raisedTo: image depth) printString
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1404
            , (image mask notNil ifTrue: [' (mask + '] ifFalse: ['('])
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1405
            , usedColors printString
325d334e93c8 added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents: 1006
diff changeset
  1406
            , ' used colors)'].
783
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1407
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1408
    ^imageInfoString
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1409
!
c81a097b84b8 revised version
tz
parents: 747
diff changeset
  1410
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1411
widthOfContents
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1412
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1413
    image isNil ifTrue:[^0].
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1414
    ^(image width * magnification x) rounded
5
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1415
! !
be72e6ba4822 *** empty log message ***
claus
parents: 1
diff changeset
  1416
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1417
!ImageEditView methodsFor:'release'!
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1418
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1419
destroy
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1420
996
f3674765d8fb releases
tz
parents: 995
diff changeset
  1421
    ClipboardMagnification := Clipboard := nil.
1003
c0958fda9993 remember the old magnification
tz
parents: 1002
diff changeset
  1422
    LastMagnification      := magnification.
686
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1423
33833bcbb5cd some cleans
tz
parents: 678
diff changeset
  1424
    super destroy
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1425
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1426
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1427
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1428
releasePasteDrawing
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1429
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1430
    (lastPastePoint notNil and: [ClipboardMagnification notNil]) 
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1431
    ifTrue: 
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1432
    [ 
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1433
        self redraw: (lastPastePoint extent: (ClipboardMagnification extent)). 
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1434
    ].
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1435
    lastPastePoint := ClipboardMagnification := nil
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1436
!
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1437
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1438
releaseUndos
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1439
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1440
    undoImages removeAll.
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1441
    "/ cg: what a kludge - please change to use a valueHolder,
995
cd84d6f8c449 several undos
tz
parents: 994
diff changeset
  1442
    masterApplication valueOfCanUndo value: false.
1038
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1443
6c0bb03e88a1 no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1444
    "Modified: / 31.7.1998 / 02:47:21 / cg"
627
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1445
! !
e0bf28f61361 many many fixes/enhancements
tz
parents: 624
diff changeset
  1446
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1447
!ImageEditView methodsFor:'testing'!
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1448
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1449
checkModified
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1450
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1451
    modified
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1452
    ifTrue:
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1453
    [
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1454
        ((YesNoBox title:(resources string:'Image was modified !!'))
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1455
            noText:(resources string:'Cancel');
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1456
            yesText:(resources string:'Forget it and proceed');
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1457
            showAtPointer;
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1458
            accepted) ifFalse: [^false].
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1459
        modified := false
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1460
    ].
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1461
    ^true
1031
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1462
a5ab5869b2ba cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1463
    "Modified: / 29.7.1998 / 18:55:24 / cg"
632
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1464
! !
be1ac8ea33a7 checkin from browser
tz
parents: 628
diff changeset
  1465
255
1dfa8deddaef checkin from browser
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
  1466
!ImageEditView class methodsFor:'documentation'!
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1467
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1468
version
1103
62fb33e2e17b checkin from browser
tz
parents: 1084
diff changeset
  1469
    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.101 1998-08-31 13:29:38 tz Exp $'
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
  1470
! !