--- a/FBrowser.st Tue Apr 16 20:45:52 1996 +0200
+++ b/FBrowser.st Wed Apr 17 18:50:08 1996 +0200
@@ -165,13 +165,13 @@
the internal encoding (which is iso8859).
Notice: currently, not too many encodings are supported by the system."
- |dialog list encodings idx msg filter encodingMatch f|
+ |dialog list encodings idx|
list := SelectionInList new.
- encodings := #(nil msdos mac jis7 euc).
-
- list list:#('default (iso8859, ANSI)' 'MSDOS' 'MAC' 'JIS7' 'EUC').
+ encodings := #(nil msdos mac jis7 euc gb big5).
+
+ list list:#('default (iso8859, ANSI)' 'MSDOS' 'MAC' 'JIS7' 'EUC' 'GB' 'BIG5').
list selectionIndex:(encodings indexOf:fileEncoding ifAbsent:1).
dialog := Dialog new.
@@ -186,35 +186,11 @@
dialog accepted ifTrue:[
idx := list selectionIndex.
fileEncoding := encodings at:idx.
- ((fileEncoding == #jis7) or:[fileEncoding == #euc]) ifTrue:[
- (subView font encoding startsWith:'jis') ifFalse:[
- msg := 'switch to a JIS encoded font ?'.
- filter := [:f | f encoding notNil
- and:['jis*' match:f encoding]].
- ]
- ] ifFalse:[
- (subView font encoding startsWith:'jis') ifTrue:[
- msg := 'switch to an ASCII encoded font ?'.
- filter := [:f | f encoding notNil
- and:[('ascii' match:f encoding)
- or:['iso*' match:f encoding]]].
- ]
- ].
- msg notNil ifTrue:[
- (self confirm:(resources string:msg) withCRs)
- ifTrue:[
- f := FontPanel
- fontFromUserInitial:nil
- title:(resources string:'font selection')
- filter:filter.
- f notNil ifTrue:[
- subView font:f
- ]
- ]
- ]
+
+ self validateFontEncodingFor:fileEncoding.
].
- "Modified: 29.2.1996 / 04:21:02 / cg"
+ "Modified: 17.4.1996 / 18:48:43 / cg"
!
fileExecute
@@ -2263,6 +2239,67 @@
"Modified: 14.12.1995 / 20:59:09 / cg"
!
+validateFontEncodingFor:newEncoding
+ "if required, query user if he/she wants to change to another font,
+ which is able to display text encoded as specified by newEncoding"
+
+ |fontsEncoding msg filter f|
+
+ fontsEncoding := subView font encoding.
+
+ ((newEncoding == #jis7) or:[newEncoding == #euc]) ifTrue:[
+ (fontsEncoding notNil and:[fontsEncoding startsWith:'jis']) ifFalse:[
+ msg := 'switch to a JIS encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:['jis*' match:f encoding]].
+ ]
+ ] ifFalse:[
+ (newEncoding == #gb) ifTrue:[
+ (fontsEncoding notNil and:[fontsEncoding startsWith:'gb']) ifFalse:[
+ msg := 'switch to a GB encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:['gb*' match:f encoding]].
+ ]
+ ] ifFalse:[
+ (newEncoding == #big5) ifTrue:[
+ (fontsEncoding notNil and:[fontsEncoding startsWith:'big5']) ifFalse:[
+ msg := 'switch to a BIG-5 encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:['big5*' match:f encoding]].
+ ]
+ ] ifFalse:[
+ fontsEncoding notNil ifTrue:[
+ ((fontsEncoding startsWith:'jis')
+ or:[(fontsEncoding startsWith:'gb')
+ or:[(fontsEncoding startsWith:'big5')]])
+ ifTrue:[
+ msg := 'switch back to an ASCII encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:[('ascii' match:f encoding)
+ or:['iso*' match:f encoding]]].
+ ]
+ ]
+ ]
+ ]
+ ].
+
+ msg notNil ifTrue:[
+ (self confirm:(resources string:msg) withCRs)
+ ifTrue:[
+ f := FontPanel
+ fontFromUserInitial:nil
+ title:(resources string:'font selection')
+ filter:filter.
+ f notNil ifTrue:[
+ subView font:f
+ ]
+ ]
+ ]
+
+ "Modified: 17.4.1996 / 18:45:58 / cg"
+ "Created: 17.4.1996 / 18:48:29 / cg"
+!
+
withoutHiddenFiles:aCollection
"remove hidden files (i.e. those that start with '.') from
the list in aCollection"
@@ -2520,5 +2557,5 @@
!FileBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.79 1996-02-29 03:50:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Attic/FBrowser.st,v 1.80 1996-04-17 16:50:08 cg Exp $'
! !
--- a/FileBrowser.st Tue Apr 16 20:45:52 1996 +0200
+++ b/FileBrowser.st Wed Apr 17 18:50:08 1996 +0200
@@ -165,13 +165,13 @@
the internal encoding (which is iso8859).
Notice: currently, not too many encodings are supported by the system."
- |dialog list encodings idx msg filter encodingMatch f|
+ |dialog list encodings idx|
list := SelectionInList new.
- encodings := #(nil msdos mac jis7 euc).
-
- list list:#('default (iso8859, ANSI)' 'MSDOS' 'MAC' 'JIS7' 'EUC').
+ encodings := #(nil msdos mac jis7 euc gb big5).
+
+ list list:#('default (iso8859, ANSI)' 'MSDOS' 'MAC' 'JIS7' 'EUC' 'GB' 'BIG5').
list selectionIndex:(encodings indexOf:fileEncoding ifAbsent:1).
dialog := Dialog new.
@@ -186,35 +186,11 @@
dialog accepted ifTrue:[
idx := list selectionIndex.
fileEncoding := encodings at:idx.
- ((fileEncoding == #jis7) or:[fileEncoding == #euc]) ifTrue:[
- (subView font encoding startsWith:'jis') ifFalse:[
- msg := 'switch to a JIS encoded font ?'.
- filter := [:f | f encoding notNil
- and:['jis*' match:f encoding]].
- ]
- ] ifFalse:[
- (subView font encoding startsWith:'jis') ifTrue:[
- msg := 'switch to an ASCII encoded font ?'.
- filter := [:f | f encoding notNil
- and:[('ascii' match:f encoding)
- or:['iso*' match:f encoding]]].
- ]
- ].
- msg notNil ifTrue:[
- (self confirm:(resources string:msg) withCRs)
- ifTrue:[
- f := FontPanel
- fontFromUserInitial:nil
- title:(resources string:'font selection')
- filter:filter.
- f notNil ifTrue:[
- subView font:f
- ]
- ]
- ]
+
+ self validateFontEncodingFor:fileEncoding.
].
- "Modified: 29.2.1996 / 04:21:02 / cg"
+ "Modified: 17.4.1996 / 18:48:43 / cg"
!
fileExecute
@@ -2263,6 +2239,67 @@
"Modified: 14.12.1995 / 20:59:09 / cg"
!
+validateFontEncodingFor:newEncoding
+ "if required, query user if he/she wants to change to another font,
+ which is able to display text encoded as specified by newEncoding"
+
+ |fontsEncoding msg filter f|
+
+ fontsEncoding := subView font encoding.
+
+ ((newEncoding == #jis7) or:[newEncoding == #euc]) ifTrue:[
+ (fontsEncoding notNil and:[fontsEncoding startsWith:'jis']) ifFalse:[
+ msg := 'switch to a JIS encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:['jis*' match:f encoding]].
+ ]
+ ] ifFalse:[
+ (newEncoding == #gb) ifTrue:[
+ (fontsEncoding notNil and:[fontsEncoding startsWith:'gb']) ifFalse:[
+ msg := 'switch to a GB encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:['gb*' match:f encoding]].
+ ]
+ ] ifFalse:[
+ (newEncoding == #big5) ifTrue:[
+ (fontsEncoding notNil and:[fontsEncoding startsWith:'big5']) ifFalse:[
+ msg := 'switch to a BIG-5 encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:['big5*' match:f encoding]].
+ ]
+ ] ifFalse:[
+ fontsEncoding notNil ifTrue:[
+ ((fontsEncoding startsWith:'jis')
+ or:[(fontsEncoding startsWith:'gb')
+ or:[(fontsEncoding startsWith:'big5')]])
+ ifTrue:[
+ msg := 'switch back to an ASCII encoded font ?'.
+ filter := [:f | f encoding notNil
+ and:[('ascii' match:f encoding)
+ or:['iso*' match:f encoding]]].
+ ]
+ ]
+ ]
+ ]
+ ].
+
+ msg notNil ifTrue:[
+ (self confirm:(resources string:msg) withCRs)
+ ifTrue:[
+ f := FontPanel
+ fontFromUserInitial:nil
+ title:(resources string:'font selection')
+ filter:filter.
+ f notNil ifTrue:[
+ subView font:f
+ ]
+ ]
+ ]
+
+ "Modified: 17.4.1996 / 18:45:58 / cg"
+ "Created: 17.4.1996 / 18:48:29 / cg"
+!
+
withoutHiddenFiles:aCollection
"remove hidden files (i.e. those that start with '.') from
the list in aCollection"
@@ -2520,5 +2557,5 @@
!FileBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.79 1996-02-29 03:50:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.80 1996-04-17 16:50:08 cg Exp $'
! !