The Trunk: ShoutCore-mt.64.mcz

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

The Trunk: ShoutCore-mt.64.mcz

Marcel Taeumel uploaded a new version of ShoutCore to project The Trunk:

==================== Summary ====================

Name: ShoutCore-mt.64
Author: mt
Time: 9 July 2019, 2:07:39.898973 pm
UUID: 4a783083-891a-4556-a362-2a401660f5bf
Ancestors: ShoutCore-nice.63

Removes the semaphore from Shout's background styling. It is not needed because we can synchronize with the current project's UI process using #addDeferredUIMessage:.

=============== Diff against ShoutCore-nice.63 ===============

Item was changed:
  Object subclass: #SHTextStyler
+ instanceVariableNames: 'backgroundProcess text monitor view stylingEnabled'
- instanceVariableNames: 'sem backgroundProcess text monitor view stylingEnabled'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'ShoutCore-Styling'!
  !SHTextStyler commentStamp: 'tween 8/27/2004 10:54' prior: 0!
  I am an Abstract class.
  Subclasses of me can create formatted, coloured, and styled copies of Text that is given to them.
  They may perform their styling asynchronously, in a background process which I create and manage.
  My public interface is...
  view: aViewOrMorph - set the view that will receive notifications when styling has completed.
  format: aText - modifies aText's string
  style: aText - modifies the TextAttributes of aText, but does not change the string, then sends #stylerStyled: to the view.
  styleInBackgroundProcess: aText - performs style: in a background process, then sends #stylerStylednBackground: to the view.
  styledTextFor: aText - answers a formatted and styled copy of aText
  unstyledTextFrom: aText - answers a copy of aText with all TextAttributes removed
  Subclasses of me should re-implement...
  privateFormat: aText - answer a formatted version of aText; the String may be changed
  privateStyle: aText - modify the TextAttributes of aText; but do not change the String

Item was changed:
  ----- Method: SHTextStyler>>styleInBackgroundProcess: (in category 'styling') -----
  styleInBackgroundProcess: aText
  self terminateBackgroundStylingProcess.
+ stylingEnabled ifTrue: [
- stylingEnabled ifTrue:[
  text := aText copy.
  self monitor critical: [
+ backgroundProcess := [
+ self privateStyle: text.
+ view ifNotNil: [:v | Project current addDeferredUIMessage: [v stylerStyledInBackground: text]].
+ ] forkAt: Processor userBackgroundPriority] ]
- sem := Semaphore new.
- [sem notNil
- ifTrue: [
- sem wait.
- view ifNotNil:[view stylerStyledInBackground: text]]
- ] forkAt: Processor activePriority.
- backgroundProcess :=
- [self privateStyle: text.
- sem signal]
- forkAt: Processor userBackgroundPriority] ]

Item was changed:
  ----- Method: SHTextStyler>>terminateBackgroundStylingProcess (in category 'private') -----
  self monitor critical: [
  ifNotNil: [
  backgroundProcess terminate.
+ backgroundProcess := nil]].!
- backgroundProcess := nil].
- sem
- ifNotNil:[
- sem terminateProcess.
- sem := nil].
- ] !

Item was changed:
  ----- Method: SHTextStyler>>veryDeepInner: (in category 'copying') -----
  veryDeepInner: aDeepCopier
  super veryDeepInner: aDeepCopier.
+ backgroundProcess := monitor := nil.
- sem := backgroundProcess := monitor := nil.
  text := text veryDeepCopyWith: aDeepCopier.
  view := view veryDeepCopyWith: aDeepCopier!