editor

package
v0.0.0-...-165de30 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package editor provides editors for the various file types. These generally take the form of a window which displays a single widget, as well as some context-sensitive menu for the main menu bar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Editor

type Editor interface {
	window.Renderable
	window.MainMenuUpdater

	// HasFocus returns true if editor is focused
	HasFocus() (hasFocus bool)
	// GetWindowTitle controls what the window title for this editor appears as
	GetWindowTitle() string
	// Show sets Visible to true
	Show()
	// SetVisible can be used to set Visible to false if the editor should be closed
	SetVisible(bool)
	// GetID returns a unique identifier for this editor window
	GetID() string
	// BringToFront brings this editor to the front of the application, giving it focus
	BringToFront()
	// State returns the current state of this editor, in a JSON-serializable struct
	State() state.EditorState
	// Save writes any changes made in the editor to the file that is open in the editor.
	Save()

	Size(float32, float32) *giu.WindowWidget
}

EditorWindow represents editor window

type EditorBase

type EditorBase struct {
	*window.Window
	Path    *common.PathEntry
	Project *hsproject.Project
}

EditorBase represents an editor

func New

func New(path *common.PathEntry, x, y float32, project *hsproject.Project) *EditorBase

New creates a new editor

func (*EditorBase) Cleanup

func (e *EditorBase) Cleanup()

Cleanup cides an editor

func (*EditorBase) EncodeState

func (e *EditorBase) EncodeState() []byte

EncodeState returns widget's state (unique for each editor type) in byte slice format

func (*EditorBase) GetID

func (e *EditorBase) GetID() string

GetID returns editors ID

func (*EditorBase) GetWindowTitle

func (e *EditorBase) GetWindowTitle() string

GetWindowTitle returns window title

func (*EditorBase) HasChanges

func (e *EditorBase) HasChanges(editor Saveable) bool

HasChanges returns true if editor has changed data

func (*EditorBase) Save

func (e *EditorBase) Save(editor Saveable)

Save saves an editor

func (*EditorBase) State

func (e *EditorBase) State() state.EditorState

State returns editors state

type Saveable

type Saveable interface {
	// GenerateSaveData is called by the underlying interface (namely editor.Editor) to retrieve the data
	// the editor wants written to the file.
	GenerateSaveData() []byte
}

Saveable denotes a struct that has data that can be saved to a file.

Directories

Path Synopsis
Package animdata contains D2 editor's data
Package animdata contains D2 editor's data
Package cof contains cof editor's data
Package cof contains cof editor's data
Package dc6 represents a dc6 editor window
Package dc6 represents a dc6 editor window
Package dcc contains dcc editor's data
Package dcc contains dcc editor's data
Package ds1 contains ds1 editor's data
Package ds1 contains ds1 editor's data
Package dt1 contains dt1 editor's data
Package dt1 contains dt1 editor's data
Package font contains font editor's data
Package font contains font editor's data
Package fonttable represents fontTableEditor's window
Package fonttable represents fontTableEditor's window
Package palette contains palette editor's data
Package palette contains palette editor's data
Package palettemap contains palette map editor's data
Package palettemap contains palette map editor's data
Package sound represents a soundEditor's window
Package sound represents a soundEditor's window
Package stringtable contains string tables editor's data
Package stringtable contains string tables editor's data
Package text contains text editor's data
Package text contains text editor's data

Jump to

Keyboard shortcuts

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