DeviceWorkstation.st
changeset 1406 2aa01c6279f0
parent 1383 f078f4ec6b08
child 1407 3528a4779c8b
equal deleted inserted replaced
1405:4cdcc64344f4 1406:2aa01c6279f0
  3693 !
  3693 !
  3694 
  3694 
  3695 initialize
  3695 initialize
  3696     "initialize the receiver for a connection to the default display"
  3696     "initialize the receiver for a connection to the default display"
  3697 
  3697 
       
  3698     idToViewMapping := WeakValueDictionary new:100.
       
  3699 
  3698     ^ self initializeFor:nil
  3700     ^ self initializeFor:nil
       
  3701 
       
  3702     "Modified: 1.3.1997 / 20:01:14 / cg"
  3699 !
  3703 !
  3700 
  3704 
  3701 initializeDeviceResources
  3705 initializeDeviceResources
  3702     "initialize heavily used device resources - to avoid looking them up later"
  3706     "initialize heavily used device resources - to avoid looking them up later"
  3703 
  3707 
  4740         wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
  4744         wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
  4741     ].
  4745     ].
  4742     knownViews at:freeIdx put:aView.
  4746     knownViews at:freeIdx put:aView.
  4743     knownIds at:freeIdx put:aWindowID.
  4747     knownIds at:freeIdx put:aWindowID.
  4744 
  4748 
       
  4749     idToViewMapping notNil ifTrue:[
       
  4750         idToViewMapping at:aWindowID put:aView.
       
  4751     ].
       
  4752 
  4745 "/    dispatching ifFalse:[
  4753 "/    dispatching ifFalse:[
  4746 "/        self startDispatch
  4754 "/        self startDispatch
  4747 "/    ].
  4755 "/    ].
  4748 
  4756 
  4749     "Modified: 22.12.1995 / 22:46:09 / cg"
  4757     "Modified: 1.3.1997 / 20:00:08 / cg"
  4750 !
  4758 !
  4751 
  4759 
  4752 removeKnownView:aView
  4760 removeKnownView:aView
  4753     "remove aView from the list of known views/id's."
  4761     "remove aView from the list of known views/id's."
  4754 
  4762 
  4755     |index wasBlocked|
  4763     |index wasBlocked|
  4756 
  4764 
  4757     aView isNil ifTrue:[^ self].
  4765     aView isNil ifTrue:[^ self].
  4758 
  4766 
  4759 "/    idToViewMapping removeValue:aView ifAbsent:[].
       
  4760 
       
  4761     lastId := nil.
  4767     lastId := nil.
  4762     lastView := nil.
  4768     lastView := nil.
  4763 
  4769 
  4764     knownViews notNil ifTrue:[
  4770     knownViews notNil ifTrue:[
  4765         wasBlocked := OperatingSystem blockInterrupts.
  4771         wasBlocked := OperatingSystem blockInterrupts.
  4766 
  4772 
  4767         index := knownViews identityIndexOf:aView.
  4773         index := knownViews identityIndexOf:aView.
  4768         index == 0 ifFalse:[
  4774         index == 0 ifFalse:[
       
  4775             idToViewMapping notNil ifTrue:[
       
  4776                 idToViewMapping removeKey:(knownIds at:index) ifAbsent:nil.
       
  4777             ].
  4769             knownViews at:index put:nil.
  4778             knownViews at:index put:nil.
  4770             knownIds at:index put:nil.
  4779             knownIds at:index put:nil.
  4771             lastId := nil.
  4780             lastId := nil.
  4772             lastView := nil.
  4781             lastView := nil.
  4773 
       
  4774         ].
  4782         ].
  4775 
  4783 
  4776         wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
  4784         wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
  4777 
  4785 
  4778         self checkForEndOfDispatch.
  4786         self checkForEndOfDispatch.
  4779     ]
  4787     ]
  4780 
  4788 
  4781     "Modified: 23.1.1997 / 21:31:22 / cg"
  4789     "Modified: 1.3.1997 / 20:02:16 / cg"
  4782 !
  4790 !
  4783 
  4791 
  4784 update:something with:aParameter from:changedObject
  4792 update:something with:aParameter from:changedObject
  4785     "this is obsolete - it will be removed"
  4793     "this is obsolete - it will be removed"
  4786 
  4794 
  4798 
  4806 
  4799             ((v := knownViews at:idx) isNil 
  4807             ((v := knownViews at:idx) isNil 
  4800             or:[v == 0]) ifTrue:[
  4808             or:[v == 0]) ifTrue:[
  4801                 id := knownIds at:idx.
  4809                 id := knownIds at:idx.
  4802                 id notNil ifTrue:[
  4810                 id notNil ifTrue:[
       
  4811                     idToViewMapping notNil ifTrue:[
       
  4812                         idToViewMapping removeKey:id.
       
  4813                     ].
  4803                     knownIds at:idx put:nil.
  4814                     knownIds at:idx put:nil.
  4804                 ].
  4815                 ].
  4805             ]
  4816             ]
  4806         ].
  4817         ].
  4807         
       
  4808     ]
  4818     ]
  4809 
  4819 
  4810     "Modified: 24.4.1996 / 19:39:46 / cg"
       
  4811     "Created: 21.6.1996 / 19:21:16 / cg"
  4820     "Created: 21.6.1996 / 19:21:16 / cg"
       
  4821     "Modified: 1.3.1997 / 19:59:32 / cg"
  4812 !
  4822 !
  4813 
  4823 
  4814 viewFromId:aWindowID
  4824 viewFromId:aWindowID
  4815     "given an Id, return the corresponding view."
  4825     "given an Id, return the corresponding view."
  4816 
  4826 
  4817     |index v|
  4827     |index v|
  4818 
  4828 
  4819 "/    ^ idToViewMapping at:aNumber ifAbsent:[nil].
  4829     idToViewMapping notNil ifTrue:[
       
  4830         v := idToViewMapping at:aWindowID ifAbsent:nil.
       
  4831         (v notNil and:[v ~~ 0]) ifTrue:[^ v].
       
  4832     ].
  4820 
  4833 
  4821     aWindowID = lastId ifTrue:[
  4834     aWindowID = lastId ifTrue:[
  4822         lastView notNil ifTrue:[
  4835         lastView notNil ifTrue:[
  4823             ^ lastView
  4836             ^ lastView
  4824         ]
  4837         ]
  4837     lastId := aWindowID.
  4850     lastId := aWindowID.
  4838     lastView := v.
  4851     lastView := v.
  4839 
  4852 
  4840     ^ v
  4853     ^ v
  4841 
  4854 
  4842     "Modified: 23.1.1997 / 21:42:56 / cg"
  4855     "Modified: 1.3.1997 / 20:04:31 / cg"
  4843 ! !
  4856 ! !
  4844 
  4857 
  4845 !DeviceWorkstation methodsFor:'window stuff'!
  4858 !DeviceWorkstation methodsFor:'window stuff'!
  4846 
  4859 
  4847 clearRectangleX:x y:y width:width height:height in:aWindowId
  4860 clearRectangleX:x y:y width:width height:height in:aWindowId
  5115 ! !
  5128 ! !
  5116 
  5129 
  5117 !DeviceWorkstation class methodsFor:'documentation'!
  5130 !DeviceWorkstation class methodsFor:'documentation'!
  5118 
  5131 
  5119 version
  5132 version
  5120     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.179 1997-02-26 14:04:51 cg Exp $'
  5133     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.180 1997-03-01 22:37:00 cg Exp $'
  5121 ! !
  5134 ! !
  5122 DeviceWorkstation initialize!
  5135 DeviceWorkstation initialize!