ImageEditor.st
changeset 1969 f1763f6f4500
parent 1967 c95484b7da49
child 1970 279cc79d6e27
equal deleted inserted replaced
1968:1a8b9416db6e 1969:f1763f6f4500
  1570             )
  1570             )
  1571            )
  1571            )
  1572          
  1572          
  1573         )
  1573         )
  1574       )
  1574       )
       
  1575 !
       
  1576 
       
  1577 windowSpecInBrowser
       
  1578     "This resource specification was automatically generated
       
  1579      by the UIPainter of ST/X."
       
  1580 
       
  1581     "Do not manually edit this!! If it is corrupted,
       
  1582      the UIPainter may not be able to read the specification."
       
  1583 
       
  1584     "
       
  1585      UIPainter new openOnClass:ImageEditor andSelector:#windowSpecInBrowser
       
  1586      ImageEditor new openInterface:#windowSpecInBrowser
       
  1587     "
       
  1588 
       
  1589     <resource: #canvas>
       
  1590 
       
  1591     ^ 
       
  1592      #(FullSpec
       
  1593         name: windowSpecInBrowser
       
  1594         window: 
       
  1595        (WindowSpec
       
  1596           label: 'Image Editor'
       
  1597           name: 'Image Editor'
       
  1598           min: (Point 400 320)
       
  1599           bounds: (Rectangle 0 0 450 350)
       
  1600           menu: menu
       
  1601         )
       
  1602         component: 
       
  1603        (SpecCollection
       
  1604           collection: (
       
  1605            (MenuPanelSpec
       
  1606               name: 'ToolBar1'
       
  1607               layout: (LayoutFrame 0 0 0 0 0 1 30 0)
       
  1608               menu: menu
       
  1609             )
       
  1610            (UISubSpecification
       
  1611               name: 'SubSpecification1'
       
  1612               layout: (LayoutFrame 0 0 30 0 0 1 0 1)
       
  1613               majorKey: ImageEditor
       
  1614               minorKey: windowSpec
       
  1615             )
       
  1616            )
       
  1617          
       
  1618         )
       
  1619       )
  1575 ! !
  1620 ! !
  1576 
  1621 
  1577 !ImageEditor class methodsFor:'menu specs'!
  1622 !ImageEditor class methodsFor:'menu specs'!
  1578 
  1623 
  1579 colorMapMenu
  1624 colorMapMenu
  1734                (MenuItem
  1779                (MenuItem
  1735                   enabled: imageHasNextImage
  1780                   enabled: imageHasNextImage
  1736                   label: 'Next in Sequence'
  1781                   label: 'Next in Sequence'
  1737                   itemValue: nextImageInSequence
  1782                   itemValue: nextImageInSequence
  1738                   translateLabel: true
  1783                   translateLabel: true
       
  1784                   isVisible: notInBrowser
  1739                 )
  1785                 )
  1740                (MenuItem
  1786                (MenuItem
  1741                   label: '-'
  1787                   label: '-'
  1742                 )
  1788                 )
  1743                (MenuItem
  1789                (MenuItem
  1808                   itemValue: doPrint
  1854                   itemValue: doPrint
  1809                   translateLabel: true
  1855                   translateLabel: true
  1810                 )
  1856                 )
  1811                (MenuItem
  1857                (MenuItem
  1812                   label: '-'
  1858                   label: '-'
       
  1859                   isVisible: notInBrowser
  1813                 )
  1860                 )
  1814                (MenuItem
  1861                (MenuItem
  1815                   activeHelpKey: fileBrowseClass
  1862                   activeHelpKey: fileBrowseClass
  1816                   enabled: hasClassDefined
  1863                   enabled: hasClassDefined
  1817                   label: 'Browse Class'
  1864                   label: 'Browse Class'
  1818                   itemValue: doBrowseClass
  1865                   itemValue: doBrowseClass
  1819                   translateLabel: true
  1866                   translateLabel: true
       
  1867                   isVisible: notInBrowser
  1820                 )
  1868                 )
  1821                (MenuItem
  1869                (MenuItem
  1822                   label: 'Inspect Image'
  1870                   label: 'Inspect Image'
  1823                   itemValue: doInspectImage
  1871                   itemValue: doInspectImage
  1824                   translateLabel: true
  1872                   translateLabel: true
       
  1873                   isVisible: notInBrowser
  1825                 )
  1874                 )
  1826                (MenuItem
  1875                (MenuItem
  1827                   label: '-'
  1876                   label: '-'
       
  1877                   isVisible: notInBrowser
  1828                 )
  1878                 )
  1829                (MenuItem
  1879                (MenuItem
  1830                   activeHelpKey: fileExit
  1880                   activeHelpKey: fileExit
  1831                   label: 'Exit'
  1881                   label: 'Exit'
  1832                   itemValue: closeRequest
  1882                   itemValue: closeRequest
  1833                   translateLabel: true
  1883                   translateLabel: true
       
  1884                   isVisible: notInBrowser
  1834                 )
  1885                 )
  1835                )
  1886                )
  1836               nil
  1887               nil
  1837               nil
  1888               nil
  1838             )
  1889             )
  2265             )
  2316             )
  2266           )
  2317           )
  2267          (MenuItem
  2318          (MenuItem
  2268             label: 'History'
  2319             label: 'History'
  2269             translateLabel: true
  2320             translateLabel: true
       
  2321             isVisible: notInBrowser
  2270             submenuChannel: menuHistory
  2322             submenuChannel: menuHistory
  2271           )
  2323           )
  2272          (MenuItem
  2324          (MenuItem
  2273             label: 'Help'
  2325             label: 'Help'
  2274             translateLabel: true
  2326             translateLabel: true
  2943         holder := AspectAdaptor new subject:self; forAspect:#magnification)
  2995         holder := AspectAdaptor new subject:self; forAspect:#magnification)
  2944     ].
  2996     ].
  2945     ^ holder
  2997     ^ holder
  2946 ! !
  2998 ! !
  2947 
  2999 
       
  3000 !ImageEditor methodsFor:'aspects-menu item visibility'!
       
  3001 
       
  3002 notInBrowser
       
  3003     ^ self masterApplication isNil
       
  3004 ! !
       
  3005 
  2948 !ImageEditor methodsFor:'change & update'!
  3006 !ImageEditor methodsFor:'change & update'!
  2949 
  3007 
  2950 findColorMapMode
  3008 findColorMapMode
  2951     "finds the colorMapMode for a new image"
  3009     "finds the colorMapMode for a new image"
  2952 
  3010 
  3310 ! !
  3368 ! !
  3311 
  3369 
  3312 !ImageEditor methodsFor:'help'!
  3370 !ImageEditor methodsFor:'help'!
  3313 
  3371 
  3314 defaultInfoLabel
  3372 defaultInfoLabel
  3315     "returns the default info label"
  3373     "returns the text shown in the info label, when the mouse is NOT over
       
  3374      some widget with a help text."
  3316 
  3375 
  3317     |resourceClass resourceSelector|
  3376     |resourceClass resourceSelector|
  3318 
  3377 
  3319     resourceClass := imageEditView resourceClass.
  3378     resourceClass := imageEditView resourceClass.
  3320     resourceClass notNil ifTrue:[
  3379     resourceClass notNil ifTrue:[
       
  3380         resourceSelector := imageEditView resourceSelector.
  3321         resourceSelector notNil ifTrue:[
  3381         resourceSelector notNil ifTrue:[
  3322             ^ resourceClass name, ' >> ', imageEditView resourceSelector
  3382             ^ resourceClass name, ' >> ', resourceSelector
  3323         ].
  3383         ].
  3324     ].
  3384     ].
  3325     ^ 'No class and selector defined.'
  3385     ^ 'No class and selector defined.'
  3326 !
  3386 !
  3327 
  3387 
  3338     "loads an image by evaluating aMessage and sets up color map list and other info labels"
  3398     "loads an image by evaluating aMessage and sets up color map list and other info labels"
  3339 
  3399 
  3340     (class isNil or:[selector]) isNil ifTrue:[
  3400     (class isNil or:[selector]) isNil ifTrue:[
  3341         imageEditView resourceClass:class.
  3401         imageEditView resourceClass:class.
  3342         imageEditView resourceSelector:selector.
  3402         imageEditView resourceSelector:selector.
       
  3403         imageEditView image:nil.
  3343         ^ self.
  3404         ^ self.
       
  3405     ].
       
  3406 
       
  3407     (imageEditView resourceClass == class
       
  3408     and:[ imageEditView resourceSelector == selector ]) ifTrue:[
       
  3409         imageEditView modified ifFalse:[
       
  3410             ^ self.
       
  3411         ].
  3344     ].
  3412     ].
  3345 
  3413 
  3346     (imageEditView loadFromClass:class selector:selector) notNil ifTrue:[
  3414     (imageEditView loadFromClass:class selector:selector) notNil ifTrue:[
  3347         self updateAfterImageChange.
  3415         self updateAfterImageChange.
  3348     ]
  3416     ]