Documentation ¶
Index ¶
- Constants
- Variables
- func ActiveDockable() unison.Dockable
- func CloseGroup(d unison.Dockable) bool
- func CloseUUID(ids map[uuid.UUID]bool) bool
- func DisplayNewDockable(wnd *unison.Window, dockable unison.Dockable)
- func DockContainerHoldsExtension(dc *unison.DockContainer, ext ...string) bool
- func MayAttemptCloseOfGroup(d unison.Dockable) bool
- func OpenFile(wnd *unison.Window, filePath string) (dockable unison.Dockable, wasOpen bool)
- func OpenFiles(filePaths []string)
- func PromptForDestination[T FileBackedDockable](choices []T) []T
- func RegisterFileTypes()
- func SaveDockable(d FileBackedDockable, saver func(filePath string) error, setUnmodified func()) bool
- func SaveDockableAs(d FileBackedDockable, extension string, saver func(filePath string) error, ...) bool
- func ShowUnableToLocateWorkspaceError()
- type DocumentDock
- type FileBackedDockable
- type Navigator
- func (n *Navigator) ApplyDisclosedPaths(paths []string)
- func (n *Navigator) ApplySelectedPaths(paths []string)
- func (n *Navigator) DisclosedPaths() []string
- func (n *Navigator) EventuallyReload()
- func (n *Navigator) InitialFocus()
- func (n *Navigator) Modified() bool
- func (n *Navigator) Reload()
- func (n *Navigator) SelectedPaths() []string
- func (n *Navigator) Title() string
- func (n *Navigator) TitleIcon(suggestedSize unison.Size) unison.Drawable
- func (n *Navigator) Tooltip() string
- type NavigatorNode
- func (n *NavigatorNode) CanHaveChildren() bool
- func (n *NavigatorNode) CellDataForSort(col int) string
- func (n *NavigatorNode) Children() []*NavigatorNode
- func (n *NavigatorNode) CloneForTarget(_ unison.Paneler, _ *NavigatorNode) *NavigatorNode
- func (n *NavigatorNode) ColumnCell(_, col int, foreground, _ unison.Ink, _, _, _ bool) unison.Paneler
- func (n *NavigatorNode) IsOpen() bool
- func (n *NavigatorNode) Match(text string) bool
- func (n *NavigatorNode) Open(wnd *unison.Window)
- func (n *NavigatorNode) Parent() *NavigatorNode
- func (n *NavigatorNode) Path() string
- func (n *NavigatorNode) Refresh()
- func (n *NavigatorNode) SetChildren(_ []*NavigatorNode)
- func (n *NavigatorNode) SetOpen(open bool)
- func (n *NavigatorNode) SetParent(_ *NavigatorNode)
- func (n *NavigatorNode) UUID() uuid.UUID
- type Workspace
Constants ¶
const AssociatedUUIDKey = "associated_uuid"
AssociatedUUIDKey is the key used with CloseUUID().
Variables ¶
var PrintMgr printing.PrintManager
PrintMgr is our PrintManager singleton.
Functions ¶
func ActiveDockable ¶
ActiveDockable returns the currently active dockable in the active window.
func CloseGroup ¶
CloseGroup attempts to close any grouped Dockables associated with the given Dockable. Returns false if a dockable refused to close.
func CloseUUID ¶
CloseUUID attempts to close any Dockables associated with the given UUIDs. Returns false if a dockable refused to close.
func DisplayNewDockable ¶
DisplayNewDockable adds the Dockable to the dock and gives it the focus.
func DockContainerHoldsExtension ¶
func DockContainerHoldsExtension(dc *unison.DockContainer, ext ...string) bool
DockContainerHoldsExtension returns true if an immediate child of the given DockContainer has a FileBackedDockable with the given extension.
func MayAttemptCloseOfGroup ¶
MayAttemptCloseOfGroup returns true if the grouped Dockables associated with the given dockable may be closed.
func OpenFile ¶
OpenFile attempts to open the given file path in the given window, which should contain a workspace. May pass nil for wnd to let it pick the first such window it discovers.
func OpenFiles ¶
func OpenFiles(filePaths []string)
OpenFiles attempts to open the given file paths.
func PromptForDestination ¶
func PromptForDestination[T FileBackedDockable](choices []T) []T
PromptForDestination puts up a modal dialog to choose one or more destinations if choices contains more than one choice. Return an empty list if canceled or there are no selections made.
func RegisterFileTypes ¶
func RegisterFileTypes()
RegisterFileTypes registers special navigator file types.
func SaveDockable ¶
func SaveDockable(d FileBackedDockable, saver func(filePath string) error, setUnmodified func()) bool
SaveDockable attempts to save the contents of the dockable using its existing path.
func SaveDockableAs ¶
func SaveDockableAs(d FileBackedDockable, extension string, saver func(filePath string) error, setUnmodifiedAndNewPath func(filePath string)) bool
SaveDockableAs attempts to save the contents of the dockable, prompting for a new path.
func ShowUnableToLocateWorkspaceError ¶
func ShowUnableToLocateWorkspaceError()
ShowUnableToLocateWorkspaceError displays an error dialog.
Types ¶
type DocumentDock ¶
DocumentDock holds the document dock.
func NewDocumentDock ¶
func NewDocumentDock() *DocumentDock
NewDocumentDock creates a new DocumentDock.
func (*DocumentDock) Modified ¶
func (d *DocumentDock) Modified() bool
Modified implements unison.Dockable
func (*DocumentDock) TitleIcon ¶
func (d *DocumentDock) TitleIcon(suggestedSize unison.Size) unison.Drawable
TitleIcon implements unison.Dockable
func (*DocumentDock) Tooltip ¶
func (d *DocumentDock) Tooltip() string
Tooltip implements unison.Dockable
type FileBackedDockable ¶
type FileBackedDockable interface { unison.Dockable unison.TabCloser BackingFilePath() string SetBackingFilePath(p string) }
FileBackedDockable defines methods a Dockable that is based on a file should implement.
type Navigator ¶
type Navigator struct { // contains filtered or unexported fields }
Navigator holds the workspace navigation panel.
func (*Navigator) ApplyDisclosedPaths ¶
ApplyDisclosedPaths closes all nodes except the ones provided, which are explicitly opened.
func (*Navigator) ApplySelectedPaths ¶
ApplySelectedPaths replaces the selection with the nodes that match the given paths.
func (*Navigator) DisclosedPaths ¶
DisclosedPaths returns a list of paths that are currently disclosed.
func (*Navigator) EventuallyReload ¶
func (n *Navigator) EventuallyReload()
EventuallyReload calls Reload() after a small delay, collapsing intervening requests to do the same.
func (*Navigator) InitialFocus ¶
func (n *Navigator) InitialFocus()
InitialFocus causes the navigator to focus its initial component.
func (*Navigator) SelectedPaths ¶
SelectedPaths returns a list of paths that are currently selected.
type NavigatorNode ¶
type NavigatorNode struct {
// contains filtered or unexported fields
}
NavigatorNode holds a library, directory or file.
func NewDirectoryNode ¶
func NewDirectoryNode(nav *Navigator, lib *library.Library, dirPath string, parent *NavigatorNode) *NavigatorNode
NewDirectoryNode creates a new DirectoryNode.
func NewFileNode ¶
func NewFileNode(lib *library.Library, filePath string, parent *NavigatorNode) *NavigatorNode
NewFileNode creates a new FileNode.
func NewLibraryNode ¶
func NewLibraryNode(nav *Navigator, lib *library.Library) *NavigatorNode
NewLibraryNode creates a new library node.
func (*NavigatorNode) CanHaveChildren ¶
func (n *NavigatorNode) CanHaveChildren() bool
CanHaveChildren implements unison.TableRowData.
func (*NavigatorNode) CellDataForSort ¶
func (n *NavigatorNode) CellDataForSort(col int) string
CellDataForSort implements unison.TableRowData.
func (*NavigatorNode) Children ¶
func (n *NavigatorNode) Children() []*NavigatorNode
Children implements unison.TableRowData.
func (*NavigatorNode) CloneForTarget ¶
func (n *NavigatorNode) CloneForTarget(_ unison.Paneler, _ *NavigatorNode) *NavigatorNode
CloneForTarget implements unison.TableRowData. Not permitted at the moment.
func (*NavigatorNode) ColumnCell ¶
func (n *NavigatorNode) ColumnCell(_, col int, foreground, _ unison.Ink, _, _, _ bool) unison.Paneler
ColumnCell implements unison.TableRowData.
func (*NavigatorNode) IsOpen ¶
func (n *NavigatorNode) IsOpen() bool
IsOpen implements unison.TableRowData.
func (*NavigatorNode) Match ¶
func (n *NavigatorNode) Match(text string) bool
Match looks for the text in the node and return true if it is present. Note that calls to this method should always pass in text that has already been run through strings.ToLower().
func (*NavigatorNode) Parent ¶
func (n *NavigatorNode) Parent() *NavigatorNode
Parent implements unison.TableRowData.
func (*NavigatorNode) Path ¶
func (n *NavigatorNode) Path() string
Path returns the full path on disk for this node.
func (*NavigatorNode) Refresh ¶
func (n *NavigatorNode) Refresh()
Refresh the contents of this node.
func (*NavigatorNode) SetChildren ¶
func (n *NavigatorNode) SetChildren(_ []*NavigatorNode)
SetChildren implements unison.TableRowData.
func (*NavigatorNode) SetOpen ¶
func (n *NavigatorNode) SetOpen(open bool)
SetOpen implements unison.TableRowData.
func (*NavigatorNode) SetParent ¶
func (n *NavigatorNode) SetParent(_ *NavigatorNode)
SetParent implements unison.TableRowData.
func (*NavigatorNode) UUID ¶
func (n *NavigatorNode) UUID() uuid.UUID
UUID implements unison.TableRowData.
type Workspace ¶
type Workspace struct { Window *unison.Window TopDock *unison.Dock DocumentDock *DocumentDock }
Workspace holds the data necessary to track the Workspace.
func Activate ¶
func Activate(matcher func(d unison.Dockable) bool) (ws *Workspace, dc *unison.DockContainer, found bool)
Activate attempts to locate an existing dockable that 'matcher' returns true for. If found, it will have been activated and focused.
func Any ¶
func Any() *Workspace
Any first tries to return the workspace for the active window. If that fails, then it looks for any available workspace and returns that.
func FromWindow ¶
FromWindow returns the Workspace associated with the given Window, or nil.
func FromWindowOrAny ¶
FromWindowOrAny first calls FromWindow(wnd) and if that fails to find a Workspace, then calls Any().
func NewWorkspace ¶
NewWorkspace creates a new Workspace for the given Window.
func (*Workspace) CurrentlyFocusedDockContainer ¶
func (w *Workspace) CurrentlyFocusedDockContainer() *unison.DockContainer
CurrentlyFocusedDockContainer returns the currently focused DockContainer, if any.
func (*Workspace) LocateDockContainerForExtension ¶
func (w *Workspace) LocateDockContainerForExtension(ext ...string) *unison.DockContainer
LocateDockContainerForExtension searches for the first FileBackedDockable with the given extension and returns its DockContainer.
func (*Workspace) LocateFileBackedDockable ¶
func (w *Workspace) LocateFileBackedDockable(filePath string) FileBackedDockable
LocateFileBackedDockable searches for a FileBackedDockable with the given path.