AbstractLauncherApplication.st
branchjv
changeset 16459 85d703589d34
parent 16445 6bc184e74f9c
parent 16446 d8a348125c03
child 16571 cf319f2e56d0
equal deleted inserted replaced
16445:6bc184e74f9c 16459:85d703589d34
  2198 !
  2198 !
  2199 
  2199 
  2200 bringWindow:aWindow intoBounds:bounds
  2200 bringWindow:aWindow intoBounds:bounds
  2201     "shift & resize a view to be completely inside bounds."
  2201     "shift & resize a view to be completely inside bounds."
  2202 
  2202 
  2203     |oldOrg newOrg oldCorner newCorner delta|
  2203     |topView oldOrg newOrg oldCorner newCorner delta|
  2204     
  2204     
  2205     oldOrg := newOrg := aWindow topView origin.
  2205     topView := aWindow topView.
  2206     oldCorner := newCorner := aWindow topView corner. 
  2206     oldOrg := newOrg := topView origin.
       
  2207     oldCorner := newCorner := topView corner. 
  2207 
  2208 
  2208     (bounds containsPoint:oldOrg) ifFalse:[
  2209     (bounds containsPoint:oldOrg) ifFalse:[
  2209         newOrg := bounds origin + (10@10).
  2210         newOrg := bounds origin + (10@10).
  2210         delta := newOrg - oldOrg.
  2211         delta := newOrg - oldOrg.
  2211         newCorner := oldCorner + delta.
  2212         newCorner := oldCorner + delta.
  2218             (bounds containsPoint:newOrg) ifFalse:[
  2219             (bounds containsPoint:newOrg) ifFalse:[
  2219                 newOrg := bounds origin + (10@10).
  2220                 newOrg := bounds origin + (10@10).
  2220             ].
  2221             ].
  2221         ].
  2222         ].
  2222     ].
  2223     ].
  2223     aWindow topView 
  2224     topView 
  2224         raiseDeiconified;
  2225         raiseDeiconified;
  2225         origin:newOrg corner:newCorner.
  2226         origin:newOrg corner:newCorner.
  2226 !
  2227 !
  2227 
  2228 
  2228 bringWindowOntoScreen:aWindow
  2229 bringWindowOntoScreen:aWindow 
  2229     "shift & resize a view to be visible.
  2230     "shift & resize a view to be visible.
  2230      If there are multiple screens,bring them all onto the screen where the launcher is"
  2231      If there are multiple screens,bring them all onto the screen where the launcher is"
  2231 
  2232     
  2232     |allBounds bounds|
  2233     |allBounds bounds myDevice|
  2233         
  2234 
  2234     allBounds := self device monitorBoundsAt:aWindow center.
  2235     myDevice := self device.
  2235     allBounds size > 0 ifTrue:[
  2236     allBounds := myDevice monitorBoundsAt:aWindow center.
  2236         bounds := allBounds detect:[:bounds | bounds containsPoint:self window center] ifNone:nil.
  2237     allBounds notEmptyOrNil ifTrue:[
       
  2238         bounds := allBounds 
       
  2239                 detect:[:bounds | bounds containsPoint:self window center ]
       
  2240                 ifNone:[ nil ].
  2237     ].
  2241     ].
  2238     bounds isNil ifTrue:[
  2242     bounds isNil ifTrue:[
  2239         bounds := 0@0 extent:self device usableExtent.
  2243         bounds := 0@0 extent:myDevice usableExtent.
  2240     ].
  2244     ].
  2241     self bringWindow:aWindow intoBounds:bounds.
  2245     self bringWindow:aWindow intoBounds:bounds
  2242 !
  2246 !
  2243 
  2247 
  2244 deIconifyAllWindows
  2248 deIconifyAllWindows
  2245     self allTopViewsDo:[:eachTopView | eachTopView expand; raise].
  2249     self allTopViewsDo:[:eachTopView | eachTopView expand; raise].
  2246     self window raise.
  2250     self window raise.
  2308 !
  2312 !
  2309 
  2313 
  2310 fullScreenHardcopy
  2314 fullScreenHardcopy
  2311     "after a second (to allow redraw of views under menu ...),
  2315     "after a second (to allow redraw of views under menu ...),
  2312      save the contents of the whole screen."
  2316      save the contents of the whole screen."
  2313 
  2317     
  2314     self window sensor ctrlDown ifTrue:[
  2318     |mySensor|
       
  2319 
       
  2320     mySensor := self window sensor.
       
  2321     mySensor ctrlDown ifTrue:[
  2315         ^ self fullScreenHardcopyUngrabbed
  2322         ^ self fullScreenHardcopyUngrabbed
  2316     ].
  2323     ].
  2317 
  2324     Processor 
  2318     Processor
  2325         addTimedBlock:[ self saveScreenImage:(Image fromScreen) defaultName:'screen' ]
  2319         addTimedBlock:[
  2326         afterSeconds:(mySensor shiftDown ifTrue:5 ifFalse:1)
  2320                         self
       
  2321                             saveScreenImage:(Image fromScreen)
       
  2322                             defaultName:'screen'
       
  2323                       ]
       
  2324         afterSeconds:(self window sensor shiftDown ifTrue:5 ifFalse:1)
       
  2325 !
  2327 !
  2326 
  2328 
  2327 fullScreenHardcopyUngrabbed
  2329 fullScreenHardcopyUngrabbed
  2328     "after a second (to allow redraw of views under menu ...),
  2330     "after a second (to allow redraw of views under menu ...),
  2329      save the contents of the whole screen."
  2331      save the contents of the whole screen."
  2539 
  2541 
  2540     WindowTreeView openOnAll
  2542     WindowTreeView openOnAll
  2541 !
  2543 !
  2542 
  2544 
  2543 viewBrowse
  2545 viewBrowse
  2544     "let user pick a view and browse its Application class. Only smalltalk views are allowed"
  2546     "let user pick a view and browse its Application class. 
       
  2547      Of course, only smalltalk views are allowed"
  2545 
  2548 
  2546     |v app appClass browser|
  2549     |v app appClass browser|
  2547 
  2550 
  2548     (v := self pickAView) notNil ifTrue:[
  2551     (v := self pickAView) notNil ifTrue:[
  2549         browser := UserPreferences browserClass.
  2552         browser := UserPreferences browserClass.
  2606 
  2609 
  2607     "Modified: / 27-04-2012 / 13:24:23 / cg"
  2610     "Modified: / 27-04-2012 / 13:24:23 / cg"
  2608 !
  2611 !
  2609 
  2612 
  2610 viewInspect
  2613 viewInspect
  2611     "let user pick a view and inspect it. Only smalltalk views are allowed"
  2614     "let user pick a view and inspect it. 
       
  2615      Of course, only smalltalk views are allowed"
  2612 
  2616 
  2613     |v|
  2617     |v|
  2614 
  2618 
  2615     (v := self pickAView) notNil ifTrue:[
  2619     (v := self pickAView) notNil ifTrue:[
  2616         v inspect
  2620         v inspect
  2617     ]
  2621     ]
  2618 
       
  2619 !
  2622 !
  2620 
  2623 
  2621 viewMigrate
  2624 viewMigrate
  2622     "let user pick a view and migrate it to some other display"
  2625     "let user pick a view and migrate it to some other display.
       
  2626      Only smalltalk views are allowed"
  2623 
  2627 
  2624     |v|
  2628     |v|
  2625 
  2629 
  2626     (v := self pickAView) notNil ifTrue:[
  2630     (v := self pickAView) notNil ifTrue:[
  2627         self migrateWindow:v topView
  2631         self migrateWindow:v topView
  2629 !
  2633 !
  2630 
  2634 
  2631 viewSelectAndShrink
  2635 viewSelectAndShrink
  2632     "let user pick a view and shrink it to a reasonable size
  2636     "let user pick a view and shrink it to a reasonable size
  2633      Added for stupid mac, to get windows back onto the screen,
  2637      Added for stupid mac, to get windows back onto the screen,
  2634      which have their resize handle hidden."
  2638      which have their resize handle hidden or unreachable."
  2635 
  2639 
  2636     |v|
  2640     |v|
  2637 
  2641 
  2638     (v := self pickAView) notNil ifTrue:[
  2642     (v := self pickAView) notNil ifTrue:[
  2639         v topView 
  2643         v topView 
  2645 widgetHardcopy
  2649 widgetHardcopy
  2646     "after a second (to allow redraw of views under menu ...),
  2650     "after a second (to allow redraw of views under menu ...),
  2647      let user specify a widget and save its contents."
  2651      let user specify a widget and save its contents."
  2648 
  2652 
  2649     Processor
  2653     Processor
  2650         addTimedBlock:[
  2654         addTimedBlock:
  2651                         |v|
  2655             [
  2652                         (v := Screen current viewFromUser) notNil ifTrue:[
  2656                 |v|
  2653                             self saveScreenImage:(Image fromView:v) defaultName:'hardcopy'
  2657                 (v := Screen current viewFromUser) notNil ifTrue:[
  2654                         ]
  2658                     self saveScreenImage:(Image fromView:v) defaultName:'hardcopy'
  2655                       ]
  2659                 ]
       
  2660             ]
  2656         afterSeconds:(self window sensor shiftDown ifTrue:5 ifFalse:1)
  2661         afterSeconds:(self window sensor shiftDown ifTrue:5 ifFalse:1)
  2657 
  2662 
  2658     "Created: / 21.8.1998 / 20:44:12 / cg"
  2663     "Created: / 21.8.1998 / 20:44:12 / cg"
  2659 ! !
  2664 ! !
  2660 
  2665