ux

package
v5.28.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2024 License: MPL-2.0, MPL-2.0 Imports: 107 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NewSheetItemID = unison.UserBaseID + iota
	NewTemplateItemID
	NewCampaignItemID
	NewTraitsLibraryItemID
	NewTraitModifiersLibraryItemID
	NewEquipmentLibraryItemID
	NewEquipmentModifiersLibraryItemID
	NewNotesLibraryItemID
	NewSkillsLibraryItemID
	NewSpellsLibraryItemID
	NewMarkdownFileItemID
	OpenItemID
	CloseTabID
	RecentFilesMenuID
	SaveItemID
	SaveAsItemID
	ExportToMenuID
	ExportAsPDFItemID
	ExportAsWEBPItemID
	ExportAsPNGItemID
	ExportAsJPEGItemID
	PrintItemID
	UndoItemID
	RedoItemID
	DuplicateItemID
	ExportPortraitItemID
	ClearPortraitItemID
	ClearSourceItemID
	SyncWithSourceItemID
	JumpToSearchFilterItemID
	ConvertToContainerItemID
	ConvertToNonContainerItemID
	ToggleStateItemID
	IncrementItemID
	DecrementItemID
	IncrementUsesItemID
	DecrementUsesItemID
	IncrementSkillLevelItemID
	DecrementSkillLevelItemID
	IncrementTechLevelItemID
	DecrementTechLevelItemID
	IncrementEquipmentLevelItemID
	DecrementEquipmentLevelItemID
	SwapDefaultsItemID
	MoveToOtherEquipmentItemID
	MoveToCarriedEquipmentItemID
	ItemMenuID
	AddNaturalAttacksItemID
	OpenEditorItemID
	CopyToSheetItemID
	CopyToTemplateItemID
	ApplyTemplateItemID
	NewSheetFromTemplateItemID
	OpenOnePageReferenceItemID
	OpenEachPageReferenceItemID
	SettingsMenuID
	PerSheetSettingsItemID
	PerSheetAttributeSettingsItemID
	PerSheetBodyTypeSettingsItemID
	DefaultSheetSettingsItemID
	DefaultAttributeSettingsItemID
	DefaultBodyTypeSettingsItemID
	GeneralSettingsItemID
	WebSettingsItemID
	PageRefMappingsItemID
	ColorSettingsItemID
	FontSettingsItemID
	MenuKeySettingsItemID
	SponsorGCSDevelopmentItemID
	MakeDonationItemID
	UpdateAppStatusItemID
	CheckForAppUpdatesItemID
	ReleaseNotesItemID
	LicenseItemID
	WebSiteItemID
	MailingListItemID
	UserGuideItemID
	ViewMenuID
	ScaleDefaultItemID
	ScaleUpItemID
	ScaleDownItemID
	Scale25ItemID
	Scale50ItemID
	Scale75ItemID
	Scale100ItemID
	Scale200ItemID
	Scale300ItemID
	Scale400ItemID
	Scale500ItemID
	Scale600ItemID
	DockUnDockItemID

	FirstNonContainerMarker // Keep this block grouped together
	NewCarriedEquipmentItemID
	NewEquipmentModifierItemID
	NewNoteItemID
	NewOtherEquipmentItemID
	NewSkillItemID
	NewSpellItemID
	NewTraitItemID
	NewTraitModifierItemID
	LastNonContainerMarker

	FirstContainerMarker // Keep this block grouped together
	NewCarriedEquipmentContainerItemID
	NewEquipmentContainerModifierItemID
	NewNoteContainerItemID
	NewOtherEquipmentContainerItemID
	NewSkillContainerItemID
	NewSpellContainerItemID
	NewTraitContainerItemID
	NewTraitContainerModifierItemID
	LastContainerMarker

	FirstAlternateNonContainerMarker // Keep this block grouped together
	NewRitualMagicSpellItemID
	NewTechniqueItemID
	LastAlternateNonContainerMarker

	NewMeleeWeaponItemID
	NewRangedWeaponItemID

	OpenInWindowMenuID

	LibraryBaseItemID        = OpenInWindowMenuID + int(dgroup.LastGroup) + 2
	RecentFieldBaseItemID    = LibraryBaseItemID + 500
	ExportToTextBaseItemID   = RecentFieldBaseItemID + 500
	DeepSearchableMenuID     = ExportToTextBaseItemID + 500
	DeepSearchableBaseItemID = DeepSearchableMenuID + 1
)

Menu, Item & Action IDs

View Source
const (
	SheetDockableKind    = "sheet"
	TemplateDockableKind = "template"
	ListDockableKind     = "list"
)

Known dockable kinds

View Source
const AssociatedIDKey = "associated_id"

AssociatedIDKey is the key used with CloseID().

View Source
const ScaleDelta = 10

ScaleDelta is the delta used when adjusting the view scale incrementally.

View Source
const SkipDeepSync = "!deepsync"

SkipDeepSync is set on components that should not trigger a deep sync.

View Source
const TableProviderClientKey = "table-provider"

TableProviderClientKey is the key used to store the table provider with the table.

View Source
const WebSiteDomain = "gurpscharactersheet.com"

WebSiteDomain holds the web site domain for GCS.

View Source
const WorkingDirKey = "working_dir"

WorkingDirKey the client data key for setting the working directory for markdown and link resolution.

Variables

View Source
var (
	StartServer func(func(error))
	StopServer  func()
)

These need to be initialized by whatever instantiates the ux package, typically main.go. They are here to break the circular reference that would otherwise occur.

View Source
var PageRefKeyNameMappings = map[string]string{}/* 265 elements not displayed */

PageRefKeyNameMappings holds the known page reference key to PDF name mappings. This does not include open-ended, but known, mappings, such as those for Pyramid Magazine issues. nolint:misspell // Proper names

View Source
var PageTableColumnHeaderTheme = unison.LabelTheme{
	TextDecoration: unison.TextDecoration{
		Font:            fonts.PageLabelPrimary,
		OnBackgroundInk: colors.OnHeader,
	},
	Gap:    3,
	HAlign: align.Middle,
	VAlign: align.Middle,
	Side:   side.Left,
}

PageTableColumnHeaderTheme holds the theme values for PageTableColumnHeaders. Modifying this data will not alter existing PageTableColumnHeaders, but will alter any PageTableColumnHeaders created in the future.

View Source
var Workspace struct {
	Window       *unison.Window
	TopDock      *unison.Dock
	Navigator    *Navigator
	DocumentDock *DocumentDock
}

Workspace holds the data necessary to track the Workspace.

Functions

func Activate

func Activate(matcher func(d unison.Dockable) bool) bool

Activate attempts to locate an existing dockable that 'matcher' returns true for. Will return true if a suitable match was found. If found, it will have been activated and focused.

func ActivateDockable added in v5.10.0

func ActivateDockable(d unison.Dockable)

ActivateDockable activates the dockable, giving it focus.

func ActiveDockable

func ActiveDockable() unison.Dockable

ActiveDockable returns the currently active dockable in the active window.

func AddHelpToInfoPop

func AddHelpToInfoPop(target unison.Paneler, text string)

AddHelpToInfoPop adds one or more lines of help text to an InfoPop.

func AddKeyBindingInfoToInfoPop

func AddKeyBindingInfoToInfoPop(target unison.Paneler, keyBinding unison.KeyBinding, text string)

AddKeyBindingInfoToInfoPop adds information about a key binding to an InfoPop.

func AddScalingHelpToInfoPop

func AddScalingHelpToInfoPop(target unison.Paneler)

AddScalingHelpToInfoPop adds the help info about scaling to an InfoPop.

func AllDockables added in v5.14.0

func AllDockables() []unison.Dockable

AllDockables returns all Dockables, whether in the workspace or in a separate window.

func AllMatchingDockables added in v5.14.0

func AllMatchingDockables(matcher func(d unison.Dockable) bool) []unison.Dockable

AllMatchingDockables returns all Dockables that 'matcher' returns true for.

func AppDescription

func AppDescription() string

AppDescription returns a description of the software.

func AppUpdateResult

func AppUpdateResult() (title string, releases []gurps.Release, updating bool)

AppUpdateResult returns the current results of any outstanding app update check.

func ApplyTemplate

func ApplyTemplate(filePath string)

ApplyTemplate loads the specified template file and applies it to a sheet.

func AttemptCloseForDockable added in v5.10.0

func AttemptCloseForDockable(d unison.Dockable) bool

AttemptCloseForDockable attempts to close a dockable.

func CanApplyTemplate

func CanApplyTemplate() bool

CanApplyTemplate returns true if a template can be applied.

func CanConvertToContainer

func CanConvertToContainer[T ConvertableNodeTypes](table *unison.Table[*Node[T]]) bool

CanConvertToContainer returns true if the table's current selection has a row that can be converted to a container.

func CanConvertToNonContainer added in v5.5.3

func CanConvertToNonContainer[T ConvertableNodeTypes](table *unison.Table[*Node[T]]) bool

CanConvertToNonContainer returns true if the table's current selection has a row that can be converted to a non-container.

func CanOpenPageRef

func CanOpenPageRef[T gurps.NodeTypes](table *unison.Table[*Node[T]]) bool

CanOpenPageRef returns true if the current selection on the table has a page reference.

func CheckForAppUpdates

func CheckForAppUpdates()

CheckForAppUpdates initiates a fresh check for application updates.

func ClearInfoPop

func ClearInfoPop(target unison.Paneler)

ClearInfoPop clears the InfoPop data.

func ClearSourceFromSelection added in v5.24.0

func ClearSourceFromSelection[T gurps.NodeTypes](table *unison.Table[*Node[T]])

ClearSourceFromSelection clears the source from the selected nodes.

func CloseGroup

func CloseGroup(d unison.Dockable) bool

CloseGroup attempts to close any grouped Dockables associated with the given Dockable. Returns false if a dockable refused to close.

func CloseID added in v5.24.0

func CloseID(ids map[tid.TID]bool) bool

CloseID attempts to close any Dockables associated with the given UUIDs. Returns false if a dockable refused to close.

func ConvertToContainer

func ConvertToContainer[T ConvertableNodeTypes](owner Rebuildable, table *unison.Table[*Node[T]])

ConvertToContainer converts any selected rows to containers, if possible.

func ConvertToNonContainer added in v5.5.3

func ConvertToNonContainer[T ConvertableNodeTypes](owner Rebuildable, table *unison.Table[*Node[T]])

ConvertToNonContainer converts any selected rows to non-containers, if possible.

func CopyRowsTo

func CopyRowsTo[T gurps.NodeTypes](table *unison.Table[*Node[T]], rows []*Node[T], postProcessor func(rows []*Node[T]), recordUndo bool)

CopyRowsTo copies the provided rows to the target table.

func CurrentlyFocusedDockContainer added in v5.10.0

func CurrentlyFocusedDockContainer() *unison.DockContainer

CurrentlyFocusedDockContainer returns the currently focused DockContainer, if any.

func DeepSync

func DeepSync(panel unison.Paneler)

DeepSync does a depth-first traversal of the panel and all of its descendents and calls Sync() on any Syncer objects it finds.

func DefaultDockContainer added in v5.10.0

func DefaultDockContainer() *unison.DockContainer

DefaultDockContainer returns the currently focused DockContainer, if possible. If not, returns the first DockContainer that can be found.

func DeleteSelection

func DeleteSelection[T gurps.NodeTypes](table *unison.Table[*Node[T]], recordUndo bool)

DeleteSelection removes the selected nodes from the table.

func DetermineDataOwnerProvider added in v5.24.0

func DetermineDataOwnerProvider(target unison.Paneler) gurps.DataOwnerProvider

DetermineDataOwnerProvider returns the DataOwnerProvider for the given target.

func DisableSorting added in v5.7.0

func DisableSorting[T unison.TableRowConstraint[T]](headers []unison.TableColumnHeader[T]) []unison.TableColumnHeader[T]

DisableSorting disables the sorting capability in the table headers.

func DisplayCalculator added in v5.6.0

func DisplayCalculator(sheet *Sheet)

DisplayCalculator displays the calculator for the given Sheet.

func DisplayNewDockable

func DisplayNewDockable(dockable unison.Dockable)

DisplayNewDockable adds the Dockable to the dock and gives it the focus.

func DockContainerForGroup

func DockContainerForGroup(dock *unison.Dock, group dgroup.Group) *unison.DockContainer

DockContainerForGroup returns the first DockContainer which has a Dockable with the given group, if any.

func DockContainerHasGroup

func DockContainerHasGroup(dc *unison.DockContainer, group dgroup.Group) bool

DockContainerHasGroup returns true if the DockContainer contains at least one Dockable associated with the given group. May pass nil for the dc.

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 DuplicateSelection

func DuplicateSelection[T gurps.NodeTypes](table *unison.Table[*Node[T]])

DuplicateSelection duplicates the selected nodes in the table.

func EditEquipment

func EditEquipment(owner Rebuildable, equipment *gurps.Equipment, carried bool)

EditEquipment displays the editor for equipment.

func EditEquipmentModifier

func EditEquipmentModifier(owner Rebuildable, modifier *gurps.EquipmentModifier)

EditEquipmentModifier displays the editor for an equipment modifier.

func EditNote

func EditNote(owner Rebuildable, note *gurps.Note)

EditNote displays the editor for a note.

func EditSkill

func EditSkill(owner Rebuildable, skill *gurps.Skill)

EditSkill displays the editor for an skill.

func EditSpell

func EditSpell(owner Rebuildable, spell *gurps.Spell)

EditSpell displays the editor for an spell.

func EditTrait

func EditTrait(owner Rebuildable, t *gurps.Trait)

EditTrait displays the editor for a trait.

func EditTraitModifier

func EditTraitModifier(owner Rebuildable, modifier *gurps.TraitModifier)

EditTraitModifier displays the editor for a trait modifier.

func EditWeapon

func EditWeapon(owner Rebuildable, w *gurps.Weapon)

EditWeapon displays the editor for a weapon.

func ExtractNodeDataFromList

func ExtractNodeDataFromList[T gurps.NodeTypes](list []*Node[T]) []T

ExtractNodeDataFromList returns the underlying node data.

func ExtractPageReferences

func ExtractPageReferences(s string) []string

ExtractPageReferences extracts any page references from the string.

func FindRowIndexByID

func FindRowIndexByID[T gurps.NodeTypes](table *unison.Table[*Node[T]], id tid.TID) int

FindRowIndexByID returns the row index of the row with the given ID in the given table.

func FocusFirstContent

func FocusFirstContent(toolbar, content unison.Paneler)

FocusFirstContent attempts to focus the first non-button widget in the content. Failing that, tries to focus the first focusable widget in the content. Failing that, tries to focus the first focusable widget in the toolbar.

func HandleLink(p unison.Paneler, target string)

HandleLink will try to open http, https, and md links, as well as resolve page references.

func HasSelectionAndNotFiltered added in v5.24.0

func HasSelectionAndNotFiltered[T gurps.NodeTypes](table *unison.Table[*Node[T]]) bool

HasSelectionAndNotFiltered returns true if the table has a selection and is not filtered.

func InitWorkspace added in v5.10.0

func InitWorkspace(wnd *unison.Window)

InitWorkspace initializes the Workspace singleton.

func InsertCmdContextMenuItem

func InsertCmdContextMenuItem[T gurps.NodeTypes](table *unison.Table[*Node[T]], title string, cmdID int, id *int, cm unison.Menu)

InsertCmdContextMenuItem inserts a context menu item for the given command.

func InsertItems

func InsertItems[T gurps.NodeTypes](owner Rebuildable, table *unison.Table[*Node[T]], topList func() []T, setTopList func([]T), rowData func(table *unison.Table[*Node[T]]) []*Node[T], items ...T)

InsertItems into a table.

func InstallContainerConversionHandlers added in v5.5.3

func InstallContainerConversionHandlers[T ConvertableNodeTypes](paneler unison.Paneler, owner Rebuildable, table *unison.Table[*Node[T]])

InstallContainerConversionHandlers installs the to & from container conversion handlers.

func InstallDockUndockCmd added in v5.10.0

func InstallDockUndockCmd(dockable unison.Dockable)

InstallDockUndockCmd installs the dock or undock command handler.

func InstallTableDropSupport

func InstallTableDropSupport[T gurps.NodeTypes](table *unison.Table[*Node[T]], provider TableProvider[T])

InstallTableDropSupport installs our standard drop support on a table.

func IsDockableInWorkspace added in v5.10.0

func IsDockableInWorkspace(d unison.Dockable) bool

IsDockableInWorkspace returns true if the Dockable is inside the Workspace as opposed to an external window.

func LoadLanguageSetting added in v5.6.0

func LoadLanguageSetting()

LoadLanguageSetting loads the language setting from disk, if present, and applies it.

func LocateDockContainerForExtension added in v5.10.0

func LocateDockContainerForExtension(ext ...string) *unison.DockContainer

LocateDockContainerForExtension searches for the first FileBackedDockable with the given extension and returns its DockContainer.

func MarkForLayoutWithinDockable

func MarkForLayoutWithinDockable(panel unison.Paneler)

MarkForLayoutWithinDockable sets the NeedsLayout flag on the provided panel and all of its parents up to the first Dockable.

func MarkModified

func MarkModified(panel unison.Paneler)

MarkModified looks for a ModifiableRoot, starting at the panel. If found, it then called MarkModified() on it.

func MarkRootAncestorForLayoutRecursively added in v5.10.0

func MarkRootAncestorForLayoutRecursively(p unison.Paneler)

MarkRootAncestorForLayoutRecursively looks for a parent DockContainer (and, failing to find one of those, a parent Dockable) and marks it and all of its descendents as needing to be laid out.

func MayAttemptCloseOfGroup

func MayAttemptCloseOfGroup(d unison.Dockable) bool

MayAttemptCloseOfGroup returns true if the grouped Dockables associated with the given dockable may be closed.

func MoveDockableToWindow added in v5.10.0

func MoveDockableToWindow(dockable unison.Dockable) (*unison.Window, error)

MoveDockableToWindow closes the tab a dockable is in within the workspace and opens a windows for it instead. If already in its own window, does nothing.

func MoveDockableToWorkspace added in v5.10.0

func MoveDockableToWorkspace(dockable unison.Dockable)

MoveDockableToWorkspace closes the window a dockable is in and places it within the workspace. If already in the workspace, does nothing.

func NewCampaignFromFile added in v5.16.2

func NewCampaignFromFile(filePath string) (unison.Dockable, error)

NewCampaignFromFile loads a GURPS campaign file and creates a new unison.Dockable for it.

func NewDefaultInfoPop

func NewDefaultInfoPop() *unison.Label

NewDefaultInfoPop creates a new InfoPop with the message about mouse wheel scaling.

func NewEditorListHeader

func NewEditorListHeader[T gurps.NodeTypes](title, tooltip string, forPage bool) unison.TableColumnHeader[*Node[T]]

NewEditorListHeader creates a new list header for an editor.

func NewEditorListSVGHeader

func NewEditorListSVGHeader[T gurps.NodeTypes](icon *unison.SVG, tooltip string, forPage bool) unison.TableColumnHeader[*Node[T]]

NewEditorListSVGHeader creates a new list header with an SVG image as its content rather than text.

func NewEditorListSVGPairHeader

func NewEditorListSVGPairHeader[T gurps.NodeTypes](leftSVG, rightSVG *unison.SVG, tooltip string, forPage bool) unison.TableColumnHeader[*Node[T]]

NewEditorListSVGPairHeader creates a new list header with a pair of SVG images as its content rather than text.

func NewEquipmentModifierTableDockableFromFile

func NewEquipmentModifierTableDockableFromFile(filePath string) (unison.Dockable, error)

NewEquipmentModifierTableDockableFromFile loads a list of equipment modifiers from a file and creates a new unison.Dockable for them.

func NewEquipmentTableDockableFromFile

func NewEquipmentTableDockableFromFile(filePath string) (unison.Dockable, error)

NewEquipmentTableDockableFromFile loads a list of equipment from a file and creates a new unison.Dockable for them.

func NewFieldInteriorLeadingLabel

func NewFieldInteriorLeadingLabel(text string, small bool) *unison.Label

NewFieldInteriorLeadingLabel creates a new label appropriate for the label in the interior of a row before a field.

func NewFieldLeadingLabel

func NewFieldLeadingLabel(text string, small bool) *unison.Label

NewFieldLeadingLabel creates a new label appropriate for the first label in a row before a field.

func NewFieldTrailingLabel

func NewFieldTrailingLabel(text string, small bool) *unison.Label

NewFieldTrailingLabel creates a new label appropriate for after a field.

func NewImageDockable

func NewImageDockable(filePath string) (unison.Dockable, error)

NewImageDockable creates a new unison.Dockable for image files.

func NewInfoPop

func NewInfoPop() *unison.Label

NewInfoPop creates a new InfoPop.

func NewMarkdownDockable

func NewMarkdownDockable(filePath string, allowEditing, startInEditMode bool) (unison.Dockable, error)

NewMarkdownDockable creates a new unison.Dockable for markdown files.

func NewMarkdownDockableWithContent

func NewMarkdownDockableWithContent(title, content string, allowEditing, startInEditMode bool) (unison.Dockable, error)

NewMarkdownDockableWithContent creates a new unison.Dockable for markdown content.

func NewNodeTable

func NewNodeTable[T gurps.NodeTypes](provider TableProvider[T], font unison.Font) (header *unison.TableHeader[*Node[T]], table *unison.Table[*Node[T]])

NewNodeTable creates a new node table of the specified type, returning the header and table. Pass nil for 'font' if this should be a standalone top-level table for a dockable. Otherwise, pass in the typical font used for a cell.

func NewNoteTableDockableFromFile

func NewNoteTableDockableFromFile(filePath string) (unison.Dockable, error)

NewNoteTableDockableFromFile loads a list of notes from a file and creates a new unison.Dockable for them.

func NewPDFDockable

func NewPDFDockable(filePath string, initialPage int) (unison.Dockable, error)

NewPDFDockable creates a new unison.Dockable for PDFRenderer files.

func NewPageHeader

func NewPageHeader(title string, hSpan int) *unison.Label

NewPageHeader creates a new center-aligned header for a sheet page.

func NewPageInternalHeader

func NewPageInternalHeader(title string, span int) unison.Paneler

NewPageInternalHeader creates a new center-aligned internal header for a sheet page.

func NewPageLabel

func NewPageLabel(title string) *unison.Label

NewPageLabel creates a new start-aligned field label for a sheet page.

func NewPageLabelCenter

func NewPageLabelCenter(title string) *unison.Label

NewPageLabelCenter creates a new center-aligned field label for a sheet page.

func NewPageLabelEnd

func NewPageLabelEnd(title string) *unison.Label

NewPageLabelEnd creates a new end-aligned field label for a sheet page.

func NewPageLabelWithInk added in v5.22.0

func NewPageLabelWithInk(title string, ink unison.Ink) *unison.Label

NewPageLabelWithInk creates a new start-aligned field label for a sheet page with the given Ink.

func NewPageLabelWithRandomizer

func NewPageLabelWithRandomizer(title, tooltip string, clickCallback func()) *unison.Panel

NewPageLabelWithRandomizer creates a new end-aligned field label for a sheet page that includes a randomization button.

func NewSVGButtonForFont added in v5.11.0

func NewSVGButtonForFont(svg *unison.SVG, font unison.Font, sizeAdjust float32) *unison.Button

NewSVGButtonForFont creates a new SVG button with the given font and a size adjustment.

func NewSearchField

func NewSearchField(watermark string, modifiedCallback func(before, after *unison.FieldState)) *unison.Field

NewSearchField creates a new search widget.

func NewSheetFromFile

func NewSheetFromFile(filePath string) (unison.Dockable, error)

NewSheetFromFile loads a GURPS character sheet file and creates a new unison.Dockable for it.

func NewSheetFromTemplate added in v5.11.0

func NewSheetFromTemplate(filePath string)

NewSheetFromTemplate loads the specified template file and creates a new character sheet from it.

func NewSkillTableDockableFromFile

func NewSkillTableDockableFromFile(filePath string) (unison.Dockable, error)

NewSkillTableDockableFromFile loads a list of skills from a file and creates a new unison.Dockable for them.

func NewSpellTableDockableFromFile

func NewSpellTableDockableFromFile(filePath string) (unison.Dockable, error)

NewSpellTableDockableFromFile loads a list of spells from a file and creates a new unison.Dockable for them.

func NewTableColumnHeader added in v5.22.0

func NewTableColumnHeader[T gurps.NodeTypes](title, tooltip string) *unison.DefaultTableColumnHeader[*Node[T]]

NewTableColumnHeader creates a new table column header panel with the given title in small caps.

func NewTagFilterPopup added in v5.11.0

func NewTagFilterPopup(tagProvider TagProvider) *unison.PopupMenu[string]

NewTagFilterPopup creates a new tag filter popup.

func NewTemplateFromFile

func NewTemplateFromFile(filePath string) (unison.Dockable, error)

NewTemplateFromFile loads a GURPS template file and creates a new unison.Dockable for it.

func NewToolbarSeparator

func NewToolbarSeparator() *unison.Separator

NewToolbarSeparator creates a new vertical separator for the toolbar.

func NewTraitModifierTableDockableFromFile

func NewTraitModifierTableDockableFromFile(filePath string) (unison.Dockable, error)

NewTraitModifierTableDockableFromFile loads a list of trait modifiers from a file and creates a new unison.Dockable for them.

func NewTraitTableDockableFromFile

func NewTraitTableDockableFromFile(filePath string) (unison.Dockable, error)

NewTraitTableDockableFromFile loads a list of traits from a file and creates a new unison.Dockable for them.

func NewWindowForDockable added in v5.10.0

func NewWindowForDockable(dockable unison.Dockable, group dgroup.Group) (*unison.Window, error)

NewWindowForDockable creates a new window and places a Dockable inside it.

func NotifyOfAppUpdate

func NotifyOfAppUpdate()

NotifyOfAppUpdate notifies the user of the available update.

func OpenEachPageRef

func OpenEachPageRef[T gurps.NodeTypes](table *unison.Table[*Node[T]])

OpenEachPageRef opens the all page references on each selected item in the table.

func OpenEditor

func OpenEditor[T gurps.NodeTypes](table *unison.Table[*Node[T]], edit func(item T))

OpenEditor opens an editor for each selected row in the table.

func OpenFile

func OpenFile(filePath string, initialPage int) (dockable unison.Dockable, wasOpen bool)

OpenFile attempts to open the given file path.

func OpenFiles

func OpenFiles(filePaths []string)

OpenFiles attempts to open the given file paths.

func OpenPageRef

func OpenPageRef[T gurps.NodeTypes](table *unison.Table[*Node[T]])

OpenPageRef opens the first page reference on each selected item in the table.

func OpenPageReference

func OpenPageReference(ref, highlight string, promptContext map[string]bool) bool

OpenPageReference opens the given page reference. Returns true if the the user asked to cancel further processing.

func PageRefKeyToName

func PageRefKeyToName(key string) string

PageRefKeyToName returns a PDF name for the given mapping, if known.

func PlaceInDock

func PlaceInDock(dockable unison.Dockable, group dgroup.Group, forceIntoDock bool)

PlaceInDock places the Dockable into the workspace document dock, grouped with the provided group, if that group is present.

func ProcessModifiers

func ProcessModifiers[T gurps.NodeTypes](owner unison.Paneler, rows []T)

ProcessModifiers processes the rows for modifiers that can be toggled on or off.

func ProcessModifiersForSelection

func ProcessModifiersForSelection[T gurps.NodeTypes](table *unison.Table[*Node[T]])

ProcessModifiersForSelection processes the selected rows for modifiers that can be toggled on or off.

func ProcessNameables

func ProcessNameables[T gurps.NodeTypes](owner unison.Paneler, rows []T)

ProcessNameables processes the rows and their children for any nameables.

func ProcessNameablesForSelection

func ProcessNameablesForSelection[T gurps.NodeTypes](table *unison.Table[*Node[T]])

ProcessNameablesForSelection processes the selected rows and their children for any nameables.

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 RefreshPageRefMappingsView

func RefreshPageRefMappingsView()

RefreshPageRefMappingsView causes the Page References Mappings view to be refreshed if it is open.

func RegisterExternalFileTypes

func RegisterExternalFileTypes()

RegisterExternalFileTypes registers the external file types.

func RegisterGCSFileTypes

func RegisterGCSFileTypes()

RegisterGCSFileTypes registers the GCS file types.

func RegisterKnownFileTypes

func RegisterKnownFileTypes()

RegisterKnownFileTypes registers the known files 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 SelectedTags added in v5.11.0

func SelectedTags(popup *unison.PopupMenu[string]) []string

SelectedTags returns the set of tags currently selected in a tag filter popup.

func SetCheckBoxState

func SetCheckBoxState(checkbox *CheckBox, checked bool)

SetCheckBoxState sets the checkbox state based on the value of checked.

func SetDataOwnerProvider added in v5.24.0

func SetDataOwnerProvider(target unison.Paneler, provider gurps.DataOwnerProvider)

SetDataOwnerProvider sets the DataOwnerProvider into the client data of the target.

func SetFieldValue

func SetFieldValue(field *unison.Field, value string)

SetFieldValue sets the value of this field, marking the field and all of its parents as needing to be laid out again if the value is not what is currently in the field.

func SetParents

func SetParents[T gurps.NodeTypes](items []T, parent T)

SetParents of each item.

func SetTextAndMarkModified

func SetTextAndMarkModified(field *unison.Field, text string)

SetTextAndMarkModified sets the field to the given text, selects it, requests focus, then calls MarkModified().

func SetupMenuBar

func SetupMenuBar(wnd *unison.Window)

SetupMenuBar the menu bar for the window.

func ShowAbout

func ShowAbout(_ unison.MenuItem)

ShowAbout displays the about box.

func ShowAttributeSettings

func ShowAttributeSettings(owner EntityPanel)

ShowAttributeSettings the Attribute Settings. Pass in nil to edit the defaults or a sheet to edit the sheet's.

func ShowBodySettings

func ShowBodySettings(owner EntityPanel)

ShowBodySettings the Body Settings. Pass in nil to edit the defaults or a sheet to edit the sheet's.

func ShowColorSettings

func ShowColorSettings()

ShowColorSettings shows the Color settings.

func ShowFontSettings

func ShowFontSettings()

ShowFontSettings shows the Font settings.

func ShowGeneralSettings

func ShowGeneralSettings()

ShowGeneralSettings the General Settings window.

func ShowLibrarySettings

func ShowLibrarySettings(lib *gurps.Library)

ShowLibrarySettings the Library Settings view for a specific library.

func ShowMenuKeySettings

func ShowMenuKeySettings()

ShowMenuKeySettings shows the Menu Key settings.

func ShowNameablesDialog added in v5.25.0

func ShowNameablesDialog(titles []string, nameables []map[string]string) bool

ShowNameablesDialog shows a dialog for editing nameables.

func ShowPageRefMappings

func ShowPageRefMappings()

ShowPageRefMappings shows the Page Reference Mappings.

func ShowReadOnlyMarkdown added in v5.5.1

func ShowReadOnlyMarkdown(title, content string)

ShowReadOnlyMarkdown attempts to show the given markdown content in a dockable.

func ShowSheetSettings

func ShowSheetSettings(owner EntityPanel)

ShowSheetSettings the Sheet Settings. Pass in nil to edit the defaults or a sheet to edit the sheet's.

func ShowWebSettings added in v5.21.0

func ShowWebSettings()

ShowWebSettings the Web Settings window.

func Start

func Start(files []string, afterStartup func())

Start the UI.

func SyncWithSourceForSelection added in v5.24.0

func SyncWithSourceForSelection[T gurps.NodeTypes](table *unison.Table[*Node[T]])

SyncWithSourceForSelection synchronizes the selected nodes with their source.

func UpdateCalculator added in v5.6.0

func UpdateCalculator(sheet *Sheet)

UpdateCalculator for the given owner.

func UpdateTitleForDockable added in v5.10.0

func UpdateTitleForDockable(d unison.Dockable)

UpdateTitleForDockable updates the title for the given Dockable, whether it is within the workspace or a separate window.

func WorkingDirProvider added in v5.13.0

func WorkingDirProvider(p unison.Paneler) string

WorkingDirProvider extracts a working dir for the given panel, if possible, otherwise returns ".".

func WrapWithSpan

func WrapWithSpan(span int, children ...unison.Paneler) *unison.Panel

WrapWithSpan wraps a number of children with a single panel that request to fill in span number of columns.

Types

type AltDropSupport

type AltDropSupport struct {
	DragKey string
	Drop    func(rowIndex int, data any)
}

AltDropSupport holds handlers for supporting an alternate drop type that drops onto a specific row, rather than moving or adding rows.

type ApplyTemplateUndoEditData

type ApplyTemplateUndoEditData struct {
	// contains filtered or unexported fields
}

ApplyTemplateUndoEditData holds the sheet table data for an undo.

func NewApplyTemplateUndoEditData

func NewApplyTemplateUndoEditData(sheet *Sheet) (*ApplyTemplateUndoEditData, error)

NewApplyTemplateUndoEditData creates a new undo that preserves the current sheet table data.

func (*ApplyTemplateUndoEditData) Apply

func (a *ApplyTemplateUndoEditData) Apply()

Apply the data.

type AttrPanel added in v5.22.0

type AttrPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

AttrPanel holds the contents of an attributes block on the sheet.

func NewPointPoolsPanel

func NewPointPoolsPanel(entity *gurps.Entity, targetMgr *TargetMgr) *AttrPanel

NewPointPoolsPanel creates a new point pools panel.

func NewPrimaryAttrPanel

func NewPrimaryAttrPanel(entity *gurps.Entity, targetMgr *TargetMgr) *AttrPanel

NewPrimaryAttrPanel creates a new primary attributes panel.

func NewSecondaryAttrPanel

func NewSecondaryAttrPanel(entity *gurps.Entity, targetMgr *TargetMgr) *AttrPanel

NewSecondaryAttrPanel creates a new secondary attributes panel.

func (*AttrPanel) Sync added in v5.22.0

func (a *AttrPanel) Sync()

Sync the panel to the current data.

type BodyPanel

type BodyPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

BodyPanel holds the contents of the body block on the sheet.

func NewBodyPanel

func NewBodyPanel(entity *gurps.Entity, targetMgr *TargetMgr) *BodyPanel

NewBodyPanel creates a new body panel.

func (*BodyPanel) Sync

func (p *BodyPanel) Sync()

Sync the panel to the current data.

type Calculator added in v5.6.0

type Calculator struct {
	unison.Panel
	// contains filtered or unexported fields
}

Calculator provides calculations for various physical tasks, such as jumping.

func (*Calculator) AttemptClose added in v5.6.0

func (c *Calculator) AttemptClose() bool

AttemptClose implements GroupedCloser

func (*Calculator) CloseWithGroup added in v5.6.0

func (c *Calculator) CloseWithGroup(other unison.Paneler) bool

CloseWithGroup implements GroupedCloser

func (*Calculator) MayAttemptClose added in v5.6.0

func (c *Calculator) MayAttemptClose() bool

MayAttemptClose implements GroupedCloser

func (*Calculator) Modified added in v5.6.0

func (c *Calculator) Modified() bool

Modified implements unison.Dockable

func (*Calculator) String added in v5.6.0

func (c *Calculator) String() string

func (*Calculator) Title added in v5.6.0

func (c *Calculator) Title() string

Title implements unison.Dockable

func (*Calculator) TitleIcon added in v5.6.0

func (c *Calculator) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements unison.Dockable

func (*Calculator) Tooltip added in v5.6.0

func (c *Calculator) Tooltip() string

Tooltip implements unison.Dockable

func (*Calculator) UndoManager added in v5.6.0

func (c *Calculator) UndoManager() *unison.UndoManager

UndoManager implements unison.UndoManagerProvider

type Campaign added in v5.16.2

type Campaign struct {
	unison.Panel
	// contains filtered or unexported fields
}

Campaign holds the view for a GURPS campaign.

func NewCampaign added in v5.16.2

func NewCampaign(filePath string, campaign *gurps.Campaign) *Campaign

NewCampaign creates a new unison.Dockable for GURPS campaign files.

func (*Campaign) AttemptClose added in v5.16.2

func (c *Campaign) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*Campaign) BackingFilePath added in v5.16.2

func (c *Campaign) BackingFilePath() string

BackingFilePath implements workspace.FileBackedDockable

func (*Campaign) MayAttemptClose added in v5.16.2

func (c *Campaign) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*Campaign) Modified added in v5.16.2

func (c *Campaign) Modified() bool

Modified implements workspace.FileBackedDockable

func (*Campaign) SetBackingFilePath added in v5.16.2

func (c *Campaign) SetBackingFilePath(p string)

SetBackingFilePath implements workspace.FileBackedDockable

func (*Campaign) String added in v5.16.2

func (c *Campaign) String() string

func (*Campaign) Title added in v5.16.2

func (c *Campaign) Title() string

Title implements workspace.FileBackedDockable

func (*Campaign) TitleIcon added in v5.16.2

func (c *Campaign) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements workspace.FileBackedDockable

func (*Campaign) Tooltip added in v5.16.2

func (c *Campaign) Tooltip() string

Tooltip implements workspace.FileBackedDockable

type CellCache

type CellCache struct {
	Panel unison.Paneler
	Data  gurps.CellData
	Width float32
}

CellCache holds data for a table row's cell to reduce the need to constantly recreate them.

func (*CellCache) Matches

func (c *CellCache) Matches(width float32, data *gurps.CellData) bool

Matches returns true if the provided width and data match the current contents.

type CheckBox

type CheckBox struct {
	*unison.CheckBox

	OnSet func()
	// contains filtered or unexported fields
}

CheckBox provides a checkbox that works with undo.

func NewCheckBox

func NewCheckBox(targetMgr *TargetMgr, targetKey, title string, get func() check.Enum, set func(check.Enum)) *CheckBox

NewCheckBox creates a new check box.

func (*CheckBox) Sync

func (c *CheckBox) Sync()

Sync the checkbox to the current value.

type ContextMenuItem

type ContextMenuItem struct {
	Title string
	ID    int
}

ContextMenuItem holds the title and ID of a context menu item that is derived from a command ID.

func AppendDefaultContextMenuItems added in v5.6.0

func AppendDefaultContextMenuItems(list []ContextMenuItem) []ContextMenuItem

AppendDefaultContextMenuItems appends the default set of context menu items for lists.

type ConvertableNodeTypes added in v5.5.3

type ConvertableNodeTypes interface {
	*gurps.Equipment | *gurps.Note
	fmt.Stringer
	nameable.Applier
	Container() bool
	CanConvertToFromContainer() bool
	ConvertToContainer()
	ConvertToNonContainer()
}

ConvertableNodeTypes defines the types that the container conversion can work on.

type DamagePanel

type DamagePanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

DamagePanel holds the contents of the damage block on the sheet.

func NewDamagePanel

func NewDamagePanel(entity *gurps.Entity) *DamagePanel

NewDamagePanel creates a new damage panel.

type DecimalField

type DecimalField = NumericField[fxp.Int]

DecimalField is field that holds a decimal (fixed-point) number.

func NewDecimalField

func NewDecimalField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() fxp.Int, set func(fxp.Int), minValue, maxValue fxp.Int, forceSign, noMinWidth bool) *DecimalField

NewDecimalField creates a new field that holds a fixed-point number.

func NewDecimalPageField

func NewDecimalPageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() fxp.Int, set func(fxp.Int), minValue, maxValue fxp.Int, noMinWidth bool) *DecimalField

NewDecimalPageField creates a new numeric text entry field for a sheet page.

type DescriptionPanel

type DescriptionPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

DescriptionPanel holds the contents of the description block on the sheet.

func NewDescriptionPanel

func NewDescriptionPanel(entity *gurps.Entity, targetMgr *TargetMgr) *DescriptionPanel

NewDescriptionPanel creates a new description panel.

type DocumentDock

type DocumentDock struct {
	*unison.Dock
}

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) Title

func (d *DocumentDock) Title() string

Title 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 DragHandle

type DragHandle struct {
	unison.Panel
	// contains filtered or unexported fields
}

DragHandle provides a simple draggable handle.

func NewDragHandle

func NewDragHandle(data map[string]any) *DragHandle

NewDragHandle creates a new draggable handle widget.

type DrawableSVGPair

type DrawableSVGPair struct {
	Left  *unison.SVG
	Right *unison.SVG
	Size  unison.Size
}

DrawableSVGPair draws two SVG's side-by-side.

func (*DrawableSVGPair) DrawInRect

func (s *DrawableSVGPair) DrawInRect(canvas *unison.Canvas, rect unison.Rect, _ *unison.SamplingOptions, paint *unison.Paint)

DrawInRect implements the Drawable interface.

func (*DrawableSVGPair) LogicalSize

func (s *DrawableSVGPair) LogicalSize() unison.Size

LogicalSize implements the Drawable interface.

type EncumbrancePanel

type EncumbrancePanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

EncumbrancePanel holds the contents of the encumbrance block on the sheet.

func NewEncumbrancePanel

func NewEncumbrancePanel(entity *gurps.Entity) *EncumbrancePanel

NewEncumbrancePanel creates a new encumbrance panel.

type EntityPanel

type EntityPanel interface {
	unison.Paneler
	Entity() *gurps.Entity
}

EntityPanel defines methods for a panel that can hold an entity.

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.

func LocateFileBackedDockable added in v5.10.0

func LocateFileBackedDockable(filePath string) FileBackedDockable

LocateFileBackedDockable searches for a FileBackedDockable with the given path.

type FocusRef

type FocusRef struct {
	Key        string
	SelStart   int
	SelEnd     int
	Selectable bool
}

FocusRef holds a focus reference.

type GroupedCloser

type GroupedCloser interface {
	unison.TabCloser
	CloseWithGroup(other unison.Paneler) bool
}

GroupedCloser defines the methods required of a tab that wishes to be closed when another tab is closed.

type IdentityPanel

type IdentityPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

IdentityPanel holds the contents of the identity block on the sheet.

func NewIdentityPanel

func NewIdentityPanel(entity *gurps.Entity, targetMgr *TargetMgr) *IdentityPanel

NewIdentityPanel creates a new identity panel.

type ImageDockable

type ImageDockable struct {
	unison.Panel
	// contains filtered or unexported fields
}

ImageDockable holds the view for an image file.

func (*ImageDockable) AttemptClose

func (d *ImageDockable) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*ImageDockable) BackingFilePath

func (d *ImageDockable) BackingFilePath() string

BackingFilePath implements workspace.FileBackedDockable

func (*ImageDockable) MayAttemptClose

func (d *ImageDockable) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*ImageDockable) Modified

func (d *ImageDockable) Modified() bool

Modified implements workspace.FileBackedDockable

func (*ImageDockable) SetBackingFilePath

func (d *ImageDockable) SetBackingFilePath(p string)

SetBackingFilePath implements workspace.FileBackedDockable

func (*ImageDockable) Title

func (d *ImageDockable) Title() string

Title implements workspace.FileBackedDockable

func (*ImageDockable) TitleIcon

func (d *ImageDockable) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements workspace.FileBackedDockable

func (*ImageDockable) Tooltip

func (d *ImageDockable) Tooltip() string

Tooltip implements workspace.FileBackedDockable

type IntegerField

type IntegerField = NumericField[int]

IntegerField is field that holds an integer.

func NewIntegerField

func NewIntegerField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() int, set func(int), minValue, maxValue int, forceSign, noMinWidth bool) *IntegerField

NewIntegerField creates a new field that holds an int.

func NewIntegerPageField

func NewIntegerPageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() int, set func(int), minValue, maxValue int, showSign, noMinWidth bool) *IntegerField

NewIntegerPageField creates a new integer entry field for a sheet page.

type ItemVariant

type ItemVariant int

ItemVariant holds the type of item variant to create.

const (
	NoItemVariant ItemVariant = iota
	ContainerItemVariant
	AlternateItemVariant
)

Possible values for ItemVariant.

type LengthField

type LengthField = NumericField[fxp.Length]

LengthField is field that holds a length value.

func NewHeightPageField

func NewHeightPageField(targetMgr *TargetMgr, targetKey, undoTitle string, entity *gurps.Entity, get func() fxp.Length, set func(fxp.Length), minValue, maxValue fxp.Length, noMinWidth bool) *LengthField

NewHeightPageField creates a new height entry field for a sheet page.

func NewLengthField

func NewLengthField(targetMgr *TargetMgr, targetKey, undoTitle string, entity *gurps.Entity, get func() fxp.Length, set func(fxp.Length), minValue, maxValue fxp.Length, noMinWidth bool) *LengthField

NewLengthField creates a new field that holds a fixed-point number.

type LiftingPanel

type LiftingPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

LiftingPanel holds the contents of the lifting block on the sheet.

func NewLiftingPanel

func NewLiftingPanel(entity *gurps.Entity) *LiftingPanel

NewLiftingPanel creates a new lifting panel.

type MarkdownDockable

type MarkdownDockable struct {
	unison.Panel
	// contains filtered or unexported fields
}

MarkdownDockable holds the view for an image file.

func (*MarkdownDockable) AttemptClose

func (d *MarkdownDockable) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*MarkdownDockable) BackingFilePath

func (d *MarkdownDockable) BackingFilePath() string

BackingFilePath implements workspace.FileBackedDockable

func (*MarkdownDockable) MarkModified added in v5.5.0

func (d *MarkdownDockable) MarkModified(_ unison.Paneler)

MarkModified implements ModifiableRoot.

func (*MarkdownDockable) MayAttemptClose

func (d *MarkdownDockable) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*MarkdownDockable) Modified

func (d *MarkdownDockable) Modified() bool

Modified implements workspace.FileBackedDockable

func (*MarkdownDockable) SetBackingFilePath

func (d *MarkdownDockable) SetBackingFilePath(p string)

SetBackingFilePath implements workspace.FileBackedDockable

func (*MarkdownDockable) Title

func (d *MarkdownDockable) Title() string

Title implements workspace.FileBackedDockable

func (*MarkdownDockable) TitleIcon

func (d *MarkdownDockable) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements workspace.FileBackedDockable

func (*MarkdownDockable) Tooltip

func (d *MarkdownDockable) Tooltip() string

Tooltip implements workspace.FileBackedDockable

func (*MarkdownDockable) UndoManager added in v5.5.0

func (d *MarkdownDockable) UndoManager() *unison.UndoManager

UndoManager implements undo.Provider

type MiscPanel

type MiscPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

MiscPanel holds the contents of the miscellaneous block on the sheet.

func NewMiscPanel

func NewMiscPanel(entity *gurps.Entity, targetMgr *TargetMgr) *MiscPanel

NewMiscPanel creates a new miscellaneous panel.

func (*MiscPanel) UpdateModified

func (m *MiscPanel) UpdateModified()

UpdateModified updates the current modification timestamp.

type ModifiableRoot

type ModifiableRoot interface {
	MarkModified(src unison.Paneler)
}

ModifiableRoot marks the root of a modifable tree of components, typically a Dockable.

type Navigator struct {
	unison.Panel
	// contains filtered or unexported fields
}

Navigator holds the workspace navigation panel.

func (n *Navigator) ApplyDisclosedPaths(paths []string)

ApplyDisclosedPaths closes all nodes except the ones provided, which are explicitly opened.

func (n *Navigator) ApplySelectedPaths(paths []string)

ApplySelectedPaths replaces the selection with the nodes that match the given paths.

func (n *Navigator) DisclosedPaths() []string

DisclosedPaths returns a list of paths that are currently disclosed.

func (n *Navigator) EventuallyReload()

EventuallyReload calls Reload() after a small delay, collapsing intervening requests to do the same.

func (n *Navigator) InitialFocus()

InitialFocus causes the navigator to focus its initial component.

func (n *Navigator) Modified() bool

Modified implements unison.Dockable

func (n *Navigator) Reload()

Reload the content of the navigator view.

func (n *Navigator) SelectedPaths() []string

SelectedPaths returns a list of paths that are currently selected.

func (n *Navigator) Title() string

Title implements unison.Dockable

func (n *Navigator) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements unison.Dockable

func (n *Navigator) Tooltip() string

Tooltip implements unison.Dockable

type NavigatorNode struct {
	// contains filtered or unexported fields
}

NavigatorNode holds a library, directory or file.

func NewDirectoryNode

func NewDirectoryNode(nav *Navigator, lib *gurps.Library, dirPath string, parent *NavigatorNode) *NavigatorNode

NewDirectoryNode creates a new DirectoryNode.

func NewFavoritesNode added in v5.12.0

func NewFavoritesNode(nav *Navigator) *NavigatorNode

NewFavoritesNode creates the Favorites node.

func NewFileNode

func NewFileNode(lib *gurps.Library, filePath string, parent *NavigatorNode) *NavigatorNode

NewFileNode creates a new FileNode.

func NewLibraryNode

func NewLibraryNode(nav *Navigator, lib *gurps.Library) *NavigatorNode

NewLibraryNode creates a new library node.

func (n *NavigatorNode) CanHaveChildren() bool

CanHaveChildren implements unison.TableRowData.

func (n *NavigatorNode) CellDataForSort(col int) string

CellDataForSort implements unison.TableRowData.

func (n *NavigatorNode) Children() []*NavigatorNode

Children implements unison.TableRowData.

func (n *NavigatorNode) CloneForTarget(_ unison.Paneler, _ *NavigatorNode) *NavigatorNode

CloneForTarget implements unison.TableRowData. Not permitted at the moment.

func (n *NavigatorNode) ColumnCell(_, col int, foreground, _ unison.Ink, _, _, _ bool) unison.Paneler

ColumnCell implements unison.TableRowData.

func (n *NavigatorNode) Container() bool

Container returns true if this node can have children.

func (n *NavigatorNode) ID() tid.TID

ID implements unison.TableRowData.

func (n *NavigatorNode) IsDirectory() bool

IsDirectory returns true if this is a directory node.

func (n *NavigatorNode) IsFavorites() bool

IsFavorites returns true if this is a favorites node.

func (n *NavigatorNode) IsFile() bool

IsFile returns true if this is a file node.

func (n *NavigatorNode) IsLibrary() bool

IsLibrary returns true if this is a library node.

func (n *NavigatorNode) IsOpen() bool

IsOpen implements unison.TableRowData.

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 (n *NavigatorNode) OpenNodeContent() (dockable unison.Dockable, wasOpen bool)

OpenNodeContent opens the node's content.

func (n *NavigatorNode) Parent() *NavigatorNode

Parent implements unison.TableRowData.

func (n *NavigatorNode) Path() string

Path returns the full path on disk for this node.

func (n *NavigatorNode) Refresh()

Refresh the contents of this node.

func (n *NavigatorNode) SetChildren(_ []*NavigatorNode)

SetChildren implements unison.TableRowData.

func (n *NavigatorNode) SetOpen(open bool)

SetOpen implements unison.TableRowData.

func (n *NavigatorNode) SetParent(_ *NavigatorNode)

SetParent implements unison.TableRowData.

type Node

type Node[T gurps.NodeTypes] struct {
	// contains filtered or unexported fields
}

Node represents a row in a table.

func NewNode

func NewNode[T gurps.NodeTypes](table *unison.Table[*Node[T]], parent *Node[T], data T, forPage bool) *Node[T]

NewNode creates a new node for a table.

func NewNodeLike

func NewNodeLike[T gurps.NodeTypes](like *Node[T], data T) *Node[T]

NewNodeLike creates a new node for a table based on the characteristics of an existing node in that table.

func (*Node[T]) CanHaveChildren

func (n *Node[T]) CanHaveChildren() bool

CanHaveChildren implements unison.TableRowData.

func (*Node[T]) CellDataForSort

func (n *Node[T]) CellDataForSort(index int) string

CellDataForSort implements unison.TableRowData.

func (*Node[T]) CellFromCellData

func (n *Node[T]) CellFromCellData(c *gurps.CellData, width float32, foreground, background unison.Ink) unison.Paneler

CellFromCellData creates a new panel for the given cell data.

func (*Node[T]) Children

func (n *Node[T]) Children() []*Node[T]

Children implements unison.TableRowData.

func (*Node[T]) CloneForTarget

func (n *Node[T]) CloneForTarget(target unison.Paneler, newParent *Node[T]) *Node[T]

CloneForTarget implements unison.TableRowData.

func (*Node[T]) ColumnCell

func (n *Node[T]) ColumnCell(row, col int, foreground, background unison.Ink, _, _, _ bool) unison.Paneler

ColumnCell implements unison.TableRowData.

func (*Node[T]) Data

func (n *Node[T]) Data() T

Data returns the underlying data object.

func (*Node[T]) HasTag

func (n *Node[T]) HasTag(tag string) bool

HasTag returns true if the specified tag is present on the node. An empty tag will match all nodes.

func (*Node[T]) ID added in v5.24.0

func (n *Node[T]) ID() tid.TID

ID implements unison.TableRowData.

func (*Node[T]) IsOpen

func (n *Node[T]) IsOpen() bool

IsOpen implements unison.TableRowData.

func (*Node[T]) Match

func (n *Node[T]) 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 (*Node[T]) Parent

func (n *Node[T]) Parent() *Node[T]

Parent implements unison.TableRowData.

func (*Node[T]) PartialMatchExceptTag

func (n *Node[T]) PartialMatchExceptTag(text string) bool

PartialMatchExceptTag returns true if the specified text is present in the node's displayable columns other than the the tags column. An empty text will match all nodes.

func (*Node[T]) SetChildren

func (n *Node[T]) SetChildren(children []*Node[T])

SetChildren implements unison.TableRowData.

func (*Node[T]) SetOpen

func (n *Node[T]) SetOpen(open bool)

SetOpen implements unison.TableRowData.

func (*Node[T]) SetParent

func (n *Node[T]) SetParent(parent *Node[T])

SetParent implements unison.TableRowData.

type NonEditableField

type NonEditableField struct {
	*unison.Label
	// contains filtered or unexported fields
}

NonEditableField holds the data for a non-editable field.

func NewNonEditableField

func NewNonEditableField(syncer func(*NonEditableField)) *NonEditableField

NewNonEditableField creates a new start-aligned non-editable field that uses the same font and size as the field.

func (*NonEditableField) Sync

func (f *NonEditableField) Sync()

Sync the field to the current value.

type NonEditablePageField

type NonEditablePageField struct {
	*unison.Label
	// contains filtered or unexported fields
}

NonEditablePageField holds the data for a non-editable page field.

func NewNonEditablePageField

func NewNonEditablePageField(syncer func(*NonEditablePageField)) *NonEditablePageField

NewNonEditablePageField creates a new start-aligned non-editable field that uses the same font and size as the page field.

func NewNonEditablePageFieldCenter

func NewNonEditablePageFieldCenter(syncer func(*NonEditablePageField)) *NonEditablePageField

NewNonEditablePageFieldCenter creates a new center-aligned non-editable field that uses the same font and size as the page field.

func NewNonEditablePageFieldEnd

func NewNonEditablePageFieldEnd(syncer func(*NonEditablePageField)) *NonEditablePageField

NewNonEditablePageFieldEnd creates a new end-aligned non-editable field that uses the same font and size as the page field.

func (*NonEditablePageField) Sync

func (f *NonEditablePageField) Sync()

Sync the field to the current value.

type NumericField

type NumericField[T xmath.Numeric] struct {
	*unison.Field

	Format func(T) string
	// contains filtered or unexported fields
}

NumericField holds a numeric value that can be edited.

func NewNumericField

func NewNumericField[T xmath.Numeric](targetMgr *TargetMgr, targetKey, undoTitle string, getPrototypes func(minValue, maxValue T) []T, get func() T, set func(T), format func(T) string, extract func(s string) (T, error), minValue, maxValue T) *NumericField[T]

NewNumericField creates a new field that formats its content.

func NewNumericFieldWithException added in v5.8.0

func NewNumericFieldWithException[T xmath.Numeric](targetMgr *TargetMgr, targetKey, undoTitle string, getPrototypes func(minValue, maxValue T) []T, get func() T, set func(T), format func(T) string, extract func(s string) (T, error), minValue, maxValue, exception T) *NumericField[T]

NewNumericFieldWithException creates a new field that formats its content and can hold an exceptional value (one outside of the minimum/maximum range.

func (*NumericField[T]) CurrentValue added in v5.14.0

func (f *NumericField[T]) CurrentValue() T

CurrentValue returns the current committed value, which may not be the same as the value showing.

func (*NumericField[T]) Exception added in v5.8.0

func (f *NumericField[T]) Exception() T

Exception returns the exception value.

func (*NumericField[T]) HasException added in v5.8.0

func (f *NumericField[T]) HasException() bool

HasException returns true if an exception value can be used.

func (*NumericField[T]) Max

func (f *NumericField[T]) Max() T

Max returns the maximum value allowed.

func (*NumericField[T]) Min

func (f *NumericField[T]) Min() T

Min returns the minimum value allowed.

func (*NumericField[T]) SetMarksModified

func (f *NumericField[T]) SetMarksModified(marksModified bool)

SetMarksModified sets whether this field will attempt to mark its ModifiableRoot as modified. Default is true.

func (*NumericField[T]) SetMinMax

func (f *NumericField[T]) SetMinMax(minValue, maxValue T)

SetMinMax sets the minimum and maximum values and then adjusts the minimum text width, if a prototype function has been set.

func (*NumericField[T]) Sync

func (f *NumericField[T]) Sync()

Sync the field to the current value.

type PDFDockable

type PDFDockable struct {
	unison.Panel
	// contains filtered or unexported fields
}

PDFDockable holds the view for a PDFRenderer file.

func (*PDFDockable) AttemptClose

func (d *PDFDockable) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*PDFDockable) Back

func (d *PDFDockable) Back()

Back moves back in history one step.

func (*PDFDockable) BackingFilePath

func (d *PDFDockable) BackingFilePath() string

BackingFilePath implements workspace.FileBackedDockable

func (*PDFDockable) ClearHistory

func (d *PDFDockable) ClearHistory()

ClearHistory clears the existing history.

func (*PDFDockable) Forward

func (d *PDFDockable) Forward()

Forward moves forward in history one step.

func (*PDFDockable) LoadPage

func (d *PDFDockable) LoadPage(pageNumber int)

LoadPage loads the specified page.

func (*PDFDockable) MayAttemptClose

func (d *PDFDockable) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*PDFDockable) Modified

func (d *PDFDockable) Modified() bool

Modified implements workspace.FileBackedDockable

func (*PDFDockable) SetBackingFilePath

func (d *PDFDockable) SetBackingFilePath(p string)

SetBackingFilePath implements workspace.FileBackedDockable

func (*PDFDockable) SetSearchText

func (d *PDFDockable) SetSearchText(text string)

SetSearchText sets the search text and updates the display.

func (*PDFDockable) Title

func (d *PDFDockable) Title() string

Title implements workspace.FileBackedDockable

func (*PDFDockable) TitleIcon

func (d *PDFDockable) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements workspace.FileBackedDockable

func (*PDFDockable) Tooltip

func (d *PDFDockable) Tooltip() string

Tooltip implements workspace.FileBackedDockable

type PDFLink struct {
	Bounds     unison.Rect
	PageNumber int
	URI        string
}

PDFLink holds a single link on a page. If PageNumber if >= 0, then this is an internal link and the URI will be empty.

type PDFPage

type PDFPage struct {
	Error      error
	PageNumber int
	Image      *unison.Image
	TOC        []*PDFTableOfContents
	Links      []*PDFLink
	Matches    []unison.Rect
}

PDFPage holds a rendered PDFRenderer page.

type PDFRenderer

type PDFRenderer struct {
	// contains filtered or unexported fields
}

PDFRenderer holds a PDFRenderer page renderer.

func NewPDFRenderer

func NewPDFRenderer(filePath string, pageLoadedCallback func()) (*PDFRenderer, error)

NewPDFRenderer creates a new PDFRenderer page renderer.

func (*PDFRenderer) CurrentPage

func (p *PDFRenderer) CurrentPage() *PDFPage

CurrentPage returns the currently rendered page.

func (*PDFRenderer) LoadPage

func (p *PDFRenderer) LoadPage(pageNumber int, search string)

LoadPage requests the given page to be loaded and rendered.

func (*PDFRenderer) MostRecentPageNumber

func (p *PDFRenderer) MostRecentPageNumber() int

MostRecentPageNumber returns the most recent page number that has been asked to be rendered.

func (*PDFRenderer) PageCount

func (p *PDFRenderer) PageCount() int

PageCount returns the total page count.

func (*PDFRenderer) RenderingFinished

func (p *PDFRenderer) RenderingFinished() (finished bool, pageNumber int, requested time.Time)

RenderingFinished returns true if there is no rendering being done for this PDFRenderer at the moment.

func (*PDFRenderer) RequestRenderPriority

func (p *PDFRenderer) RequestRenderPriority()

RequestRenderPriority attempts to bump this PDFRenderer's rendering to the head of the queue.

type PDFTableOfContents

type PDFTableOfContents struct {
	Title        string
	PageNumber   int
	PageLocation unison.Point
	Children     []*PDFTableOfContents
}

PDFTableOfContents holds a table of contents entry.

type Page

type Page struct {
	unison.Panel

	Force bool
	// contains filtered or unexported fields
}

Page holds a logical page worth of content.

func NewPage

func NewPage(entity *gurps.Entity) *Page

NewPage creates a new page.

func (*Page) ApplyPreferredSize

func (p *Page) ApplyPreferredSize()

ApplyPreferredSize to this panel.

func (*Page) LayoutSizes

func (p *Page) LayoutSizes(_ *unison.Panel, _ unison.Size) (minSize, prefSize, maxSize unison.Size)

LayoutSizes implements unison.Layout

func (*Page) PerformLayout

func (p *Page) PerformLayout(_ *unison.Panel)

PerformLayout implements unison.Layout

type PageList

type PageList[T gurps.NodeTypes] struct {
	unison.Panel

	Table *unison.Table[*Node[T]]
	// contains filtered or unexported fields
}

PageList holds a list for a sheet page.

func NewCarriedEquipmentPageList

func NewCarriedEquipmentPageList(owner Rebuildable, provider gurps.ListProvider) *PageList[*gurps.Equipment]

NewCarriedEquipmentPageList creates the carried equipment page list.

func NewConditionalModifiersPageList

func NewConditionalModifiersPageList(entity *gurps.Entity) *PageList[*gurps.ConditionalModifier]

NewConditionalModifiersPageList creates the conditional modifiers page list.

func NewMeleeWeaponsPageList

func NewMeleeWeaponsPageList(entity *gurps.Entity) *PageList[*gurps.Weapon]

NewMeleeWeaponsPageList creates the melee weapons page list.

func NewNotesPageList

func NewNotesPageList(owner Rebuildable, provider gurps.ListProvider) *PageList[*gurps.Note]

NewNotesPageList creates the notes page list.

func NewOtherEquipmentPageList

func NewOtherEquipmentPageList(owner Rebuildable, provider gurps.ListProvider) *PageList[*gurps.Equipment]

NewOtherEquipmentPageList creates the other equipment page list.

func NewRangedWeaponsPageList

func NewRangedWeaponsPageList(entity *gurps.Entity) *PageList[*gurps.Weapon]

NewRangedWeaponsPageList creates the ranged weapons page list.

func NewReactionsPageList

func NewReactionsPageList(entity *gurps.Entity) *PageList[*gurps.ConditionalModifier]

NewReactionsPageList creates the reaction modifiers page list.

func NewSkillsPageList

func NewSkillsPageList(owner Rebuildable, provider gurps.ListProvider) *PageList[*gurps.Skill]

NewSkillsPageList creates the skills page list.

func NewSpellsPageList

func NewSpellsPageList(owner Rebuildable, provider gurps.SpellListProvider) *PageList[*gurps.Spell]

NewSpellsPageList creates the spells page list.

func NewTraitsPageList

func NewTraitsPageList(owner Rebuildable, provider gurps.ListProvider) *PageList[*gurps.Trait]

NewTraitsPageList creates the traits page list.

func (*PageList[T]) ApplySelection

func (p *PageList[T]) ApplySelection(selection map[tid.TID]bool)

ApplySelection locates the rows with the given IDs and selects them, replacing any existing selection.

func (*PageList[T]) CreateItem

func (p *PageList[T]) CreateItem(owner Rebuildable, variant ItemVariant)

CreateItem calls CreateItem on the contained TableProvider.

func (*PageList[T]) CurrentDrawRowRange

func (p *PageList[T]) CurrentDrawRowRange() (start, endBefore int)

CurrentDrawRowRange returns the current row range that will be drawn.

func (*PageList[T]) OverheadHeight

func (p *PageList[T]) OverheadHeight() float32

OverheadHeight returns the overhead for this page list, i.e. the border and header space.

func (*PageList[T]) RecordSelection

func (p *PageList[T]) RecordSelection() map[tid.TID]bool

RecordSelection collects the currently selected row IDs.

func (*PageList[T]) RowCount

func (p *PageList[T]) RowCount() int

RowCount returns the number of rows.

func (*PageList[T]) RowHeights

func (p *PageList[T]) RowHeights() []float32

RowHeights returns the heights of each row.

func (*PageList[T]) SelectedNodes

func (p *PageList[T]) SelectedNodes(minimal bool) []*Node[T]

SelectedNodes returns the set of selected nodes. If 'minimal' is true, then children of selected rows that may also be selected are not returned, just the topmost row that is selected in any given hierarchy.

func (*PageList[T]) SetDrawRowRange

func (p *PageList[T]) SetDrawRowRange(start, endBefore int)

SetDrawRowRange sets the row range that will be drawn.

func (*PageList[T]) Sync

func (p *PageList[T]) Sync()

Sync the underlying data.

type PageTableColumnHeader

type PageTableColumnHeader[T gurps.NodeTypes] struct {
	*unison.Label
	// contains filtered or unexported fields
}

PageTableColumnHeader provides a default page table column header panel.

func NewPageTableColumnHeader

func NewPageTableColumnHeader[T gurps.NodeTypes](title, tooltip string) *PageTableColumnHeader[T]

NewPageTableColumnHeader creates a new page table column header panel with the given title.

func (*PageTableColumnHeader[T]) DefaultDraw

func (h *PageTableColumnHeader[T]) DefaultDraw(gc *unison.Canvas, dirty unison.Rect)

DefaultDraw provides the default drawing.

func (*PageTableColumnHeader[T]) DefaultMouseUp

func (h *PageTableColumnHeader[T]) DefaultMouseUp(where unison.Point, _ int, _ unison.Modifiers) bool

DefaultMouseUp provides the default mouse up handling.

func (*PageTableColumnHeader[T]) DefaultSizes

func (h *PageTableColumnHeader[T]) DefaultSizes(hint unison.Size) (minSize, prefSize, maxSize unison.Size)

DefaultSizes provides the default sizing.

func (*PageTableColumnHeader[T]) SetSortState

func (h *PageTableColumnHeader[T]) SetSortState(state unison.SortState)

SetSortState sets the SortState.

func (*PageTableColumnHeader[T]) SortState

func (h *PageTableColumnHeader[T]) SortState() unison.SortState

SortState returns the current SortState.

type PercentageField

type PercentageField = NumericField[int]

PercentageField is field that holds a percentage.

func NewPercentageField

func NewPercentageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() int, set func(int), minValue, maxValue int, forceSign, noMinWidth bool) *PercentageField

NewPercentageField creates a new field that holds a percentage.

func NewScaleField

func NewScaleField(minValue, maxValue int, defValue, get func() int, set func(int), afterApply func(), attemptCenter bool, scroller *unison.ScrollPanel) *PercentageField

NewScaleField creates a new scale field and hooks it into the target.

type PointsPanel

type PointsPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

PointsPanel holds the contents of the points block on the sheet.

func NewPointsPanel

func NewPointsPanel(entity *gurps.Entity, targetMgr *TargetMgr) *PointsPanel

NewPointsPanel creates a new points panel.

func (*PointsPanel) Sync

func (p *PointsPanel) Sync()

Sync the panel to the current data.

type Popup[T comparable] struct {
	*unison.PopupMenu[T]
	// contains filtered or unexported fields
}

Popup provides a popup menu that works with undo.

func NewPopup

func NewPopup[T comparable](targetMgr *TargetMgr, targetKey, undoTitle string, get func() T, set func(T), items ...T) *Popup[T]

NewPopup creates a new popup menu.

func (*Popup[T]) Sync

func (p *Popup[T]) Sync()

Sync the popup to the current value.

type PortraitPanel

type PortraitPanel struct {
	unison.Panel
	// contains filtered or unexported fields
}

PortraitPanel holds the contents of the portrait block on the sheet.

func NewPortraitPanel

func NewPortraitPanel(entity *gurps.Entity) *PortraitPanel

NewPortraitPanel creates a new portrait panel.

func (*PortraitPanel) Sync

func (p *PortraitPanel) Sync()

Sync the panel to the current data.

type PreservedTableData

type PreservedTableData[T gurps.NodeTypes] struct {
	// contains filtered or unexported fields
}

PreservedTableData holds the data and selection state of a table in a serialized form.

func (*PreservedTableData[T]) Apply

func (d *PreservedTableData[T]) Apply(table *unison.Table[*Node[T]]) error

Apply the data and selection state to a table.

func (*PreservedTableData[T]) Collect

func (d *PreservedTableData[T]) Collect(table *unison.Table[*Node[T]]) error

Collect the data and selection state from a table.

type Rebuildable

type Rebuildable interface {
	unison.Paneler
	fmt.Stringer
	Rebuild(full bool)
}

Rebuildable defines the methods a rebuildable panel should provide.

type Selectable

type Selectable interface {
	Selection() (start, end int)
	SetSelection(start, end int)
}

Selectable panels can have their selection queried and set.

type SettingsDockable

type SettingsDockable struct {
	unison.Panel
	TabTitle          string
	TabIcon           *unison.SVG
	Extensions        []string
	Loader            func(fileSystem fs.FS, filePath string) error
	Saver             func(filePath string) error
	Resetter          func()
	ModifiedCallback  func() bool
	WillCloseCallback func() bool
}

SettingsDockable holds common settings dockable data.

func (*SettingsDockable) AttemptClose

func (d *SettingsDockable) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*SettingsDockable) MarkModified

func (d *SettingsDockable) MarkModified(_ unison.Paneler)

MarkModified implements widget.ModifiableRoot

func (*SettingsDockable) MayAttemptClose

func (d *SettingsDockable) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*SettingsDockable) Modified

func (d *SettingsDockable) Modified() bool

Modified implements unison.Dockable

func (*SettingsDockable) Setup

func (d *SettingsDockable) Setup(addToStartToolbar, addToEndToolbar, initContent func(*unison.Panel))

Setup the dockable and display it.

func (*SettingsDockable) Title

func (d *SettingsDockable) Title() string

Title implements unison.Dockable

func (*SettingsDockable) TitleIcon

func (d *SettingsDockable) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements unison.Dockable

func (*SettingsDockable) Tooltip

func (d *SettingsDockable) Tooltip() string

Tooltip implements unison.Dockable

type Sheet

type Sheet struct {
	unison.Panel

	Reactions            *PageList[*gurps.ConditionalModifier]
	ConditionalModifiers *PageList[*gurps.ConditionalModifier]
	MeleeWeapons         *PageList[*gurps.Weapon]
	RangedWeapons        *PageList[*gurps.Weapon]
	Traits               *PageList[*gurps.Trait]
	Skills               *PageList[*gurps.Skill]
	Spells               *PageList[*gurps.Spell]
	CarriedEquipment     *PageList[*gurps.Equipment]
	OtherEquipment       *PageList[*gurps.Equipment]
	Notes                *PageList[*gurps.Note]
	// contains filtered or unexported fields
}

Sheet holds the view for a GURPS character sheet.

func ActiveSheet

func ActiveSheet() *Sheet

ActiveSheet returns the currently active sheet.

func NewSheet

func NewSheet(filePath string, entity *gurps.Entity) *Sheet

NewSheet creates a new unison.Dockable for GURPS character sheet files.

func OpenSheets

func OpenSheets(exclude *Sheet) []*Sheet

OpenSheets returns the currently open sheets.

func (*Sheet) AttemptClose

func (s *Sheet) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*Sheet) BackingFilePath

func (s *Sheet) BackingFilePath() string

BackingFilePath implements workspace.FileBackedDockable

func (*Sheet) DataOwner added in v5.24.0

func (s *Sheet) DataOwner() gurps.DataOwner

DataOwner implements gurps.DataOwnerProvider.

func (*Sheet) DockableKind

func (s *Sheet) DockableKind() string

DockableKind implements widget.DockableKind

func (*Sheet) Entity

func (s *Sheet) Entity() *gurps.Entity

Entity returns the entity this is displaying information for.

func (*Sheet) MarkModified

func (s *Sheet) MarkModified(src unison.Paneler)

MarkModified implements widget.ModifiableRoot.

func (*Sheet) MayAttemptClose

func (s *Sheet) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*Sheet) Modified

func (s *Sheet) Modified() bool

Modified implements workspace.FileBackedDockable

func (*Sheet) Rebuild

func (s *Sheet) Rebuild(full bool)

Rebuild implements widget.Rebuildable.

func (*Sheet) SetBackingFilePath

func (s *Sheet) SetBackingFilePath(p string)

SetBackingFilePath implements workspace.FileBackedDockable

func (*Sheet) SheetSettingsUpdated

func (s *Sheet) SheetSettingsUpdated(entity *gurps.Entity, blockLayout bool)

SheetSettingsUpdated implements gurps.SheetSettingsResponder.

func (*Sheet) String

func (s *Sheet) String() string

func (*Sheet) Title

func (s *Sheet) Title() string

Title implements workspace.FileBackedDockable

func (*Sheet) TitleIcon

func (s *Sheet) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements workspace.FileBackedDockable

func (*Sheet) Tooltip

func (s *Sheet) Tooltip() string

Tooltip implements workspace.FileBackedDockable

func (*Sheet) UndoManager

func (s *Sheet) UndoManager() *unison.UndoManager

UndoManager implements undo.Provider

type StringField

type StringField struct {
	*unison.Field
	// contains filtered or unexported fields
}

StringField holds the value for a string field.

func NewMultiLineStringField

func NewMultiLineStringField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField

NewMultiLineStringField creates a new field for editing a string.

func NewStringField

func NewStringField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField

NewStringField creates a new field for editing a string.

func NewStringPageField

func NewStringPageField(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField

NewStringPageField creates a new text entry field for a sheet page.

func NewStringPageFieldNoGrab

func NewStringPageFieldNoGrab(targetMgr *TargetMgr, targetKey, undoTitle string, get func() string, set func(string)) *StringField

NewStringPageFieldNoGrab creates a new text entry field for a sheet page, but with HGrab set to false.

func (*StringField) Sync

func (f *StringField) Sync()

Sync the field to the current value.

type Syncer

type Syncer interface {
	Sync()
}

Syncer should be called to sync an object's UI state to its model.

type TableDockable

type TableDockable[T gurps.NodeTypes] struct {
	unison.Panel
	// contains filtered or unexported fields
}

TableDockable holds the view for a file that contains a (potentially hierarchical) list of data.

func NewEquipmentModifierTableDockable

func NewEquipmentModifierTableDockable(filePath string, modifiers []*gurps.EquipmentModifier) *TableDockable[*gurps.EquipmentModifier]

NewEquipmentModifierTableDockable creates a new unison.Dockable for equipment modifier list files.

func NewEquipmentTableDockable

func NewEquipmentTableDockable(filePath string, equipment []*gurps.Equipment) *TableDockable[*gurps.Equipment]

NewEquipmentTableDockable creates a new unison.Dockable for equipment list files.

func NewNoteTableDockable

func NewNoteTableDockable(filePath string, notes []*gurps.Note) *TableDockable[*gurps.Note]

NewNoteTableDockable creates a new unison.Dockable for note list files.

func NewSkillTableDockable

func NewSkillTableDockable(filePath string, skills []*gurps.Skill) *TableDockable[*gurps.Skill]

NewSkillTableDockable creates a new unison.Dockable for skill list files.

func NewSpellTableDockable

func NewSpellTableDockable(filePath string, spells []*gurps.Spell) *TableDockable[*gurps.Spell]

NewSpellTableDockable creates a new unison.Dockable for spell list files.

func NewTableDockable

func NewTableDockable[T gurps.NodeTypes](filePath, extension string, provider TableProvider[T], saver func(path string) error, canCreateIDs ...int) *TableDockable[T]

NewTableDockable creates a new TableDockable for list data files.

func NewTraitModifierTableDockable

func NewTraitModifierTableDockable(filePath string, modifiers []*gurps.TraitModifier) *TableDockable[*gurps.TraitModifier]

NewTraitModifierTableDockable creates a new unison.Dockable for trait modifier list files.

func NewTraitTableDockable

func NewTraitTableDockable(filePath string, traits []*gurps.Trait) *TableDockable[*gurps.Trait]

NewTraitTableDockable creates a new unison.Dockable for trait list files.

func (*TableDockable[T]) AllTags added in v5.11.0

func (d *TableDockable[T]) AllTags() []string

AllTags returns all tags currently present in the data.

func (*TableDockable[T]) ApplyFilter added in v5.11.0

func (d *TableDockable[T]) ApplyFilter(tags []string)

ApplyFilter applies the current filtering, if any.

func (*TableDockable[T]) AttemptClose

func (d *TableDockable[T]) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*TableDockable[T]) BackingFilePath

func (d *TableDockable[T]) BackingFilePath() string

BackingFilePath implements workspace.FileBackedDockable

func (*TableDockable[T]) DockableKind

func (d *TableDockable[T]) DockableKind() string

DockableKind implements widget.DockableKind

func (*TableDockable[T]) Entity

func (d *TableDockable[T]) Entity() *gurps.Entity

Entity implements gurps.EntityProvider

func (*TableDockable[T]) Hash added in v5.28.0

func (d *TableDockable[T]) Hash(h hash.Hash)

Hash writes this object's contents into the hasher.

func (*TableDockable[T]) MarkModified

func (d *TableDockable[T]) MarkModified(_ unison.Paneler)

MarkModified implements widget.ModifiableRoot.

func (*TableDockable[T]) MayAttemptClose

func (d *TableDockable[T]) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*TableDockable[T]) Modified

func (d *TableDockable[T]) Modified() bool

Modified implements workspace.FileBackedDockable

func (*TableDockable[T]) Rebuild

func (d *TableDockable[T]) Rebuild(_ bool)

Rebuild implements widget.Rebuildable.

func (*TableDockable[T]) SetBackingFilePath

func (d *TableDockable[T]) SetBackingFilePath(p string)

SetBackingFilePath implements workspace.FileBackedDockable

func (*TableDockable[T]) String

func (d *TableDockable[T]) String() string

func (*TableDockable[T]) Title

func (d *TableDockable[T]) Title() string

Title implements workspace.FileBackedDockable

func (*TableDockable[T]) TitleIcon

func (d *TableDockable[T]) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements workspace.FileBackedDockable

func (*TableDockable[T]) Tooltip

func (d *TableDockable[T]) Tooltip() string

Tooltip implements workspace.FileBackedDockable

func (*TableDockable[T]) UndoManager

func (d *TableDockable[T]) UndoManager() *unison.UndoManager

UndoManager implements undo.Provider

type TableDragUndoEditData

type TableDragUndoEditData[T gurps.NodeTypes] struct {
	From *TableUndoEditData[T]
	To   *TableUndoEditData[T]
}

TableDragUndoEditData holds the undo edit data for a table drag.

func NewTableDragUndoEditData

func NewTableDragUndoEditData[T gurps.NodeTypes](from, to *unison.Table[*Node[T]]) *TableDragUndoEditData[T]

NewTableDragUndoEditData collects the undo edit data for a table drag.

func (*TableDragUndoEditData[T]) Apply

func (t *TableDragUndoEditData[T]) Apply()

Apply the undo edit data to a table.

type TableProvider

type TableProvider[T gurps.NodeTypes] interface {
	unison.TableModel[*Node[T]]
	gurps.DataOwnerProvider
	SetTable(table *unison.Table[*Node[T]])
	RootData() []T
	SetRootData(data []T)
	DragKey() string
	DragSVG() *unison.SVG
	DropShouldMoveData(from, to *unison.Table[*Node[T]]) bool
	ProcessDropData(from, to *unison.Table[*Node[T]])
	AltDropSupport() *AltDropSupport
	ItemNames() (singular, plural string)
	Headers() []unison.TableColumnHeader[*Node[T]]
	SyncHeader(headers []unison.TableColumnHeader[*Node[T]])
	ColumnIDs() []int
	HierarchyColumnID() int
	ExcessWidthColumnID() int
	ContextMenuItems() []ContextMenuItem
	OpenEditor(owner Rebuildable, table *unison.Table[*Node[T]])
	CreateItem(owner Rebuildable, table *unison.Table[*Node[T]], variant ItemVariant)
	Serialize() ([]byte, error)
	Deserialize(data []byte) error
	RefKey() string
	AllTags() []string
}

TableProvider defines the methods a table provider must contain.

func NewConditionalModifiersProvider

func NewConditionalModifiersProvider(provider gurps.ConditionalModifierListProvider) TableProvider[*gurps.ConditionalModifier]

NewConditionalModifiersProvider creates a new table provider for conditional modifiers.

func NewEquipmentModifiersProvider

func NewEquipmentModifiersProvider(provider gurps.EquipmentModifierListProvider, forEditor bool) TableProvider[*gurps.EquipmentModifier]

NewEquipmentModifiersProvider creates a new table provider for equipment modifiers.

func NewEquipmentProvider

func NewEquipmentProvider(provider gurps.EquipmentListProvider, carried, forPage bool) TableProvider[*gurps.Equipment]

NewEquipmentProvider creates a new table provider for equipment. 'carried' is only relevant if 'forPage' is true.

func NewNotesProvider

func NewNotesProvider(provider gurps.NoteListProvider, forPage bool) TableProvider[*gurps.Note]

NewNotesProvider creates a new table provider for notes.

func NewReactionModifiersProvider

func NewReactionModifiersProvider(provider gurps.ReactionModifierListProvider) TableProvider[*gurps.ConditionalModifier]

NewReactionModifiersProvider creates a new table provider for reaction modifiers.

func NewSkillsProvider

func NewSkillsProvider(provider gurps.SkillListProvider, forPage bool) TableProvider[*gurps.Skill]

NewSkillsProvider creates a new table provider for skills.

func NewSpellsProvider

func NewSpellsProvider(provider gurps.SpellListProvider, forPage bool) TableProvider[*gurps.Spell]

NewSpellsProvider creates a new table provider for spells.

func NewTraitModifiersProvider

func NewTraitModifiersProvider(provider gurps.TraitModifierListProvider, forEditor bool) TableProvider[*gurps.TraitModifier]

NewTraitModifiersProvider creates a new table provider for trait modifiers.

func NewTraitsProvider

func NewTraitsProvider(provider gurps.TraitListProvider, forPage bool) TableProvider[*gurps.Trait]

NewTraitsProvider creates a new table provider for traits.

func NewWeaponsProvider

func NewWeaponsProvider(provider gurps.WeaponListProvider, melee, forPage bool) TableProvider[*gurps.Weapon]

NewWeaponsProvider creates a new table provider for weapons.

type TableUndoEditData

type TableUndoEditData[T gurps.NodeTypes] struct {
	Table *unison.Table[*Node[T]]
	Data  PreservedTableData[T]
}

TableUndoEditData holds the data necessary to provide undo for a table.

func NewTableUndoEditData

func NewTableUndoEditData[T gurps.NodeTypes](table *unison.Table[*Node[T]]) *TableUndoEditData[T]

NewTableUndoEditData collects the undo edit data for a table.

func (*TableUndoEditData[T]) Apply

func (t *TableUndoEditData[T]) Apply()

Apply the undo edit data to a table.

type TagProvider added in v5.11.0

type TagProvider interface {
	AllTags() []string
	ApplyFilter(tags []string)
}

TagProvider defines the methods required for the tag filter popup.

type TargetMgr

type TargetMgr struct {
	// contains filtered or unexported fields
}

TargetMgr provides management of target panels.

func NewTargetMgr

func NewTargetMgr(root unison.Paneler) *TargetMgr

NewTargetMgr creates a new TargetMgr with the given root.

func (*TargetMgr) CurrentFocusRef

func (t *TargetMgr) CurrentFocusRef() *FocusRef

CurrentFocusRef returns the current FocusRef, if any.

func (*TargetMgr) Find

func (t *TargetMgr) Find(refKey string) *unison.Panel

Find searches the tree of panels starting at the root, looking for a specific refKey.

func (*TargetMgr) NextPrefix

func (t *TargetMgr) NextPrefix() string

NextPrefix returns the next unique prefix to use.

func (*TargetMgr) ReacquireFocus

func (t *TargetMgr) ReacquireFocus(ref *FocusRef, toolbar, content unison.Paneler)

ReacquireFocus attempts to restore the focus previously obtained by a call to CurrentFocusRef().

type TargetUndo

type TargetUndo[T any] struct {
	unison.UndoEdit[T]
	// contains filtered or unexported fields
}

TargetUndo provides undo support for fields that may be swapped out during updates by using a TargetMgr to locate the real target.

func NewTargetUndo

func NewTargetUndo[T any](targetMgr *TargetMgr, targetKey, title string, undoID int64, applyCallback func(target *unison.Panel, data T), beforeData T) *TargetUndo[T]

NewTargetUndo creates a new undo that supports having a revisable target.

type Template

type Template struct {
	unison.Panel

	Traits    *PageList[*gurps.Trait]
	Skills    *PageList[*gurps.Skill]
	Spells    *PageList[*gurps.Spell]
	Equipment *PageList[*gurps.Equipment]
	Notes     *PageList[*gurps.Note]
	// contains filtered or unexported fields
}

Template holds the view for a GURPS character template.

func NewTemplate

func NewTemplate(filePath string, template *gurps.Template) *Template

NewTemplate creates a new unison.Dockable for GURPS template files.

func OpenTemplates

func OpenTemplates(exclude *Template) []*Template

OpenTemplates returns the currently open templates.

func (*Template) AttemptClose

func (t *Template) AttemptClose() bool

AttemptClose implements unison.TabCloser

func (*Template) BackingFilePath

func (t *Template) BackingFilePath() string

BackingFilePath implements workspace.FileBackedDockable

func (*Template) DockableKind

func (t *Template) DockableKind() string

DockableKind implements widget.DockableKind

func (*Template) Entity

func (t *Template) Entity() *gurps.Entity

Entity implements gurps.EntityProvider

func (*Template) MarkModified

func (t *Template) MarkModified(_ unison.Paneler)

MarkModified implements widget.ModifiableRoot.

func (*Template) MayAttemptClose

func (t *Template) MayAttemptClose() bool

MayAttemptClose implements unison.TabCloser

func (*Template) Modified

func (t *Template) Modified() bool

Modified implements workspace.FileBackedDockable

func (*Template) Rebuild

func (t *Template) Rebuild(full bool)

Rebuild implements widget.Rebuildable.

func (*Template) SetBackingFilePath

func (t *Template) SetBackingFilePath(p string)

SetBackingFilePath implements workspace.FileBackedDockable

func (*Template) SheetSettingsUpdated

func (t *Template) SheetSettingsUpdated(e *gurps.Entity, blockLayout bool)

SheetSettingsUpdated implements gurps.SheetSettingsResponder.

func (*Template) String

func (t *Template) String() string

func (*Template) Title

func (t *Template) Title() string

Title implements workspace.FileBackedDockable

func (*Template) TitleIcon

func (t *Template) TitleIcon(suggestedSize unison.Size) unison.Drawable

TitleIcon implements workspace.FileBackedDockable

func (*Template) Tooltip

func (t *Template) Tooltip() string

Tooltip implements workspace.FileBackedDockable

func (*Template) UndoManager

func (t *Template) UndoManager() *unison.UndoManager

UndoManager implements undo.Provider

type TitledBorder

type TitledBorder struct {
	Title string
	Font  unison.Font
}

TitledBorder provides a titled line border.

func (*TitledBorder) Draw

func (t *TitledBorder) Draw(gc *unison.Canvas, rect unison.Rect)

Draw implements unison.Border

func (*TitledBorder) Insets

func (t *TitledBorder) Insets() unison.Insets

Insets implements unison.Border

type WeightField

type WeightField = NumericField[fxp.Weight]

WeightField is field that holds a weight value.

func NewWeightField

func NewWeightField(targetMgr *TargetMgr, targetKey, undoTitle string, entity *gurps.Entity, get func() fxp.Weight, set func(fxp.Weight), minValue, maxValue fxp.Weight, noMinWidth bool) *WeightField

NewWeightField creates a new field that holds a fixed-point number.

func NewWeightPageField

func NewWeightPageField(targetMgr *TargetMgr, targetKey, undoTitle string, entity *gurps.Entity, get func() fxp.Weight, set func(fxp.Weight), minValue, maxValue fxp.Weight, noMinWidth bool) *WeightField

NewWeightPageField creates a new weight entry field for a sheet page.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL