FileBrowserV2SettingsAppl.st
author ca
Tue, 21 Sep 2004 14:13:16 +0200
changeset 6035 e2ff0e546070
parent 6021 e25ed9197b7d
child 6063 74124a9963bc
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 2002 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

"{ Package: 'stx:libtool' }"

AbstractSettingsApplication subclass:#FileBrowserV2SettingsAppl
	instanceVariableNames:'sortDirectoriesBeforeFiles showDirectoryTree sortCaseless
		showHiddenFiles openMultipleApplicationsForType
		toolBarVisibleHolder viewDirectoryDescription
		openAlwaysInTextEditor viewFilesInDirectoryTree viewDescription
		viewPreview viewTime viewSize viewSizeInBytes viewType
		viewDetails viewPermissions viewGroup viewDirsInContentsBrowser
		viewOwner filenameEntryFieldVisibleHolder viewSizeInKiloBytes'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Tools-File'
!

!FileBrowserV2SettingsAppl class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2002 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
! !

!FileBrowserV2SettingsAppl class methodsFor:'icon'!

defaultIcon

    ^ FileBrowserV2 applicationIcon
! !

!FileBrowserV2SettingsAppl class methodsFor:'interface specs'!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:FileBrowserV2SettingsAppl andSelector:#windowSpec
     FileBrowserV2SettingsAppl new openInterface:#windowSpec
     FileBrowserV2SettingsAppl open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'Settings'
          name: 'Settings'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 432 621)
        )
        component: 
       (SpecCollection
          collection: (
           (VerticalPanelViewSpec
              name: 'VerticalPanel2'
              layout: (LayoutFrame 0 0 0 0 0 1 591 0)
              horizontalLayout: fit
              verticalLayout: top
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (FramedBoxSpec
                    label: 'Show'
                    name: 'FramedBox1'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (CheckBoxSpec
                          label: 'Hidden Files'
                          name: 'CheckBox1'
                          layout: (LayoutFrame 0 0.0 7 0 0 1.0 27 0)
                          model: showHiddenFiles
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Directory Tree'
                          name: 'CheckBox2'
                          layout: (LayoutFrame 0 0.0 32 0 0 1.0 52 0)
                          model: showDirectoryTree
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Regular Files in TreeView (Left)'
                          name: 'CheckBox3'
                          layout: (LayoutFrame 20 0 57 0 0 1.0 77 0)
                          model: viewFilesInDirectoryTree
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Directories in ContentsView (Right)'
                          name: 'CheckBox4'
                          layout: (LayoutFrame 0 0.0 82 0 0 1.0 102 0)
                          model: viewDirsInContentsBrowser
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Toolbar'
                          name: 'CheckBox11'
                          layout: (LayoutFrame 0 0.0 107 0 0 1.0 127 0)
                          model: toolBarVisibleHolder
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Path Entry && Filter'
                          name: 'CheckBox12'
                          layout: (LayoutFrame 0 0.0 132 0 0 1.0 152 0)
                          model: filenameEntryFieldVisibleHolder
                          translateLabel: true
                        )
                       )
                     
                    )
                    extent: (Point 432 184)
                  )
                 (FramedBoxSpec
                    label: 'Sort'
                    name: 'FramedBox2'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (CheckBoxSpec
                          label: 'Ignore Case'
                          name: 'CheckBox6'
                          layout: (LayoutFrame 0 0.0 7 0 0 1.0 27 0)
                          model: sortCaseless
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Directories before Files'
                          name: 'CheckBox7'
                          layout: (LayoutFrame 0 0.0 32 0 0 1.0 52 0)
                          model: sortDirectoriesBeforeFiles
                          translateLabel: true
                        )
                       )
                     
                    )
                    extent: (Point 432 81)
                  )
                 (FramedBoxSpec
                    label: 'Application Notebook'
                    name: 'FramedBox3'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (CheckBoxSpec
                          label: 'Text Editor for all Types'
                          name: 'CheckBox8'
                          layout: (LayoutFrame 0 0.0 7 0 0 1.0 27 0)
                          model: openAlwaysInTextEditor
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Open Multiple Applications'
                          name: 'CheckBox9'
                          layout: (LayoutFrame 0 0.0 32 0 0 1.0 52 0)
                          model: openMultipleApplicationsForType
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Auto Open Directory Description'
                          name: 'CheckBox10'
                          layout: (LayoutFrame 0 0.0 57 0 0 1.0 77 0)
                          model: viewDirectoryDescription
                          translateLabel: true
                        )
                       )
                     
                    )
                    extent: (Point 432 111)
                  )
                 (FramedBoxSpec
                    label: 'Columns in Filelist'
                    name: 'FramedBox4'
                    labelPosition: topLeft
                    translateLabel: true
                    component: 
                   (SpecCollection
                      collection: (
                       (CheckBoxSpec
                          label: 'Details'
                          name: 'CheckBox22'
                          layout: (LayoutFrame 0 0.0 7 0 0 1.0 27 0)
                          model: viewDetails
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Suffix'
                          name: 'CheckBox13'
                          layout: (LayoutFrame 20 0.0 32 0 170 0 52 0)
                          enableChannel: viewDetails
                          model: viewType
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Permissions'
                          name: 'CheckBox21'
                          layout: (LayoutFrame 170 0.0 32 0 -5 1 52 0)
                          enableChannel: viewDetails
                          model: viewPermissions
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Owner'
                          name: 'CheckBox14'
                          layout: (LayoutFrame 20 0.0 57 0 170 0 77 0)
                          enableChannel: viewDetails
                          model: viewOwner
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Group'
                          name: 'CheckBox18'
                          layout: (LayoutFrame 170 0.0 57 0 -5 1 77 0)
                          enableChannel: viewDetails
                          model: viewGroup
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Size'
                          name: 'CheckBox15'
                          layout: (LayoutFrame 20 0.0 82 0 170 0 102 0)
                          enableChannel: viewDetails
                          model: viewSize
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Date && Time'
                          name: 'CheckBox19'
                          layout: (LayoutFrame 170 0.0 82 0 -5 1 102 0)
                          enableChannel: viewDetails
                          model: viewTime
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Size (Byte)'
                          name: 'CheckBox16'
                          layout: (LayoutFrame 20 0.0 107 0 170 0 127 0)
                          enableChannel: viewDetails
                          model: viewSizeInBytes
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Size (KByte)'
                          name: 'CheckBox20'
                          layout: (LayoutFrame 170 0.0 107 0 -5 1 127 0)
                          enableChannel: viewDetails
                          model: viewSizeInKiloBytes
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'File Info'
                          name: 'CheckBox23'
                          layout: (LayoutFrame 20 0.0 132 0 170 0 152 0)
                          enableChannel: viewDetails
                          model: viewDescription
                          translateLabel: true
                        )
                       (CheckBoxSpec
                          label: 'Preview'
                          name: 'CheckBox24'
                          layout: (LayoutFrame 170 0.0 132 0 -5 1 152 0)
                          enableChannel: viewDetails
                          model: viewPreview
                          translateLabel: true
                        )
                       )
                     
                    )
                    extent: (Point 432 183)
                  )
                 )
               
              )
            )
           )
         
        )
      )
! !

!FileBrowserV2SettingsAppl class methodsFor:'resources'!

classResources
    ^ FileBrowserV2 classResources
! !

!FileBrowserV2SettingsAppl methodsFor:'accessing'!

requestor
    "return the value of the instance variable 'requestor' (automatically generated)"

    | masterApplication |
    masterApplication := self masterApplication.
    masterApplication notNil ifTrue:[
        ^ masterApplication requestor.
    ].
    ^ nil
! !

!FileBrowserV2SettingsAppl methodsFor:'actions'!

basicSaveSettings
    |aspectList req writeToCurrentFileBrowser|

    aspectList := AbstractFileBrowser userPreferencesAspectList.
    req := self settingsDialog.
    writeToCurrentFileBrowser := (req notNil and:[req isKindOf:AbstractFileBrowser]).
    aspectList do:[ :aAspect | |value|
        value := (self perform:aAspect) value.
        (currentUserPrefs perform:((aAspect asString, ':') asSymbol) with:value).
        writeToCurrentFileBrowser ifTrue:[
            (req perform:aAspect) value:value.
        ].
    ].
!

helpFilename
    ^ 'FileBrowserV2/settings.html'
!

readSettings
    |req receiver aspectList|

    req := self settingsDialog.
    receiver := (req notNil and:[req isKindOf:AbstractFileBrowser]) ifTrue:[
                req
            ] ifFalse:[
                currentUserPrefs
            ].
    aspectList := AbstractFileBrowser userPreferencesAspectList.
    aspectList do:[:aAspect | |value|
        value := (receiver perform:aAspect) value.
        (self perform:aAspect) value:value
    ].
    self modifiedChannel value:false
! !

!FileBrowserV2SettingsAppl methodsFor:'aspects'!

filenameEntryFieldVisibleHolder
    filenameEntryFieldVisibleHolder isNil ifTrue:[
        filenameEntryFieldVisibleHolder := true asValue.
        filenameEntryFieldVisibleHolder onChangeSend:#updateModifiedChannel
            to:self
    ].
    ^ filenameEntryFieldVisibleHolder
!

openAlwaysInTextEditor
    openAlwaysInTextEditor isNil ifTrue:[
        openAlwaysInTextEditor := true asValue.
        openAlwaysInTextEditor onChangeSend:#updateModifiedChannel to:self
    ].
    ^ openAlwaysInTextEditor
!

openMultipleApplicationsForType
    openMultipleApplicationsForType isNil ifTrue:[
        openMultipleApplicationsForType := true asValue.
        openMultipleApplicationsForType onChangeSend:#updateModifiedChannel
            to:self
    ].
    ^ openMultipleApplicationsForType
!

showDirectoryTree
    showDirectoryTree isNil ifTrue:[
        showDirectoryTree := true asValue.
        showDirectoryTree onChangeSend:#updateModifiedChannel to:self
    ].
    ^ showDirectoryTree
!

showHiddenFiles
    showHiddenFiles isNil ifTrue:[
        showHiddenFiles := true asValue.
        showHiddenFiles onChangeSend:#updateModifiedChannel to:self
    ].
    ^ showHiddenFiles
!

sortCaseless
    sortCaseless isNil ifTrue:[
        sortCaseless := true asValue.
        sortCaseless onChangeSend:#updateModifiedChannel to:self
    ].
    ^ sortCaseless
!

sortDirectoriesBeforeFiles
    sortDirectoriesBeforeFiles isNil ifTrue:[
        sortDirectoriesBeforeFiles := true asValue.
        sortDirectoriesBeforeFiles onChangeSend:#updateModifiedChannel to:self
    ].
    ^ sortDirectoriesBeforeFiles
!

toolBarVisibleHolder
    toolBarVisibleHolder isNil ifTrue:[
        toolBarVisibleHolder := true asValue.
        toolBarVisibleHolder onChangeSend:#updateModifiedChannel to:self
    ].
    ^ toolBarVisibleHolder
!

viewDescription
    viewDescription isNil ifTrue:[
        viewDescription := false asValue.
        viewDescription onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewDescription
!

viewDetails
    viewDetails isNil ifTrue:[
        viewDetails := true asValue.
        viewDetails onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewDetails
!

viewDirectoryDescription
    viewDirectoryDescription isNil ifTrue:[
        viewDirectoryDescription := true asValue.
        viewDirectoryDescription onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewDirectoryDescription
!

viewDirsInContentsBrowser
    viewDirsInContentsBrowser isNil ifTrue:[
        viewDirsInContentsBrowser := true asValue.
        viewDirsInContentsBrowser onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewDirsInContentsBrowser
!

viewFilesInDirectoryTree
    viewFilesInDirectoryTree isNil ifTrue:[
        viewFilesInDirectoryTree := true asValue.
        viewFilesInDirectoryTree onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewFilesInDirectoryTree
!

viewGroup
    viewGroup isNil ifTrue:[
        viewGroup := true asValue.
        viewGroup onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewGroup
!

viewOwner
    viewOwner isNil ifTrue:[
        viewOwner := true asValue.
        viewOwner onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewOwner
!

viewPermissions
    viewPermissions isNil ifTrue:[
        viewPermissions := true asValue.
        viewPermissions onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewPermissions
!

viewPreview
    viewPreview isNil ifTrue:[
        viewPreview := true asValue.
        viewPreview onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewPreview
!

viewSize
    viewSize isNil ifTrue:[
        viewSize := true asValue.
        viewSize onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewSize
!

viewSizeInBytes
    viewSizeInBytes isNil ifTrue:[
        viewSizeInBytes := false asValue.
        viewSizeInBytes onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewSizeInBytes
!

viewSizeInKiloBytes
    viewSizeInKiloBytes isNil ifTrue:[
        viewSizeInKiloBytes := false asValue.
        viewSizeInKiloBytes onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewSizeInKiloBytes
!

viewTime
    viewTime isNil ifTrue:[
        viewTime := true asValue.
        viewTime onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewTime
!

viewType
    viewType isNil ifTrue:[
        viewType := true asValue.
        viewType onChangeSend:#updateModifiedChannel to:self
    ].
    ^ viewType
! !

!FileBrowserV2SettingsAppl methodsFor:'queries'!

hasUnsavedChanges

    |aspectList req receiver|

    req := self settingsDialog.
    receiver := (req notNil and:[req isKindOf:AbstractFileBrowser]) ifTrue:[
                req
            ] ifFalse:[
                currentUserPrefs
            ].

    aspectList := AbstractFileBrowser userPreferencesAspectList.
    aspectList do:[ : aAspect |
        (self perform:aAspect) value ~= (receiver perform:aAspect) value ifTrue:[ 
            ^ true
        ]
    ].
    ^ false
! !

!FileBrowserV2SettingsAppl class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2SettingsAppl.st,v 1.19 2004-09-21 12:13:14 ca Exp $'
! !