Documentation ¶
Index ¶
- Variables
- func SetActiveMap(km *Map, kmName MapName)
- func SetActiveMapName(mapnm MapName)
- type Funs
- func (kf Funs) Chord() key.Chord
- func (i Funs) Desc() string
- func (i Funs) Int64() int64
- func (kf Funs) Label() string
- func (i Funs) MarshalText() ([]byte, error)
- func (i *Funs) SetInt64(in int64)
- func (i *Funs) SetString(s string) error
- func (i Funs) String() string
- func (i *Funs) UnmarshalText(text []byte) error
- func (i Funs) Values() []enums.Enum
- type Map
- type MapItem
- type MapName
- type Maps
- func (km *Maps) CopyFrom(cp Maps)
- func (km *Maps) MapByName(name MapName) (*Map, int, bool)
- func (km *Maps) MarkdownDoc() string
- func (km *Maps) Open(filename string) error
- func (km *Maps) OpenSettings() error
- func (km *Maps) RevertToStd()
- func (km *Maps) Save(filename string) error
- func (km *Maps) SavePrefs() error
- type MapsItem
Constants ¶
This section is empty.
Variables ¶
var AvailMapsChanged = false
AvailMapsChanged is used to update giv.KeyMapsView toolbars via following menu, toolbar props update methods -- not accurate if editing any other map but works for now..
var PrefsMapsFilename = "key_maps_prefs.json"
PrefsMapsFilename is the name of the preferences file in Cogent Core prefs directory for saving / loading the default AvailMaps key maps list
var StdMaps = Maps{ {"MacStandard", "Standard Mac KeyMap", Map{ "UpArrow": MoveUp, "Shift+UpArrow": MoveUp, "Meta+UpArrow": MoveUp, "Control+P": MoveUp, "Shift+Control+P": MoveUp, "Meta+Control+P": MoveUp, "DownArrow": MoveDown, "Shift+DownArrow": MoveDown, "Meta+DownArrow": MoveDown, "Control+N": MoveDown, "Shift+Control+N": MoveDown, "Meta+Control+N": MoveDown, "RightArrow": MoveRight, "Shift+RightArrow": MoveRight, "Meta+RightArrow": End, "Control+F": MoveRight, "Shift+Control+F": MoveRight, "Meta+Control+F": MoveRight, "LeftArrow": MoveLeft, "Shift+LeftArrow": MoveLeft, "Meta+LeftArrow": Home, "Control+B": MoveLeft, "Shift+Control+B": MoveLeft, "Meta+Control+B": MoveLeft, "PageUp": PageUp, "Shift+PageUp": PageUp, "Control+UpArrow": PageUp, "Control+U": PageUp, "PageDown": PageDown, "Shift+PageDown": PageDown, "Control+DownArrow": PageDown, "Shift+Control+V": PageDown, "Alt+√": PageDown, "Alt+V": PageDown, "Meta+Home": DocHome, "Shift+Home": DocHome, "Meta+H": DocHome, "Meta+End": DocEnd, "Shift+End": DocEnd, "Meta+L": DocEnd, "Control+RightArrow": WordRight, "Control+LeftArrow": WordLeft, "Alt+RightArrow": WordRight, "Shift+Alt+RightArrow": WordRight, "Alt+LeftArrow": WordLeft, "Shift+Alt+LeftArrow": WordLeft, "Home": Home, "Control+A": Home, "Shift+Control+A": Home, "End": End, "Control+E": End, "Shift+Control+E": End, "Tab": FocusNext, "Shift+Tab": FocusPrev, "ReturnEnter": Enter, "KeypadEnter": Enter, "Meta+A": SelectAll, "Control+G": CancelSelect, "Control+Spacebar": SelectMode, "Control+ReturnEnter": Accept, "Escape": Abort, "Backspace": Backspace, "Control+Backspace": BackspaceWord, "Alt+Backspace": BackspaceWord, "Delete": Delete, "Control+Delete": DeleteWord, "Alt+Delete": DeleteWord, "Control+D": Delete, "Control+K": Kill, "Alt+∑": Copy, "Alt+C": Copy, "Meta+C": Copy, "Control+W": Cut, "Meta+X": Cut, "Control+Y": Paste, "Control+V": Paste, "Meta+V": Paste, "Shift+Meta+V": PasteHist, "Alt+D": Duplicate, "Control+T": Transpose, "Alt+T": TransposeWord, "Control+Z": Undo, "Meta+Z": Undo, "Shift+Control+Z": Redo, "Shift+Meta+Z": Redo, "Control+I": Insert, "Control+O": InsertAfter, "Shift+Meta+=": ZoomIn, "Meta+=": ZoomIn, "Meta+-": ZoomOut, "Control+=": ZoomIn, "Shift+Control++": ZoomIn, "Shift+Meta+-": ZoomOut, "Control+-": ZoomOut, "Shift+Control+_": ZoomOut, "Control+Alt+P": Settings, "F5": Refresh, "Control+L": Recenter, "Control+.": Complete, "Control+,": Lookup, "Control+S": Search, "Meta+F": Find, "Meta+R": Replace, "Control+J": Jump, "Control+[": HistPrev, "Control+]": HistNext, "Meta+[": HistPrev, "Meta+]": HistNext, "F10": Menu, "Control+M": Menu, "Meta+`": WinFocusNext, "Meta+W": WinClose, "Control+Alt+G": WinSnapshot, "Shift+Control+G": WinSnapshot, "Control+Alt+I": Inspector, "Shift+Control+I": Inspector, "Meta+N": New, "Shift+Meta+N": NewAlt1, "Alt+Meta+N": NewAlt2, "Meta+O": Open, "Shift+Meta+O": OpenAlt1, "Alt+Meta+O": OpenAlt2, "Meta+S": Save, "Shift+Meta+S": SaveAs, "Alt+Meta+S": SaveAlt, "Shift+Meta+W": CloseAlt1, "Alt+Meta+W": CloseAlt2, }}, {"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", Map{ "UpArrow": MoveUp, "Shift+UpArrow": MoveUp, "Meta+UpArrow": MoveUp, "Control+P": MoveUp, "Shift+Control+P": MoveUp, "Meta+Control+P": MoveUp, "DownArrow": MoveDown, "Shift+DownArrow": MoveDown, "Meta+DownArrow": MoveDown, "Control+N": MoveDown, "Shift+Control+N": MoveDown, "Meta+Control+N": MoveDown, "RightArrow": MoveRight, "Shift+RightArrow": MoveRight, "Meta+RightArrow": End, "Control+F": MoveRight, "Shift+Control+F": MoveRight, "Meta+Control+F": MoveRight, "LeftArrow": MoveLeft, "Shift+LeftArrow": MoveLeft, "Meta+LeftArrow": Home, "Control+B": MoveLeft, "Shift+Control+B": MoveLeft, "Meta+Control+B": MoveLeft, "PageUp": PageUp, "Shift+PageUp": PageUp, "Control+UpArrow": PageUp, "Control+U": PageUp, "PageDown": PageDown, "Shift+PageDown": PageDown, "Control+DownArrow": PageDown, "Shift+Control+V": PageDown, "Alt+√": PageDown, "Alt+V": PageDown, "Control+V": PageDown, "Control+RightArrow": WordRight, "Control+LeftArrow": WordLeft, "Alt+RightArrow": WordRight, "Shift+Alt+RightArrow": WordRight, "Alt+LeftArrow": WordLeft, "Shift+Alt+LeftArrow": WordLeft, "Home": Home, "Control+A": Home, "Shift+Control+A": Home, "End": End, "Control+E": End, "Shift+Control+E": End, "Meta+Home": DocHome, "Shift+Home": DocHome, "Meta+H": DocHome, "Control+H": DocHome, "Control+Alt+A": DocHome, "Meta+End": DocEnd, "Shift+End": DocEnd, "Meta+L": DocEnd, "Control+Alt+E": DocEnd, "Alt+Ƒ": WordRight, "Alt+F": WordRight, "Alt+∫": WordLeft, "Alt+B": WordLeft, "Tab": FocusNext, "Shift+Tab": FocusPrev, "ReturnEnter": Enter, "KeypadEnter": Enter, "Meta+A": SelectAll, "Control+G": CancelSelect, "Control+Spacebar": SelectMode, "Control+ReturnEnter": Accept, "Escape": Abort, "Backspace": Backspace, "Control+Backspace": BackspaceWord, "Alt+Backspace": BackspaceWord, "Delete": Delete, "Control+Delete": DeleteWord, "Alt+Delete": DeleteWord, "Control+D": Delete, "Control+K": Kill, "Alt+∑": Copy, "Alt+C": Copy, "Meta+C": Copy, "Control+W": Cut, "Meta+X": Cut, "Control+Y": Paste, "Meta+V": Paste, "Shift+Meta+V": PasteHist, "Shift+Control+Y": PasteHist, "Alt+∂": Duplicate, "Alt+D": Duplicate, "Control+T": Transpose, "Alt+T": TransposeWord, "Control+Z": Undo, "Meta+Z": Undo, "Control+/": Undo, "Shift+Control+Z": Redo, "Shift+Meta+Z": Redo, "Control+I": Insert, "Control+O": InsertAfter, "Shift+Meta+=": ZoomIn, "Meta+=": ZoomIn, "Meta+-": ZoomOut, "Control+=": ZoomIn, "Shift+Control++": ZoomIn, "Shift+Meta+-": ZoomOut, "Control+-": ZoomOut, "Shift+Control+_": ZoomOut, "Control+Alt+P": Settings, "F5": Refresh, "Control+L": Recenter, "Control+.": Complete, "Control+,": Lookup, "Control+S": Search, "Meta+F": Find, "Meta+R": Replace, "Control+R": Replace, "Control+J": Jump, "Control+[": HistPrev, "Control+]": HistNext, "Meta+[": HistPrev, "Meta+]": HistNext, "F10": Menu, "Control+M": Menu, "Meta+`": WinFocusNext, "Meta+W": WinClose, "Control+Alt+G": WinSnapshot, "Shift+Control+G": WinSnapshot, "Control+Alt+I": Inspector, "Shift+Control+I": Inspector, "Meta+N": New, "Shift+Meta+N": NewAlt1, "Alt+Meta+N": NewAlt2, "Meta+O": Open, "Shift+Meta+O": OpenAlt1, "Alt+Meta+O": OpenAlt2, "Meta+S": Save, "Shift+Meta+S": SaveAs, "Alt+Meta+S": SaveAlt, "Shift+Meta+W": CloseAlt1, "Alt+Meta+W": CloseAlt2, }}, {"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", Map{ "UpArrow": MoveUp, "Shift+UpArrow": MoveUp, "Alt+UpArrow": MoveUp, "Control+P": MoveUp, "Shift+Control+P": MoveUp, "Alt+Control+P": MoveUp, "DownArrow": MoveDown, "Shift+DownArrow": MoveDown, "Alt+DownArrow": MoveDown, "Control+N": MoveDown, "Shift+Control+N": MoveDown, "Alt+Control+N": MoveDown, "RightArrow": MoveRight, "Shift+RightArrow": MoveRight, "Alt+RightArrow": End, "Control+F": MoveRight, "Shift+Control+F": MoveRight, "Alt+Control+F": MoveRight, "LeftArrow": MoveLeft, "Shift+LeftArrow": MoveLeft, "Alt+LeftArrow": Home, "Control+B": MoveLeft, "Shift+Control+B": MoveLeft, "Alt+Control+B": MoveLeft, "PageUp": PageUp, "Shift+PageUp": PageUp, "Control+UpArrow": PageUp, "Control+U": PageUp, "Shift+Control+U": PageUp, "Alt+Control+U": PageUp, "PageDown": PageDown, "Shift+PageDown": PageDown, "Control+DownArrow": PageDown, "Control+V": PageDown, "Shift+Control+V": PageDown, "Alt+Control+V": PageDown, "Alt+Home": DocHome, "Shift+Home": DocHome, "Alt+H": DocHome, "Control+Alt+A": DocHome, "Alt+End": DocEnd, "Shift+End": DocEnd, "Alt+L": DocEnd, "Control+Alt+E": DocEnd, "Control+RightArrow": WordRight, "Control+LeftArrow": WordLeft, "Home": Home, "Control+A": Home, "Shift+Control+A": Home, "End": End, "Control+E": End, "Shift+Control+E": End, "Tab": FocusNext, "Shift+Tab": FocusPrev, "ReturnEnter": Enter, "KeypadEnter": Enter, "Alt+A": SelectAll, "Control+G": CancelSelect, "Control+Spacebar": SelectMode, "Control+ReturnEnter": Accept, "Escape": Abort, "Backspace": Backspace, "Control+Backspace": BackspaceWord, "Delete": Delete, "Control+D": Delete, "Control+Delete": DeleteWord, "Alt+Delete": DeleteWord, "Control+K": Kill, "Alt+W": Copy, "Alt+C": Copy, "Control+W": Cut, "Alt+X": Cut, "Control+Y": Paste, "Alt+V": Paste, "Shift+Alt+V": PasteHist, "Shift+Control+Y": PasteHist, "Alt+D": Duplicate, "Control+T": Transpose, "Alt+T": TransposeWord, "Control+Z": Undo, "Control+/": Undo, "Shift+Control+Z": Redo, "Control+I": Insert, "Control+O": InsertAfter, "Control+=": ZoomIn, "Shift+Control++": ZoomIn, "Control+-": ZoomOut, "Shift+Control+_": ZoomOut, "Control+Alt+P": Settings, "F5": Refresh, "Control+L": Recenter, "Control+.": Complete, "Control+,": Lookup, "Control+S": Search, "Alt+F": Find, "Control+R": Replace, "Control+J": Jump, "Control+[": HistPrev, "Control+]": HistNext, "F10": Menu, "Control+M": Menu, "Alt+F6": WinFocusNext, "Shift+Control+W": WinClose, "Control+Alt+G": WinSnapshot, "Shift+Control+G": WinSnapshot, "Control+Alt+I": Inspector, "Shift+Control+I": Inspector, "Alt+N": New, "Shift+Alt+N": NewAlt1, "Control+Alt+N": NewAlt2, "Alt+O": Open, "Shift+Alt+O": OpenAlt1, "Control+Alt+O": OpenAlt2, "Alt+S": Save, "Shift+Alt+S": SaveAs, "Control+Alt+S": SaveAlt, "Shift+Alt+W": CloseAlt1, "Control+Alt+W": CloseAlt2, }}, {"LinuxStandard", "Standard Linux KeyMap", Map{ "UpArrow": MoveUp, "Shift+UpArrow": MoveUp, "DownArrow": MoveDown, "Shift+DownArrow": MoveDown, "RightArrow": MoveRight, "Shift+RightArrow": MoveRight, "LeftArrow": MoveLeft, "Shift+LeftArrow": MoveLeft, "PageUp": PageUp, "Shift+PageUp": PageUp, "Control+UpArrow": PageUp, "PageDown": PageDown, "Shift+PageDown": PageDown, "Control+DownArrow": PageDown, "Home": Home, "Alt+LeftArrow": Home, "End": End, "Alt+Home": DocHome, "Shift+Home": DocHome, "Alt+End": DocEnd, "Shift+End": DocEnd, "Control+RightArrow": WordRight, "Control+LeftArrow": WordLeft, "Alt+RightArrow": End, "Tab": FocusNext, "Shift+Tab": FocusPrev, "ReturnEnter": Enter, "KeypadEnter": Enter, "Control+A": SelectAll, "Shift+Control+A": CancelSelect, "Control+G": CancelSelect, "Control+Spacebar": SelectMode, "Control+ReturnEnter": Accept, "Escape": Abort, "Backspace": Backspace, "Control+Backspace": BackspaceWord, "Delete": Delete, "Control+Delete": DeleteWord, "Alt+Delete": DeleteWord, "Control+K": Kill, "Control+C": Copy, "Control+X": Cut, "Control+V": Paste, "Shift+Control+V": PasteHist, "Alt+D": Duplicate, "Control+T": Transpose, "Alt+T": TransposeWord, "Control+Z": Undo, "Control+Y": Redo, "Shift+Control+Z": Redo, "Control+Alt+I": Insert, "Control+Alt+O": InsertAfter, "Control+=": ZoomIn, "Shift+Control++": ZoomIn, "Control+-": ZoomOut, "Shift+Control+_": ZoomOut, "Shift+Control+P": Settings, "Control+Alt+P": Settings, "F5": Refresh, "Control+L": Recenter, "Control+.": Complete, "Control+,": Lookup, "Alt+S": Search, "Control+F": Find, "Control+H": Replace, "Control+R": Replace, "Control+J": Jump, "Control+[": HistPrev, "Control+]": HistNext, "Control+N": New, "F10": Menu, "Control+M": Menu, "Alt+F6": WinFocusNext, "Control+W": WinClose, "Control+Alt+G": WinSnapshot, "Shift+Control+G": WinSnapshot, "Shift+Control+I": Inspector, "Shift+Control+N": NewAlt1, "Control+Alt+N": NewAlt2, "Control+O": Open, "Shift+Control+O": OpenAlt1, "Shift+Alt+O": OpenAlt2, "Control+S": Save, "Shift+Control+S": SaveAs, "Control+Alt+S": SaveAlt, "Shift+Control+W": CloseAlt1, "Control+Alt+W": CloseAlt2, }}, {"WindowsStandard", "Standard Windows KeyMap", Map{ "UpArrow": MoveUp, "Shift+UpArrow": MoveUp, "DownArrow": MoveDown, "Shift+DownArrow": MoveDown, "RightArrow": MoveRight, "Shift+RightArrow": MoveRight, "LeftArrow": MoveLeft, "Shift+LeftArrow": MoveLeft, "PageUp": PageUp, "Shift+PageUp": PageUp, "Control+UpArrow": PageUp, "PageDown": PageDown, "Shift+PageDown": PageDown, "Control+DownArrow": PageDown, "Home": Home, "Alt+LeftArrow": Home, "End": End, "Alt+RightArrow": End, "Alt+Home": DocHome, "Shift+Home": DocHome, "Alt+End": DocEnd, "Shift+End": DocEnd, "Control+RightArrow": WordRight, "Control+LeftArrow": WordLeft, "Tab": FocusNext, "Shift+Tab": FocusPrev, "ReturnEnter": Enter, "KeypadEnter": Enter, "Control+A": SelectAll, "Shift+Control+A": CancelSelect, "Control+G": CancelSelect, "Control+Spacebar": SelectMode, "Control+ReturnEnter": Accept, "Escape": Abort, "Backspace": Backspace, "Control+Backspace": BackspaceWord, "Delete": Delete, "Control+Delete": DeleteWord, "Alt+Delete": DeleteWord, "Control+K": Kill, "Control+C": Copy, "Control+X": Cut, "Control+V": Paste, "Shift+Control+V": PasteHist, "Alt+D": Duplicate, "Control+T": Transpose, "Alt+T": TransposeWord, "Control+Z": Undo, "Control+Y": Redo, "Shift+Control+Z": Redo, "Control+Alt+I": Insert, "Control+Alt+O": InsertAfter, "Control+=": ZoomIn, "Shift+Control++": ZoomIn, "Control+-": ZoomOut, "Shift+Control+_": ZoomOut, "Shift+Control+P": Settings, "Control+Alt+P": Settings, "F5": Refresh, "Control+L": Recenter, "Control+.": Complete, "Control+,": Lookup, "Alt+S": Search, "Control+F": Find, "Control+H": Replace, "Control+R": Replace, "Control+J": Jump, "Control+[": HistPrev, "Control+]": HistNext, "F10": Menu, "Control+M": Menu, "Alt+F6": WinFocusNext, "Control+W": WinClose, "Control+Alt+G": WinSnapshot, "Shift+Control+G": WinSnapshot, "Shift+Control+I": Inspector, "Control+N": New, "Shift+Control+N": NewAlt1, "Control+Alt+N": NewAlt2, "Control+O": Open, "Shift+Control+O": OpenAlt1, "Shift+Alt+O": OpenAlt2, "Control+S": Save, "Shift+Control+S": SaveAs, "Control+Alt+S": SaveAlt, "Shift+Control+W": CloseAlt1, "Control+Alt+W": CloseAlt2, }}, {"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", Map{ "UpArrow": MoveUp, "Shift+UpArrow": MoveUp, "DownArrow": MoveDown, "Shift+DownArrow": MoveDown, "RightArrow": MoveRight, "Shift+RightArrow": MoveRight, "LeftArrow": MoveLeft, "Shift+LeftArrow": MoveLeft, "PageUp": PageUp, "Shift+PageUp": PageUp, "Control+UpArrow": PageUp, "PageDown": PageDown, "Shift+PageDown": PageDown, "Control+DownArrow": PageDown, "Home": Home, "Alt+LeftArrow": Home, "End": End, "Alt+Home": DocHome, "Shift+Home": DocHome, "Alt+End": DocEnd, "Shift+End": DocEnd, "Control+RightArrow": WordRight, "Control+LeftArrow": WordLeft, "Alt+RightArrow": End, "Tab": FocusNext, "Shift+Tab": FocusPrev, "ReturnEnter": Enter, "KeypadEnter": Enter, "Control+A": SelectAll, "Shift+Control+A": CancelSelect, "Control+G": CancelSelect, "Control+Spacebar": SelectMode, "Control+ReturnEnter": Accept, "Escape": Abort, "Backspace": Backspace, "Control+Backspace": BackspaceWord, "Delete": Delete, "Control+Delete": DeleteWord, "Alt+Delete": DeleteWord, "Control+K": Kill, "Control+C": Copy, "Control+X": Cut, "Control+V": Paste, "Shift+Control+V": PasteHist, "Alt+D": Duplicate, "Control+T": Transpose, "Alt+T": TransposeWord, "Control+Z": Undo, "Control+Y": Redo, "Shift+Control+Z": Redo, "Control+Alt+I": Insert, "Control+Alt+O": InsertAfter, "Control+=": ZoomIn, "Shift+Control++": ZoomIn, "Control+-": ZoomOut, "Shift+Control+_": ZoomOut, "Shift+Control+P": Settings, "Control+Alt+P": Settings, "F5": Refresh, "Control+L": Recenter, "Control+.": Complete, "Control+,": Lookup, "Alt+S": Search, "Control+F": Find, "Control+H": Replace, "Control+R": Replace, "Control+J": Jump, "Control+[": HistPrev, "Control+]": HistNext, "F10": Menu, "Control+M": Menu, "Alt+F6": WinFocusNext, "Control+W": WinClose, "Control+Alt+G": WinSnapshot, "Shift+Control+G": WinSnapshot, "Shift+Control+I": Inspector, "Control+N": New, "Shift+Control+N": NewAlt1, "Control+Alt+N": NewAlt2, "Control+O": Open, "Shift+Control+O": OpenAlt1, "Shift+Alt+O": OpenAlt2, "Control+S": Save, "Shift+Control+S": SaveAs, "Control+Alt+S": SaveAlt, "Shift+Control+W": CloseAlt1, "Control+Alt+W": CloseAlt2, }}, }
StdMaps is the original compiled-in set of standard keymaps that have the lastest key functions bound to standard key chords.
Functions ¶
func SetActiveMap ¶
SetActiveMap sets the current ActiveKeyMap, calling Update on the map prior to setting it to ensure that it is a valid, complete map
func SetActiveMapName ¶
func SetActiveMapName(mapnm MapName)
SetActiveMapName sets the current ActiveKeyMap by name from those defined in AvailKeyMaps, calling Update on the map prior to setting it to ensure that it is a valid, complete map
Types ¶
type Funs ¶
type Funs int32 //enums:enum
Funs are functions that keyboard events can perform in the GUI. It seems possible to keep this flat and consistent across different contexts, as long as the functions can be appropriately reinterpreted for each context.
const ( Nil Funs = iota MoveUp MoveDown MoveRight MoveLeft PageUp PageDown // PageRight // PageLeft Home // start-of-line End // end-of-line DocHome // start-of-doc -- Control / Alt / Shift +Home DocEnd // end-of-doc Control / Alt / Shift +End WordRight WordLeft FocusNext // Tab FocusPrev // Shift-Tab Enter // Enter / return key -- has various special functions Accept // Ctrl+Enter = accept any changes and close dialog / move to next CancelSelect SelectMode SelectAll Abort // EditItem Copy Cut Paste PasteHist // from history Backspace BackspaceWord Delete DeleteWord Kill Duplicate Transpose TransposeWord Undo Redo Insert InsertAfter ZoomOut ZoomIn Settings Refresh Recenter // Ctrl+L in emacs Complete Lookup Search // Ctrl+S in emacs -- more interactive type of search Find // Command+F full-dialog find Replace Jump // jump to line HistPrev HistNext Menu // put focus on menu WinFocusNext WinClose WinSnapshot Inspector // Below are menu specific functions -- use these as shortcuts for menu buttons // allows uniqueness of mapping and easy customization of all key buttons New NewAlt1 // alternative version (e.g., shift) NewAlt2 // alternative version (e.g., alt) Open OpenAlt1 // alternative version (e.g., shift) OpenAlt2 // alternative version (e.g., alt) Save SaveAs SaveAlt // another alt (e.g., alt) CloseAlt1 // alternative version (e.g., shift) CloseAlt2 // alternative version (e.g., alt) )
const FunsN Funs = 66
FunsN is the highest valid value for type Funs, plus one.
func FunsValues ¶
func FunsValues() []Funs
FunsValues returns all possible values for the type Funs.
func (Funs) Chord ¶ added in v0.0.8
Chord returns all of the key chord triggers for this key function in the current active map, separating them with newlines.
func (Funs) Label ¶ added in v0.0.8
Label transforms the key function into a string representing its underlying key chord(s) in a form suitable for display to users.
func (Funs) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Funs) SetString ¶
SetString sets the Funs value from its string representation, and returns an error if the string is invalid.
func (*Funs) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Map ¶
Map is a map between a key sequence (chord) and a specific KeyFun function. This mapping must be unique, in that each chord has unique KeyFun, but multiple chords can trigger the same function.
var ActiveMap *Map
ActiveMap points to the active map -- users can set this to an alternative map in Prefs
func (*Map) ChordFor ¶
ChordFor returns all of the key chord triggers for the given key function in the map, separating them with newlines.
type MapItem ¶
type MapItem struct { // the key chord that activates a function Key key.Chord // the function of that key Fun Funs }
MapItem records one element of the key map, which is used for organizing the map.
type MapName ¶
type MapName string
MapName has an associated Value for selecting from the list of available key map names, for use in preferences etc.
var ActiveMapName MapName
ActiveMapName is the name of the active keymap
var DefaultMap MapName = "LinuxStandard"
DefaultMap is the overall default keymap, which is set in init depending on the platform
type Maps ¶
type Maps []MapsItem //gti:add
Maps is a list of KeyMap's -- users can edit these in their settings -- to create a custom one, just duplicate an existing map, rename, and customize
var AvailMaps Maps
AvailMaps is the current list of available keymaps for use -- can be loaded / saved / edited with preferences. This is set to StdKeyMaps at startup.
func (*Maps) MapByName ¶
MapByName returns a keymap and index by name -- returns false and emits a message to stdout if not found
func (*Maps) MarkdownDoc ¶
MarkdownDoc generates a markdown table of all the key mappings
func (*Maps) Open ¶
Open opens keymaps from a json-formatted file. You can save and open key maps to / from files to share, experiment, transfer, etc
func (*Maps) OpenSettings ¶
OpenSettings opens KeyMaps from Cogent Core standard prefs directory, in file key_maps_prefs.json. This is called automatically, so calling it manually should not be necessary in most cases.
func (*Maps) RevertToStd ¶
func (km *Maps) RevertToStd()
RevertToStd reverts the keymaps to using the StdKeyMaps that are compiled into the program and have all the lastest key functions defined. If you have edited your maps, and are finding things not working, it is a good idea to save your current maps and try this, or at least do ViewStdMaps to see the current standards. Your current map edits will be lost if you proceed!
type MapsItem ¶
type MapsItem struct { // name of keymap Name string `width:"20"` // description of keymap -- good idea to include source it was derived from Desc string // to edit key sequence click button and type new key combination; to edit function mapped to key sequence choose from menu Map Map }
MapsItem is an entry in a Maps list
func (*MapsItem) SetDesc ¶
SetDesc sets the [MapsItem.Desc]: description of keymap -- good idea to include source it was derived from