ImageEditor.st
author Claus Gittinger <cg@exept.de>
Wed, 29 Jul 1998 01:12:22 +0200
changeset 922 0a5799408f54
parent 921 a5aca21ea803
child 926 04887448fab8
permissions -rw-r--r--
assign all inputFields to a common group.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
400
228524287573 intitial checkin
tz
parents:
diff changeset
     1
"
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
     2
 COPYRIGHT (c) 1997-1998 by eXept Software AG
400
228524287573 intitial checkin
tz
parents:
diff changeset
     3
              All Rights Reserved
228524287573 intitial checkin
tz
parents:
diff changeset
     4
228524287573 intitial checkin
tz
parents:
diff changeset
     5
 This software is furnished under a license and may be used
228524287573 intitial checkin
tz
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
405
8546da96ab11 widgets rearranged for different fonts
tz
parents: 401
diff changeset
     7
 inclusion of the above copyright notice. This software may not
400
228524287573 intitial checkin
tz
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
405
8546da96ab11 widgets rearranged for different fonts
tz
parents: 401
diff changeset
     9
 other person. No title to or ownership of the software is
400
228524287573 intitial checkin
tz
parents:
diff changeset
    10
 hereby transferred.
228524287573 intitial checkin
tz
parents:
diff changeset
    11
"
228524287573 intitial checkin
tz
parents:
diff changeset
    12
228524287573 intitial checkin
tz
parents:
diff changeset
    13
ToolApplicationModel subclass:#ImageEditor
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
    14
	instanceVariableNames:'imageEditView colorMapMode selectedColorIndex postOpenAction'
400
228524287573 intitial checkin
tz
parents:
diff changeset
    15
	classVariableNames:''
228524287573 intitial checkin
tz
parents:
diff changeset
    16
	poolDictionaries:''
617
463306131678 checkin from browser
tz
parents: 611
diff changeset
    17
	category:'Interface-UIPainter'
400
228524287573 intitial checkin
tz
parents:
diff changeset
    18
!
228524287573 intitial checkin
tz
parents:
diff changeset
    19
228524287573 intitial checkin
tz
parents:
diff changeset
    20
!ImageEditor class methodsFor:'documentation'!
228524287573 intitial checkin
tz
parents:
diff changeset
    21
228524287573 intitial checkin
tz
parents:
diff changeset
    22
copyright
228524287573 intitial checkin
tz
parents:
diff changeset
    23
"
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    24
 COPYRIGHT (c) 1997-1998 by eXept Software AG
400
228524287573 intitial checkin
tz
parents:
diff changeset
    25
              All Rights Reserved
228524287573 intitial checkin
tz
parents:
diff changeset
    26
228524287573 intitial checkin
tz
parents:
diff changeset
    27
 This software is furnished under a license and may be used
228524287573 intitial checkin
tz
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
405
8546da96ab11 widgets rearranged for different fonts
tz
parents: 401
diff changeset
    29
 inclusion of the above copyright notice. This software may not
400
228524287573 intitial checkin
tz
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
405
8546da96ab11 widgets rearranged for different fonts
tz
parents: 401
diff changeset
    31
 other person. No title to or ownership of the software is
400
228524287573 intitial checkin
tz
parents:
diff changeset
    32
 hereby transferred.
228524287573 intitial checkin
tz
parents:
diff changeset
    33
"
228524287573 intitial checkin
tz
parents:
diff changeset
    34
!
228524287573 intitial checkin
tz
parents:
diff changeset
    35
228524287573 intitial checkin
tz
parents:
diff changeset
    36
documentation
228524287573 intitial checkin
tz
parents:
diff changeset
    37
"
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
    38
    Image Editor allows you to create, design, modify or just inspect images.
400
228524287573 intitial checkin
tz
parents:
diff changeset
    39
228524287573 intitial checkin
tz
parents:
diff changeset
    40
    [start with:]
228524287573 intitial checkin
tz
parents:
diff changeset
    41
        ImageEditor open
228524287573 intitial checkin
tz
parents:
diff changeset
    42
        ImageEditor openOnClass:ImageEditor andSelector:#newImageIcon
228524287573 intitial checkin
tz
parents:
diff changeset
    43
228524287573 intitial checkin
tz
parents:
diff changeset
    44
    [see also:]
228524287573 intitial checkin
tz
parents:
diff changeset
    45
        ImageEditView Image
228524287573 intitial checkin
tz
parents:
diff changeset
    46
228524287573 intitial checkin
tz
parents:
diff changeset
    47
    [author:]
544
8fa6ee20c3cd help menu item aligned to the right
tz
parents: 535
diff changeset
    48
        Thomas Zwick, eXept Software AG
400
228524287573 intitial checkin
tz
parents:
diff changeset
    49
"
228524287573 intitial checkin
tz
parents:
diff changeset
    50
! !
228524287573 intitial checkin
tz
parents:
diff changeset
    51
228524287573 intitial checkin
tz
parents:
diff changeset
    52
!ImageEditor class methodsFor:'instance creation'!
228524287573 intitial checkin
tz
parents:
diff changeset
    53
228524287573 intitial checkin
tz
parents:
diff changeset
    54
openModalOnClass: aClass andSelector: aSelector
900
5dd8303a9bb5 opens an Image Editor in any case
tz
parents: 899
diff changeset
    55
    "opens modal a Image Editor on aClass and aSelector"
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    56
    "
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    57
     self openModalOnClass: self andSelector: #leftMouseKeyIcon
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    58
    "
400
228524287573 intitial checkin
tz
parents:
diff changeset
    59
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    60
    |imageEditor imageEditView className resourceClassName resourceSelector| 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    61
400
228524287573 intitial checkin
tz
parents:
diff changeset
    62
    imageEditor := self new.
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    63
900
5dd8303a9bb5 opens an Image Editor in any case
tz
parents: 899
diff changeset
    64
    aClass isClass  ifTrue: [className := aClass name].
5dd8303a9bb5 opens an Image Editor in any case
tz
parents: 899
diff changeset
    65
    aClass isString ifTrue: [className := aClass].      
903
63203d996e61 openModal bug fixed
tz
parents: 901
diff changeset
    66
    aClass isNil    ifTrue: [className := ''].      
400
228524287573 intitial checkin
tz
parents:
diff changeset
    67
688
788fe83ab3c0 time clock removed
tz
parents: 679
diff changeset
    68
    imageEditor postOpenAction: [imageEditView := imageEditor imageEditView. imageEditor loadFromOrPrepareForMessage: className, ' ', aSelector].
400
228524287573 intitial checkin
tz
parents:
diff changeset
    69
    imageEditor openModal.
228524287573 intitial checkin
tz
parents:
diff changeset
    70
688
788fe83ab3c0 time clock removed
tz
parents: 679
diff changeset
    71
    resourceClassName := imageEditView resourceClass.
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    72
    resourceSelector  := imageEditView resourceSelector.
415
f792d83774b3 with modal support
tz
parents: 405
diff changeset
    73
815
b2b9356a648c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
    74
    ((className asString ~= resourceClassName) 
b2b9356a648c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 767
diff changeset
    75
    or:[aSelector asString ~= resourceSelector])
415
f792d83774b3 with modal support
tz
parents: 405
diff changeset
    76
        ifTrue: [^resourceClassName, ' ', resourceSelector]
f792d83774b3 with modal support
tz
parents: 405
diff changeset
    77
        ifFalse:[^nil]
400
228524287573 intitial checkin
tz
parents:
diff changeset
    78
!
228524287573 intitial checkin
tz
parents:
diff changeset
    79
228524287573 intitial checkin
tz
parents:
diff changeset
    80
openOnClass: aClass andSelector: aSelector
900
5dd8303a9bb5 opens an Image Editor in any case
tz
parents: 899
diff changeset
    81
    "opens a Image Editor on aClass and aSelector"
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    82
    "
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    83
     self openOnClass: self andSelector: #leftMouseKeyIcon
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    84
    "
400
228524287573 intitial checkin
tz
parents:
diff changeset
    85
228524287573 intitial checkin
tz
parents:
diff changeset
    86
    ^self open loadFromMessage: aClass name, ' ', aSelector
228524287573 intitial checkin
tz
parents:
diff changeset
    87
!
228524287573 intitial checkin
tz
parents:
diff changeset
    88
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    89
openOnFile: aFileName
900
5dd8303a9bb5 opens an Image Editor in any case
tz
parents: 899
diff changeset
    90
    "opens a Image Editor on aFileName"
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    91
    "
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    92
     self openOnFile: 'bitmaps/SmalltalkX.xbm'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    93
    "
400
228524287573 intitial checkin
tz
parents:
diff changeset
    94
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    95
    ^self open loadFromFile: aFileName
400
228524287573 intitial checkin
tz
parents:
diff changeset
    96
!
228524287573 intitial checkin
tz
parents:
diff changeset
    97
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
    98
openOnImage: anImage
900
5dd8303a9bb5 opens an Image Editor in any case
tz
parents: 899
diff changeset
    99
    "opens a Image Editor on anImage"
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   100
    "
895
69269bc88320 checkin from browser
tz
parents: 880
diff changeset
   101
     self openOnImage: Icon startIcon
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   102
    "
400
228524287573 intitial checkin
tz
parents:
diff changeset
   103
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   104
    ^self open loadFromImage: anImage
400
228524287573 intitial checkin
tz
parents:
diff changeset
   105
! !
228524287573 intitial checkin
tz
parents:
diff changeset
   106
228524287573 intitial checkin
tz
parents:
diff changeset
   107
!ImageEditor class methodsFor:'accessing'!
228524287573 intitial checkin
tz
parents:
diff changeset
   108
228524287573 intitial checkin
tz
parents:
diff changeset
   109
listOfColorMaps
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   110
    "returns the list of default color maps for a new image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
   111
228524287573 intitial checkin
tz
parents:
diff changeset
   112
    |colorMap|
898
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   113
400
228524287573 intitial checkin
tz
parents:
diff changeset
   114
    (colorMap := OrderedCollection new)
228524287573 intitial checkin
tz
parents:
diff changeset
   115
        add: Color black;
228524287573 intitial checkin
tz
parents:
diff changeset
   116
        add: Color white;
228524287573 intitial checkin
tz
parents:
diff changeset
   117
        add: Color red;
228524287573 intitial checkin
tz
parents:
diff changeset
   118
        add: Color green;
228524287573 intitial checkin
tz
parents:
diff changeset
   119
        add: Color blue;
228524287573 intitial checkin
tz
parents:
diff changeset
   120
        add: Color cyan;
228524287573 intitial checkin
tz
parents:
diff changeset
   121
        add: Color yellow;
228524287573 intitial checkin
tz
parents:
diff changeset
   122
        add: Color magenta;
898
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   123
        add: (Color redByte: 127 greenByte:   0 blueByte:   0);
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   124
        add: (Color redByte:   0 greenByte: 127 blueByte:   0);
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   125
        add: (Color redByte:   0 greenByte:   0 blueByte: 127);
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   126
        add: (Color redByte:   0 greenByte: 127 blueByte: 127);
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   127
        add: (Color redByte: 127 greenByte: 127 blueByte:   0);
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   128
        add: (Color redByte: 127 greenByte:   0 blueByte: 127);
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   129
        add: (Color redByte: 127 greenByte: 127 blueByte: 127);
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   130
        add: (Color redByte: 170 greenByte: 170 blueByte: 170).
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   131
400
228524287573 intitial checkin
tz
parents:
diff changeset
   132
    0 to: 5 do:
228524287573 intitial checkin
tz
parents:
diff changeset
   133
    [:r|                                                    
228524287573 intitial checkin
tz
parents:
diff changeset
   134
        0 to: 5 do:         
228524287573 intitial checkin
tz
parents:
diff changeset
   135
        [:g|
228524287573 intitial checkin
tz
parents:
diff changeset
   136
            0 to: 5 do:                             
228524287573 intitial checkin
tz
parents:
diff changeset
   137
            [:b|
898
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   138
                colorMap add: (Color redByte: (r*255//5) ceiling greenByte: (g*255//5) ceiling blueByte: (b*255//5) ceiling)
400
228524287573 intitial checkin
tz
parents:
diff changeset
   139
            ]
228524287573 intitial checkin
tz
parents:
diff changeset
   140
        ]
228524287573 intitial checkin
tz
parents:
diff changeset
   141
    ].
228524287573 intitial checkin
tz
parents:
diff changeset
   142
228524287573 intitial checkin
tz
parents:
diff changeset
   143
    1 to: 25 do:
228524287573 intitial checkin
tz
parents:
diff changeset
   144
    [:g|                             
898
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
   145
        colorMap add: (Color redByte: (g*255//26) ceiling greenByte: (g*255//26) ceiling blueByte: (g*255//26) ceiling)
400
228524287573 intitial checkin
tz
parents:
diff changeset
   146
    ].
228524287573 intitial checkin
tz
parents:
diff changeset
   147
228524287573 intitial checkin
tz
parents:
diff changeset
   148
    ^Dictionary new
228524287573 intitial checkin
tz
parents:
diff changeset
   149
        at: '8-plane' put: colorMap;
228524287573 intitial checkin
tz
parents:
diff changeset
   150
        at: '8-plane + mask' put: colorMap;
228524287573 intitial checkin
tz
parents:
diff changeset
   151
        at: '4-plane' put: (colorMap copyFrom: 1 to: 16);
228524287573 intitial checkin
tz
parents:
diff changeset
   152
        at: '4-plane + mask' put: (colorMap copyFrom: 1 to: 16);
228524287573 intitial checkin
tz
parents:
diff changeset
   153
        at: '2-plane' put: (colorMap copyFrom: 1 to: 4);
228524287573 intitial checkin
tz
parents:
diff changeset
   154
        at: '2-plane + mask' put: (colorMap copyFrom: 1 to: 4);
228524287573 intitial checkin
tz
parents:
diff changeset
   155
        at: '1-plane' put: (colorMap copyFrom: 1 to: 2);
228524287573 intitial checkin
tz
parents:
diff changeset
   156
        at: '1-plane + mask' put: (colorMap copyFrom: 1 to: 2);
228524287573 intitial checkin
tz
parents:
diff changeset
   157
        yourself
228524287573 intitial checkin
tz
parents:
diff changeset
   158
!
228524287573 intitial checkin
tz
parents:
diff changeset
   159
228524287573 intitial checkin
tz
parents:
diff changeset
   160
listOfDefaultSizes
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   161
    "returns the list of default sizes for a new image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
   162
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   163
    ^#('22x22' '16x16' '32x32')
400
228524287573 intitial checkin
tz
parents:
diff changeset
   164
! !
228524287573 intitial checkin
tz
parents:
diff changeset
   165
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   166
!ImageEditor class methodsFor:'help specs'!
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   167
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   168
helpSpec
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   169
    "This resource specification was automatically generated
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   170
     by the UIHelpTool of ST/X."
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   171
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   172
    "Do not manually edit this!! If it is corrupted,
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   173
     the UIHelpTool may not be able to read the specification."
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   174
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   175
    "
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   176
     UIHelpTool openOnClass:ImageEditor    
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   177
    "
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   178
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   179
    <resource: #help>
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   180
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   181
    ^super helpSpec addPairsFrom:#(
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   182
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   183
#colorMap
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   184
'Increases or reduces size of color map of the image.'
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   185
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   186
#colorMapTable
675
25a770a729fc some help text changed
tz
parents: 674
diff changeset
   187
'Shows a list of used colors of the image.'
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   188
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   189
#drawModeBox
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   190
'Switches to box-drawing mode.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   191
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   192
#drawModeCopy
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   193
'Switches to area-copy mode.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   194
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   195
#drawModeFill
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   196
'Switches to flood-fill mode.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   197
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   198
#drawModeFilledBox
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   199
'Switches to filled-box drawing mode.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   200
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   201
#drawModePaste
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   202
'Switches to paste mode.'
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   203
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   204
#drawModePasteUnder
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   205
'Switches to paste under mode.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   206
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   207
#drawModePoint
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   208
'Switches to point-drawing mode.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   209
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   210
#editFlipHorizontal
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   211
'Flips the image horizontally.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   212
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   213
#editFlipVertical
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   214
'Flips the image vertically.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   215
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   216
#editMagnifyImage
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   217
'Magnify the image.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   218
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   219
#editNegate
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   220
'Invert the images colors.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   221
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   222
#editResize
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   223
'Resize the image (preserving the old image).'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   224
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   225
#editRotate
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   226
'Rotate the image.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   227
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   228
#fileLoadFromClass
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   229
'Selecting and load an image from a resource method.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   230
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   231
#fileLoadFromFile
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   232
'Selecting and load an image from a file.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   233
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   234
#fileNewImage
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   235
'Create a new image'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   236
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   237
#filePrint
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   238
'Print the image on a postscript printer.'
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   239
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   240
#fileSaveAs
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   241
'Save the image to a file.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   242
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   243
#fileSaveMaskAs
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   244
'Save the mask of the image to a file.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   245
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   246
#fileSaveMethod
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   247
'Save the image as resource method in the current class and selector.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   248
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   249
#fileSaveMethodAs
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   250
'Save the image as resource method in a class.'
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   251
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   252
#magnificationNumber
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   253
'Shows the current magnification.'
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   254
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   255
#magnifyImageDown
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   256
'Decrease magnification.'
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   257
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   258
#magnifyImageUp
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   259
'Increase magnification.'
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   260
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   261
#mouseKeyColorMode
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   262
'Toggles between left and right mouse button color.'
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   263
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   264
#previewView
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   265
'Shows a preview of the image.'
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
   266
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   267
#settingsGridMagnification
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   268
'Change the grid magnification of the edit view.'
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   269
460
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   270
)
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   271
! !
9d141cb07d5e help texts added
tz
parents: 450
diff changeset
   272
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   273
!ImageEditor class methodsFor:'image specs'!
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   274
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   275
leftMouseKeyIcon
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   276
    "This resource specification was automatically generated
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   277
     by the ImageEditor of ST/X."
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   278
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   279
    "Do not manually edit this!! If it is corrupted,
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   280
     the ImageEditor may not be able to read the specification."
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   281
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   282
    "
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   283
     ImageEditor openOnClass:self andSelector:#leftMouseKeyIcon
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   284
    "
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   285
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   286
    <resource: #image>
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   287
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   288
    ^Icon
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   289
        constantNamed:#'ImageEditor leftMouseKeyIcon'
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   290
        ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@JEE@@B!!QP@@(TT@@@@@@@AUUP@@UUT@@EUU@@AUUP@@UUT@@EUU@@@UU@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b') ; yourself); yourself]!
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   291
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   292
rightMouseKeyIcon
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   293
    "This resource specification was automatically generated
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   294
     by the ImageEditor of ST/X."
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   295
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   296
    "Do not manually edit this!! If it is corrupted,
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   297
     the ImageEditor may not be able to read the specification."
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   298
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   299
    "
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   300
     ImageEditor openOnClass:self andSelector:#rightMouseKeyIcon
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   301
    "
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   302
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   303
    <resource: #image>
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   304
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   305
    ^Icon
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   306
        constantNamed:#'ImageEditor rightMouseKeyIcon'
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   307
        ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@EEJ@@AQR @@TT(@@@@@@@AUUP@@UUT@@EUU@@AUUP@@UUT@@EUU@@@UU@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b') ; yourself); yourself]! !
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   308
400
228524287573 intitial checkin
tz
parents:
diff changeset
   309
!ImageEditor class methodsFor:'interface specs'!
228524287573 intitial checkin
tz
parents:
diff changeset
   310
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   311
dialogSpecForNewImage
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   312
    "This resource specification was automatically generated
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   313
     by the UIPainter of ST/X."
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   314
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   315
    "Do not manually edit this!! If it is corrupted,
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   316
     the UIPainter may not be able to read the specification."
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   317
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   318
    "
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   319
     UIPainter new openOnClass:ImageEditor andSelector:#dialogSpecForNewImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   320
     ImageEditor new openInterface:#dialogSpecForNewImage
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   321
    "
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   322
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   323
    <resource: #canvas>
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   324
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   325
    ^
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   326
     
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   327
       #(#FullSpec
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   328
          #window: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   329
           #(#WindowSpec
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   330
              #name: 'New Image'
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   331
              #layout: #(#LayoutFrame 240 0 278 0 540 0 382 0)
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   332
              #label: 'New Image'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   333
              #min: #(#Point 10 10)
738210a2fa06 revised version
tz
parents: 651
diff changeset
   334
              #max: #(#Point 1152 900)
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   335
              #bounds: #(#Rectangle 240 278 541 383)
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   336
              #usePreferredExtent: false
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   337
          )
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   338
          #component: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   339
           #(#SpecCollection
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   340
              #collection: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   341
               #(
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   342
                 #(#ViewSpec
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   343
                    #name: 'View'
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   344
                    #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -35 1.0)
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   345
                    #component: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   346
                     #(#SpecCollection
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   347
                        #collection: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   348
                         #(
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   349
                           #(#FramedBoxSpec
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   350
                              #name: 'framedBox1'
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   351
                              #layout: #(#LayoutFrame 1 0.0 7 0.0 0 0.4 66 0)
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   352
                              #component: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   353
                               #(#SpecCollection
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   354
                                  #collection: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   355
                                   #(
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   356
                                     #(#ComboBoxSpec
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   357
                                        #name: 'defaultSizesComboBox'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   358
                                        #layout: #(#LayoutFrame 15 0.0 20 0.0 17 1.0 16 1.0)
738210a2fa06 revised version
tz
parents: 651
diff changeset
   359
                                        #model: #selectionOfSize
738210a2fa06 revised version
tz
parents: 651
diff changeset
   360
                                        #type: #string
738210a2fa06 revised version
tz
parents: 651
diff changeset
   361
                                        #comboList: #listOfDefaultSizes
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   362
                                    )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   363
                                  )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   364
                              )
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   365
                              #label: 'Size'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   366
                              #labelPosition: #topLeft
738210a2fa06 revised version
tz
parents: 651
diff changeset
   367
                              #style: #(#FontDescription #helvetica #medium #roman 12)
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   368
                          )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   369
                           #(#FramedBoxSpec
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   370
                              #name: 'framedBox2'
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   371
                              #layout: #(#LayoutFrame 0 0.4 7 0.0 -1 1.0 66 0)
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   372
                              #component: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   373
                               #(#SpecCollection
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   374
                                  #collection: 
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   375
                                   #(
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   376
                                     #(#ComboListSpec
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   377
                                        #name: 'colorMapComboBox'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   378
                                        #layout: #(#LayoutFrame 15 0.0 20 0.0 18 1.0 16 1.0)
738210a2fa06 revised version
tz
parents: 651
diff changeset
   379
                                        #model: #selectionOfColorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   380
                                        #comboList: #listOfColorMaps
738210a2fa06 revised version
tz
parents: 651
diff changeset
   381
                                        #useIndex: false
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   382
                                    )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   383
                                  )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   384
                              )
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   385
                              #label: 'Color Map'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   386
                              #labelPosition: #topLeft
738210a2fa06 revised version
tz
parents: 651
diff changeset
   387
                              #style: #(#FontDescription #helvetica #medium #roman 12)
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   388
                          )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   389
                        )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   390
                    )
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   391
                    #level: 1
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   392
                )
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   393
                 #(#UISubSpecification
738210a2fa06 revised version
tz
parents: 651
diff changeset
   394
                    #name: 'UISubSpecification1'
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   395
                    #layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0)
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   396
                    #majorKey: #ToolApplicationModel
738210a2fa06 revised version
tz
parents: 651
diff changeset
   397
                    #minorKey: #windowSpecForCommitWithoutChannels
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   398
                )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   399
              )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   400
          )
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   401
      )
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   402
!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   403
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   404
windowSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   405
    "This resource specification was automatically generated
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   406
     by the UIPainter of ST/X."
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   407
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   408
    "Do not manually edit this!! If it is corrupted,
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   409
     the UIPainter may not be able to read the specification."
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   410
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   411
    "
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   412
     UIPainter new openOnClass:ImageEditor andSelector:#windowSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   413
     ImageEditor new openInterface:#windowSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   414
     ImageEditor open
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   415
    "
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   416
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   417
    <resource: #canvas>
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   418
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   419
    ^
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   420
     
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   421
       #(#FullSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   422
          #window: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   423
           #(#WindowSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   424
              #name: 'Image Editor'
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   425
              #layout: #(#LayoutFrame 176 0 156 0 675 0 501 0)
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   426
              #label: 'Image Editor'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   427
              #min: #(#Point 400 320)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   428
              #max: #(#Point 1152 900)
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   429
              #bounds: #(#Rectangle 176 156 676 502)
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   430
              #menu: #menu
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   431
              #usePreferredExtent: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   432
          )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   433
          #component: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   434
           #(#SpecCollection
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   435
              #collection: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   436
               #(
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   437
                 #(#MenuPanelSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   438
                    #name: 'menuToolbarView'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   439
                    #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   440
                    #menu: #menuToolbar
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   441
                    #style: #(#FontDescription #helvetica #medium #roman 10)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   442
                    #showSeparatingLines: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   443
                )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   444
                 #(#VariableHorizontalPanelSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   445
                    #name: 'variableHorizontalPanel1'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   446
                    #layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   447
                    #component: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   448
                     #(#SpecCollection
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   449
                        #collection: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   450
                         #(
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   451
                           #(#ViewSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   452
                              #name: 'view1'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   453
                              #component: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   454
                               #(#SpecCollection
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   455
                                  #collection: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   456
                                   #(
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   457
                                     #(#VariableVerticalPanelSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   458
                                        #name: 'VariableVerticalPanel1'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   459
                                        #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   460
                                        #component: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   461
                                         #(#SpecCollection
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   462
                                            #collection: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   463
                                             #(
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   464
                                               #(#ViewSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   465
                                                  #name: 'View1'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   466
                                                  #component: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   467
                                                   #(#SpecCollection
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   468
                                                      #collection: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   469
                                                       #(
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   470
                                                         #(#MenuPanelSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   471
                                                            #name: 'MouseButtonColorToolBar'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   472
                                                            #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 24 0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   473
                                                            #menu: #menuMouseButtonColors
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   474
                                                        )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   475
                                                         #(#DataSetSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   476
                                                            #name: 'colorDataSetView'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   477
                                                            #layout: #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   478
                                                            #activeHelpKey: #colorMapTable
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   479
                                                            #model: #selectionOfColor
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   480
                                                            #style: #(#FontDescription #helvetica #medium #roman 10)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   481
                                                            #hasHorizontalScrollBar: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   482
                                                            #hasVerticalScrollBar: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   483
                                                            #miniScrollerHorizontal: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   484
                                                            #miniScrollerVertical: true
917
43e80afe8222 change level of colorMap-dataSet to 0.
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
   485
                                                            "/ #level: -1
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   486
                                                            #dataList: #listOfColors
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   487
                                                            #has3Dsepartors: true
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   488
                                                            #has3Dseparators: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   489
                                                            #verticalSpacing: 1
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   490
                                                            #columns: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   491
                                                             #(
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   492
                                                               #(#DataSetColumnSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   493
                                                                  #rendererType: #rowSelector
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   494
                                                                  #backgroundSelector: #yourself
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   495
                                                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   496
                                                               #(#DataSetColumnSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   497
                                                                  #label: 'R'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   498
                                                                  #labelAlignment: #left
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   499
                                                                  #model: #redFromColor:
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   500
                                                                  #canSelect: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   501
                                                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   502
                                                               #(#DataSetColumnSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   503
                                                                  #label: 'G'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   504
                                                                  #labelAlignment: #left
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   505
                                                                  #model: #greenFromColor:
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   506
                                                                  #canSelect: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   507
                                                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   508
                                                               #(#DataSetColumnSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   509
                                                                  #label: 'B'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   510
                                                                  #labelAlignment: #left
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   511
                                                                  #model: #blueFromColor:
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   512
                                                                  #canSelect: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   513
                                                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   514
                                                            )
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   515
                                                            #columnAdaptor: #colorColumnAdaptor
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   516
                                                        )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   517
                                                      )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   518
                                                  )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   519
                                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   520
                                               #(#ArbitraryComponentSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   521
                                                  #name: 'imagePreView'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   522
                                                  #activeHelpKey: #previewView
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   523
                                                  #hasHorizontalScrollBar: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   524
                                                  #hasVerticalScrollBar: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   525
                                                  #miniScrollerHorizontal: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   526
                                                  #miniScrollerVertical: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   527
                                                  #component: #ImageView
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   528
                                                  #hasBorder: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   529
                                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   530
                                            )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   531
                                        )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   532
                                        #handles: #(#Any 0.723776 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   533
                                    )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   534
                                  )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   535
                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   536
                          )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   537
                           #(#ViewSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   538
                              #name: 'view2'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   539
                              #component: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   540
                               #(#SpecCollection
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   541
                                  #collection: 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   542
                                   #(
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   543
                                     #(#ArbitraryComponentSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   544
                                        #name: 'imageEditView'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   545
                                        #layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   546
                                        #hasHorizontalScrollBar: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   547
                                        #hasVerticalScrollBar: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   548
                                        #component: #ImageEditView
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   549
                                        #hasBorder: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   550
                                    )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   551
                                     #(#LabelSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   552
                                        #name: 'coordLabel'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   553
                                        #layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   554
                                        #level: -1
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   555
                                        #adjust: #left
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   556
                                        #resizeForLabel: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   557
                                    )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   558
                                     #(#ArrowButtonSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   559
                                        #name: 'magnifyDownButton'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   560
                                        #layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   561
                                        #activeHelpKey: #magnifyImageDown
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   562
                                        #model: #doMagnifyDown
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   563
                                        #enableChannel: #imageIsLoaded
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   564
                                        #isTriggerOnDown: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   565
                                        #direction: #left
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   566
                                    )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   567
                                     #(#ArrowButtonSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   568
                                        #name: 'magnifyUpButton'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   569
                                        #layout: #(#LayoutFrame -24 1 -22 1 -2 1 0 1)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   570
                                        #activeHelpKey: #magnifyImageUp
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   571
                                        #model: #doMagnifyUp
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   572
                                        #enableChannel: #imageIsLoaded
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   573
                                        #isTriggerOnDown: true
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   574
                                        #direction: #right
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   575
                                    )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   576
                                     #(#InputFieldSpec
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   577
                                        #name: 'magnificationInputField'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   578
                                        #layout: #(#LayoutFrame -57 1 -22 1 -26 1 0 1)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   579
                                        #activeHelpKey: #magnificationNumber
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   580
                                        #enableChannel: #imageIsLoaded
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   581
                                        #model: #valueOfMagnification
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   582
                                        #type: #numberInRange
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   583
                                        #acceptOnReturn: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   584
                                        #acceptOnTab: false
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   585
                                        #numChars: 2
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   586
                                        #minValue: 1
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   587
                                        #maxValue: 99
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   588
                                    )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   589
                                  )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   590
                              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   591
                              #level: -1
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   592
                          )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   593
                        )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   594
                    )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   595
                    #handles: #(#Any 0.276 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   596
                )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   597
                 #(#UISubSpecification
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   598
                    #name: 'infoBarSubSpec'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   599
                    #layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0)
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   600
                    #majorKey: #ToolApplicationModel
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   601
                    #minorKey: #windowSpecForInfoBar
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   602
                )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   603
              )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   604
          )
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   605
      )
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   606
917
43e80afe8222 change level of colorMap-dataSet to 0.
Claus Gittinger <cg@exept.de>
parents: 915
diff changeset
   607
    "Modified: / 27.7.1998 / 17:41:55 / cg"
519
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   608
! !
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   609
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   610
!ImageEditor class methodsFor:'menu specs'!
085cf69fcd6c single lines in tool bar removed
tz
parents: 503
diff changeset
   611
400
228524287573 intitial checkin
tz
parents:
diff changeset
   612
menu
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   613
    "This resource specification was automatically generated
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   614
     by the MenuEditor of ST/X."
400
228524287573 intitial checkin
tz
parents:
diff changeset
   615
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   616
    "Do not manually edit this!! If it is corrupted,
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   617
     the MenuEditor may not be able to read the specification."
400
228524287573 intitial checkin
tz
parents:
diff changeset
   618
228524287573 intitial checkin
tz
parents:
diff changeset
   619
    "
228524287573 intitial checkin
tz
parents:
diff changeset
   620
     MenuEditor new openOnClass:ImageEditor andSelector:#menu
228524287573 intitial checkin
tz
parents:
diff changeset
   621
     (Menu new fromLiteralArrayEncoding:(ImageEditor menu)) startUp
228524287573 intitial checkin
tz
parents:
diff changeset
   622
    "
228524287573 intitial checkin
tz
parents:
diff changeset
   623
228524287573 intitial checkin
tz
parents:
diff changeset
   624
    <resource: #menu>
228524287573 intitial checkin
tz
parents:
diff changeset
   625
228524287573 intitial checkin
tz
parents:
diff changeset
   626
    ^
228524287573 intitial checkin
tz
parents:
diff changeset
   627
     
228524287573 intitial checkin
tz
parents:
diff changeset
   628
       #(#Menu
228524287573 intitial checkin
tz
parents:
diff changeset
   629
          
228524287573 intitial checkin
tz
parents:
diff changeset
   630
           #(
228524287573 intitial checkin
tz
parents:
diff changeset
   631
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   632
                #label: 'About'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   633
                #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   634
                #activeHelpKey: #about
738210a2fa06 revised version
tz
parents: 651
diff changeset
   635
                #labelImage: #(#ResourceRetriever nil #menuIcon)
738210a2fa06 revised version
tz
parents: 651
diff changeset
   636
                #submenuChannel: #menuAbout
400
228524287573 intitial checkin
tz
parents:
diff changeset
   637
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   638
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   639
                #label: 'File'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   640
                #translateLabel: true
738210a2fa06 revised version
tz
parents: 651
diff changeset
   641
                #activeHelpKey: #file
738210a2fa06 revised version
tz
parents: 651
diff changeset
   642
                #submenu: 
400
228524287573 intitial checkin
tz
parents:
diff changeset
   643
                 #(#Menu
228524287573 intitial checkin
tz
parents:
diff changeset
   644
                    
228524287573 intitial checkin
tz
parents:
diff changeset
   645
                     #(
228524287573 intitial checkin
tz
parents:
diff changeset
   646
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   647
                          #label: 'New...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   648
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   649
                          #value: #doNewImage
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   650
                          #activeHelpKey: #fileNewImage
400
228524287573 intitial checkin
tz
parents:
diff changeset
   651
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   652
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   653
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   654
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   655
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   656
                          #label: 'Load...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   657
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   658
                          #value: #doLoadFromClass
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   659
                          #activeHelpKey: #fileLoadFromClass
400
228524287573 intitial checkin
tz
parents:
diff changeset
   660
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   661
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   662
                          #label: 'Load From File...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   663
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   664
                          #value: #doLoadFromFile
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   665
                          #activeHelpKey: #fileLoadFromFile
400
228524287573 intitial checkin
tz
parents:
diff changeset
   666
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   667
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   668
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   669
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   670
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   671
                          #label: 'Save'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   672
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   673
                          #value: #doSaveMethod
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   674
                          #activeHelpKey: #fileSaveMethod
738210a2fa06 revised version
tz
parents: 651
diff changeset
   675
                          #enabled: #imageIsLoaded
400
228524287573 intitial checkin
tz
parents:
diff changeset
   676
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   677
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   678
                          #label: 'Save As...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   679
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   680
                          #value: #doSaveMethodAs
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   681
                          #activeHelpKey: #fileSaveMethodAs
738210a2fa06 revised version
tz
parents: 651
diff changeset
   682
                          #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
   683
                      )
738210a2fa06 revised version
tz
parents: 651
diff changeset
   684
                       #(#MenuItem
738210a2fa06 revised version
tz
parents: 651
diff changeset
   685
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   686
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   687
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   688
                          #label: 'Save To File...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   689
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   690
                          #value: #doSaveImageFileAs
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   691
                          #activeHelpKey: #fileSaveAs
738210a2fa06 revised version
tz
parents: 651
diff changeset
   692
                          #enabled: #imageIsLoaded
400
228524287573 intitial checkin
tz
parents:
diff changeset
   693
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   694
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   695
                          #label: 'Save Mask To File...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   696
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   697
                          #value: #doSaveImageMaskFileAs
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   698
                          #activeHelpKey: #fileSaveMaskAs
738210a2fa06 revised version
tz
parents: 651
diff changeset
   699
                          #enabled: #imageIsLoaded
400
228524287573 intitial checkin
tz
parents:
diff changeset
   700
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   701
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   702
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   703
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   704
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   705
                          #label: 'Print'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   706
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   707
                          #value: #doPrint
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   708
                          #activeHelpKey: #filePrint
738210a2fa06 revised version
tz
parents: 651
diff changeset
   709
                          #enabled: #imageIsLoaded
400
228524287573 intitial checkin
tz
parents:
diff changeset
   710
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   711
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   712
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   713
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   714
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   715
                          #label: 'Browse Class'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   716
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   717
                          #value: #doBrowseClass
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   718
                          #activeHelpKey: #fileBrowseClass
738210a2fa06 revised version
tz
parents: 651
diff changeset
   719
                          #enabled: #imageIsLoaded
400
228524287573 intitial checkin
tz
parents:
diff changeset
   720
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   721
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   722
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   723
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   724
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   725
                          #label: 'Exit'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   726
                          #translateLabel: true
738210a2fa06 revised version
tz
parents: 651
diff changeset
   727
                          #value: #closeRequest
738210a2fa06 revised version
tz
parents: 651
diff changeset
   728
                          #activeHelpKey: #fileExit
400
228524287573 intitial checkin
tz
parents:
diff changeset
   729
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   730
                    ) nil
228524287573 intitial checkin
tz
parents:
diff changeset
   731
                    nil
228524287573 intitial checkin
tz
parents:
diff changeset
   732
                )
228524287573 intitial checkin
tz
parents:
diff changeset
   733
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   734
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   735
                #label: 'Edit'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   736
                #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   737
                #activeHelpKey: #edit
738210a2fa06 revised version
tz
parents: 651
diff changeset
   738
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
   739
                #submenu: 
400
228524287573 intitial checkin
tz
parents:
diff changeset
   740
                 #(#Menu
228524287573 intitial checkin
tz
parents:
diff changeset
   741
                    
228524287573 intitial checkin
tz
parents:
diff changeset
   742
                     #(
228524287573 intitial checkin
tz
parents:
diff changeset
   743
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   744
                          #label: 'Undo'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   745
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   746
                          #value: #doUndo
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   747
                          #activeHelpKey: #editUndo
738210a2fa06 revised version
tz
parents: 651
diff changeset
   748
                          #enabled: #valueOfCanUndo
400
228524287573 intitial checkin
tz
parents:
diff changeset
   749
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   750
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   751
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   752
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   753
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   754
                          #label: 'Flip - Vertical'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   755
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   756
                          #value: #doFlipVertical
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   757
                          #activeHelpKey: #editFlipVertical
400
228524287573 intitial checkin
tz
parents:
diff changeset
   758
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   759
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   760
                          #label: 'Flip - Horizontal'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   761
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   762
                          #value: #doFlipHorizontal
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   763
                          #activeHelpKey: #editFlipHorizontal
400
228524287573 intitial checkin
tz
parents:
diff changeset
   764
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   765
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   766
                          #label: '-'
400
228524287573 intitial checkin
tz
parents:
diff changeset
   767
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   768
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   769
                          #label: 'Resize...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   770
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   771
                          #value: #doResizeImage
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   772
                          #activeHelpKey: #editResize
400
228524287573 intitial checkin
tz
parents:
diff changeset
   773
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   774
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   775
                          #label: 'Magnify...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   776
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   777
                          #value: #doMagnifyImage
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   778
                          #activeHelpKey: #editMagnifyImage
400
228524287573 intitial checkin
tz
parents:
diff changeset
   779
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   780
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   781
                          #label: 'Rotate...'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   782
                          #translateLabel: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   783
                          #value: #doRotateImage
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   784
                          #activeHelpKey: #editRotate
400
228524287573 intitial checkin
tz
parents:
diff changeset
   785
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   786
                    ) nil
228524287573 intitial checkin
tz
parents:
diff changeset
   787
                    nil
228524287573 intitial checkin
tz
parents:
diff changeset
   788
                )
228524287573 intitial checkin
tz
parents:
diff changeset
   789
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   790
             #(#MenuItem
919
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   791
                #label: 'ColorMap'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   792
                #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   793
                #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   794
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
   795
                #submenu: 
400
228524287573 intitial checkin
tz
parents:
diff changeset
   796
                 #(#Menu
228524287573 intitial checkin
tz
parents:
diff changeset
   797
                    
228524287573 intitial checkin
tz
parents:
diff changeset
   798
                     #(
228524287573 intitial checkin
tz
parents:
diff changeset
   799
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   800
                          #label: '8-Plane'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   801
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   802
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   803
                          #argument: '8-plane'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   804
                          #indication: #colorMapMode:value:
738210a2fa06 revised version
tz
parents: 651
diff changeset
   805
                      )
738210a2fa06 revised version
tz
parents: 651
diff changeset
   806
                       #(#MenuItem
738210a2fa06 revised version
tz
parents: 651
diff changeset
   807
                          #label: '4-Plane'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   808
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   809
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   810
                          #argument: '4-plane'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   811
                          #indication: #colorMapMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
   812
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   813
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   814
                          #label: '2-Plane'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   815
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   816
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   817
                          #argument: '2-plane'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   818
                          #indication: #colorMapMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
   819
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   820
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   821
                          #label: '1-Plane'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   822
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   823
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   824
                          #argument: '1-plane'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   825
                          #indication: #colorMapMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
   826
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   827
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   828
                          #label: '-'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   829
                      )
738210a2fa06 revised version
tz
parents: 651
diff changeset
   830
                       #(#MenuItem
738210a2fa06 revised version
tz
parents: 651
diff changeset
   831
                          #label: '8-Plane + Mask'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   832
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   833
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   834
                          #argument: '8-plane + mask'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   835
                          #indication: #colorMapMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
   836
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   837
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   838
                          #label: '4-Plane + Mask'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   839
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   840
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   841
                          #argument: '4-plane + mask'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   842
                          #indication: #colorMapMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
   843
                      )
228524287573 intitial checkin
tz
parents:
diff changeset
   844
                       #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   845
                          #label: '2-Plane + Mask'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   846
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   847
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   848
                          #argument: '2-plane + mask'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   849
                          #indication: #colorMapMode:value:
738210a2fa06 revised version
tz
parents: 651
diff changeset
   850
                      )
738210a2fa06 revised version
tz
parents: 651
diff changeset
   851
                       #(#MenuItem
738210a2fa06 revised version
tz
parents: 651
diff changeset
   852
                          #label: '1-Plane + Mask'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   853
                          #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   854
                          #activeHelpKey: #colorMap
738210a2fa06 revised version
tz
parents: 651
diff changeset
   855
                          #argument: '1-plane + mask'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   856
                          #indication: #colorMapMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
   857
                      )
919
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   858
                       #(#MenuItem
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   859
                          #label: '-'
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   860
                      )
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   861
                       #(#MenuItem
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   862
                          #label: 'Compress colormap'
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   863
                          #translateLabel: true
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   864
                          #value: #compressColorMap
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   865
                      )
400
228524287573 intitial checkin
tz
parents:
diff changeset
   866
                    ) nil
228524287573 intitial checkin
tz
parents:
diff changeset
   867
                    nil
228524287573 intitial checkin
tz
parents:
diff changeset
   868
                )
228524287573 intitial checkin
tz
parents:
diff changeset
   869
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   870
             #(#MenuItem
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   871
                #label: 'Settings'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   872
                #translateLabel: true
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   873
                #submenu: 
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   874
                 #(#Menu
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   875
                    
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   876
                     #(
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   877
                       #(#MenuItem
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   878
                          #label: 'Grid Magnification...'
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   879
                          #translateLabel: true
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   880
                          #value: #doChangeGridMagnification
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   881
                          #activeHelpKey: #settingsGridMagnification
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   882
                      )
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   883
                       #(#MenuItem
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   884
                          #label: '-'
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   885
                      )
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
   886
                       #(#MenuItem
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   887
                          #label: 'Fonts'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   888
                          #translateLabel: true
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   889
                          #submenuChannel: #menuFont
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   890
                      )
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   891
                    ) nil
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   892
                    nil
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   893
                )
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   894
            )
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   895
             #(#MenuItem
756
52a76ec8828d (image with colorMap size = 1)-bug fixed
tz
parents: 737
diff changeset
   896
                #label: 'History'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   897
                #translateLabel: true
756
52a76ec8828d (image with colorMap size = 1)-bug fixed
tz
parents: 737
diff changeset
   898
                #activeHelpKey: #history
52a76ec8828d (image with colorMap size = 1)-bug fixed
tz
parents: 737
diff changeset
   899
                #submenuChannel: #menuHistory
52a76ec8828d (image with colorMap size = 1)-bug fixed
tz
parents: 737
diff changeset
   900
            )
52a76ec8828d (image with colorMap size = 1)-bug fixed
tz
parents: 737
diff changeset
   901
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   902
                #label: 'Help'
843
273d9a7c2712 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 815
diff changeset
   903
                #translateLabel: true
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   904
                #startGroup: #right
738210a2fa06 revised version
tz
parents: 651
diff changeset
   905
                #activeHelpKey: #help
738210a2fa06 revised version
tz
parents: 651
diff changeset
   906
                #submenuChannel: #menuHelp
400
228524287573 intitial checkin
tz
parents:
diff changeset
   907
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   908
          ) nil
228524287573 intitial checkin
tz
parents:
diff changeset
   909
          nil
228524287573 intitial checkin
tz
parents:
diff changeset
   910
      )
919
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   911
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
   912
    "Modified: / 28.7.1998 / 20:03:52 / cg"
400
228524287573 intitial checkin
tz
parents:
diff changeset
   913
!
228524287573 intitial checkin
tz
parents:
diff changeset
   914
679
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   915
menuMouseButtonColors
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   916
    "This resource specification was automatically generated
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   917
     by the MenuEditor of ST/X."
679
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   918
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   919
    "Do not manually edit this!! If it is corrupted,
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   920
     the MenuEditor may not be able to read the specification."
679
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   921
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   922
    "
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   923
     MenuEditor new openOnClass:ImageEditor andSelector:#menuMouseButtonColors
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   924
     (Menu new fromLiteralArrayEncoding:(ImageEditor menuMouseButtonColors)) startUp
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   925
    "
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   926
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   927
    <resource: #menu>
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   928
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   929
    ^
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   930
     
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   931
       #(#Menu
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   932
          
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   933
           #(
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   934
             #(#MenuItem
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   935
                #label: 'Left Mouse Button'
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   936
                #nameKey: #leftMouseKeyButton
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   937
                #activeHelpKey: #mouseKeyColorMode
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   938
                #argument: '1'
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   939
                #labelImage: #(#ResourceRetriever nil #leftMouseKeyIcon)
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   940
                #indication: #mouseKeyColorMode:value:
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   941
            )
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   942
             #(#MenuItem
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   943
                #label: 'Right Mouse Button'
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   944
                #nameKey: #rightMouseKeyButton
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   945
                #activeHelpKey: #mouseKeyColorMode
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   946
                #argument: '2'
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   947
                #labelImage: #(#ResourceRetriever nil #rightMouseKeyIcon)
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   948
                #indication: #mouseKeyColorMode:value:
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   949
            )
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   950
          ) nil
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   951
          nil
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   952
      )
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   953
!
9cd2115ac627 mouse button color menu readded below the color map
tz
parents: 676
diff changeset
   954
400
228524287573 intitial checkin
tz
parents:
diff changeset
   955
menuToolbar
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   956
    "This resource specification was automatically generated
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   957
     by the MenuEditor of ST/X."
400
228524287573 intitial checkin
tz
parents:
diff changeset
   958
737
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   959
    "Do not manually edit this!! If it is corrupted,
ed5b109a0f91 user can define own fonts
tz
parents: 732
diff changeset
   960
     the MenuEditor may not be able to read the specification."
400
228524287573 intitial checkin
tz
parents:
diff changeset
   961
228524287573 intitial checkin
tz
parents:
diff changeset
   962
    "
228524287573 intitial checkin
tz
parents:
diff changeset
   963
     MenuEditor new openOnClass:ImageEditor andSelector:#menuToolbar
228524287573 intitial checkin
tz
parents:
diff changeset
   964
     (Menu new fromLiteralArrayEncoding:(ImageEditor menuToolbar)) startUp
228524287573 intitial checkin
tz
parents:
diff changeset
   965
    "
228524287573 intitial checkin
tz
parents:
diff changeset
   966
228524287573 intitial checkin
tz
parents:
diff changeset
   967
    <resource: #menu>
228524287573 intitial checkin
tz
parents:
diff changeset
   968
228524287573 intitial checkin
tz
parents:
diff changeset
   969
    ^
228524287573 intitial checkin
tz
parents:
diff changeset
   970
     
228524287573 intitial checkin
tz
parents:
diff changeset
   971
       #(#Menu
228524287573 intitial checkin
tz
parents:
diff changeset
   972
          
228524287573 intitial checkin
tz
parents:
diff changeset
   973
           #(
228524287573 intitial checkin
tz
parents:
diff changeset
   974
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   975
                #label: 'newImage'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   976
                #isButton: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   977
                #value: #doNewImage
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   978
                #activeHelpKey: #fileNewImage
880
a344e9ef09dc images moved to class Icon
tz
parents: 843
diff changeset
   979
                #labelImage: #(#ResourceRetriever #Icon #newIcon)
400
228524287573 intitial checkin
tz
parents:
diff changeset
   980
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   981
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   982
                #label: 'loadFromClass'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   983
                #isButton: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   984
                #value: #doLoadFromClass
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   985
                #activeHelpKey: #fileLoadFromClass
880
a344e9ef09dc images moved to class Icon
tz
parents: 843
diff changeset
   986
                #labelImage: #(#ResourceRetriever #Icon #loadIcon)
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   987
            )
738210a2fa06 revised version
tz
parents: 651
diff changeset
   988
             #(#MenuItem
738210a2fa06 revised version
tz
parents: 651
diff changeset
   989
                #label: 'saveMethod'
738210a2fa06 revised version
tz
parents: 651
diff changeset
   990
                #isButton: true
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
   991
                #value: #doSaveMethod
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   992
                #activeHelpKey: #fileSaveMethod
738210a2fa06 revised version
tz
parents: 651
diff changeset
   993
                #enabled: #imageIsLoaded
880
a344e9ef09dc images moved to class Icon
tz
parents: 843
diff changeset
   994
                #labelImage: #(#ResourceRetriever #Icon #saveIcon)
400
228524287573 intitial checkin
tz
parents:
diff changeset
   995
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   996
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
   997
                #label: ''
400
228524287573 intitial checkin
tz
parents:
diff changeset
   998
            )
228524287573 intitial checkin
tz
parents:
diff changeset
   999
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1000
                #label: ''
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1001
            )
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1002
             #(#MenuItem
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1003
                #label: ''
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1004
            )
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1005
             #(#MenuItem
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1006
                #label: ''
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1007
            )
228524287573 intitial checkin
tz
parents:
diff changeset
  1008
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1009
                #label: 'Point'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1010
                #activeHelpKey: #drawModePoint
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1011
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1012
                #argument: 'point'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1013
                #indication: #editMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1014
            )
228524287573 intitial checkin
tz
parents:
diff changeset
  1015
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1016
                #label: 'Box'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1017
                #activeHelpKey: #drawModeBox
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1018
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1019
                #argument: 'box'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1020
                #indication: #editMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1021
            )
228524287573 intitial checkin
tz
parents:
diff changeset
  1022
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1023
                #label: 'Filled Box'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1024
                #activeHelpKey: #drawModeFilledBox
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1025
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1026
                #argument: 'filledBox'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1027
                #indication: #editMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1028
            )
228524287573 intitial checkin
tz
parents:
diff changeset
  1029
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1030
                #label: 'Fill'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1031
                #activeHelpKey: #drawModeFill
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1032
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1033
                #argument: 'fill'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1034
                #indication: #editMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1035
            )
228524287573 intitial checkin
tz
parents:
diff changeset
  1036
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1037
                #label: 'Copy'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1038
                #activeHelpKey: #drawModeCopy
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1039
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1040
                #argument: 'copy'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1041
                #indication: #editMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1042
            )
228524287573 intitial checkin
tz
parents:
diff changeset
  1043
             #(#MenuItem
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1044
                #label: 'Paste'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1045
                #activeHelpKey: #drawModePaste
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1046
                #enabled: #imageIsLoaded
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1047
                #argument: 'paste'
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1048
                #indication: #editMode:value:
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1049
            )
914
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1050
             #(#MenuItem
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1051
                #label: 'Paste Under'
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1052
                #activeHelpKey: #drawModePasteUnder
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1053
                #enabled: #imageIsLoaded
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1054
                #argument: 'pasteUnder'
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1055
                #indication: #editMode:value:
b4f32d092c8b added paste-under;
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1056
            )
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1057
          ) nil
228524287573 intitial checkin
tz
parents:
diff changeset
  1058
          nil
228524287573 intitial checkin
tz
parents:
diff changeset
  1059
      )
228524287573 intitial checkin
tz
parents:
diff changeset
  1060
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1061
228524287573 intitial checkin
tz
parents:
diff changeset
  1062
!ImageEditor methodsFor:'accessing'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1063
228524287573 intitial checkin
tz
parents:
diff changeset
  1064
image
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1065
    "returns the current editing image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1066
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1067
    ^imageEditView image
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1068
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1069
228524287573 intitial checkin
tz
parents:
diff changeset
  1070
postOpenAction: anAction
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1071
   "sets an action which is evaluated after opening"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1072
228524287573 intitial checkin
tz
parents:
diff changeset
  1073
    postOpenAction := anAction
228524287573 intitial checkin
tz
parents:
diff changeset
  1074
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1075
228524287573 intitial checkin
tz
parents:
diff changeset
  1076
!ImageEditor methodsFor:'accessing - views'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1077
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1078
colorDataSetView
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1079
    "returns the view of the colormap"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1080
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1081
    ^(builder componentAt: #colorDataSetView)
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1082
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1083
    "Created: / 26.7.1998 / 12:02:14 / cg"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1084
!
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1085
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
  1086
coordLabel
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1087
    "returns the view the coord label"
487
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
  1088
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
  1089
    ^builder componentAt: #coordLabel
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
  1090
!
6c336c183330 info bar as subSpec to class ToolApplicationModel moved
tz
parents: 475
diff changeset
  1091
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1092
imageEditView
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1093
    "returns the view of the image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1094
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1095
    ^imageEditView := (builder componentAt: #imageEditView) subViews first 
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1096
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1097
228524287573 intitial checkin
tz
parents:
diff changeset
  1098
imagePreView
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1099
    "returns the preview of the image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1100
228524287573 intitial checkin
tz
parents:
diff changeset
  1101
    ^(builder componentAt: #imagePreView) subViews first 
475
0d5a50fe59f4 default value of info label set
tz
parents: 468
diff changeset
  1102
! !
0d5a50fe59f4 default value of info label set
tz
parents: 468
diff changeset
  1103
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1104
!ImageEditor methodsFor:'aspects'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1105
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1106
colorColumnAdaptor
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1107
    ^ self
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1108
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1109
    "Created: / 26.7.1998 / 12:17:03 / cg"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1110
!
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1111
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1112
imageIsLoaded
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1113
    "returns whether an image is loaded as value holder"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1114
228524287573 intitial checkin
tz
parents:
diff changeset
  1115
    |holder|
228524287573 intitial checkin
tz
parents:
diff changeset
  1116
    (holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[
228524287573 intitial checkin
tz
parents:
diff changeset
  1117
        builder aspectAt:#imageIsLoaded put:(holder :=  false asValue).
228524287573 intitial checkin
tz
parents:
diff changeset
  1118
    ].
228524287573 intitial checkin
tz
parents:
diff changeset
  1119
    ^ holder
228524287573 intitial checkin
tz
parents:
diff changeset
  1120
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1121
228524287573 intitial checkin
tz
parents:
diff changeset
  1122
listOfColors
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1123
    "returns the list of colors in a List"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1124
228524287573 intitial checkin
tz
parents:
diff changeset
  1125
    |holder|
228524287573 intitial checkin
tz
parents:
diff changeset
  1126
    (holder := builder bindingAt:#listOfColors) isNil ifTrue:[
228524287573 intitial checkin
tz
parents:
diff changeset
  1127
        builder aspectAt:#listOfColors put:(holder :=  List new).
228524287573 intitial checkin
tz
parents:
diff changeset
  1128
    ].
228524287573 intitial checkin
tz
parents:
diff changeset
  1129
    ^ holder
228524287573 intitial checkin
tz
parents:
diff changeset
  1130
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1131
228524287573 intitial checkin
tz
parents:
diff changeset
  1132
selectionOfColor
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1133
    "returns current selection of the edit color as an AspectAdaptor"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1134
228524287573 intitial checkin
tz
parents:
diff changeset
  1135
    |holder|
228524287573 intitial checkin
tz
parents:
diff changeset
  1136
    (holder := builder bindingAt:#selectionOfColor) isNil ifTrue:[
228524287573 intitial checkin
tz
parents:
diff changeset
  1137
        builder aspectAt:#selectionOfColor put:(
228524287573 intitial checkin
tz
parents:
diff changeset
  1138
        holder := AspectAdaptor new subject:self; forAspect:#selectedColorIndex).
228524287573 intitial checkin
tz
parents:
diff changeset
  1139
    ].
228524287573 intitial checkin
tz
parents:
diff changeset
  1140
    ^ holder
228524287573 intitial checkin
tz
parents:
diff changeset
  1141
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1142
228524287573 intitial checkin
tz
parents:
diff changeset
  1143
valueOfMagnification
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1144
    "returns current magnification of the image as an AspectAdaptor"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1145
228524287573 intitial checkin
tz
parents:
diff changeset
  1146
    |holder|
228524287573 intitial checkin
tz
parents:
diff changeset
  1147
    (holder := builder bindingAt:#valueOfMagnification) isNil ifTrue:[
228524287573 intitial checkin
tz
parents:
diff changeset
  1148
        builder aspectAt:#valueOfMagnification put:(
228524287573 intitial checkin
tz
parents:
diff changeset
  1149
        holder := AspectAdaptor new subject:self; forAspect:#magnification)
228524287573 intitial checkin
tz
parents:
diff changeset
  1150
    ].
228524287573 intitial checkin
tz
parents:
diff changeset
  1151
    ^ holder
228524287573 intitial checkin
tz
parents:
diff changeset
  1152
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1153
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1154
!ImageEditor methodsFor:'change & update'!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1155
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1156
findColorMapMode
899
43b744c647ba comment grammar
tz
parents: 898
diff changeset
  1157
    "finds the colorMapMode for a new image"
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1158
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1159
    self image depth > 8 ifTrue: [colorMapMode := ''. self listOfColors removeAll. ^nil].
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1160
    colorMapMode := self image depth printString, '-plane'.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1161
    self listOfColors isEmpty
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1162
    ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1163
    [   
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1164
         self colorMapMode: colorMapMode value: nil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1165
    ].                               
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1166
    imageEditView selectColors: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1])).
898
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
  1167
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
  1168
    self image mask notNil
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1169
    ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1170
    [         
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1171
        colorMapMode := colorMapMode, ' + mask'.
898
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
  1172
        (self listOfColors detect: [:clr| clr = (Color basicNew setColorId:0)] ifNone: nil) isNil
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
  1173
        ifTrue:
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
  1174
        [
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
  1175
            self listOfColors addFirst: (Color basicNew setColorId:0).
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1176
            imageEditView selectColors: (Array with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1]) with: (self listOfColors at: 1)).
898
d2ae6ce33fec bugs fixed in undo/mask and pasting
tz
parents: 895
diff changeset
  1177
        ]
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1178
    ].
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1179
    self selectionOfColor value: 0.
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1180
    self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1181
!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1182
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1183
updateForNoneImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1184
    "updates channels and view, if image is loaded"
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1185
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1186
    self imageIsLoaded value: false.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1187
    self listOfColors removeAll.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1188
    self imagePreView image: nil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1189
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1190
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1191
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1192
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1193
!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1194
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1195
updateLabelsAndHistory
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1196
    "updates labels and history, if something has changed"
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1197
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1198
    self imageIsLoaded value: self image notNil.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1199
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1200
    self image isNil ifTrue: [^nil].
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1201
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1202
    self updateInfoLabel.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1203
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1204
    imageEditView resourceMessage asCollectionOfWords size = 2
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1205
        ifTrue: [self addToHistory: imageEditView resourceMessage -> #loadFromMessage:].
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1206
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1207
    self image fileName notNil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1208
        ifTrue: [self addToHistory: self image fileName -> #loadFromFile:].
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1209
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1210
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1211
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1212
! !
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1213
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1214
!ImageEditor methodsFor:'data access'!
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1215
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1216
blueFromColor:aColor
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1217
    "helper used to access a color as a row in the dataSet view"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1218
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1219
    ^ aColor blueByte ? 'mask'
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1220
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1221
    "Created: / 26.7.1998 / 12:30:35 / cg"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1222
!
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1223
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1224
greenFromColor:aColor
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1225
    "helper used to access a color as a row in the dataSet view"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1226
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1227
    ^ aColor greenByte ? 'mask'
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1228
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1229
    "Created: / 26.7.1998 / 12:30:29 / cg"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1230
!
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1231
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1232
redFromColor:aColor
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1233
    "helper used to access a color as a row in the dataSet view"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1234
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1235
    ^ aColor redByte ? 'mask'
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1236
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1237
    "Modified: / 26.7.1998 / 12:30:22 / cg"
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1238
! !
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1239
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1240
!ImageEditor methodsFor:'help'!
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1241
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1242
defaultInfoLabel
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1243
    "returns the default info label"
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1244
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1245
    (imageEditView resourceClass isSymbol and: [(Smalltalk at: imageEditView resourceClass) isClass])
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1246
    ifTrue:
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1247
    [
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1248
        ^imageEditView resourceClass, ' >> ', imageEditView resourceSelector
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1249
    ].
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1250
    ^'No class and selector defined.'
674
d49e23b768e6 unused method found + help file access added
tz
parents: 673
diff changeset
  1251
!
d49e23b768e6 unused method found + help file access added
tz
parents: 673
diff changeset
  1252
702
c9de7a9bc416 docu call changed
tz
parents: 694
diff changeset
  1253
openDocumentation
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1254
    "opens the documentation file of the Image Editor"
674
d49e23b768e6 unused method found + help file access added
tz
parents: 673
diff changeset
  1255
763
19b3e479e0b8 docu call
tz
parents: 756
diff changeset
  1256
    self openHTMLDocument: 'tools/uipainter/ImageEditor.html'
19b3e479e0b8 docu call
tz
parents: 756
diff changeset
  1257
672
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1258
! !
738210a2fa06 revised version
tz
parents: 651
diff changeset
  1259
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1260
!ImageEditor methodsFor:'loading'!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1261
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1262
loadFromFile: aFileName
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1263
    "loads an image from aFileName and sets up color map list and other info labels"
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1264
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1265
    (imageEditView loadFromFile: aFileName) notNil
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1266
    ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1267
    [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1268
        self image notNil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1269
        ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1270
        [          
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1271
            self image colorMap notNil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1272
            ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1273
            [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1274
                self listOfColors contents: self image usedColors asSet.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1275
            ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1276
            ifFalse:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1277
            [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1278
                self listOfColors removeAll.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1279
            ].
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1280
            self findColorMapMode.     
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1281
            self updateLabelsAndHistory.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1282
        ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1283
        ifFalse:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1284
        [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1285
            self updateForNoneImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1286
        ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1287
    ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1288
!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1289
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1290
loadFromImage: anImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1291
    "loads an image from anImage and sets up color map list and other info labels"
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1292
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1293
    imageEditView image: anImage.
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1294
    self image notNil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1295
    ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1296
    [    
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1297
        self image colorMap notNil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1298
        ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1299
        [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1300
            self listOfColors contents: self image usedColors asSet asOrderedCollection.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1301
        ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1302
        ifFalse:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1303
        [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1304
            self listOfColors removeAll.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1305
        ].
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1306
        self findColorMapMode.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1307
        self updateLabelsAndHistory.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1308
    ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1309
    ifFalse:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1310
    [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1311
        self updateForNoneImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1312
    ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1313
!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1314
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1315
loadFromMessage: aMessage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1316
    "loads an image by evaluating aMessage and sets up color map list and other info labels"
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1317
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1318
    (imageEditView loadFromMessage: aMessage) notNil
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1319
    ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1320
    [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1321
        self image notNil
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1322
        ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1323
        [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1324
            self listOfColors contents: self image usedColors asSet asOrderedCollection.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1325
            self findColorMapMode.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1326
            self updateLabelsAndHistory.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1327
        ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1328
        ifFalse:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1329
        [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1330
            self updateForNoneImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1331
        ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1332
    ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1333
!
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1334
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1335
loadFromOrPrepareForMessage: aMessage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1336
    "loads an image by evaluating aMessage;
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1337
     if no image could extract from aMessage; do set the class and the selector from 
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1338
     the aMessage for a saving at the end of editing"
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1339
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1340
    (imageEditView loadFromMessage: aMessage) notNil
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1341
    ifTrue:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1342
    [
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1343
        self listOfColors contents: self image usedColors asSet asOrderedCollection.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1344
        self findColorMapMode.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1345
    ]
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1346
    ifFalse:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1347
    [
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1348
        imageEditView resourceMessage: aMessage.
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1349
    ].
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1350
    self updateLabelsAndHistory.
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1351
! !
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1352
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1353
!ImageEditor methodsFor:'menu modes'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1354
228524287573 intitial checkin
tz
parents:
diff changeset
  1355
colorMapMode: aMode
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1356
    "returns whether colorMapMode is equal to aMode"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1357
228524287573 intitial checkin
tz
parents:
diff changeset
  1358
    ^colorMapMode = aMode
228524287573 intitial checkin
tz
parents:
diff changeset
  1359
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1360
228524287573 intitial checkin
tz
parents:
diff changeset
  1361
editMode: aMode
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1362
    "returns whether editMode is equal to aMode"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1363
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1364
    ^imageEditView editMode = aMode
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1365
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1366
228524287573 intitial checkin
tz
parents:
diff changeset
  1367
editMode: aMode value: aValue
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1368
    "sets the editMode to aMode"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1369
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1370
    imageEditView editMode: aMode
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1371
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1372
228524287573 intitial checkin
tz
parents:
diff changeset
  1373
mouseKeyColorMode: aMode
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1374
    "sets the mouseKeyColorMode to aMode"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1375
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1376
    ^imageEditView mouseKeyColorMode = aMode
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1377
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1378
228524287573 intitial checkin
tz
parents:
diff changeset
  1379
mouseKeyColorMode: aMode value: aValue
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1380
    "sets the mouseKeyColorMode to aMode"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1381
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1382
    imageEditView mouseKeyColorMode: aMode.
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1383
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1384
    self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1385
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1386
535
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1387
!ImageEditor methodsFor:'queries'!
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1388
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1389
preferredExtent
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1390
    "returns the preferred extent"
535
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1391
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1392
    ^super preferredExtent max: (Screen current width//3)@(Screen current height//3.5)
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1393
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1394
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1395
! !
1caf545614c5 info bar subspec changed
tz
parents: 519
diff changeset
  1396
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1397
!ImageEditor methodsFor:'selection'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1398
228524287573 intitial checkin
tz
parents:
diff changeset
  1399
magnification
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1400
    "returns the magnification of the image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1401
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1402
    self imageEditView isNil ifTrue: [^1].
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1403
    ^imageEditView magnification x
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1404
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1405
228524287573 intitial checkin
tz
parents:
diff changeset
  1406
magnification: aValue
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1407
    "sets the magnification of the image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1408
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
  1409
    |magnification|        
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
  1410
    magnification := (aValue ? 1) asPoint.
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1411
    (magnification = imageEditView magnification or: [magnification = (0@0)]) ifTrue: [^nil].
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1412
    imageEditView magnification: magnification
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1413
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1414
228524287573 intitial checkin
tz
parents:
diff changeset
  1415
selectedColorIndex
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1416
    "returns the index of the selected color"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1417
228524287573 intitial checkin
tz
parents:
diff changeset
  1418
    ^selectedColorIndex
228524287573 intitial checkin
tz
parents:
diff changeset
  1419
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1420
228524287573 intitial checkin
tz
parents:
diff changeset
  1421
selectedColorIndex: anIndex
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1422
    "sets the index of the selected color"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1423
228524287573 intitial checkin
tz
parents:
diff changeset
  1424
    selectedColorIndex := anIndex.    
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1425
    imageEditView selectedColor: (self listOfColors at: anIndex ifAbsent: [^nil])
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1426
228524287573 intitial checkin
tz
parents:
diff changeset
  1427
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1428
228524287573 intitial checkin
tz
parents:
diff changeset
  1429
!ImageEditor methodsFor:'startup / release'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1430
228524287573 intitial checkin
tz
parents:
diff changeset
  1431
closeRequest
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1432
    "close request"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1433
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1434
    imageEditView checkModified ifTrue:[super closeRequest]
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1435
228524287573 intitial checkin
tz
parents:
diff changeset
  1436
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1437
228524287573 intitial checkin
tz
parents:
diff changeset
  1438
open
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1439
    "after opening, sets the masterApplication of the imageEditView to self"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1440
228524287573 intitial checkin
tz
parents:
diff changeset
  1441
    super open.
444
cd7959cb70dd some clean ups
tz
parents: 420
diff changeset
  1442
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1443
    imageEditView := (builder componentAt: #imageEditView) subViews first.
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1444
    imageEditView masterApplication: self
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1445
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1446
228524287573 intitial checkin
tz
parents:
diff changeset
  1447
postOpenWith:aBuilder
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1448
    "after opening, sets the masterApplication of the imageEditView to self;
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1449
     evaluate the postOpenAction"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1450
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1451
    imageEditView masterApplication: self.
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1452
    postOpenAction notNil ifTrue: [postOpenAction value].
228524287573 intitial checkin
tz
parents:
diff changeset
  1453
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1454
    super postOpenWith:aBuilder
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1455
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1456
    "Modified: / 26.7.1998 / 12:32:55 / cg"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1457
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1458
919
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1459
!ImageEditor methodsFor:'user actions - colormap'!
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1460
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1461
colorMapMode:aMode value: aValue
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1462
    "calculates a new color map for the image from aMode"
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1463
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1464
    |depth numColors newColorMap newImage 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1465
     oldImage image newColors realColorMap oldFileName
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1466
     usedColors useNearest usageCounts tmpBits tmpMap| 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1467
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1468
    self withExecuteCursorDo:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1469
        oldImage := self image.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1470
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1471
        newColorMap := self class listOfColorMaps at:aMode.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1472
        depth       := (newColorMap size log: 2) asInteger. 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1473
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1474
        useNearest := false.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1475
        (self confirm:'Keep colormap (or use standard)') ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1476
            "/ keep the colormap
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1477
            depth > oldImage depth ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1478
                "/ easy - simply copy the part
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1479
                numColors := 1 bitShift:oldImage depth.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1480
                0 to:numColors-1 do:[:pixel |
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1481
                    newColorMap at:(pixel+1) put:(oldImage colorFromValue:pixel)
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1482
                ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1483
            ] ifFalse:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1484
                "/ see if all used color fit the new colormap
920
bde5b9369ef8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1485
                usedColors := oldImage usedColors asArray.
919
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1486
                usedColors size <= (1 bitShift:depth) ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1487
                    "/ yea - just install them
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1488
                    usedColors keysAndValuesDo:[:idx :clr |
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1489
                        newColorMap at:idx put:clr
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1490
                    ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1491
                ] ifFalse:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1492
                    "/ copy over those that are most often used.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1493
                    oldImage depth ~~ 8 ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1494
                        tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1495
                        oldImage bits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1496
                            expandPixels:(oldImage depth)
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1497
                            width:oldImage width
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1498
                            height:oldImage height 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1499
                            into:tmpBits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1500
                            mapping:nil.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1501
                    ] ifFalse:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1502
                        tmpBits := oldImage bits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1503
                    ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1504
                    usageCounts := tmpBits usageCounts.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1505
                    tmpMap := Array new:usageCounts size.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1506
                    oldImage colorMap asArray keysAndValuesDo:[:i :clr |
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1507
                        tmpMap at:i put:clr
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1508
                    ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1509
                    usageCounts sort:[:a :b | a > b] with:tmpMap.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1510
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1511
                    1 to:(1 bitShift:depth) do:[:idx |
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1512
                        newColorMap at:idx put:(tmpMap at:idx)
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1513
                    ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1514
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1515
                    useNearest := Dialog 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1516
                                        confirmWithCancel:('Image requires %1 colors.\ColorMap has only space for %2\\Use nearest (or map to black) ?'
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1517
                                                           bindWith:usedColors size
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1518
                                                           with:(1 bitShift:depth)) withCRs
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1519
                                        labels:#('cancel' 'black' 'nearest').
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1520
                    useNearest isNil ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1521
                        ^ self   "/ cancel
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1522
                    ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1523
                ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1524
            ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1525
        ] ifFalse:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1526
            "/ standard colormap
921
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1527
            usedColors := oldImage usedColors.
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1528
            (usedColors conform:[:clr | newColorMap includes:clr]) ifFalse:[
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1529
                useNearest := Dialog 
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1530
                                    confirmWithCancel:('Not all colors are present in the new colormap.\\Map missing ones to nearest (or map to black) ?'
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1531
                                                       ) withCRs
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1532
                                    labels:#('cancel' 'black' 'nearest').
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1533
                useNearest isNil ifTrue:[
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1534
                    ^ self   "/ cancel
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1535
                ].
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1536
            ].
919
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1537
        ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1538
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1539
        imageEditView makeUndo.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1540
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1541
        newImage    := (Image implementorForDepth: depth) new.  
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1542
        oldFileName := oldImage fileName.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1543
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1544
        Object errorSignal handle:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1545
        [:ex|
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1546
            Object errorSignal handle:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1547
            [:ex|
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1548
                imageEditView undo.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1549
                ^self warn: 'Conversion failed!!'
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1550
            ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1551
            do:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1552
            [
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1553
                newImage := (Image implementorForDepth: depth) new.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1554
                newImage width:oldImage width height:oldImage height depth:depth.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1555
                newImage colorMap:newColorMap.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1556
                newImage photometric:#palette.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1557
                newImage bits:(ByteArray new:(newImage bytesPerRow * newImage height)).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1558
            
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1559
                oldImage colorsFromX:0 y:0 toX:(oldImage width-1) y:(oldImage height-1) do:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1560
                [:x :y :clr |
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1561
                    |newColor|
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1562
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1563
                    (newColorMap includes:clr)
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1564
                        ifTrue: [newColor := clr]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1565
                        ifFalse: [
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1566
                            useNearest ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1567
                                newColor := clr nearestIn:newColorMap
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1568
                            ] ifFalse:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1569
                                newColor := oldImage colorMap first
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1570
                            ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1571
                        ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1572
                    newImage colorAtX:x y:y put:newColor.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1573
                ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1574
                image := newImage
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1575
            ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1576
        ] 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1577
        do:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1578
        [ 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1579
            image := newImage fromImage: oldImage
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1580
        ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1581
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1582
        (String fromString: aMode) reverse readStream nextWord reverse = 'mask'
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1583
        ifTrue:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1584
        [
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1585
            image mask isNil
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1586
            ifTrue:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1587
            [
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1588
                image mask: (Depth1Image fromImage: (image asThresholdMonochromeImage: 0.1)). 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1589
            ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1590
        ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1591
        ifFalse:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1592
        [ 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1593
            image mask: nil.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1594
        ]. 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1595
        realColorMap := OrderedCollection new.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1596
        image realColorMap do:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1597
        [:clr|
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1598
            (realColorMap includes: clr) ifFalse: [realColorMap add: clr]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1599
        ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1600
        newColors := realColorMap copyFrom: 1 to: (newColorMap size min: realColorMap size).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1601
        newColorMap do:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1602
        [:clr|
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1603
            ((newColors size < newColorMap size) and: [(newColors includes: clr) not]) 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1604
            ifTrue:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1605
            [      
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1606
                newColors add: clr
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1607
            ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1608
        ].                  
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1609
        image colorMap: newColors.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1610
        colorMapMode := aMode.            
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1611
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1612
        (imageEditView image: image) notNil ifTrue:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1613
        [
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1614
            image fileName: oldFileName.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1615
            self listOfColors contents: image colorMap.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1616
            self findColorMapMode.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1617
            self updateLabelsAndHistory.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1618
        ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1619
    ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1620
921
a5aca21ea803 also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents: 920
diff changeset
  1621
    "Modified: / 28.7.1998 / 22:29:53 / cg"
919
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1622
!
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1623
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1624
compressColorMap
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1625
    "calculates a new color map for the image, using only used colors"
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1626
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1627
    |depth numColors newColorMap newImage 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1628
     oldImage  newColors realColorMap oldFileName
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1629
     usedColors useNearest oldToNew oldBits newBits tmpBits| 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1630
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1631
    oldImage := self image.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1632
    depth := oldImage depth.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1633
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1634
    oldImage photometric ~~ #palette ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1635
        self information:'Only palette images have colormaps.'.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1636
        ^ self
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1637
    ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1638
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1639
    usedColors := oldImage usedColors.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1640
    usedColors size == (1 bitShift:depth) ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1641
        self information:'All colors are used - no compression.'.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1642
        ^ self
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1643
    ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1644
    usedColors size == oldImage colorMap size ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1645
        self information:'Colormap already compressed - no compression.'.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1646
        ^ self
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1647
    ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1648
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1649
    imageEditView makeUndo.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1650
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1651
    self information:('%1 colors used.' bindWith:usedColors size).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1652
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1653
    self withExecuteCursorDo:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1654
        newColorMap := Array new:usedColors size.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1655
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1656
        "/ translation table
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1657
        oldToNew := ByteArray new:(1 bitShift:depth).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1658
        newColorMap := usedColors asArray.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1659
        oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr |
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1660
            |newPixel|
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1661
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1662
            (usedColors includes:clr) ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1663
                newPixel := newColorMap indexOf:clr.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1664
                oldToNew at:oldIdx put:newPixel-1.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1665
            ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1666
        ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1667
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1668
        oldBits := oldImage bits.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1669
        newBits := ByteArray new:(oldBits size).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1670
        depth ~~ 8 ifTrue:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1671
            "/ expand/compress can only handle 8bits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1672
            tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1673
            oldBits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1674
                expandPixels:depth
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1675
                width:oldImage width
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1676
                height:oldImage height 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1677
                into:tmpBits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1678
                mapping:oldToNew.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1679
            tmpBits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1680
                compressPixels:depth 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1681
                width:oldImage width 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1682
                height:oldImage height 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1683
                into:newBits 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1684
                mapping:nil
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1685
        ] ifFalse:[
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1686
            oldBits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1687
                expandPixels:depth
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1688
                width:oldImage width
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1689
                height:oldImage height 
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1690
                into:newBits
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1691
                mapping:oldToNew.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1692
        ].
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1693
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1694
        newImage := oldImage species new
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1695
                        width:oldImage width
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1696
                        height:oldImage height
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1697
                        depth:depth
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1698
                        fromArray:newBits.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1699
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1700
        newImage colorMap:newColorMap.  
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1701
        newImage fileName:oldImage fileName.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1702
        newImage mask:(oldImage mask copy).
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1703
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1704
        (imageEditView image:newImage) notNil ifTrue:
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1705
        [
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1706
            self listOfColors contents: newImage colorMap.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1707
            self findColorMapMode.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1708
            self updateLabelsAndHistory.
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1709
        ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1710
    ]
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1711
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1712
    "Created: / 28.7.1998 / 20:03:11 / cg"
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1713
    "Modified: / 28.7.1998 / 21:36:17 / cg"
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1714
! !
4e50c3164625 more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents: 917
diff changeset
  1715
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1716
!ImageEditor methodsFor:'user actions - editing'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1717
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1718
doBrowseClass
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1719
    "opens a System Browser on the resourceClass and the resourceSelector"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1720
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1721
    SystemBrowser openInClass: (Smalltalk at: imageEditView resourceClass ifAbsent: [^nil]) class selector: imageEditView resourceSelector
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1722
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1723
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
  1724
doChangeGridMagnification
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
  1725
    "change grid magnification"
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
  1726
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1727
    imageEditView changeGridMagnification
905
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
  1728
!
5f5d0a415c04 grid magnification can be changed
tz
parents: 903
diff changeset
  1729
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1730
doFlipHorizontal
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1731
    "flips horizontally current image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1732
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1733
    imageEditView flipHorizontal
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1734
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1735
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1736
doFlipVertical
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1737
    "flips vertically current image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1738
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1739
    imageEditView flipVertical
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1740
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1741
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1742
doMagnifyDown
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1743
    "magnifies current image one step down"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1744
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1745
    |magHolder mag|
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1746
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1747
    magHolder := self valueOfMagnification.
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1748
    (mag := magHolder value) > 1 ifTrue: [
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1749
        magHolder value: mag - 1
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1750
    ]
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1751
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1752
    "Modified: / 26.7.1998 / 20:24:08 / cg"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1753
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1754
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1755
doMagnifyImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1756
    "magnifies current image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1757
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1758
    imageEditView magnifyImage.   
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1759
    self updateInfoLabel
228524287573 intitial checkin
tz
parents:
diff changeset
  1760
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1761
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1762
doMagnifyUp
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1763
    "magnifies current image one step up"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1764
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1765
    |magHolder mag|
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1766
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1767
    magHolder := self valueOfMagnification.
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1768
    (mag := magHolder value) < 99 ifTrue: [
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1769
        magHolder value: mag + 1
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1770
    ]
915
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1771
99f8e19aab3a better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
  1772
    "Modified: / 26.7.1998 / 20:23:52 / cg"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1773
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1774
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1775
doNegativeImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1776
    "negates current image by negating the color map"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1777
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1778
    imageEditView negativeImage.
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1779
    self listOfColors removeAll.
901
ce482227787d several undos
tz
parents: 900
diff changeset
  1780
    self findColorMapMode.     
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1781
    imageEditView undoImages removeLast
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1782
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1783
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1784
doResizeImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1785
    "resizes current image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1786
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1787
    imageEditView resizeImage.   
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1788
    self updateInfoLabel
228524287573 intitial checkin
tz
parents:
diff changeset
  1789
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1790
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1791
doRotateImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1792
    "rotates current image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1793
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1794
    imageEditView rotateImage.
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1795
    self updateInfoLabel
228524287573 intitial checkin
tz
parents:
diff changeset
  1796
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1797
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1798
doUndo
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1799
    "reverses last edit action"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1800
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1801
    imageEditView undo
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1802
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1803
228524287573 intitial checkin
tz
parents:
diff changeset
  1804
!ImageEditor methodsFor:'user actions - loading'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1805
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1806
doLoadFromClass
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1807
    "opens a dialog for loading an image from class and a (resource-) selector"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1808
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1809
    (imageEditView loadFromClass) notNil
574
8d82e8f101c1 undo disabling
tz
parents: 573
diff changeset
  1810
    ifTrue:
8d82e8f101c1 undo disabling
tz
parents: 573
diff changeset
  1811
    [
8d82e8f101c1 undo disabling
tz
parents: 573
diff changeset
  1812
        self image notNil
8d82e8f101c1 undo disabling
tz
parents: 573
diff changeset
  1813
        ifTrue:
8d82e8f101c1 undo disabling
tz
parents: 573
diff changeset
  1814
        [
8d82e8f101c1 undo disabling
tz
parents: 573
diff changeset
  1815
            self listOfColors contents: self image usedColors asSet asOrderedCollection.
8d82e8f101c1 undo disabling
tz
parents: 573
diff changeset
  1816
            self findColorMapMode.
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1817
            self updateLabelsAndHistory
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1818
        ]
228524287573 intitial checkin
tz
parents:
diff changeset
  1819
        ifFalse:
228524287573 intitial checkin
tz
parents:
diff changeset
  1820
        [
461
aed297a2d395 load errors removed
tz
parents: 460
diff changeset
  1821
            self updateForNoneImage
aed297a2d395 load errors removed
tz
parents: 460
diff changeset
  1822
        ]
449
dac8dc1f9dc8 if none image found for loading clear all
tz
parents: 444
diff changeset
  1823
    ]
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1824
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1825
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1826
doLoadFromFile
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1827
    "opens a dialog for loading an image from a file"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1828
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1829
    self loadFromFile:
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1830
        (FileSelectionBrowser
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1831
            request: 'Load Image From'
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1832
            fileName: (self image notNil ifTrue: [self image fileName] ifFalse: [nil])
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1833
            withFileFilters: FileSelectionBrowser loadImageFileNameFilters)
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1834
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1835
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1836
doNewImage
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1837
    "opens a dialog with choices of size and color map for creating a new image"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1838
228524287573 intitial checkin
tz
parents:
diff changeset
  1839
    |aspects|
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1840
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1841
    aspects  := IdentityDictionary new
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1842
        at:#listOfSizes         put: self class listOfDefaultSizes asValue;
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1843
        at:#listOfColorMaps     put: self class listOfColorMaps keys asSortedCollection asValue;
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1844
        at:#selectionOfSize     put: self class listOfDefaultSizes first copy asValue;
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1845
        at:#selectionOfColorMap put: self class listOfColorMaps keys asSortedCollection first asValue;
228524287573 intitial checkin
tz
parents:
diff changeset
  1846
        yourself.
228524287573 intitial checkin
tz
parents:
diff changeset
  1847
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1848
    (self openDialogInterface:#dialogSpecForNewImage withBindings:aspects)
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1849
    ifTrue:
228524287573 intitial checkin
tz
parents:
diff changeset
  1850
    [
228524287573 intitial checkin
tz
parents:
diff changeset
  1851
        |width height cMap imageClass image|
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1852
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1853
        width  := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value upTo: $x) onError:[24]).
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1854
        height := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value copy reverse upTo: $x) reverse onError:[24]).
228524287573 intitial checkin
tz
parents:
diff changeset
  1855
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1856
        cMap       := (self class listOfColorMaps at: (colorMapMode := (aspects at:#selectionOfColorMap) value)).
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1857
        imageClass := Image implementorForDepth: ((cMap size log: 2) asInteger).
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1858
        image      := imageClass width: width height: height fromArray: (ByteArray new: width*height).
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1859
228524287573 intitial checkin
tz
parents:
diff changeset
  1860
        (colorMapMode copy reverse readStream nextWord reverse = 'mask')
228524287573 intitial checkin
tz
parents:
diff changeset
  1861
        ifTrue:
228524287573 intitial checkin
tz
parents:
diff changeset
  1862
        [
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1863
            image mask: (Depth1Image width: width height: height depth: 1 fromArray: (ByteArray new: width*height)) clearMaskedPixels
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1864
        ].
228524287573 intitial checkin
tz
parents:
diff changeset
  1865
        image colorMap: cMap.
228524287573 intitial checkin
tz
parents:
diff changeset
  1866
        image fillRectangleX:0 y:0 width:width height:height with:Color white.
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1867
        (imageEditView image: image) notNil
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1868
        ifTrue:
228524287573 intitial checkin
tz
parents:
diff changeset
  1869
        [
228524287573 intitial checkin
tz
parents:
diff changeset
  1870
            self listOfColors contents: cMap.
228524287573 intitial checkin
tz
parents:
diff changeset
  1871
            self findColorMapMode.
694
88c7004cfb6c updateLabelsAndHistory
tz
parents: 688
diff changeset
  1872
            self updateLabelsAndHistory
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1873
        ]
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1874
    ]
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1875
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1876
228524287573 intitial checkin
tz
parents:
diff changeset
  1877
!ImageEditor methodsFor:'user actions - saving'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1878
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1879
doPrint
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1880
    "prints current image on the current printer"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1881
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1882
    imageEditView print
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1883
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1884
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1885
doSaveImageFile
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1886
    "saves current image to current file"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1887
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1888
    imageEditView save
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1889
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1890
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1891
doSaveImageFileAs
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1892
    "opens a dialog for saving current image to a file"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1893
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1894
    imageEditView saveImageFileAs.
694
88c7004cfb6c updateLabelsAndHistory
tz
parents: 688
diff changeset
  1895
    self updateLabelsAndHistory
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1896
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1897
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1898
doSaveImageMaskFileAs
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1899
    "opens a dialog for saving mask of current image to a file"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1900
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1901
    imageEditView saveImageMaskFileAs
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1902
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1903
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1904
doSaveMethod
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1905
    "saves current image on current class and selector"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1906
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1907
    imageEditView saveMethod notNil
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1908
    ifTrue:
228524287573 intitial checkin
tz
parents:
diff changeset
  1909
    [
694
88c7004cfb6c updateLabelsAndHistory
tz
parents: 688
diff changeset
  1910
        self updateLabelsAndHistory
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1911
    ]
228524287573 intitial checkin
tz
parents:
diff changeset
  1912
!
228524287573 intitial checkin
tz
parents:
diff changeset
  1913
767
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1914
doSaveMethodAs
ed96f735dab1 comments added
tz
parents: 763
diff changeset
  1915
    "opens a dialog for saving current image on a class and a selector"
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1916
911
ec8db5b62352 unnecessary calls removed
tz
parents: 905
diff changeset
  1917
    imageEditView saveMethodAs notNil
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1918
    ifTrue:
228524287573 intitial checkin
tz
parents:
diff changeset
  1919
    [
694
88c7004cfb6c updateLabelsAndHistory
tz
parents: 688
diff changeset
  1920
        self updateLabelsAndHistory
400
228524287573 intitial checkin
tz
parents:
diff changeset
  1921
    ]
228524287573 intitial checkin
tz
parents:
diff changeset
  1922
! !
228524287573 intitial checkin
tz
parents:
diff changeset
  1923
228524287573 intitial checkin
tz
parents:
diff changeset
  1924
!ImageEditor class methodsFor:'documentation'!
228524287573 intitial checkin
tz
parents:
diff changeset
  1925
228524287573 intitial checkin
tz
parents:
diff changeset
  1926
version
228524287573 intitial checkin
tz
parents:
diff changeset
  1927
    ^ '$Header$'
228524287573 intitial checkin
tz
parents:
diff changeset
  1928
! !