FilenameWidgetWithHistory.st
author Claus Gittinger <cg@exept.de>
Wed, 08 Aug 2018 14:17:49 +0200
changeset 5872 798ab0cedaeb
parent 5569 73812d992757
child 5954 3c254cdfdfbc
permissions -rw-r--r--
#FEATURE by cg class: FilenameWidgetWithHistory class definition added: #fileNameTranslationHook #fileNameTranslationHook: changed: #browseForFileOrDirectory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3318
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     1
"
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     2
 COPYRIGHT (c) 2007 by eXept Software AG
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     3
              All Rights Reserved
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     4
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     5
 This software is furnished under a license and may be used
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     6
 only in accordance with the terms of that license and with the
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     8
 be provided or otherwise made available to, or used by, any
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
     9
 other person.  No title to or ownership of the software is
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    10
 hereby transferred.
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    11
"
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
4708
adabb83e93bf class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
    14
"{ NameSpace: Smalltalk }"
adabb83e93bf class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
    15
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
SimpleView subclass:#FilenameWidgetWithHistory
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    17
	instanceVariableNames:'fileNameEntryField browseButton history directoriesOnly filesOnly
5872
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
    18
		dialogTitle initialDirectoryHolder baseDirectory
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
    19
		fileNameTranslationHook'
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Views-Interactors'
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!FilenameWidgetWithHistory class methodsFor:'documentation'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
3318
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    27
copyright
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    28
"
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    29
 COPYRIGHT (c) 2007 by eXept Software AG
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    30
              All Rights Reserved
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    31
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    32
 This software is furnished under a license and may be used
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    33
 only in accordance with the terms of that license and with the
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    35
 be provided or otherwise made available to, or used by, any
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    36
 other person.  No title to or ownership of the software is
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    37
 hereby transferred.
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    38
"
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    39
!
5a0aff0fd23a copyright
Claus Gittinger <cg@exept.de>
parents: 3251
diff changeset
    40
3471
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    41
documentation
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    42
"
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    43
    A Filename InputField with history-list and a browse-button, which opens a file dialog.
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    44
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    45
    [author:]
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    46
        Claus Gittinger
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    47
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    48
    [see also:]
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    49
        ComboBoxView
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    50
        FilenameEditField
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    51
        FilenameComboBoxView
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    52
"
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    53
!
f3cde37d9d53 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3427
diff changeset
    54
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
examples
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
"
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
                                                                        [exBegin]
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
     |top b|
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
     top := StandardSystemView new.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
     top extent:(300 @ 200).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
     b := FilenameWidgetWithHistory in:top.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
     b origin:(0.0 @ 0.0) corner:(1.0 @ 0.0).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
     b bottomInset:(b preferredExtent y negated).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
     top open.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
                                                                        [exEnd]
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
"
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
!FilenameWidgetWithHistory methodsFor:'accessing'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
3950
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    74
acceptOnExpand:aBoolean
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    75
    fileNameEntryField acceptOnExpand:aBoolean
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    76
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    77
    "Created: / 20-10-2010 / 17:49:54 / cg"
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    78
!
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    79
3959
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    80
baseDirectory
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    81
    ^ baseDirectory
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    82
!
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    83
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    84
baseDirectory:something
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    85
    baseDirectory := something.
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    86
!
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
    87
3950
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    88
contents
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    89
    ^ fileNameEntryField contents
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    90
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    91
    "Created: / 20-10-2010 / 17:51:07 / cg"
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    92
!
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
    93
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    94
dialogTitle:something
5569
73812d992757 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5336
diff changeset
    95
    "set the dialog's title"
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    96
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
    97
    dialogTitle := something.
5569
73812d992757 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5336
diff changeset
    98
73812d992757 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5336
diff changeset
    99
    "Modified (comment): / 03-08-2017 / 14:39:00 / cg"
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   100
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   101
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   102
directoriesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   103
    "if true, directories are selectable only.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   104
     If both filesOnly and directoriesOnly are false, which is the default, 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   105
     anything is selectable."
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   106
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   107
    directoriesOnly := aBoolean.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   108
    directoriesOnly ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   109
        filesOnly := false.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   110
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   111
    fileNameEntryField notNil ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   112
        fileNameEntryField directoriesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   113
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   114
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   115
5872
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   116
fileNameTranslationHook
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   117
    ^ fileNameTranslationHook
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   118
!
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   119
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   120
fileNameTranslationHook:aBlock
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   121
    "an optional hook which gets the filename from the editField
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   122
     and produces a full path for the file dialog (in the ...-button).
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   123
     Use this, if the filename contains $(xxx) variables to be expanded"
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   124
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   125
    fileNameTranslationHook := aBlock.
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   126
!
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   127
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   128
filesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   129
    "if true, files are selectable only.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   130
     If both filesOnly and directoriesOnly are false, which is the default, 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   131
     anything is selectable."
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   132
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   133
    filesOnly := aBoolean.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   134
    filesOnly ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   135
        directoriesOnly := false.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   136
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   137
    fileNameEntryField notNil ifTrue:[
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   138
        fileNameEntryField filesOnly:aBoolean
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   139
    ].
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   140
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   141
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
historyList
3474
cde8a45f74f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
   143
    history isNil ifTrue:[
4708
adabb83e93bf class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   144
        history := ValueHolder with:nil
3474
cde8a45f74f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
   145
    ].
cde8a45f74f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3473
diff changeset
   146
    ^ history
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
4798
88362e198319 class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4797
diff changeset
   149
historyList:aCollection
3593
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   150
    "set the history - useful when two or more such fields shall share a common history"
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   151
4798
88362e198319 class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4797
diff changeset
   152
    self historyList value: aCollection
3593
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   153
!
f11c5a41d4a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3590
diff changeset
   154
3594
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   155
initialDirectoryHolder
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   156
    "can be used to force the file-dialog into some initial directory"
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   157
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   158
    ^ initialDirectoryHolder
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   159
!
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   160
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
model
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    ^ fileNameEntryField model
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
model:aFilenameHolder
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    fileNameEntryField model:aFilenameHolder.
3950
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   167
!
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   168
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   169
selectAllInitially
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   170
    fileNameEntryField selectAllInitially
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   171
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   172
    "Created: / 20-10-2010 / 17:50:23 / cg"
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
3546
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   175
!FilenameWidgetWithHistory methodsFor:'accessing-channels'!
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   176
4797
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   177
acceptChannel:aValueHolder
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   178
    fileNameEntryField acceptChannel:aValueHolder.
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   179
!
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   180
5336
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   181
backgroundChannel
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   182
    ^ fileNameEntryField backgroundChannel
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   183
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   184
    "Created: / 17-11-2016 / 21:34:10 / cg"
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   185
!
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   186
5335
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   187
backgroundChannel:aValueHolder
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   188
    fileNameEntryField backgroundChannel:aValueHolder.
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   189
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   190
    "Created: / 17-11-2016 / 21:32:04 / cg"
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   191
!
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   192
3546
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   193
enableChannel:aValueHolder
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   194
    fileNameEntryField enableChannel:aValueHolder.
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   195
    browseButton enableChannel:aValueHolder.
4084
5738fc3ced77 added: #modifiedChannel:
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   196
!
5738fc3ced77 added: #modifiedChannel:
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   197
5336
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   198
foregroundChannel
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   199
    ^ fileNameEntryField foregroundChannel
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   200
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   201
    "Created: / 17-11-2016 / 21:34:17 / cg"
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   202
!
c1933e2d616e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5335
diff changeset
   203
5335
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   204
foregroundChannel:aValueHolder
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   205
    fileNameEntryField foregroundChannel:aValueHolder.
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   206
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   207
    "Created: / 17-11-2016 / 21:32:11 / cg"
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   208
!
62a286201b0c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4798
diff changeset
   209
4084
5738fc3ced77 added: #modifiedChannel:
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   210
modifiedChannel:aValueHolder
5738fc3ced77 added: #modifiedChannel:
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   211
    fileNameEntryField modifiedChannel:aValueHolder.
5738fc3ced77 added: #modifiedChannel:
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   212
5738fc3ced77 added: #modifiedChannel:
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   213
    "Created: / 05-10-2011 / 14:59:48 / cg"
3546
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   214
! !
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   215
b3269a9dec19 +enableChannel
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   216
!FilenameWidgetWithHistory methodsFor:'accessing-editField attributes'!
3472
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   217
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   218
acceptIfUnchanged:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   219
    fileNameEntryField acceptIfUnchanged:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   220
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   221
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   222
acceptOnLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   223
    fileNameEntryField acceptOnLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   224
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   225
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   226
acceptOnLostFocus:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   227
    fileNameEntryField acceptOnLostFocus:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   228
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   229
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   230
acceptOnPointerLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   231
    fileNameEntryField acceptOnPointerLeave:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   232
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   233
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   234
acceptOnReturn:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   235
    fileNameEntryField acceptOnReturn:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   236
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   237
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   238
acceptOnTab:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   239
    fileNameEntryField acceptOnTab:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   240
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   241
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   242
contents:aString
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   243
    fileNameEntryField contents:aString
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   244
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   245
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   246
immediateAccept:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   247
    fileNameEntryField immediateAccept:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   248
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   249
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   250
maxChars:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   251
    fileNameEntryField maxChars:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   252
!
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   253
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   254
readOnly:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   255
    fileNameEntryField readOnly:aBoolean
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   256
! !
20087c3d9dda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3471
diff changeset
   257
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
!FilenameWidgetWithHistory methodsFor:'initialization'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
initialize
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    super initialize.
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   263
    directoriesOnly := filesOnly := false.
4708
adabb83e93bf class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4330
diff changeset
   264
    initialDirectoryHolder := ValueHolder with:nil.
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   265
3940
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   266
    self initializeFilenameField.
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
    fileNameEntryField layout:(LayoutFrame
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
                                  leftFraction:0 offset:0 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
                                  rightFraction:1 offset:-22 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
                                  topFraction:0 offset:0 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
                                  bottomFraction:1 offset:0).
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
3959
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   273
    self initializeBrowseButton.
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    browseButton layout:(LayoutFrame
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
                                  leftFraction:1 offset:-22 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
                                  rightFraction:1 offset:-2 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
                                  topFraction:0 offset:0 
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
                                  bottomFraction:1 offset:0).
3940
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   279
3959
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   280
    "Modified: / 02-11-2010 / 19:50:33 / cg"
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   281
!
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   282
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   283
initializeBrowseButton
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   284
    browseButton := Button in:self.
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   285
    browseButton label:'...'.
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   286
    browseButton action:[ self browseForFileOrDirectory ].
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   287
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   288
    "Created: / 02-11-2010 / 19:50:21 / cg"
3940
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   289
!
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   290
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   291
initializeFilenameField
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   292
    fileNameEntryField := FilenameComboBoxView in:self.
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   293
    fileNameEntryField listHolder:(self historyList).
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   294
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   295
    "Created: / 19-10-2010 / 16:20:09 / cg"
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
!FilenameWidgetWithHistory methodsFor:'queries'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
preferredExtent
3568
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   301
    "/ If I have an explicit preferredExtent..
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   302
    explicitExtent notNil ifTrue:[
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   303
        ^ explicitExtent
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   304
    ].
2f293d1e2eef changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3546
diff changeset
   305
    "/ If I have a cached preferredExtent value..
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
    preferredExtent notNil ifTrue:[
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
        ^ preferredExtent
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    ].
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
3427
9927e4970fce added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   310
    preferredExtent := (fileNameEntryField preferredWidth + browseButton preferredWidth)
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
                       @
3427
9927e4970fce added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3318
diff changeset
   312
                       (fileNameEntryField preferredHeight "max: browseButton preferredExtent y").
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
    ^ preferredExtent
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
!FilenameWidgetWithHistory methodsFor:'user actions'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
browseForDestinationDirectory
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   319
    <resource: #obsolete>
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   320
    self obsoleteMethodWarning.
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   321
    self browseForFileOrDirectory
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   322
!
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   323
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   324
browseForFileOrDirectory
3594
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   325
    |path |
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
4721
e3cb03ac761a class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4708
diff changeset
   327
    Dialog modifyingBoxWith:[:box |
4797
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   328
        |holder|
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   329
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   330
        holder := box perform:#browsemenuItemVisibleHolder ifNotUnderstood:[nil].
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   331
        holder notNil ifTrue:[
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   332
            holder value:true
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   333
        ]
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    ] do:[
3594
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   335
        |title defaultPath defaultDir|
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   336
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   337
        title := dialogTitle notNil 
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   338
                    ifTrue:[ dialogTitle ]
3959
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   339
                    ifFalse:[
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   340
                        resources string:(
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   341
                            directoriesOnly 
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   342
                                ifTrue:[ 'Select Directory' ]
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   343
                                ifFalse:[ 
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   344
                                    filesOnly
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   345
                                        ifTrue:[ 'Select File' ]
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   346
                                        ifFalse:[ 'Select Path' ]])].
3590
c3c778e11564 fixes (thanx to bretts info)
Claus Gittinger <cg@exept.de>
parents: 3568
diff changeset
   347
3950
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   348
        defaultPath := (self model notNil)
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   349
                            ifTrue:[ self model value ]
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   350
                            ifFalse:[ fileNameEntryField contents ].
3959
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   351
4019
33b8c1b762cb changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
   352
        defaultPath notEmptyOrNil ifTrue:[
5872
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   353
            fileNameTranslationHook notNil ifTrue:[
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   354
                defaultPath := fileNameTranslationHook value:defaultPath
798ab0cedaeb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5569
diff changeset
   355
            ].
4019
33b8c1b762cb changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
   356
            defaultPath asFilename isAbsolute ifFalse:[
33b8c1b762cb changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
   357
                baseDirectory notNil ifTrue:[
33b8c1b762cb changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
   358
                    defaultPath := baseDirectory asFilename construct:defaultPath.
33b8c1b762cb changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
   359
                ].
3959
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   360
            ].
3594
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   361
            defaultDir := defaultPath asFilename directory.
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   362
        ] ifFalse:[     
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   363
            defaultDir := initialDirectoryHolder value.
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   364
        ].
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   365
        path := Dialog 
3954
e28b5c4fe0c9 comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3953
diff changeset
   366
                    requestFileName:title
e28b5c4fe0c9 comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3953
diff changeset
   367
                    default:defaultPath
e28b5c4fe0c9 comment/format in: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3953
diff changeset
   368
                    fromDirectory:defaultDir.
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
    ].
3594
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   370
    path isEmptyOrNil ifTrue:[ ^ self ].
3953
370687d1030b changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents: 3950
diff changeset
   371
    path := path asFilename.
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
3959
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   373
    baseDirectory notNil ifTrue:[
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   374
        (path pathName startsWith:baseDirectory asFilename pathName) ifTrue:[
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   375
            path := (path pathName copyFrom:(baseDirectory asFilename pathName size + 2)) asFilename.
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   376
        ].
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   377
    ].        
5b7ff23ff724 baseDirectory
Claus Gittinger <cg@exept.de>
parents: 3954
diff changeset
   378
3953
370687d1030b changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents: 3950
diff changeset
   379
    initialDirectoryHolder value:path directory.
370687d1030b changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents: 3950
diff changeset
   380
    path := path pathName.
370687d1030b changed: #browseForFileOrDirectory
Stefan Vogel <sv@exept.de>
parents: 3950
diff changeset
   381
3594
8bdad6d9c51a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3593
diff changeset
   382
    "/ lastDirectoryHolder value:path directory.
3950
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   383
    self model notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   384
        self model value:path.
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   385
    ].
Claus Gittinger <cg@exept.de>
parents: 3940
diff changeset
   386
    fileNameEntryField contents:path.
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
4019
33b8c1b762cb changed: #browseForFileOrDirectory
Claus Gittinger <cg@exept.de>
parents: 3959
diff changeset
   388
    "Modified: / 08-02-2011 / 09:24:51 / cg"
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
! !
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
!FilenameWidgetWithHistory class methodsFor:'documentation'!
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
version
4797
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   394
    ^ '$Header$'
3940
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   395
!
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   396
705b77e37f67 added: #initializeFilenameField
Claus Gittinger <cg@exept.de>
parents: 3700
diff changeset
   397
version_CVS
4797
b145bd0e466d class: FilenameWidgetWithHistory
Claus Gittinger <cg@exept.de>
parents: 4721
diff changeset
   398
    ^ '$Header$'
3251
29b44f456526 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
! !
4330
69a2cba2229e aboutToOpenBoxNotificationSignal semantic change (for Jan)
Claus Gittinger <cg@exept.de>
parents: 4084
diff changeset
   400