ApplicationModel.st
changeset 1479 c30179d243db
parent 1478 b3bc19d6369f
child 1481 e1922b505268
equal deleted inserted replaced
1478:b3bc19d6369f 1479:c30179d243db
   308      which ought to be defined in the application subclass.
   308      which ought to be defined in the application subclass.
   309      Alternatively, a subclass may redefine this method, to provide
   309      Alternatively, a subclass may redefine this method, to provide
   310      interfaceSpecifications from a Dictionary or whatever.
   310      interfaceSpecifications from a Dictionary or whatever.
   311      Typically, an interfaceSpecification is returned there."
   311      Typically, an interfaceSpecification is returned there."
   312 
   312 
       
   313     |displayDevice displayDeviceType modifiedKey|
       
   314 
       
   315     "/ this code is so ugly...
       
   316     displayDevice := Screen current ? Screen default.
       
   317     displayDevice notNil ifTrue:[
       
   318         displayDeviceType := displayDevice deviceType.
       
   319         displayDeviceType notNil ifTrue:[
       
   320             modifiedKey := (aKey , '_' , displayDeviceType) asSymbolIfInterned.
       
   321             modifiedKey notNil ifTrue:[
       
   322                 (self application respondsTo:modifiedKey) ifTrue:[
       
   323                     ^ self application perform:modifiedKey
       
   324                 ]
       
   325             ]
       
   326         ]
       
   327     ].
   313     ^ self application perform:aKey
   328     ^ self application perform:aKey
   314 
   329 
   315     "Modified: / 5.2.1998 / 00:21:57 / stefan"
   330     "Modified: / 5.2.1998 / 00:21:57 / stefan"
   316 !
   331 !
   317 
   332 
   616      on some X display screen. The argument aScreenName must be 
   631      on some X display screen. The argument aScreenName must be 
   617      a valid x-display name (i.e. of the form '<host>:<screenNr>' as in 'foo:0').
   632      a valid x-display name (i.e. of the form '<host>:<screenNr>' as in 'foo:0').
   618      For more info, read the document on multiple display
   633      For more info, read the document on multiple display
   619      support and the documentation of the DeviceWorkstation class."
   634      support and the documentation of the DeviceWorkstation class."
   620 
   635 
   621     |newDevice app|
   636     |newDevice msg|
   622 
   637 
   623     newDevice := XWorkstation newDispatchingFor:aScreenName.
   638     newDevice := XWorkstation newDispatchingFor:aScreenName.
   624     newDevice isNil ifTrue:[
   639     newDevice isNil ifTrue:[
       
   640         msg := 'Could not open display: ' , aScreenName.
   625         Screen current notNil ifTrue:[
   641         Screen current notNil ifTrue:[
   626             self warn:('Could not open display: ' , aScreenName).
   642             self warn:msg.
   627         ] ifFalse:[
   643         ] ifFalse:[
   628             ('Could not open display: ' , aScreenName) errorPrintCR
   644             msg errorPrintCR
   629         ].
   645         ].
   630         ^ nil
   646         ^ nil
   631     ].
   647     ].
   632     Screen currentScreenQuerySignal 
   648     ^ self openOnDevice:newDevice.
   633         answer:newDevice
       
   634         do:[
       
   635             app := self open.
       
   636         ].
       
   637     ^ app
       
   638 
   649 
   639     "
   650     "
   640      Launcher openOnXScreenNamed:'sgi:0'
   651      Launcher openOnXScreenNamed:'sgi:0'
   641      Launcher openOnXScreenNamed:'foo:0'
   652      Launcher openOnXScreenNamed:'foo:0'
   642      NewLauncher openOnXScreenNamed:'dawn:0'
   653      NewLauncher openOnXScreenNamed:'dawn:0'
       
   654      NewLauncher openOnXScreenNamed:'bitsy:0'
   643      SystemBrowser openOnXScreenNamed:'dawn:0'
   655      SystemBrowser openOnXScreenNamed:'dawn:0'
       
   656      SystemBrowser openOnXScreenNamed:'bitsy:0'
   644     "
   657     "
   645 
   658 
   646     "Modified: 13.1.1997 / 20:55:27 / cg"
   659     "Modified: 13.1.1997 / 20:55:27 / cg"
   647 !
   660 !
   648 
   661 
   999      which ought to be defined in the application subclass.
  1012      which ought to be defined in the application subclass.
  1000      Alternatively, a subclass may redefine this method, to provide
  1013      Alternatively, a subclass may redefine this method, to provide
  1001      interfaceSpecifications from a Dictionary or whatever.
  1014      interfaceSpecifications from a Dictionary or whatever.
  1002      Typically, an interfaceSpecification is returned there."
  1015      Typically, an interfaceSpecification is returned there."
  1003 
  1016 
  1004      |app|
  1017     |displayDevice displayDeviceType app modifiedKey|
       
  1018 
       
  1019     "/ this code is so ugly...
       
  1020     displayDevice := (self graphicsDevice ? Screen current) ? Screen default.
       
  1021     displayDevice notNil ifTrue:[
       
  1022         displayDeviceType := displayDevice deviceType.
       
  1023         displayDeviceType notNil ifTrue:[
       
  1024             modifiedKey := (aKey , '_' , displayDeviceType) asSymbolIfInterned.
       
  1025             modifiedKey notNil ifTrue:[
       
  1026                 (self application respondsTo:modifiedKey) ifTrue:[
       
  1027                     ^ self application perform:modifiedKey
       
  1028                 ]
       
  1029             ]
       
  1030         ]
       
  1031     ].
  1005 
  1032 
  1006     "/(self selfResponsibleFor:aKey)       "/ rubbish
  1033     "/(self selfResponsibleFor:aKey)       "/ rubbish
  1007     (self respondsTo:aKey)
  1034     (self respondsTo:aKey) ifTrue:[     
  1008     ifTrue:[     
       
  1009         ^ self perform:aKey
  1035         ^ self perform:aKey
  1010     ].
  1036     ].
  1011     ((app := self application) respondsTo:aKey) ifTrue:[
  1037     ((app := self application) respondsTo:aKey) ifTrue:[
  1012         ^ app perform:aKey
  1038         ^ app perform:aKey
  1013     ].
  1039     ].
  2472 ! !
  2498 ! !
  2473 
  2499 
  2474 !ApplicationModel class methodsFor:'documentation'!
  2500 !ApplicationModel class methodsFor:'documentation'!
  2475 
  2501 
  2476 version
  2502 version
  2477     ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.155 2001-06-12 13:28:33 cg Exp $'
  2503     ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.156 2001-06-22 15:51:05 cg Exp $'
  2478 ! !
  2504 ! !
  2479 ApplicationModel initialize!
  2505 ApplicationModel initialize!