Added copyright notice.
"
COPYRIGHT (c) 2012-2013 by Jan Vrany
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:libscm/mercurial' }"
FileBrowserV2 subclass:#HGWorkingCopyBrowser
instanceVariableNames:'toolbarHgVisibleHolder'
classVariableNames:''
poolDictionaries:''
category:'SCM-Mercurial-StX-Interface'
!
Smalltalk::DirectoryContentsBrowser subclass:#DirectoryContentsBrowser
instanceVariableNames:'toolbarHgVisibleHolder'
classVariableNames:''
poolDictionaries:''
privateIn:HGWorkingCopyBrowser
!
!HGWorkingCopyBrowser class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 2012-2013 by Jan Vrany
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.
"
! !
!HGWorkingCopyBrowser class methodsFor:'help specs'!
helpSpec
"This resource specification was automatically generated
by the UIHelpTool of ST/X."
"Do not manually edit this!! If it is corrupted,
the UIHelpTool may not be able to read the specification."
"
UIHelpTool openOnClass:HGWorkingCopyBrowser
"
<resource: #help>
^ super helpSpec addPairsFrom:#(
#copyFile
''
#cutFile
''
#deleteFile
''
#editFile
''
#fileGotoBookmark
''
#fileGotoSmalltalkDirectory
''
#fileHistory
''
#fileHome
''
#fileIn
''
#pasteFile
''
)
! !
!HGWorkingCopyBrowser 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:HGWorkingCopyBrowser andSelector:#windowSpec
HGWorkingCopyBrowser new openInterface:#windowSpec
HGWorkingCopyBrowser open
"
<resource: #canvas>
^
#(FullSpec
name: windowSpec
window:
(WindowSpec
label: FileBrowser
name: FileBrowser
min: (Point 10 10)
bounds: (Rectangle 0 0 800 600)
menu: mainMenu
icon: defaultIcon
)
component:
(SpecCollection
collection: (
(ViewSpec
name: 'ToolbarBox1'
layout: (LayoutFrame 0 0 0 0 0 1 40 0)
level: 0
visibilityChannel: toolBarVisibleHolder
component:
(SpecCollection
collection: (
(ActionButtonSpec
label: 'hideToolBarIcon'
name: 'HideToolBarButton'
layout: (LayoutFrame 0 0 0 0 13 0 40 0)
activeHelpKey: hideToolBar
hasCharacterOrientedLabel: false
translateLabel: true
model: hideToolbar
postBuildCallback: hideToolBarButtonCreated:
)
(MenuPanelSpec
name: 'ToolBar'
layout: (LayoutFrame 13 0 0 0 0 1 40 0)
level: 1
menu: toolBarMainMenu
textDefault: true
)
)
)
)
(ViewSpec
name: 'ToolBarBox2'
layout: (LayoutFrame 0 0 40 0 0 1 80 0)
level: 0
visibilityChannel: toolbarHgVisibleHolder
component:
(SpecCollection
collection: (
(ActionButtonSpec
label: 'hideToolBarIcon'
name: 'Button1'
layout: (LayoutFrame 0 0 0 0 13 0 40 0)
activeHelpKey: hideToolBar
hasCharacterOrientedLabel: false
translateLabel: true
model: hideToolbarHg
postBuildCallback: hideToolBarButtonCreated:
)
(MenuPanelSpec
name: 'ToolBar2'
layout: (LayoutFrame 13 0 0 0 0 1 40 0)
level: 1
menu: toolBarHGMenu
textDefault: true
)
)
)
)
(ViewSpec
name: 'FilenameEntryFieldBox'
layout: (LayoutFrame 0 0 80 0 0 1 105 0)
level: 0
visibilityChannel: filenameEntryFieldVisibleHolder
component:
(SpecCollection
collection: (
(ActionButtonSpec
label: 'hideFilenameEntryFieldIcon'
name: 'HideFilenameEntryFieldButton'
layout: (LayoutFrame 0 0 0 0 13 0 0 1)
activeHelpKey: hideFilenameEntryField
hasCharacterOrientedLabel: false
translateLabel: true
model: hideFilenameEntryField
postBuildCallback: hideFilenameEntryFieldButtonCreated:
)
(HorizontalPanelViewSpec
name: 'HorizontalPanel1'
layout: (LayoutFrame 13 0.0 0 0.0 0 1.0 0 1.0)
level: 1
horizontalLayout: leftFit
verticalLayout: fit
horizontalSpace: 3
verticalSpace: 3
component:
(SpecCollection
collection: (
(ComboListSpec
name: 'ComboList1'
visibilityChannel: driveSelectorVisible
model: selectedDeviceDrive
comboList: listOfDeviceDrives
useIndex: false
hidePullDownMenuButton: false
extent: (Point 53 23)
)
(VariableHorizontalPanelSpec
name: 'VariableHorizontalPanel1'
level: 0
showHandle: true
component:
(SpecCollection
collection: (
(NonScrollableArbitraryComponentSpec
name: 'NonScrollableArbitraryComponent1'
component: FilenameEditFieldV2
postBuildCallback: postBuildEditField:
)
(ViewSpec
name: 'FilterBox'
component:
(SpecCollection
collection: (
(LabelSpec
label: 'Filter:'
name: 'Filter'
layout: (LayoutFrame 0 0 0 0 40 0 0 1)
translateLabel: true
adjust: left
postBuildCallback: postBuildPathViewBox:
)
(ComboBoxSpec
name: 'FilterSelectionBox'
layout: (LayoutFrame 40 0 0 0 0 1 0 1)
model: filterModel
immediateAccept: true
acceptOnPointerLeave: false
comboList: filterListModel
)
)
)
postBuildCallback: postBuildPathViewBox:
)
)
)
handles: (Any 0.774936 1.0)
postBuildCallback: postBuildPathViewBox:
useDefaultExtent: true
)
)
)
postBuildCallback: postBuildPathViewBox:
)
)
)
)
(#'FileBrowserV2UISpecifications::PanelSpec'
name: 'BrowserBox'
layout: (LayoutFrame 0 0.0 106 0.0 0 1.0 -26 1.0)
level: 0
showHandle: true
snapMode: both
whichView: last
orientation: vertical
visibility: viewNoteBookApplicationHolder
component:
(SpecCollection
collection: (
(#'FileBrowserV2UISpecifications::PanelSpec'
name: 'HorizontalPanel'
level: 0
snapMode: both
whichView: first
orientation: horizontal
visibility: showDirectoryTree
component:
(SpecCollection
collection: (
(SubCanvasSpec
name: 'DirectoryTreeBrowser'
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: DirectoryTreeBrowser
createNewApplication: true
createNewBuilder: true
postBuildCallback: postBuildDirectoryTree:
)
(SubCanvasSpec
name: 'DirectoryContentsBrowser'
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: 'HGWorkingCopyBrowser::DirectoryContentsBrowser'
createNewApplication: true
createNewBuilder: true
)
)
)
handles: (Any 0.225 1.0)
)
(SubCanvasSpec
name: 'FileApplicationNoteBook'
tabable: false
hasHorizontalScrollBar: false
hasVerticalScrollBar: false
majorKey: FileApplicationNoteBook
createNewApplication: true
createNewBuilder: true
)
)
)
handles: (Any 0.5 1.0)
)
(ViewSpec
name: 'InfoBox'
layout: (LayoutFrame 0 0 -26 1 0 1 0 1)
level: 0
visibilityChannel: infoBarVisibleHolder
component:
(SpecCollection
collection: (
(LabelSpec
label: 'NotifyLabel'
name: 'NotifyLabel'
layout: (LayoutFrame 0 0 1 0.0 -220 1 1 1.0)
level: -1
translateLabel: true
labelChannel: notifyChannel
adjust: left
)
(LabelSpec
label: 'encoding'
name: 'EncodingLabel'
layout: (LayoutFrame -318 1 2 0.0 -235 1 0 1.0)
activeHelpKey: encodingLabel
level: 0
labelChannel: fileEncodingHolder
adjust: right
menu: encodingMenu
)
(LabelSpec
name: 'FileEncodingLockedLabel'
layout: (LayoutFrame -235 1 2 0.0 -220 1 20 0.0)
activeHelpKey: encodingLockedLabel
level: 0
labelChannel: fileEncodingLockImageHolder
adjust: right
menu: encodingMenu
)
(LabelSpec
label: 'Shown Files'
name: 'ShownFilesLabel'
layout: (LayoutFrame -220 1 1 0.0 -65 1 1 1.0)
activeHelpKey: numberOfFiles
level: -1
translateLabel: true
labelChannel: shownFiles
adjust: right
)
(ViewSpec
name: 'ProgressIndicatorBox'
layout: (LayoutFrame -220 1 1 0.0 -65 1 1 1.0)
level: -1
visibilityChannel: activityVisibilityChannel
component:
(SpecCollection
collection: (
(ProgressIndicatorSpec
name: 'ProgressIndicator1'
layout: (LayoutFrame 5 0.0 -7 0.5 -5 1.0 7 0.5)
backgroundColor: (Color 0.0 66.6666666666667 66.6666666666667)
isActivityIndicator: true
)
)
)
)
(LabelSpec
name: 'BusyLabel'
layout: (LayoutFrame -220 1 1 0.0 -65 1 1 1.0)
activeHelpKey: modeLabel
level: -1
visibilityChannel: busyLabelVisibleHolder
translateLabel: true
labelChannel: busyLabelHolder
adjust: right
)
(LabelSpec
label: 'M'
name: 'ModeLabel'
layout: (LayoutFrame -65 1 1 0.0 -55 1 1 1.0)
activeHelpKey: modeLabel
level: -1
translateLabel: true
labelChannel: modeLabelHolder
adjust: right
postBuildCallback: postBuildEditModeInfoLabel:
)
(LabelSpec
label: 'L'
name: 'LineLabel'
layout: (LayoutFrame -55 1 1 0.0 -20 1 1 1.0)
activeHelpKey: lineLabel
level: -1
translateLabel: true
labelChannel: cursorLineLabelHolder
adjust: right
)
(LabelSpec
label: 'C'
name: 'ColLabel'
layout: (LayoutFrame -20 1 1 0.0 0 1 1 1.0)
activeHelpKey: columnLabel
level: -1
translateLabel: true
labelChannel: cursorColLabelHolder
adjust: right
)
)
)
)
(LabelSpec
label: 'Preview'
name: 'PreviewLabel'
layout: (LayoutFrame 0 0.5 93 0 100 0.5 115 0)
level: 0
borderWidth: 1
visibilityChannel: previewVisibleHolder
backgroundColor: (Color 86.9993133440147 86.9993133440147 86.9993133440147)
translateLabel: true
)
(ArbitraryComponentSpec
name: 'Preview'
layout: (LayoutFrame 0 0.5 116 0 -147 1 -266 1)
level: 1
visibilityChannel: previewVisibleHolder
hasBorder: false
component: ImageView
)
(ActionButtonSpec
label: 'closePreviewButtonImage'
name: 'ClosePreviewButton'
layout: (LayoutFrame -169 1 94 0 -147 1 116 0)
visibilityChannel: previewVisibleHolder
hasCharacterOrientedLabel: false
translateLabel: true
)
)
)
)
"Modified: / 14-12-2012 / 19:59:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGWorkingCopyBrowser class methodsFor:'menu specs'!
scmMenuSlice
"This resource specification was automatically generated
by the MenuEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
label: 'Mercurial'
translateLabel: true
submenuChannel: hgMenu
)
)
nil
nil
)
"Created: / 14-12-2012 / 15:25:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
toolBarMainMenu
"This resource specification was automatically generated
by the MenuEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the MenuEditor may not be able to read the specification."
"
MenuEditor new openOnClass:HGWorkingCopyBrowser andSelector:#toolBarMainMenu
(Menu new fromLiteralArrayEncoding:(HGWorkingCopyBrowser toolBarMainMenu)) startUp
"
<resource: #menu>
^
#(Menu
(
(MenuItem
activeHelpKey: directoryBack
enabled: enableBack
label: 'Back'
itemValue: doBack
isButton: true
submenuChannel: menuDirHistoryBack
labelImage: (ResourceRetriever ToolbarIconLibrary historyBackIcon)
)
(MenuItem
label: ''
)
(MenuItem
activeHelpKey: directoryForward
enabled: enableForward
label: 'Forward'
itemValue: doForward
isButton: true
submenuChannel: menuDirHistoryForward
labelImage: (ResourceRetriever ToolbarIconLibrary historyForwardIcon)
)
(MenuItem
label: '-'
)
(MenuItem
activeHelpKey: directoryUp
enabled: enableDirectoryUp
label: 'DirectoryUp'
itemValue: doGoDirectoryUp
isButton: true
labelImage: (ResourceRetriever ToolbarIconLibrary directoryUpIcon)
)
(MenuItem
activeHelpKey: fileHome
enabled: enableHome
label: 'Home'
itemValue: doGotoHomeDirectory
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary homeIcon)
)
(MenuItem
activeHelpKey: fileGotoDefaultDirectory
enabled: enableGotoDefaultDirectory
label: 'Current'
itemValue: doGotoDefaultDirectory
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary currentDirectoryIcon)
)
(MenuItem
activeHelpKey: fileGotoSmalltalkDirectory
enabled: enableGotoSmalltalkDirectory
label: 'ST/X Default'
itemValue: doGotoSmalltalkDirectory
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary stxHomeIcon)
)
(MenuItem
activeHelpKey: fileGotoBookmark
label: 'Bookmarks'
isButton: true
isVisible: false
submenuChannel: gotoBookmarksMenu
labelImage: (ResourceRetriever ToolbarIconLibrary directoryBookmarksIcon)
)
(MenuItem
activeHelpKey: fileHistory
enabled: enableFileHistory
label: 'File History'
isButton: true
isVisible: false
submenuChannel: menuFileHistory
labelImage: (ResourceRetriever ToolbarIconLibrary historyIcon)
)
(MenuItem
label: '-'
)
(MenuItem
activeHelpKey: searchFile
label: 'Search File'
itemValue: doOpenSearchFile
isButton: true
labelImage: (ResourceRetriever ToolbarIconLibrary searchFileIcon)
)
(MenuItem
label: '-'
)
(MenuItem
activeHelpKey: cutFile
enabled: hasSelection
label: 'Cut'
itemValue: cutFiles
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary cutFileIcon)
)
(MenuItem
activeHelpKey: copyFile
enabled: hasSelection
label: 'Copy'
itemValue: copyFiles
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary copyFileIcon)
)
(MenuItem
activeHelpKey: pasteFile
enabled: canPaste
label: 'Paste'
itemValue: pasteFiles
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary pasteFileIcon)
)
(MenuItem
activeHelpKey: deleteFile
enabled: hasSelection
label: 'Delete'
itemValue: deleteFiles
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary deleteFileIcon)
)
(MenuItem
label: '-'
isVisible: false
)
(MenuItem
activeHelpKey: editFile
label: 'Edit File'
itemValue: doShowFileContents
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary editFileIcon)
)
(MenuItem
activeHelpKey: fileIn
label: 'File In'
itemValue: fileFileIn
isButton: true
isVisible: false
labelImage: (ResourceRetriever ToolbarIconLibrary fileInIcon)
)
(MenuItem
activeHelpKey: openChangeBrowser
enabled: hasFileSelection
label: 'Changes Browser'
itemValue: openChangesBrowser
isButton: true
labelImage: (ResourceRetriever ToolbarIconLibrary startChangesBrowserIcon)
)
(MenuItem
label: '-'
isVisible: false
)
(MenuItem
activeHelpKey: addTerminal
label: 'VT100'
itemValue: doAddTerminal
isButton: true
labelImage: (ResourceRetriever ToolbarIconLibrary shellTerminalIcon)
)
(MenuItem
activeHelpKey: make
enabled: canMake
label: 'Make'
itemValue: doMake
isButton: true
labelImage: (ResourceRetriever ToolbarIconLibrary make24x24Icon3)
)
(MenuItem
activeHelpKey: viewDetails
label: 'viewDetails'
isButton: true
startGroup: right
hideMenuOnActivated: false
indication: viewDetails
labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon)
)
(MenuItem
activeHelpKey: viewDetails
label: 'viewDetails'
isButton: true
startGroup: right
isVisible: false
indication: viewDetails
submenuChannel: viewDetailsMenuSpec
labelImage: (ResourceRetriever ToolbarIconLibrary viewDetailsIcon)
)
(MenuItem
activeHelpKey: selectDetails
label: ''
isButton: true
startGroup: right
submenuChannel: viewDetailsMenuSpec
labelImage: (ResourceRetriever ToolbarIconLibrary empty1x20Icon)
)
)
nil
nil
)
! !
!HGWorkingCopyBrowser methodsFor:'actions'!
hideToolbarHg
self toolbarHgVisibleHolder value: false
"Created: / 14-12-2012 / 15:21:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGWorkingCopyBrowser methodsFor:'aspects'!
directoryContentsBrowser
^ self applications at:#'HGWorkingCopyBrowser::DirectoryContentsBrowser' ifAbsent:nil.
"Created: / 14-12-2012 / 20:01:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
toolbarHgVisibleHolder
"return/create the 'bookmarkBarVisibleHolder' value holder (automatically generated)"
toolbarHgVisibleHolder isNil ifTrue:[
toolbarHgVisibleHolder := true asValue.
toolbarHgVisibleHolder addDependent:self.
].
^ toolbarHgVisibleHolder
"Created: / 14-12-2012 / 15:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
toolbarHgVisibleHolder:something
"set the 'bookmarkBarVisibleHolder' value holder (automatically generated)"
|oldValue newValue|
toolbarHgVisibleHolder notNil ifTrue:[
oldValue := toolbarHgVisibleHolder value.
toolbarHgVisibleHolder removeDependent:self.
].
toolbarHgVisibleHolder := something.
toolbarHgVisibleHolder notNil ifTrue:[
toolbarHgVisibleHolder addDependent:self.
].
newValue := toolbarHgVisibleHolder value.
oldValue ~~ newValue ifTrue:[
self update:#value with:newValue from:toolbarHgVisibleHolder.
].
"Created: / 14-12-2012 / 15:20:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGWorkingCopyBrowser methodsFor:'aspects-visibility'!
hgMenusAreShown
^true
"Created: / 14-12-2012 / 15:41:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGWorkingCopyBrowser methodsFor:'change & update'!
currentFileNameHolderChanged
super currentFileNameHolderChanged.
"Created: / 20-04-2012 / 18:04:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 14-12-2012 / 15:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
update:something with:aParameter from:changedObject
"Invoked when an object that I depend upon sends a change notification."
"stub code automatically generated - please change as required"
"/ changedObject == someOfMyValueHolders ifTrue:[
"/ self doSomethingApropriate.
"/ ^ self.
"/ ].
super update:something with:aParameter from:changedObject
!
updateToolVisibility
|builder toolBar bookmarkBar infoBar filenameEntryField vPanel topOffset bottomOffset
toolBarVisible bookmarkBarVisible filenameEntryFieldVisible infoBarVisible d|
builder := self builder.
topOffset := 0.
bottomOffset := 0.
toolBarVisible := self toolBarVisibleHolder value.
toolBarVisible ifTrue:[
toolBar := builder componentAt:#ToolbarBox1.
topOffset := topOffset + toolBar height.
].
bookmarkBarVisible := self toolbarHgVisibleHolder value.
bookmarkBarVisible ifTrue:[
bookmarkBar := builder componentAt:#ToolBarBox2.
topOffset := topOffset + (bookmarkBar height max: 40)
].
filenameEntryFieldVisible := self filenameEntryFieldVisibleHolder value.
filenameEntryFieldVisible ifTrue:[
filenameEntryField := builder componentAt:#FilenameEntryFieldBox.
d := filenameEntryField layout bottomOffset - filenameEntryField layout topOffset.
filenameEntryField layout topOffset:topOffset bottomOffset:topOffset + d.
topOffset := topOffset + filenameEntryField height.
filenameEntryField container notNil ifTrue:[
filenameEntryField containerChangedSize.
].
].
infoBarVisible := self infoBarVisibleHolder value.
infoBarVisible ifTrue:[
infoBar := builder componentAt:#InfoBox.
bottomOffset := bottomOffset - infoBar height.
].
vPanel := builder componentAt:#BrowserBox.
vPanel layout topOffset:topOffset+1.
vPanel layout bottomOffset:bottomOffset-1.
vPanel container notNil ifTrue:[
vPanel containerChangedSize.
].
"Modified: / 14-12-2012 / 15:23:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGWorkingCopyBrowser class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !