settings

package
v5.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InitialPointsDef           = fxp.From(150)
	InitialPointsMin           fxp.Int
	InitialPointsMax           = fxp.From(9999999)
	TooltipDelayDef            = fxp.FromStringForced("0.75")
	TooltipDelayMin            fxp.Int
	TooltipDelayMax            = fxp.Thirty
	TooltipDismissalDef        = fxp.From(60)
	TooltipDismissalMin        = fxp.One
	TooltipDismissalMax        = fxp.From(3600)
	ScrollWheelMultiplierDef   = fxp.From(unison.MouseWheelMultiplier)
	ScrollWheelMultiplierMin   = fxp.Int(1)
	ScrollWheelMultiplierMax   = fxp.From(9999)
	ImageResolutionDef         = 200
	ImageResolutionMin         = 50
	ImageResolutionMax         = 400
	InitialUIScaleMin          = 50
	InitialUIScaleMax          = 400
	InitialNavigatorUIScaleDef = 100
	InitialListUIScaleDef      = 100
	InitialEditorUIScaleDef    = 100
	InitialSheetUIScaleDef     = 133
	AutoColWidthMin            = 50
	AutoColWidthMax            = 9999
	MaximumAutoColWidthDef     = 800
)

Default, min & max values for the general numeric settings

Functions

func AvailableCalendarRefs

func AvailableCalendarRefs(libraries library.Libraries) []*library.NamedFileSet

AvailableCalendarRefs scans the libraries and returns the available calendars.

Types

type CalendarRef

type CalendarRef struct {
	Name     string
	Calendar *calendar.Calendar
}

CalendarRef holds a named reference to a calendar.

func LookupCalendarRef

func LookupCalendarRef(name string, libraries library.Libraries) *CalendarRef

LookupCalendarRef a CalendarRef by name.

func NewCalendarRefFromFS

func NewCalendarRefFromFS(fileSystem fs.FS, filePath string) (*CalendarRef, error)

NewCalendarRefFromFS creates a new CalendarRef from a file.

func (*CalendarRef) RandomBirthday

func (c *CalendarRef) RandomBirthday(not string) string

RandomBirthday generates a random birthday month and day.

type General

type General struct {
	DefaultPlayerName     string  `json:"default_player_name,omitempty"`
	DefaultTechLevel      string  `json:"default_tech_level,omitempty"`
	CalendarName          string  `json:"calendar_ref,omitempty"`
	ExternalPDFCmdLine    string  `json:"external_pdf_cmd_line,omitempty"`
	InitialPoints         fxp.Int `json:"initial_points"`
	TooltipDelay          fxp.Int `json:"tooltip_delay"`
	TooltipDismissal      fxp.Int `json:"tooltip_dismissal"`
	ScrollWheelMultiplier fxp.Int `json:"scroll_wheel_multiplier"`
	NavigatorUIScale      int     `json:"navigator_scale"`
	InitialListUIScale    int     `json:"initial_list_scale"`
	InitialEditorUIScale  int     `json:"initial_editor_scale"`
	InitialSheetUIScale   int     `json:"initial_sheet_scale"`
	MaximumAutoColWidth   int     `json:"maximum_auto_col_width"`
	ImageResolution       int     `json:"image_resolution"`
	AutoFillProfile       bool    `json:"auto_fill_profile"`
	AutoAddNaturalAttacks bool    `json:"add_natural_attacks"`
}

General holds settings for a sheet.

func NewGeneral

func NewGeneral() *General

NewGeneral creates settings with factory defaults.

func NewGeneralFromFile

func NewGeneralFromFile(fileSystem fs.FS, filePath string) (*General, error)

NewGeneralFromFile loads new settings from a file.

func (*General) CalendarRef

func (s *General) CalendarRef(libraries library.Libraries) *CalendarRef

CalendarRef returns the CalendarRef these settings refer to.

func (*General) EnsureValidity

func (s *General) EnsureValidity()

EnsureValidity checks the current settings for validity and if they aren't valid, makes them so.

func (*General) Save

func (s *General) Save(filePath string) error

Save writes the settings to the file as JSON.

func (*General) UpdateToolTipTiming

func (s *General) UpdateToolTipTiming()

UpdateToolTipTiming updates the default tooltip theme to use the timing values from this object.

type Page

type Page struct {
	Size         paper.Size        `json:"paper_size"`
	Orientation  paper.Orientation `json:"orientation"`
	TopMargin    paper.Length      `json:"top_margin"`
	LeftMargin   paper.Length      `json:"left_margin"`
	BottomMargin paper.Length      `json:"bottom_margin"`
	RightMargin  paper.Length      `json:"right_margin"`
}

Page holds page settings.

func NewPage

func NewPage() *Page

NewPage returns new settings with factory defaults.

func (*Page) Clone

func (p *Page) Clone() *Page

Clone a copy of this.

func (*Page) EnsureValidity

func (p *Page) EnsureValidity()

EnsureValidity checks the current settings for validity and if they aren't valid, makes them so.

type PageOverrides

type PageOverrides struct {
	Size         *paper.Size
	Orientation  *paper.Orientation
	TopMargin    *paper.Length
	LeftMargin   *paper.Length
	BottomMargin *paper.Length
	RightMargin  *paper.Length
}

PageOverrides holds page setting overrides.

func (*PageOverrides) Apply

func (p *PageOverrides) Apply(page *Page)

Apply the overrides to a Page.

func (*PageOverrides) ParseBottomMargin

func (p *PageOverrides) ParseBottomMargin(in string)

ParseBottomMargin and set the override, if applicable.

func (*PageOverrides) ParseLeftMargin

func (p *PageOverrides) ParseLeftMargin(in string)

ParseLeftMargin and set the override, if applicable.

func (*PageOverrides) ParseOrientation

func (p *PageOverrides) ParseOrientation(in string)

ParseOrientation and set the override, if applicable.

func (*PageOverrides) ParseRightMargin

func (p *PageOverrides) ParseRightMargin(in string)

ParseRightMargin and set the override, if applicable.

func (*PageOverrides) ParseSize

func (p *PageOverrides) ParseSize(in string)

ParseSize and set the override, if applicable.

func (*PageOverrides) ParseTopMargin

func (p *PageOverrides) ParseTopMargin(in string)

ParseTopMargin and set the override, if applicable.

Jump to

Keyboard shortcuts

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