AbstractFileBrowser.st
changeset 5737 c5a659e2c4c7
parent 5725 58b0f245345d
child 5739 ec8cb05922b5
--- a/AbstractFileBrowser.st	Tue Mar 16 15:04:21 2004 +0100
+++ b/AbstractFileBrowser.st	Tue Mar 16 15:53:32 2004 +0100
@@ -520,6 +520,9 @@
 
     ^ super helpSpec addPairsFrom:#(
 
+#lockFileEncoding
+'Do not guess the encoding from the files contents.'
+
 )
 ! !
 
@@ -1307,7 +1310,7 @@
             )
            (DataSetSpec
               name: 'Table1'
-              layout: (LayoutFrame 0 0 30 0 0 1 -30 1)
+              layout: (LayoutFrame 0 0 30 0 0 1 -60 1)
               model: selectedEncoding
               hasHorizontalScrollBar: true
               hasVerticalScrollBar: true
@@ -1341,7 +1344,7 @@
               doubleClickChannel: accept
             )
            (HorizontalPanelViewSpec
-              name: 'HorizontalPanel1'
+              name: 'ButtonPanel'
               layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
               horizontalLayout: fitSpace
               verticalLayout: center
@@ -1356,7 +1359,7 @@
                     name: 'Button2'
                     translateLabel: true
                     model: cancel
-                    extent: (Point 179 22)
+                    extent: (Point 185 22)
                   )
                  (ActionButtonSpec
                     label: 'OK'
@@ -1364,12 +1367,20 @@
                     translateLabel: true
                     model: accept
                     isDefault: true
-                    extent: (Point 179 22)
+                    extent: (Point 185 22)
                   )
                  )
                
               )
             )
+           (CheckBoxSpec
+              label: 'Lock Encoding'
+              name: 'LockEncodingCheckBox'
+              layout: (LayoutFrame 3 0 -60 1 217 0 -30 1)
+              activeHelpKey: lockFileEncoding
+              model: lockFileEncoding
+              translateLabel: true
+            )
            )
          
         )
@@ -2629,6 +2640,8 @@
     bindings := IdentityDictionary new.
     bindings at:#encodingList put:encodingDescr.
     bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue.
+    bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue).
+
     (self openDialogInterface:#encodingDialogSpec withBindings:bindings)
     ifTrue:[
         idx := (bindings at:#selectedEncoding) value.
@@ -2636,6 +2649,7 @@
         selectedEncoding notNil ifTrue:[
             self fileEncoding:selectedEncoding asSymbol.
         ].
+        self lockFileEncoding:(bindings at:#lockFileEncoding) value.
     ].
 
     "Modified: 30.6.1997 / 14:41:12 / cg"
@@ -2982,6 +2996,16 @@
         ].
 !
 
+fileEncodingHolder
+    ^ self 
+        aspectFor:#fileEncodingHolder 
+        ifAbsent:[
+            self 
+                applicationNamed:#FileApplicationNoteBook
+                ifPresentDo:[:appl | appl fileEncodingHolder].
+        ]
+!
+
 hasFileSelection
 
     ^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ].
@@ -3001,6 +3025,31 @@
         ].
 !
 
+lockFileEncoding:aBoolean
+    self lockFileEncodingHolder value:aBoolean.
+
+    self 
+        applicationNamed:#FileApplicationNoteBook
+        ifPresentDo:[:nb | 
+            |appl|
+
+            appl := nb selectedApplication.
+            (appl notNil and:[appl isTextEditor]) ifTrue:[
+                appl lockFileEncoding:aBoolean
+            ]
+        ].
+!
+
+lockFileEncodingHolder
+    ^ self 
+        aspectFor:#lockFileEncodingHolder 
+        ifAbsent:[
+            self 
+                applicationNamed:#FileApplicationNoteBook
+                ifPresentDo:[:appl | appl lockFileEncodingHolder].
+        ]
+!
+
 notify:aString
     self notifyChannel value:aString
 !
@@ -6650,5 +6699,5 @@
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.218 2004-03-15 23:21:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.219 2004-03-16 14:53:24 cg Exp $'
 ! !