ImageEditor.st
changeset 2339 a06d19fe7b32
parent 2308 60722577a10a
child 2354 15be12f5e320
equal deleted inserted replaced
2338:0a9b2ccc6d66 2339:a06d19fe7b32
  2905 !
  2905 !
  2906 
  2906 
  2907 imagePreView
  2907 imagePreView
  2908     "returns the preview of the image"
  2908     "returns the preview of the image"
  2909 
  2909 
       
  2910     |imagePreViewSubViews|
       
  2911 
       
  2912     imagePreViewSubViews := (self componentAt: #imagePreView) subViews.
       
  2913 
  2910     "subViews is an empty array at closing image Editor"
  2914     "subViews is an empty array at closing image Editor"
  2911     (self componentAt: #imagePreView) subViews isEmptyOrNil ifTrue:[
  2915     imagePreViewSubViews isEmptyOrNil ifTrue:[
  2912         ^ nil
  2916         ^ nil
  2913     ].
  2917     ].
  2914 
  2918 
  2915     ^ (self componentAt: #imagePreView) subViews first 
  2919     ^ imagePreViewSubViews first 
  2916 ! !
  2920 ! !
  2917 
  2921 
  2918 !ImageEditor methodsFor:'aspects'!
  2922 !ImageEditor methodsFor:'aspects'!
  2919 
  2923 
  2920 activityInfoHolder
  2924 activityInfoHolder
  3438 
  3442 
  3439 theColorItSelf:aColor
  3443 theColorItSelf:aColor
  3440     ^ aColor
  3444     ^ aColor
  3441 ! !
  3445 ! !
  3442 
  3446 
       
  3447 !ImageEditor methodsFor:'drag & drop'!
       
  3448 
       
  3449 canDropObjects:aCollectionOfDropObjects in:aWidget
       
  3450     ^ (aCollectionOfDropObjects size == 1) 
       
  3451       and:[ aCollectionOfDropObjects 
       
  3452                 contains:[:dropObject | dropObject isFileObject]]
       
  3453 !
       
  3454 
       
  3455 dropObjects:aCollectionOfDropObjects in:aWidget at:position
       
  3456     |dropObject|
       
  3457 
       
  3458     dropObject := aCollectionOfDropObjects first.
       
  3459     dropObject isFileObject ifTrue:[
       
  3460         self loadFromFile:dropObject asFilename.
       
  3461     ]
       
  3462 ! !
       
  3463 
       
  3464 !ImageEditor methodsFor:'event handling'!
       
  3465 
       
  3466 processEvent:anEvent
       
  3467     "Return true, if I have eaten the event"
       
  3468 
       
  3469     |p|
       
  3470 
       
  3471     anEvent view == self imagePreView ifTrue:[
       
  3472         ((anEvent isButtonPressEvent and:[ anEvent button == 1 ])
       
  3473         or:[ anEvent isButtonMotionEvent and:[ anEvent hasButton1 ]])  ifTrue:[
       
  3474             p := anEvent x @ anEvent y.
       
  3475             p := anEvent view transformation applyInverseTo:p.
       
  3476             self imageEditView scrollToMakeVisible:p.    
       
  3477             ^ true.
       
  3478         ].
       
  3479     ].
       
  3480     ^ false.
       
  3481 ! !
       
  3482 
  3443 !ImageEditor methodsFor:'help'!
  3483 !ImageEditor methodsFor:'help'!
  3444 
  3484 
  3445 defaultInfoLabel
  3485 defaultInfoLabel
  3446     "returns the text shown in the info label, when the mouse is NOT over
  3486     "returns the text shown in the info label, when the mouse is NOT over
  3447      some widget with a help text."
  3487      some widget with a help text."
  3493     ]
  3533     ]
  3494 
  3534 
  3495     "Modified: / 16.3.1999 / 21:44:41 / cg"
  3535     "Modified: / 16.3.1999 / 21:44:41 / cg"
  3496 !
  3536 !
  3497 
  3537 
  3498 loadFromFile: aFileName
  3538 loadFromFile:aFileName
  3499     "loads an image from aFileName and sets up color map list and other info labels"
  3539     "loads an image from aFileName and sets up color map list and other info labels"
  3500 
  3540 
  3501     self withCursor:Cursor wait do:[
  3541     self withCursor:Cursor wait do:[
  3502         (imageEditView loadFromFile: aFileName) notNil ifTrue:[
  3542         (imageEditView loadFromFile: aFileName) notNil ifTrue:[
  3503             self updateAfterImageChange
  3543             self updateAfterImageChange
  3796     postOpenAction value.
  3836     postOpenAction value.
  3797 
  3837 
  3798     super postOpenWith:aBuilder.
  3838     super postOpenWith:aBuilder.
  3799 
  3839 
  3800     aBuilder keyboardProcessor menuBar:nil.
  3840     aBuilder keyboardProcessor menuBar:nil.
  3801 
  3841     self windowGroup addPreEventHook:self.
  3802     "Modified: / 10.2.2000 / 23:17:43 / cg"
       
  3803 ! !
  3842 ! !
  3804 
  3843 
  3805 !ImageEditor methodsFor:'user actions-colormap'!
  3844 !ImageEditor methodsFor:'user actions-colormap'!
  3806 
  3845 
  3807 addColorToColormap
  3846 addColorToColormap