FileApplicationNoteBook.st
changeset 5737 c5a659e2c4c7
parent 5718 a16c274a18ef
child 5745 4bef8a714d5e
--- a/FileApplicationNoteBook.st	Tue Mar 16 15:04:21 2004 +0100
+++ b/FileApplicationNoteBook.st	Tue Mar 16 15:53:32 2004 +0100
@@ -74,7 +74,7 @@
 		itemRemoved enableHexToggle md5CheckSum
 		md5HashValueComputationProcess viewModifiedChannel
 		textEditorModificationTime checkModifiedBlock fileEncodingHolder
-		doNotShowFontDialog'
+		doNotShowFontDialog lockFileEncodingHolder'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:FileApplicationNoteBook
@@ -516,10 +516,16 @@
         ].
     ].
     newAppl := aClass new.
+    newAppl masterApplication:self.
     aBlock notNil ifTrue:[
         aBlock value:newAppl.    
     ].
     newAppl type:aType.
+
+    newAppl isTextEditor ifTrue:[
+        newAppl fileEncoding:(self fileEncodingHolder value).    
+        newAppl lockFileEncoding:(self lockFileEncodingHolder value).    
+    ].
     (newAppl item:anItem) ifFalse:[ ^ nil ].
     (anItem notNil and:[(anItem isDirectory not) and:[aType ~= #directoryDescription]]) ifTrue:[
         self fileHistory add:anItem.
@@ -576,7 +582,7 @@
 startApplication:anApplication
     | window|
 
-    anApplication masterApplication:self.
+"/    anApplication masterApplication:self.
     anApplication window ifNil:[
         window := ApplicationSubView new.
         anApplication createBuilder.
@@ -819,6 +825,14 @@
         ]
 !
 
+lockFileEncodingHolder
+    ^ self 
+        aspectFor:#lockFileEncodingHolder 
+        ifAbsent:[
+            IndirectValue for:(false asValue)
+        ]
+!
+
 modeLabelHolder
     ^ self 
         aspectFor:#modeLabelHolder 
@@ -873,6 +887,7 @@
     self cursorColLabelHolder valueHolder: (app cursorColLabelHolder).
     self modeLabelHolder valueHolder: (app modeLabelHolder).
     self fileEncodingHolder valueHolder: (app fileEncodingHolder).
+    self lockFileEncodingHolder valueHolder: (app lockFileEncodingHolder).
 !
 
 update:something with:aParameter from:changedObject
@@ -4107,6 +4122,10 @@
     ^ true
 !
 
+lockFileEncoding:aBoolean
+    self lockFileEncodingHolder value:aBoolean.
+!
+
 presentation
     "return the value of the instance variable 'presentation' (automatically generated)"
 
@@ -4292,9 +4311,11 @@
 
     |text guessedEncoding s|
 
-    guessedEncoding := SourceCodeManagerUtilities guessEncodingOfFile:item fileName asFilename.
-    guessedEncoding := guessedEncoding ? (self fileEncoding).
-    self fileEncoding:(guessedEncoding asSymbol).
+    self lockFileEncodingHolder value ifFalse:[
+        guessedEncoding := SourceCodeManagerUtilities guessEncodingOfFile:item fileName asFilename.
+        guessedEncoding := guessedEncoding ? (self fileEncoding).
+        self fileEncoding:(guessedEncoding asSymbol).
+    ].
 
     editView notNil ifTrue:[
 "/        self validateEditViewsFontEncoding.
@@ -4366,7 +4387,7 @@
                 boxLabel:'Error during decode'.
             answer isNil ifTrue:[ AbortOperationRequest raise ].
             answer == #ignoreAll ifTrue:[ firstDecoderError := false ].
-            ex proceedWith:(ex defaultValue).
+            ex proceedWith:(ex parameter).
         ].
         ex proceedWith:(ex parameter).
     ] do:[
@@ -4668,6 +4689,16 @@
     ^ itemRemoved
 !
 
+lockFileEncodingHolder
+    lockFileEncodingHolder isNil ifTrue:[
+        lockFileEncodingHolder := false asValue.
+"/        masterApplication notNil ifTrue:[
+"/            lockFileEncodingHolder value:(masterApplication lockFileEncodingHolder value)    
+"/        ]
+    ].
+    ^ lockFileEncodingHolder
+!
+
 modeLabelHolder
     ^ editView modeLabelHolder.
 !
@@ -5457,5 +5488,5 @@
 !FileApplicationNoteBook class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.164 2004-03-15 12:59:21 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.165 2004-03-16 14:53:26 cg Exp $'
 ! !