Issue 3247 in pharo: Remodel Text Constants

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Issue 3247 in pharo: Remodel Text Constants

pharo
Status: New
Owner: ----

New issue 3247 by Benjamin.VanRyseghem.Pharo: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Gofer new
      squeaksource: 'PharoTaskForces';
      package: 'KillTextConstants';
      load.

KillTextConstants new script.

It remodel TextConstants as a SharedPool, and create a global dictionary  
SharedDictionary to allow classes to share constants.

One step is missing, the one which check all methods invoking  
SharedDictionary to know if they really use SharedDictionary or pool  
variables from TextConstants


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo
Updates:
        Status: Fixed

Comment #1 on issue 3247 by Benjamin.VanRyseghem: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

(No comment was entered for this change.)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #2 on issue 3247 by Benjamin.VanRyseghem.Pharo: Remodel Text  
Constants
http://code.google.com/p/pharo/issues/detail?id=3247

A new version is available, where I fix the bug about poolDictionaries and  
where I fix 3 classes.

If someone want to play with it, enjoy ^^


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo
Updates:
        Labels: Milestone-1.2

Comment #3 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

I will have a look later in the afternoon but this is true that we should  
have a look at that because this is good to fix it.


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo
Updates:
        Cc: marcus.denker adrian.lienhard siguctua

Comment #4 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

(No comment was entered for this change.)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #5 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

I read all the code and this looks quite good.
I will run it now and check if I can release package after.


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #6 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Benjamin,  it would be good to rename SharedDictionary into something like  
TextSharedInformation.




Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #7 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Then we could define such dictionary as a classVar of the new sharedPool  
class TextConstant.
Like that we minimize the globals in the system.





Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo
Updates:
        Cc: -siguctua

Comment #8 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Then I do not understand why

You changed | letter varAndValue tempArray width |
        "CtrlA..CtrlZ, Ctrla..Ctrlz"
        letter := $A.
  #( 212 230 228 196 194 226 241 243 214 229 200 217 246
                        245 216 202 210 239 211 240 197 198 209 215 242 231
          1 166 228 132 130 12 232 179 150 165 136 153 182
                        14 15 138 17 18 19 11 21 134 145 151 178 167 ) do:
                [:kbd |
                TextContants at: ('Ctrl', letter asSymbol) asSymbol put: kbd asCharacter.
                letter := letter == $Z ifTrue: [$a] ifFalse: [(letter asciiValue + 1)  
asCharacter]].


into | letter varAndValue tempArray width |
        "CtrlA..CtrlZ, Ctrla..Ctrlz"
        letter := $A.
  #( 212 230 228 196 194 226 241 243 214 229 200 217 246
                        245 216 202 210 239 211 240 197 198 209 215 242 231
          1 166 228 132 130 12 232 179 150 165 136 153 182
                        14 15 138 17 18 19 11 21 134 145 151 178 167 ) do:
                [:kbd |
                SharedDictionary at: ('Ctrl', letter asSymbol) asSymbol put: kbd  
asCharacter.
                letter := letter == $Z ifTrue: [$a] ifFalse: [(letter asciiValue + 1)  
asCharacter]].


The idea is to have TextConstant (the new shared) containing the constants  
and the other dictionary the variable part
but here this is clearly constant.



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #9 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

The TextConstant class>>initialize could be better since we cannot  
reproduce it (or somehow)

Ctrll := $
should be something like
Ctrll := Character value: XCXXC

like that we do not really on an invisible character


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #10 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

I have the impression that we should add a ClassVar to TextStyle and that a  
lot of changes where simply puts in the wrong place. all the methods in  
TextStyle class for example.

Similarly HostFont should have a classVariables for its fonts!

Same probably for StrikeFont

May be should perform these changes first. Like that the migration will be  
easier.



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #11 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Ben when a class uses a Pool you can use the key of the variable instead of  
the at: expression

For example:

text: aText
        "Answer an instance of me such that the text displayed is aText
        according to the system's default text style."

        ^self new
                setText: aText
                textStyle: DefaultTextStyle copy
                offset: 0 @ 0

is better than

text: aText
        "Answer an instance of me such that the text displayed is aText
        according to the system's default text style."

        ^self new
                setText: aText
                textStyle: (SharedDictionary at: #DefaultTextStyle) copy
                offset: 0 @ 0


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #12 on issue 3247 by Benjamin.VanRyseghem.Pharo: Remodel Text  
Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Comment 8 : This method should be removed (I'll write a fix asap)
Comment 9 : I will take a look at that too
Comment 10 : For sure, there is a lot of classes to fix, but I can't script  
that
Comment 11 : DefaultTextStyle is not in the SharedPool, but in the  
SharedDictionary


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #13 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

may be we can just do the changes for some items of comment 10 by hand.




Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #14 on issue 3247 by Benjamin.VanRyseghem.Pharo: Remodel Text  
Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Update done ^^


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #15 on issue 3247 by Benjamin.VanRyseghem.Pharo: Remodel Text  
Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Now the dictionary for shared values is named TextSharedInformations and it  
is a class variable of TextConstants.


Moreover, I have added TextConstants in the poolDictionaries of classes  
which formely invoke the dictionary


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo
In reply to this post by pharo

Comment #16 on issue 3247 by Benjamin.VanRyseghem.Pharo: Remodel Text  
Constants
http://code.google.com/p/pharo/issues/detail?id=3247

A new version of TextConstants is available which patch on the fly methods  
which invoke TextSharedInformation.

If some people could test it, it could be great ^^
(when I've done some tests, there was no problem)


Thx to Jannik for his help :)


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #17 on issue 3247 by stephane.ducasse: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Thanks I definitively want to have that in 1.2



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #18 on issue 3247 by marcus.denker: Remodel Text Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Text initialize --> DNU

#initTextSharedInformation missing

I can not recompile

ParseNode>>printSingleComment: aString on: aStream indent: indent

same for LogicalFontManager... I thin the script does not add the Pool back
into the classes correctly.

BDFFontReader class>>installX11Fonts (TextSharedInformation is Undeclared)
BDFFontReader class>>installX11Fonts (TextSharedInformation is Undeclared)
FontSet class>>installAsTextStyle (TextSharedInformation is Undeclared)
FontSet class>>installAsTextStyle (TextSharedInformation is Undeclared)
FontSet class>>installAsDefault (TextSharedInformation is Undeclared)
FontSet class>>installAsTextStyle (TextSharedInformation is Undeclared)
FontSet class>>installAsTextStyle (TextSharedInformation is Undeclared)
FontSet class>>installAsDefault (TextSharedInformation is Undeclared)
LogicalFontManager>>bestFontFor:whenFindingAlternativeIgnoreAll:  
(TextSharedInformation is Undeclared)
ScriptLoader>>removeDejaVuFonts (TextSharedInformation is Undeclared)
StandardFonts class>>defaultFont: (TextSharedInformation is Undeclared)
StandardFonts class>>defaultFont: (TextSharedInformation is Undeclared)
StrikeFontSet>>objectForDataStream: (TextSharedInformation is Undeclared)
StrikeFontSet class>>removeFontsForEncoding:encodingName:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeKorean:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeKorean:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontOn:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontOn:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeJapanese:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeJapanese:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>familyName:size: (TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForLatin2:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForLatin2:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>removeFontsForEncoding:encodingName:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeKorean:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeKorean:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontFileName:inDir:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontOn:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet  
class>>installExternalFontOn:encoding:encodingName:textStyleName:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeJapanese:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForUnicodeJapanese:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>familyName:size: (TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForLatin2:  
(TextSharedInformation is Undeclared)
StrikeFontSet class>>createExternalFontFileForLatin2:  
(TextSharedInformation is Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>removeStyleName: (TextSharedInformation is Undeclared)
TTCFont class>>familyName:pointSize:emphasis: (TextSharedInformation is  
Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>reorganizeForNewFontArray:name: (TextSharedInformation is  
Undeclared)
TTCFont class>>removeStyleName: (TextSharedInformation is Undeclared)
TTCFont class>>familyName:pointSize:emphasis: (TextSharedInformation is  
Undeclared)
TTCFontDescription>>objectForDataStream: (TextSharedInformation is  
Undeclared)
TTCFontSet class>>discardDefault (TextSharedInformation is Undeclared)
TTCFontSet class>>familyName:pointSize: (TextSharedInformation is  
Undeclared)
TTCFontSet class>>removeStyleName: (TextSharedInformation is Undeclared)
TTCFontSet class>>newTextStyleFromTT: (TextSharedInformation is Undeclared)
TTCFontSet class>>newTextStyleFromTT: (TextSharedInformation is Undeclared)
TTCFontSet class>>discardDefault (TextSharedInformation is Undeclared)
TTCFontSet class>>familyName:pointSize: (TextSharedInformation is  
Undeclared)
TTCFontSet class>>removeStyleName: (TextSharedInformation is Undeclared)
TTCFontSet class>>newTextStyleFromTT: (TextSharedInformation is Undeclared)
TTCFontSet class>>newTextStyleFromTT: (TextSharedInformation is Undeclared)
TTFontDescription>>objectForDataStream: (TextSharedInformation is  
Undeclared)
TTFontReader class>>installTTF:asTextStyle:sizes: (TextSharedInformation is  
Undeclared)
TTFontReader class>>installTTF:asTextStyle:sizes: (TextSharedInformation is  
Undeclared)
UpdatingStringMorph>>setFontStyle (TextSharedInformation is Undeclared)




Reply | Threaded
Open this post in threaded view
|

Re: Issue 3247 in pharo: Remodel Text Constants

pharo

Comment #19 on issue 3247 by Benjamin.VanRyseghem.Pharo: Remodel Text  
Constants
http://code.google.com/p/pharo/issues/detail?id=3247

Now all classes should be fixed (some classes used to use TextConstants as  
global not as a SharedPool) ...

I cross my fingers ^^


12