ImageEditor.st
changeset 499 da5c2e271d1a
parent 497 13ce380baa5f
child 503 98b67511b1c0
equal deleted inserted replaced
498:43a78c5f806c 499:da5c2e271d1a
   199 'Opens a dialog to resize the image with preserving the old image.'
   199 'Opens a dialog to resize the image with preserving the old image.'
   200 
   200 
   201 #editRotate
   201 #editRotate
   202 'Opens a dialog to rotate the image in degrees.'
   202 'Opens a dialog to rotate the image in degrees.'
   203 
   203 
   204 #editUndo
       
   205 'Undoes last action.'
       
   206 
       
   207 #fileBrowseClass
   204 #fileBrowseClass
   208 'Opens the System Browser on the class and the selector.'
   205 'Opens the System Browser on the class and the selector.'
   209 
   206 
   210 #fileLoadFromClass
   207 #fileLoadFromClass
   211 'Opens a dialog for selecting an image resource method.'
   208 'Opens a dialog for selecting an image resource method.'
   313                           #'label:' 'Load From Class...'
   310                           #'label:' 'Load From Class...'
   314                           #'value:' #loadFromClass
   311                           #'value:' #loadFromClass
   315                           #'activeHelpKey:' #fileLoadFromClass
   312                           #'activeHelpKey:' #fileLoadFromClass
   316                       )
   313                       )
   317                        #(#MenuItem
   314                        #(#MenuItem
   318                           #'label:' 'Load From Class With Superclass...'
       
   319                           #'translateLabel:' true
       
   320                           #'value:' #loadFromClassWithSuperclass
       
   321                           #'activeHelpKey:' #fileLoadFromClassWithSuperclass
       
   322                       )
       
   323                        #(#MenuItem
       
   324                           #'label:' '-'
   315                           #'label:' '-'
   325                       )
   316                       )
   326                        #(#MenuItem
   317                        #(#MenuItem
   327                           #'label:' 'Save'
   318                           #'label:' 'Save'
   328                           #'value:' #saveImageFile
   319                           #'value:' #saveImageFile
   367                       )
   358                       )
   368                        #(#MenuItem
   359                        #(#MenuItem
   369                           #'label:' '-'
   360                           #'label:' '-'
   370                       )
   361                       )
   371                        #(#MenuItem
   362                        #(#MenuItem
   372                           #'label:' 'Browse Class'
   363                           #'label:' 'Browse Image Class'
   373                           #'value:' #browseClass
   364                           #'value:' #browseClass
   374                           #'activeHelpKey:' #fileBrowseClass
   365                           #'activeHelpKey:' #fileBrowseClass
   375                           #'enabled:' #imageIsLoaded
   366                           #'enabled:' #imageIsLoaded
   376                       )
   367                       )
   377                        #(#MenuItem
   368                        #(#MenuItem
  1171 !ImageEditor methodsFor:'active help'!
  1162 !ImageEditor methodsFor:'active help'!
  1172 
  1163 
  1173 defaultInfoLabel
  1164 defaultInfoLabel
  1174 
  1165 
  1175     |usedColors|
  1166     |usedColors|
  1176     self image isNil ifTrue: [^'No image defined'].
  1167     self image isNil ifTrue: [^'No image loaded.'].
  1177     self image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := self image usedColors size].
  1168     self image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := self image usedColors size].
  1178     ^self image width printString, 'x',
  1169     ^self image width printString, 'x',
  1179         self image height printString, 'x',
  1170         self image height printString, 'x',
  1180         (2 raisedTo: self image depth) printString,
  1171         (2 raisedTo: self image depth) printString,
  1181         (self image mask notNil ifTrue: [' (mask + '] ifFalse: ['(']),
  1172         (self image mask notNil ifTrue: [' (mask + '] ifFalse: ['(']),
  1615 
  1606 
  1616     self loadFromInClassesOf: #Object.
  1607     self loadFromInClassesOf: #Object.
  1617    
  1608    
  1618 !
  1609 !
  1619 
  1610 
  1620 loadFromClassWithSuperclass
       
  1621 
       
  1622     |box|
       
  1623     box := EnterBox new.
       
  1624     box title:'Name of superclass:'.
       
  1625     box okText:'OK'.
       
  1626     box abortText:'Cancel'.
       
  1627     box initialText: 'ApplicationModel'.
       
  1628     box entryCompletionBlock:[:contents |
       
  1629         |s what m|
       
  1630 
       
  1631         s := contents withoutSpaces.
       
  1632         what := Smalltalk classnameCompletion:s.
       
  1633         box contents:what first.
       
  1634         (what at:2) size ~~ 1 ifTrue:[
       
  1635             self beep
       
  1636         ]
       
  1637     ].
       
  1638     box showAtPointer.
       
  1639     box accepted
       
  1640     ifTrue:
       
  1641     [            
       
  1642         self loadFromInClassesOf: box contents asSymbol
       
  1643     ]
       
  1644 
       
  1645     "Modified: / 28.1.1998 / 13:14:00 / stefan"
       
  1646 !
       
  1647 
       
  1648 loadFromFile
  1611 loadFromFile
  1649 
  1612 
  1650     self loadFromFile:
  1613     self loadFromFile:
  1651         (FileSelectionBrowser
  1614         (FileSelectionBrowser
  1652             request: 'Load Image From' 
  1615             request: 'Load Image From'