gidev

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Overview

Package gidev implements the GideView editor, using all the elements from the gide interface. Having it in a separate package allows GideView to also include other packages that tap into the gide interface, such as the GoPi interactive parser.

Index

Constants

View Source
const (
	FileTreeIdx = iota
	TextView1Idx
	TextView2Idx
	TabsIdx
)

These are then the fixed indices of the different elements in the splitview

View Source
const NTextViews = 2

NTextViews is the number of text views to create -- to keep things simple and consistent (e.g., splitter settings always have the same number of values), we fix this degree of freedom, and have flexibility in the splitter settings for what to actually show.

Variables

CatNoEdit are the files to NOT edit from categories: Doc, Data

View Source
var GideViewInactiveEmptyFunc = giv.ActionUpdateFunc(func(gei any, act *gi.Action) {
	ge := gei.(ki.Ki).Embed(KiT_GideView).(*GideView)
	if !ge.IsConfiged() {
		return
	}
	act.SetInactiveState(ge.IsEmpty())
})

GideViewInactiveEmptyFunc is an ActionUpdateFunc that inactivates action if project is empty

View Source
var GideViewInactiveTextSelectionFunc = giv.ActionUpdateFunc(func(gei any, act *gi.Action) {
	ge := gei.(ki.Ki).Embed(KiT_GideView).(*GideView)
	if !ge.IsConfiged() {
		return
	}
	if ge.ActiveTextView() != nil && ge.ActiveTextView().Buf != nil {
		act.SetActiveState(ge.ActiveTextView().HasSelection())
	} else {
		act.SetActiveState(false)
	}
})

GideViewInactiveTextSelectionFunc is an ActionUpdateFunc that inactivates action there is no active text view

View Source
var GideViewInactiveTextViewFunc = giv.ActionUpdateFunc(func(gei any, act *gi.Action) {
	ge := gei.(ki.Ki).Embed(KiT_GideView).(*GideView)
	if !ge.IsConfiged() {
		return
	}
	act.SetInactiveState(ge.ActiveTextView().Buf == nil)
})

GideViewInactiveTextViewFunc is an ActionUpdateFunc that inactivates action there is no active text view

View Source
var GideViewProps = ki.Props{
	"EnumType:Flag":    gi.KiT_NodeFlags,
	"background-color": &gi.Prefs.Colors.Background,
	"color":            &gi.Prefs.Colors.Font,
	"max-width":        -1,
	"max-height":       -1,
	"#title": ki.Props{
		"max-width":        -1,
		"horizontal-align": gist.AlignCenter,
		"vertical-align":   gist.AlignTop,
	},
	"MethViewNoUpdateAfter": true,
	"ToolBar": ki.PropSlice{
		{"UpdateFiles", ki.Props{
			"shortcut": "Command+U",
			"desc":     "update file browser list of files",
			"icon":     "update",
		}},
		{"NextViewFile", ki.Props{
			"label": "Open...",
			"icon":  "file-open",
			"desc":  "open a file in current active text view",
			"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
				return key.Chord(gide.ChordForFun(gide.KeyFunFileOpen).String())
			}),
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "ActiveFilename",
				}},
			},
		}},
		{"SaveActiveView", ki.Props{
			"label": "Save",
			"desc":  "save active text view file to its current filename",
			"icon":  "file-save",
			"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
				return key.Chord(gide.ChordForFun(gide.KeyFunBufSave).String())
			}),
		}},
		{"SaveActiveViewAs", ki.Props{
			"label": "Save As...",
			"icon":  "file-save",
			"desc":  "save active text view file to a new filename",
			"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
				return key.Chord(gide.ChordForFun(gide.KeyFunBufSaveAs).String())
			}),
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "ActiveFilename",
				}},
			},
		}},
		{"SaveAll", ki.Props{
			"icon": "file-save",
			"desc": "save all open files (if modified) and the current project prefs (if .gide file exists, from prior Save Proj As..)",
		}},
		{"ViewOpenNodeName", ki.Props{
			"icon":         "file-text",
			"label":        "Edit",
			"desc":         "select an open file to view in active text view",
			"submenu-func": giv.SubMenuFunc(GideViewOpenNodes),
			"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
				return key.Chord(gide.ChordForFun(gide.KeyFunBufSelect).String())
			}),
			"Args": ki.PropSlice{
				{"Node Name", ki.Props{}},
			},
		}},
		{"sep-find", ki.BlankProp{}},
		{"CursorToHistPrev", ki.Props{
			"icon":     "wedge-left",
			"shortcut": gi.KeyFunHistPrev,
			"label":    "",
			"desc":     "move cursor to previous location in active text view",
		}},
		{"CursorToHistNext", ki.Props{
			"icon":     "wedge-right",
			"shortcut": gi.KeyFunHistNext,
			"label":    "",
			"desc":     "move cursor to next location in active text view",
		}},
		{"Find", ki.Props{
			"label":    "Find...",
			"icon":     "search",
			"desc":     "Find / replace in all open folders in file browser",
			"shortcut": gi.KeyFunFind,
			"Args": ki.PropSlice{
				{"Search For", ki.Props{
					"default-field": "Prefs.Find.Find",
					"history-field": "Prefs.Find.FindHist",
					"width":         80,
				}},
				{"Replace With", ki.Props{
					"desc":          "Optional replace string -- replace will be controlled interactively in Find panel, including replace all",
					"default-field": "Prefs.Find.Replace",
					"history-field": "Prefs.Find.ReplHist",
					"width":         80,
				}},
				{"Ignore Case", ki.Props{
					"default-field": "Prefs.Find.IgnoreCase",
				}},
				{"Regexp", ki.Props{
					"default-field": "Prefs.Find.Regexp",
				}},
				{"Location", ki.Props{
					"desc":          "location to find in",
					"default-field": "Prefs.Find.Loc",
				}},
				{"Languages", ki.Props{
					"desc":          "restrict find to files associated with these languages -- leave empty for all files",
					"default-field": "Prefs.Find.Langs",
				}},
			},
		}},
		{"Symbols", ki.Props{
			"icon": "structure",
		}},
		{"Spell", ki.Props{
			"label": "Spelling",
			"icon":  "spelling",
		}},
		{"sep-file", ki.BlankProp{}},
		{"Build", ki.Props{
			"icon": "terminal",
			"desc": "build the project -- command(s) specified in Project Prefs",
			"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
				return key.Chord(gide.ChordForFun(gide.KeyFunBuildProj).String())
			}),
		}},
		{"Run", ki.Props{
			"icon": "terminal",
			"desc": "run the project -- command(s) specified in Project Prefs",
			"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
				return key.Chord(gide.ChordForFun(gide.KeyFunRunProj).String())
			}),
		}},
		{"Debug", ki.Props{
			"icon": "terminal",
			"desc": "debug currently selected executable (context menu on executable, select Set Run Exec) -- if none selected, prompts to select one",
		}},
		{"DebugTest", ki.Props{
			"icon": "terminal",
			"desc": "debug test in current active view directory",
		}},
		{"sep-exe", ki.BlankProp{}},
		{"Commit", ki.Props{
			"icon": "star",
		}},
		{"ExecCmdNameActive", ki.Props{
			"icon":            "terminal",
			"label":           "Exec Cmd",
			"desc":            "execute given command on active file / directory / project",
			"subsubmenu-func": giv.SubSubMenuFunc(ExecCmds),
			"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
				return key.Chord(gide.ChordForFun(gide.KeyFunExecCmd).String())
			}),
			"Args": ki.PropSlice{
				{"Cmd Name", ki.Props{}},
			},
		}},
		{"sep-splt", ki.BlankProp{}},
		{"Splits", ki.PropSlice{
			{"SplitsSetView", ki.Props{
				"label":   "Set View",
				"submenu": &gide.AvailSplitNames,
				"Args": ki.PropSlice{
					{"Split Name", ki.Props{
						"default-field": "Prefs.SplitName",
					}},
				},
			}},
			{"SplitsSaveAs", ki.Props{
				"label": "Save As...",
				"desc":  "save current splitter values to a new named split configuration",
				"Args": ki.PropSlice{
					{"Name", ki.Props{
						"width": 60,
					}},
					{"Desc", ki.Props{
						"width": 60,
					}},
				},
			}},
			{"SplitsSave", ki.Props{
				"label":   "Save",
				"submenu": &gide.AvailSplitNames,
				"Args": ki.PropSlice{
					{"Split Name", ki.Props{
						"default-field": "Prefs.SplitName",
					}},
				},
			}},
			{"SplitsEdit", ki.Props{
				"label": "Edit...",
			}},
		}},
	},
	"MainMenu": ki.PropSlice{
		{"AppMenu", ki.BlankProp{}},
		{"File", ki.PropSlice{
			{"OpenRecent", ki.Props{
				"submenu": &gide.SavedPaths,
				"Args": ki.PropSlice{
					{"File Name", ki.Props{}},
				},
			}},
			{"OpenProj", ki.Props{
				"shortcut": gi.KeyFunMenuOpen,
				"label":    "Open Project...",
				"desc":     "open a gide project -- can be a .gide file or just a file or directory (projects are just directories with relevant files)",
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"default-field": "ProjFilename",
						"ext":           ".gide",
					}},
				},
			}},
			{"OpenPath", ki.Props{
				"shortcut": gi.KeyFunMenuOpenAlt1,
				"label":    "Open Path...",
				"desc":     "open a gide project for a file or directory (projects are just directories with relevant files)",
				"Args": ki.PropSlice{
					{"Path", ki.Props{}},
				},
			}},
			{"New", ki.PropSlice{
				{"NewProj", ki.Props{
					"shortcut": gi.KeyFunMenuNew,
					"label":    "New Project...",
					"desc":     "Create a new project -- select a path for the parent folder, and a folder name for the new project -- all GideView projects are basically folders with files.  You can also specify the main language and {version control system for the project.  For other options, do <code>Proj Prefs</code> in the File menu of the new project.",
					"Args": ki.PropSlice{
						{"Parent Folder", ki.Props{
							"dirs-only":     true,
							"default-field": "ProjRoot",
						}},
						{"Folder", ki.Props{
							"width": 60,
						}},
						{"Main Lang", ki.Props{}},
						{"Version Ctrl", ki.Props{}},
					},
				}},
				{"NewFile", ki.Props{
					"shortcut": gi.KeyFunMenuNewAlt1,
					"label":    "New File...",
					"desc":     "Create a new file in project -- to create in sub-folders, use context menu on folder in file browser",
					"Args": ki.PropSlice{
						{"File Name", ki.Props{
							"width": 60,
						}},
						{"Add To Version Control", ki.Props{}},
					},
				}},
			}},
			{"SaveProj", ki.Props{
				"shortcut": gi.KeyFunMenuSave,
				"label":    "Save Project",
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"SaveProjAs", ki.Props{
				"shortcut": gi.KeyFunMenuSaveAs,
				"label":    "Save Project As...",
				"desc":     "Save project to given file name -- this is the .gide file containing preferences and current settings -- also saves all open files -- once saved, further saving is automatic",
				"updtfunc": GideViewInactiveEmptyFunc,
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"default-field": "ProjFilename",
						"ext":           ".gide",
					}},
					{"SaveAll", ki.Props{
						"value": false,
					}},
				},
			}},
			{"SaveAll", ki.Props{}},
			{"sep-af", ki.BlankProp{}},
			{"ViewFile", ki.Props{
				"label": "Open File...",
				"shortcut-func": func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunFileOpen).String())
				},
				"updtfunc": GideViewInactiveEmptyFunc,
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"default-field": "ActiveFilename",
					}},
				},
			}},
			{"SaveActiveView", ki.Props{
				"label": "Save File",
				"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunBufSave).String())
				}),
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"SaveActiveViewAs", ki.Props{
				"label":    "Save File As...",
				"updtfunc": GideViewInactiveEmptyFunc,
				"desc":     "save active text view file to a new filename",
				"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunBufSaveAs).String())
				}),
				"Args": ki.PropSlice{
					{"File Name", ki.Props{
						"default-field": "ActiveFilename",
					}},
				},
			}},
			{"RevertActiveView", ki.Props{
				"desc":     "Revert active file to last saved version: this will lose all active changes -- are you sure?",
				"confirm":  true,
				"label":    "Revert File...",
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"CloseActiveView", ki.Props{
				"label":    "Close File",
				"updtfunc": GideViewInactiveEmptyFunc,
				"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunBufClose).String())
				}),
			}},
			{"sep-prefs", ki.BlankProp{}},
			{"EditProjPrefs", ki.Props{
				"label":    "Project Prefs...",
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"sep-close", ki.BlankProp{}},
			{"Close Window", ki.BlankProp{}},
		}},
		{"Edit", ki.PropSlice{
			{"Copy", ki.Props{
				"keyfun":   gi.KeyFunCopy,
				"updtfunc": GideViewInactiveTextSelectionFunc,
			}},
			{"Cut", ki.Props{
				"keyfun":   gi.KeyFunCut,
				"updtfunc": GideViewInactiveTextSelectionFunc,
			}},
			{"Paste", ki.Props{
				"keyfun": gi.KeyFunPaste,
			}},
			{"Paste History...", ki.Props{
				"keyfun": gi.KeyFunPasteHist,
			}},
			{"Registers", ki.PropSlice{
				{"RegisterCopy", ki.Props{
					"label": "Copy...",
					"desc":  "save currently-selected text to a named register, which can be pasted later -- persistent across sessions as well",
					"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
						return key.Chord(gide.ChordForFun(gide.KeyFunRegCopy).String())
					}),
					"updtfunc": GideViewInactiveEmptyFunc,
					"Args": ki.PropSlice{
						{"Register Name", ki.Props{
							"default": "",
						}},
					},
				}},
				{"RegisterPaste", ki.Props{
					"label": "Paste...",
					"desc":  "paste text from named register",
					"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
						return key.Chord(gide.ChordForFun(gide.KeyFunRegPaste).String())
					}),
					"updtfunc": GideViewInactiveEmptyFunc,
					"Args": ki.PropSlice{
						{"Register Name", ki.Props{
							"default-field": "Prefs.Register",
						}},
					},
				}},
			}},
			{"sep-undo", ki.BlankProp{}},
			{"Undo", ki.Props{
				"keyfun": gi.KeyFunUndo,
			}},
			{"Redo", ki.Props{
				"keyfun": gi.KeyFunRedo,
			}},
			{"sep-find", ki.BlankProp{}},
			{"Find", ki.Props{
				"label":    "Find...",
				"shortcut": gi.KeyFunFind,
				"desc":     "Find / replace in all open folders in file browser",
				"updtfunc": GideViewInactiveEmptyFunc,
				"Args": ki.PropSlice{
					{"Search For", ki.Props{
						"default-field": "Prefs.Find.Find",
						"history-field": "Prefs.Find.FindHist",
						"width":         80,
					}},
					{"Replace With", ki.Props{
						"desc":          "Optional replace string -- replace will be controlled interactively in Find panel, including replace all",
						"default-field": "Prefs.Find.Replace",
						"history-field": "Prefs.Find.ReplHist",
						"width":         80,
					}},
					{"Ignore Case", ki.Props{
						"default-field": "Prefs.Find.IgnoreCase",
					}},
					{"Regexp", ki.Props{
						"default-field": "Prefs.Find.Regexp",
					}},
					{"Location", ki.Props{
						"desc":          "location to find in",
						"default-field": "Prefs.Find.Loc",
					}},
					{"Languages", ki.Props{
						"desc":          "restrict find to files associated with these languages -- leave empty for all files",
						"default-field": "Prefs.Find.Langs",
					}},
				},
			}},
			{"ReplaceInActive", ki.Props{
				"label":    "Replace In Active...",
				"shortcut": gi.KeyFunReplace,
				"desc":     "query-replace in current active text view only (use Find for multi-file)",
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"Spell", ki.Props{
				"label":    "Spelling...",
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"ShowCompletions", ki.Props{
				"keyfun":   gi.KeyFunComplete,
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"LookupSymbol", ki.Props{
				"keyfun":   gi.KeyFunLookup,
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"sep-adv", ki.BlankProp{}},
			{"CommentOut", ki.Props{
				"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunCommentOut).String())
				}),
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"Indent", ki.Props{
				"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunIndent).String())
				}),
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"sep-xform", ki.BlankProp{}},
			{"ReCase", ki.Props{
				"desc":     "replace currently-selected text with text of given case",
				"updtfunc": GideViewInactiveEmptyFunc,
				"Args": ki.PropSlice{
					{"To Case", ki.Props{}},
				},
			}},
			{"JoinParaLines", ki.Props{
				"desc":     "merges sequences of lines with hard returns forming paragraphs, separated by blank lines, into a single line per paragraph, for given selected region (full text if no selection)",
				"confirm":  true,
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"TabsToSpaces", ki.Props{
				"desc":     "converts tabs to spaces for given selected region (full text if no selection)",
				"confirm":  true,
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"SpacesToTabs", ki.Props{
				"desc":     "converts spaces to tabs for given selected region (full text if no selection)",
				"confirm":  true,
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
		}},
		{"View", ki.PropSlice{
			{"Panels", ki.PropSlice{
				{"FocusNextPanel", ki.Props{
					"label": "Focus Next",
					"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
						return key.Chord(gide.ChordForFun(gide.KeyFunNextPanel).String())
					}),
					"updtfunc": GideViewInactiveEmptyFunc,
				}},
				{"FocusPrevPanel", ki.Props{
					"label": "Focus Prev",
					"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
						return key.Chord(gide.ChordForFun(gide.KeyFunPrevPanel).String())
					}),
					"updtfunc": GideViewInactiveEmptyFunc,
				}},
				{"CloneActiveView", ki.Props{
					"label": "Clone Active",
					"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
						return key.Chord(gide.ChordForFun(gide.KeyFunBufClone).String())
					}),
					"updtfunc": GideViewInactiveEmptyFunc,
				}},
			}},
			{"Splits", ki.PropSlice{
				{"SplitsSetView", ki.Props{
					"label":    "Set View",
					"submenu":  &gide.AvailSplitNames,
					"updtfunc": GideViewInactiveEmptyFunc,
					"Args": ki.PropSlice{
						{"Split Name", ki.Props{}},
					},
				}},
				{"SplitsSaveAs", ki.Props{
					"label":    "Save As...",
					"desc":     "save current splitter values to a new named split configuration",
					"updtfunc": GideViewInactiveEmptyFunc,
					"Args": ki.PropSlice{
						{"Name", ki.Props{
							"width": 60,
						}},
						{"Desc", ki.Props{
							"width": 60,
						}},
					},
				}},
				{"SplitsSave", ki.Props{
					"label":    "Save",
					"submenu":  &gide.AvailSplitNames,
					"updtfunc": GideViewInactiveEmptyFunc,
					"Args": ki.PropSlice{
						{"Split Name", ki.Props{}},
					},
				}},
				{"SplitsEdit", ki.Props{
					"updtfunc": GideViewInactiveEmptyFunc,
					"label":    "Edit...",
				}},
			}},
			{"OpenConsoleTab", ki.Props{
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
		}},
		{"Navigate", ki.PropSlice{
			{"Cursor", ki.PropSlice{
				{"Back", ki.Props{
					"keyfun": gi.KeyFunHistPrev,
				}},
				{"Forward", ki.Props{
					"keyfun": gi.KeyFunHistNext,
				}},
				{"Jump To Line", ki.Props{
					"keyfun": gi.KeyFunJump,
				}},
			}},
		}},
		{"Command", ki.PropSlice{
			{"Build", ki.Props{
				"updtfunc": GideViewInactiveEmptyFunc,
				"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunBuildProj).String())
				}),
			}},
			{"Run", ki.Props{
				"updtfunc": GideViewInactiveEmptyFunc,
				"shortcut-func": giv.ShortcutFunc(func(gei any, act *gi.Action) key.Chord {
					return key.Chord(gide.ChordForFun(gide.KeyFunRunProj).String())
				}),
			}},
			{"Debug", ki.Props{}},
			{"DebugTest", ki.Props{}},
			{"DebugAttach", ki.Props{
				"desc": "attach to an already running process: enter the process PID",
				"Args": ki.PropSlice{
					{"Process PID", ki.Props{}},
				},
			}},
			{"ChooseRunExec", ki.Props{
				"desc": "choose the executable to run for this project using the Run button",
				"Args": ki.PropSlice{
					{"RunExec", ki.Props{
						"default-field": "Prefs.RunExec",
					}},
				},
			}},
			{"sep-run", ki.BlankProp{}},
			{"Commit", ki.Props{
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"VCSLog", ki.Props{
				"label":    "VCS Log View",
				"desc":     "shows the VCS log of commits to repository associated with active file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc (SVN only supports a max number of entries).",
				"updtfunc": GideViewInactiveEmptyFunc,
				"Args": ki.PropSlice{
					{"Since Date", ki.Props{}},
				},
			}},
			{"VCSUpdateAll", ki.Props{
				"label":    "VCS Update All",
				"updtfunc": GideViewInactiveEmptyFunc,
			}},
			{"sep-cmd", ki.BlankProp{}},
			{"ExecCmdNameActive", ki.Props{
				"label":           "Exec Cmd",
				"subsubmenu-func": giv.SubSubMenuFunc(ExecCmds),
				"updtfunc":        GideViewInactiveEmptyFunc,
				"Args": ki.PropSlice{
					{"Cmd Name", ki.Props{}},
				},
			}},
			{"DiffFiles", ki.Props{
				"updtfunc": GideViewInactiveEmptyFunc,
				"Args": ki.PropSlice{
					{"File Name 1", ki.Props{}},
					{"File Name 2", ki.Props{}},
				},
			}},
			{"sep-cmd", ki.BlankProp{}},
			{"CountWords", ki.Props{
				"updtfunc":    GideViewInactiveEmptyFunc,
				"show-return": true,
			}},
			{"CountWordsRegion", ki.Props{
				"updtfunc":    GideViewInactiveEmptyFunc,
				"show-return": true,
			}},
		}},
		{"Window", "Windows"},
		{"Help", ki.PropSlice{
			{"HelpWiki", ki.Props{}},
		}},
	},
	"CallMethods": ki.PropSlice{
		{"NextViewFile", ki.Props{
			"Args": ki.PropSlice{
				{"File Name", ki.Props{
					"default-field": "ActiveFilename",
				}},
			},
		}},
		{"SplitsSetView", ki.Props{
			"Args": ki.PropSlice{
				{"Split Name", ki.Props{}},
			},
		}},
		{"ExecCmd", ki.Props{}},
		{"ChooseRunExec", ki.Props{
			"Args": ki.PropSlice{
				{"Exec File Name", ki.Props{}},
			},
		}},
	},
}
View Source
var KiT_GideView = kit.Types.AddType(&GideView{}, nil)

Functions

func CheckForProjAtPath

func CheckForProjAtPath(path string) (string, bool)

CheckForProjAtPath checks if there is a .gide project at the given path returns project path and true if found, otherwise false

func ExecCmds

func ExecCmds(it any, vp *gi.Viewport2D) [][]string

ExecCmds gets list of available commands for current active file, as a submenu-func

func GideViewOpenNodes

func GideViewOpenNodes(it any, vp *gi.Viewport2D) []string

GideViewOpenNodes gets list of open nodes for submenu-func

func ProjPathParse

func ProjPathParse(path string) (root, projnm, fnm string, ok bool)

ProjPathParse parses given project path into a root directory (which could be the path or just the directory portion of the path, depending in whether the path is a directory or not), and a bool if all is good (otherwise error message has been reported). projnm is always the last directory of the path.

func QuitReq

func QuitReq() bool

QuitReq is called when user tries to quit the app -- we go through all open main windows and look for gide windows and call their CloseWindowReq functions!

func TextLinkHandler

func TextLinkHandler(tl girl.TextLink) bool

TextLinkHandler is the GideView handler for text links -- preferred one b/c directly connects to correct GideView project

Types

type GideView

type GideView struct {
	gi.Frame

	// root directory for the project -- all projects must be organized within a top-level root directory, with all the files therein constituting the scope of the project -- by default it is the path for ProjFilename
	ProjRoot gi.FileName `` /* 217-byte string literal not displayed */

	// current project filename for saving / loading specific Gide configuration information in a .gide file (optional)
	ProjFilename gi.FileName `` /* 131-byte string literal not displayed */

	// filename of the currently-active textview
	ActiveFilename gi.FileName `desc:"filename of the currently-active textview"`

	// language for current active filename
	ActiveLang filecat.Supported `desc:"language for current active filename"`

	// VCS repo for current active filename
	ActiveVCS vci.Repo `desc:"VCS repo for current active filename"`

	// VCS info for current active filename (typically branch or revision) -- for status
	ActiveVCSInfo string `desc:"VCS info for current active filename (typically branch or revision) -- for status"`

	// has the root changed?  we receive update signals from root for changes
	Changed bool `json:"-" desc:"has the root changed?  we receive update signals from root for changes"`

	// timestamp for when a file was last saved -- provides dirty state for various updates including rebuilding in debugger
	LastSaveTStamp time.Time `` /* 133-byte string literal not displayed */

	// all the files in the project directory and subdirectories
	Files giv.FileTree `desc:"all the files in the project directory and subdirectories"`

	// the files tree view
	FilesView *gide.FileTreeView `json:"-" desc:"the files tree view"`

	// index of the currently-active textview -- new files will be viewed in other views if available
	ActiveTextViewIdx int `json:"-" desc:"index of the currently-active textview -- new files will be viewed in other views if available"`

	// list of open nodes, most recent first
	OpenNodes gide.OpenNodes `json:"-" desc:"list of open nodes, most recent first"`

	// the command buffers for commands run in this project
	CmdBufs map[string]*giv.TextBuf `json:"-" desc:"the command buffers for commands run in this project"`

	// history of commands executed in this session
	CmdHistory gide.CmdNames `json:"-" desc:"history of commands executed in this session"`

	// currently running commands in this project
	RunningCmds gide.CmdRuns `json:"-" xml:"-" desc:"currently running commands in this project"`

	// current arg var vals
	ArgVals gide.ArgVarVals `json:"-" xml:"-" desc:"current arg var vals"`

	// preferences for this project -- this is what is saved in a .gide project file
	Prefs gide.ProjPrefs `desc:"preferences for this project -- this is what is saved in a .gide project file"`

	// current debug view
	CurDbg *gide.DebugView `desc:"current debug view"`

	// first key in sequence if needs2 key pressed
	KeySeq1 key.Chord `desc:"first key in sequence if needs2 key pressed"`

	// mutex for protecting overall updates to GideView
	UpdtMu sync.Mutex `desc:"mutex for protecting overall updates to GideView"`
}

GideView is the core editor and tab viewer framework for the Gide system. The default view has a tree browser of files on the left, editor panels in the middle, and a tabbed viewer on the right.

func NewGideProjPath

func NewGideProjPath(path string) (*gi.Window, *GideView)

NewGideProjPath creates a new GideView window with a new GideView project for given path, returning the window and the path

func NewGideWindow

func NewGideWindow(path, projnm, root string, doPath bool) (*gi.Window, *GideView)

NewGideWindow is common code for Open GideWindow from Proj or Path

func OpenGideProj

func OpenGideProj(projfile string) (*gi.Window, *GideView)

OpenGideProj creates a new GideView window opened to given GideView project, returning the window and the path

func (*GideView) ActiveFileNode added in v1.1.7

func (ge *GideView) ActiveFileNode() *giv.FileNode

ActiveFileNode returns the file node for the active file -- nil if none

func (*GideView) ActiveTextView

func (ge *GideView) ActiveTextView() *gide.TextView

ActiveTextView returns the currently-active TextView

func (*GideView) ApplyPrefs

func (ge *GideView) ApplyPrefs()

ApplyPrefs applies current project preference settings into places where they are used -- only for those done prior to loading

func (*GideView) ApplyPrefsAction

func (ge *GideView) ApplyPrefsAction()

ApplyPrefsAction applies current preferences to the project, and updates the project

func (*GideView) ArgVarVals

func (ge *GideView) ArgVarVals() *gide.ArgVarVals

func (*GideView) AutoSaveCheck

func (ge *GideView) AutoSaveCheck(tv *gide.TextView, vidx int, fn *giv.FileNode) bool

AutoSaveCheck checks for an autosave file and prompts user about opening it -- returns true if autosave file does exist for a file that currently unchanged (means just opened)

func (*GideView) Build

func (ge *GideView) Build()

Build runs the BuildCmds set for this project

func (*GideView) ChooseRunExec added in v0.9.11

func (ge *GideView) ChooseRunExec(exePath gi.FileName)

ChooseRunExec selects the executable to run for the project

func (*GideView) ClearDebug added in v0.9.14

func (ge *GideView) ClearDebug()

ClearDebug clears the current debugger setting -- no more debugger active.

func (*GideView) CloneActiveView

func (ge *GideView) CloneActiveView() (*gide.TextView, int)

CloneActiveView sets the next text view to view the same file currently being vieweds in the active view. returns text view and index

func (*GideView) CloseActiveView

func (ge *GideView) CloseActiveView()

CloseActiveView closes the buffer associated with active view

func (*GideView) CloseOpenNodes added in v0.9.11

func (ge *GideView) CloseOpenNodes(nodes []*gide.FileNode)

CloseOpenNodes closes any nodes with open views (including those in directories under nodes). called prior to rename.

func (*GideView) CloseWindowReq

func (ge *GideView) CloseWindowReq() bool

CloseWindowReq is called when user tries to close window -- we automatically save the project if it already exists (no harm), and prompt to save open files -- if this returns true, then it is OK to close -- otherwise not

func (*GideView) CmdRuns

func (ge *GideView) CmdRuns() *gide.CmdRuns

func (*GideView) CommentOut

func (ge *GideView) CommentOut() bool

CommentOut comments-out selected lines in active text view and uncomments if already commented If multiple lines are selected and any line is uncommented all will be commented

func (*GideView) Commit

func (ge *GideView) Commit()

Commit commits the current changes using relevant VCS tool. Checks for VCS setting and for unsaved files.

func (*GideView) CommitNoChecks

func (ge *GideView) CommitNoChecks()

CommitNoChecks does the commit without any further checks for VCS, and unsaved files

func (*GideView) Config added in v0.5.8

func (ge *GideView) Config()

Config configures the view

func (*GideView) ConfigSplitView

func (ge *GideView) ConfigSplitView()

ConfigSplitView configures the SplitView.

func (*GideView) ConfigStatusBar

func (ge *GideView) ConfigStatusBar()

ConfigStatusBar configures statusbar with label

func (*GideView) ConfigTextBuf

func (ge *GideView) ConfigTextBuf(tb *giv.TextBuf)

ConfigTextBuf configures the text buf according to prefs

func (*GideView) ConfigTextViews added in v0.9.15

func (ge *GideView) ConfigTextViews()

ConfigTextViews configures text views according to current settings

func (*GideView) ConfigToolbar

func (ge *GideView) ConfigToolbar()

ConfigToolbar adds a GideView toolbar.

func (*GideView) ConnectEvents2D

func (ge *GideView) ConnectEvents2D()

func (*GideView) CopyRect added in v0.9.15

func (ge *GideView) CopyRect()

CopyRect copies rectangle in active text view

func (*GideView) CountWords added in v0.9.14

func (ge *GideView) CountWords() string

CountWords counts number of words (and lines) in active file returns a string report thereof.

func (*GideView) CountWordsRegion added in v0.9.14

func (ge *GideView) CountWordsRegion() string

CountWordsRegion counts number of words (and lines) in selected region in file if no selection, returns numbers for entire file.

func (*GideView) CurDebug added in v0.9.11

func (ge *GideView) CurDebug() *gide.DebugView

CurDebug returns the current debug view

func (*GideView) CurPanel

func (ge *GideView) CurPanel() int

CurPanel returns the splitter panel that currently has keyboard focus

func (*GideView) CursorToHistNext

func (ge *GideView) CursorToHistNext() bool

CursorToHistNext moves cursor to next position on history list -- returns true if moved

func (*GideView) CursorToHistPrev

func (ge *GideView) CursorToHistPrev() bool

CursorToHistPrev moves cursor to previous position on history list -- returns true if moved

func (*GideView) CutRect added in v0.9.15

func (ge *GideView) CutRect()

CutRect cuts rectangle in active text view

func (*GideView) Debug added in v0.9.11

func (ge *GideView) Debug()

Debug starts the debugger on the RunExec executable.

func (*GideView) DebugAttach added in v0.9.11

func (ge *GideView) DebugAttach(pid uint64)

DebugAttach runs the debugger by attaching to an already-running process. pid is the process id to attach to.

func (*GideView) DebugTest added in v0.9.11

func (ge *GideView) DebugTest()

DebugTest runs the debugger using testing mode in current active textview path

func (*GideView) Defaults

func (ge *GideView) Defaults()

Defaults sets new project defaults based on overall preferences

func (*GideView) DiffFileNode

func (ge *GideView) DiffFileNode(fna *giv.FileNode, fnmB gi.FileName)

DiffFileNode shows the differences between given file node as the A file, and another given file as the B file, in side-by-side DiffView and in the console as a context diff.

func (*GideView) DiffFiles

func (ge *GideView) DiffFiles(fnmA, fnmB gi.FileName)

DiffFiles shows the differences between two given files in side-by-side DiffView and in the console as a context diff. It opens the files as file nodes and uses existing contents if open already.

func (*GideView) EditProjPrefs

func (ge *GideView) EditProjPrefs()

EditProjPrefs allows editing of project preferences (settings specific to this project)

func (*GideView) EditRecents

func (ge *GideView) EditRecents()

RecentsEdit opens a dialog editor for deleting from the recents project list

func (*GideView) ExecCmd

func (ge *GideView) ExecCmd()

ExecCmd pops up a menu to select a command appropriate for the current active text view, and shows output in Tab with name of command

func (*GideView) ExecCmdFileNode

func (ge *GideView) ExecCmdFileNode(fn *giv.FileNode)

ExecCmdFileNode pops up a menu to select a command appropriate for the given node, and shows output in Tab with name of command

func (*GideView) ExecCmdName

func (ge *GideView) ExecCmdName(cmdNm gide.CmdName, sel bool, clearBuf bool)

ExecCmdName executes command of given name -- this is the final common pathway for all command invokation except on a node. if sel, select tab. if clearBuf, clear the buffer prior to command

func (*GideView) ExecCmdNameActive

func (ge *GideView) ExecCmdNameActive(cmdNm string)

ExecCmdNameActive calls given command on current active textview

func (*GideView) ExecCmdNameFileName added in v0.5.5

func (ge *GideView) ExecCmdNameFileName(fn string, cmdNm gide.CmdName, sel bool, clearBuf bool)

ExecCmdNameFileName executes command of given name on given file name

func (*GideView) ExecCmdNameFileNode

func (ge *GideView) ExecCmdNameFileNode(fn *giv.FileNode, cmdNm gide.CmdName, sel bool, clearBuf bool)

ExecCmdNameFileNode executes command of given name on given node

func (*GideView) ExecCmds

func (ge *GideView) ExecCmds(cmdNms gide.CmdNames, sel bool, clearBuf bool)

ExecCmds executes a sequence of commands, sel = select tab, clearBuf = clear buffer

func (*GideView) ExecCmdsFileNode

func (ge *GideView) ExecCmdsFileNode(fn *giv.FileNode, cmdNms gide.CmdNames, sel bool, clearBuf bool)

ExecCmdsFileNode executes a sequence of commands on file node, sel = select tab, clearBuf = clear buffer

func (*GideView) FileNodeClosed

func (ge *GideView) FileNodeClosed(fn *giv.FileNode, tvn *gide.FileTreeView)

FileNodeClosed is called whenever file tree browser node is closed

func (*GideView) FileNodeForFile added in v0.9.11

func (ge *GideView) FileNodeForFile(fpath string, add bool) *giv.FileNode

FileNodeForFile returns file node for given file path add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.

func (*GideView) FileNodeOpened

func (ge *GideView) FileNodeOpened(fn *giv.FileNode, tvn *gide.FileTreeView)

FileNodeOpened is called whenever file node is double-clicked in file tree

func (*GideView) FileNodeSelected

func (ge *GideView) FileNodeSelected(fn *giv.FileNode, tvn *gide.FileTreeView)

FileNodeSelected is called whenever tree browser has file node selected

func (*GideView) FileTree

func (ge *GideView) FileTree() *giv.FileTree

func (*GideView) FileTreeView added in v0.9.14

func (ge *GideView) FileTreeView() *gide.FileTreeView

FileTree returns the main FileTreeView

func (*GideView) Find

func (ge *GideView) Find(find, repl string, ignoreCase, regExp bool, loc gide.FindLoc, langs []filecat.Supported)

Find does Find / Replace in files, using given options and filters -- opens up a main tab with the results and further controls.

func (*GideView) FocusNextPanel

func (ge *GideView) FocusNextPanel()

FocusNextPanel moves the keyboard focus to the next panel to the right

func (*GideView) FocusOnPanel

func (ge *GideView) FocusOnPanel(panel int) bool

FocusOnPanel moves keyboard focus to given panel -- returns false if nothing at that tab

func (*GideView) FocusOnTabs added in v0.9.11

func (ge *GideView) FocusOnTabs() bool

func (*GideView) FocusPrevPanel

func (ge *GideView) FocusPrevPanel()

FocusPrevPanel moves the keyboard focus to the previous panel to the left

func (*GideView) GideViewKeys

func (ge *GideView) GideViewKeys(kt *key.ChordEvent)

func (*GideView) GrabPrefs

func (ge *GideView) GrabPrefs()

GrabPrefs grabs the current project preference settings from various places, e.g., prior to saving or editing.

func (*GideView) GuessMainLang

func (ge *GideView) GuessMainLang() bool

GuessMainLang guesses the main language in the project -- returns true if successful

func (*GideView) HelpWiki

func (ge *GideView) HelpWiki()

HelpWiki opens wiki page for gide on github

func (*GideView) Indent

func (ge *GideView) Indent() bool

Indent indents selected lines in active view

func (*GideView) IsConfiged added in v0.5.8

func (ge *GideView) IsConfiged() bool

IsConfiged returns true if the view is fully configured

func (*GideView) IsEmpty

func (ge *GideView) IsEmpty() bool

func (*GideView) JoinParaLines added in v1.0.0

func (ge *GideView) JoinParaLines()

JoinParaLines merges sequences of lines with hard returns forming paragraphs, separated by blank lines, into a single line per paragraph, for given selected region (full text if no selection)

func (*GideView) KeyChordEvent

func (ge *GideView) KeyChordEvent()

func (*GideView) LangDefaults

func (ge *GideView) LangDefaults()

LangDefaults applies default language settings based on MainLang

func (*GideView) LastSaveTime added in v0.9.15

func (ge *GideView) LastSaveTime() time.Time

func (*GideView) LinkViewFile

func (ge *GideView) LinkViewFile(fnm gi.FileName) (*gide.TextView, int, bool)

LinkViewFile opens the file in the 2nd textview, which is next to the tabs where links are clicked, if it is not collapsed -- else 1st

func (*GideView) LinkViewFileNode

func (ge *GideView) LinkViewFileNode(fn *giv.FileNode) (*gide.TextView, int)

LinkViewFileNode opens the file node in the 2nd textview, which is next to the tabs where links are clicked, if it is not collapsed -- else 1st

func (*GideView) LookupFun added in v0.9.11

func (ge *GideView) LookupFun(data any, text string, posLn, posCh int) (ld complete.Lookup)

LookupFun is the completion system Lookup function that makes a custom textview dialog that has option to edit resulting file.

func (*GideView) MouseEvent added in v1.1.1

func (ge *GideView) MouseEvent()

func (*GideView) NChangedFiles

func (ge *GideView) NChangedFiles() int

NChangedFiles returns number of opened files with unsaved changes

func (*GideView) NewFile

func (ge *GideView) NewFile(filename string, addToVcs bool)

NewFile creates a new file in the project

func (*GideView) NewProj

func (ge *GideView) NewProj(path gi.FileName, folder string, mainLang filecat.Supported, versCtrl giv.VersCtrlName) (*gi.Window, *GideView)

NewProj creates a new project at given path, making a new folder in that path -- all GideView projects are essentially defined by a path to a folder containing files. If the folder already exists, then use OpenPath. Can also specify main language and version control type

func (*GideView) NextTextView

func (ge *GideView) NextTextView() (*gide.TextView, int)

NextTextView returns the next text view available for viewing a file and its index -- if the active text view is empty, then it is used, otherwise it is the next one (if visible)

func (*GideView) NextViewFile

func (ge *GideView) NextViewFile(fnm gi.FileName) (*gide.TextView, int, bool)

NextViewFile sets the next text view to view given file name -- include as much of name as possible to disambiguate -- will use the first matching -- if already being viewed, that is activated -- returns textview and its index, false if not found

func (*GideView) NextViewFileNode

func (ge *GideView) NextViewFileNode(fn *giv.FileNode) (*gide.TextView, int)

NextViewFileNode sets the next text view to view file in given node (opens buffer if not already opened) -- if already being viewed, that is activated, returns text view and index

func (*GideView) OSFileEvent added in v1.0.14

func (ge *GideView) OSFileEvent()

func (*GideView) OpenConsoleTab

func (ge *GideView) OpenConsoleTab()

OpenConsoleTab opens a main tab displaying console output (stdout, stderr)

func (*GideView) OpenFile added in v1.0.14

func (ge *GideView) OpenFile(fnm string)

OpenFile opens file in an open project if it has the same path as the file or in a new window.

func (*GideView) OpenFileAtRegion added in v0.5.7

func (ge *GideView) OpenFileAtRegion(filename gi.FileName, tr textbuf.Region) (tv *gide.TextView, ok bool)

func (*GideView) OpenFileNode

func (ge *GideView) OpenFileNode(fn *giv.FileNode) (bool, error)

OpenFileNode opens file for file node -- returns new bool and error

func (*GideView) OpenFileURL

func (ge *GideView) OpenFileURL(ur string, ftv *giv.TextView) bool

OpenFileURL opens given file:/// url

func (*GideView) OpenFindURL

func (ge *GideView) OpenFindURL(ur string, ftv *giv.TextView) bool

OpenFindURL opens given find:/// url from Find -- delegates to FindView

func (*GideView) OpenNodeForTextView

func (ge *GideView) OpenNodeForTextView(tv *gide.TextView) (*giv.FileNode, int, bool)

OpenNodeForTextView finds the FileNode that a given TextView is viewing, returning its index within OpenNodes list, or false if not found

func (*GideView) OpenPath

func (ge *GideView) OpenPath(path gi.FileName) (*gi.Window, *GideView)

OpenPath creates a new project by opening given path, which can either be a specific file or a folder containing multiple files of interest -- opens in current GideView object if it is empty, or otherwise opens a new window.

func (*GideView) OpenProj

func (ge *GideView) OpenProj(filename gi.FileName) (*gi.Window, *GideView)

OpenProj opens .gide project file and its settings from given filename, in a standard JSON-formatted file

func (*GideView) OpenRecent

func (ge *GideView) OpenRecent(filename gi.FileName)

OpenRecent opens a recently-used file

func (*GideView) PanelIsOpen

func (ge *GideView) PanelIsOpen(panel int) bool

PanelIsOpen returns true if the given panel has not been collapsed and is avail and visible for displaying something

func (*GideView) ParseOpenFindURL

func (ge *GideView) ParseOpenFindURL(ur string, ftv *giv.TextView) (tv *gide.TextView, reg textbuf.Region, findBufStLn, findCount int, ok bool)

ParseOpenFindURL parses and opens given find:/// url from Find, return text region encoded in url, and starting line of results in find buffer, and number of results returned -- for parsing all the find results

func (*GideView) PasteRect added in v0.9.15

func (ge *GideView) PasteRect()

PasteRect cuts rectangle in active text view

func (*GideView) ProjPrefs

func (ge *GideView) ProjPrefs() *gide.ProjPrefs

func (*GideView) ReCase added in v0.9.15

func (ge *GideView) ReCase(c textbuf.Cases) string

ReCase replaces currently selected text in current active view with given case

func (*GideView) RecycleCmdBuf added in v0.5.11

func (ge *GideView) RecycleCmdBuf(cmdNm string, clear bool) (*giv.TextBuf, bool)

RecycleCmdBuf creates the buffer for command output, or returns existing. If clear is true, then any existing buffer is cleared. Returns true if new buffer created.

func (*GideView) RecycleCmdTab added in v0.5.11

func (ge *GideView) RecycleCmdTab(cmdNm string, sel bool, clearBuf bool) (*giv.TextBuf, *giv.TextView, bool)

RecycleCmdTab creates the tab to show command output, including making a buffer object to save output from the command. returns true if a new buffer was created, false if one already existed. if sel, select tab. if clearBuf, then any existing buffer is cleared. Also returns index of tab.

func (*GideView) RecycleTabTextView added in v0.9.11

func (ge *GideView) RecycleTabTextView(label string, sel bool) *giv.TextView

RecycleTabTextView returns a tab with given name, first by looking for an existing one, and if not found, making a new one with a Layout and then a TextView in it. if sel, then select it. returns widget

func (*GideView) RegisterCopy

func (ge *GideView) RegisterCopy(name string) bool

RegisterCopy saves current selection in active text view to register of given name returns true if saved

func (*GideView) RegisterPaste

func (ge *GideView) RegisterPaste(name gide.RegisterName) bool

RegisterPaste pastes register of given name into active text view returns true if pasted

func (*GideView) Render2D

func (ge *GideView) Render2D()

func (*GideView) ReplaceInActive

func (ge *GideView) ReplaceInActive()

ReplaceInActive does query-replace in active file only

func (*GideView) RevertActiveView

func (ge *GideView) RevertActiveView()

RevertActiveView revert active view to saved version

func (*GideView) Run

func (ge *GideView) Run()

Run runs the RunCmds set for this project

func (*GideView) RunPostCmdsActiveView

func (ge *GideView) RunPostCmdsActiveView() bool

RunPostCmdsActiveView runs any registered post commands on the active view -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.

func (*GideView) RunPostCmdsFileNode

func (ge *GideView) RunPostCmdsFileNode(fn *giv.FileNode) bool

RunPostCmdsFileNode runs any registered post commands on the given file node -- returns true if commands were run and file was reverted after that -- uses MainLang to disambiguate if multiple languages associated with extension.

func (*GideView) SaveActiveView

func (ge *GideView) SaveActiveView()

SaveActiveView saves the contents of the currently-active textview

func (*GideView) SaveActiveViewAs

func (ge *GideView) SaveActiveViewAs(filename gi.FileName)

SaveActiveViewAs save with specified filename the contents of the currently-active textview

func (*GideView) SaveAll added in v1.0.0

func (ge *GideView) SaveAll()

SaveAll saves all of the open filenodes to their current file names and saves the project state if it has been saved before (i.e., the .gide file exists)

func (*GideView) SaveAllCheck

func (ge *GideView) SaveAllCheck(cancelOpt bool, fun func()) bool

SaveAllCheck -- check if any files have not been saved, and prompt to save them returns true if there were unsaved files, false otherwise. cancelOpt presents an option to cancel current command, in which case function is not called. if function is passed, then it is called in all cases except if the user selects cancel.

func (*GideView) SaveAllOpenNodes

func (ge *GideView) SaveAllOpenNodes()

SaveAllOpenNodes saves all of the open filenodes to their current file names

func (*GideView) SaveProj

func (ge *GideView) SaveProj()

SaveProj saves project file containing custom project settings, in a standard JSON-formatted file

func (*GideView) SaveProjAs

func (ge *GideView) SaveProjAs(filename gi.FileName, saveAllFiles bool) bool

SaveProjAs saves project custom settings to given filename, in a standard JSON-formatted file saveAllFiles indicates if user should be prompted for saving all files returns true if the user was prompted, false otherwise

func (*GideView) SaveProjIfExists

func (ge *GideView) SaveProjIfExists(saveAllFiles bool) bool

SaveProjIfExists saves project file containing custom project settings, in a standard JSON-formatted file, only if it already exists -- returns true if saved saveAllFiles indicates if user should be prompted for saving all files

func (*GideView) SelectOpenNode

func (ge *GideView) SelectOpenNode()

SelectOpenNode pops up a menu to select an open node (aka buffer) to view in current active textview

func (*GideView) SelectTabByName added in v0.9.11

func (ge *GideView) SelectTabByName(label string) gi.Node2D

SelectTabByName Selects given main tab, and returns all of its contents as well.

func (*GideView) SetActiveFileInfo

func (ge *GideView) SetActiveFileInfo(buf *giv.TextBuf)

SetActiveFileInfo sets the active file info from textbuf

func (*GideView) SetActiveTextView

func (ge *GideView) SetActiveTextView(av *gide.TextView) int

SetActiveTextView sets the given textview as the active one, and returns its index

func (*GideView) SetActiveTextViewIdx

func (ge *GideView) SetActiveTextViewIdx(idx int) *gide.TextView

SetActiveTextViewIdx sets the given view index as the currently-active TextView -- returns that textview

func (*GideView) SetArgVarVals

func (ge *GideView) SetArgVarVals()

SetArgVarVals sets the ArgVar values for commands, from GideView values

func (*GideView) SetStatus

func (ge *GideView) SetStatus(msg string)

SetStatus updates the statusbar label with given message, along with other status info

func (*GideView) ShowFile added in v0.9.11

func (ge *GideView) ShowFile(fname string, ln int) (*gide.TextView, error)

ShowFile shows given file name at given line, returning TextView showing it or error if not found.

func (*GideView) SpacesToTabs added in v1.0.11

func (ge *GideView) SpacesToTabs()

SpacesToTabs converts spaces to tabs for given selected region (full text if no selection)

func (*GideView) Spell

func (ge *GideView) Spell()

Spell checks spelling in active text view

func (*GideView) SplitView

func (ge *GideView) SplitView() *gi.SplitView

SplitView returns the main SplitView

func (*GideView) SplitsEdit

func (ge *GideView) SplitsEdit()

SplitsEdit opens the SplitsView editor to customize saved splitter settings

func (*GideView) SplitsSave

func (ge *GideView) SplitsSave(split gide.SplitName)

SplitsSave saves current splitter settings to named splitter settings under existing name, and saves to prefs file

func (*GideView) SplitsSaveAs

func (ge *GideView) SplitsSaveAs(name, desc string)

SplitsSaveAs saves current splitter settings to new named splitter settings, and saves to prefs file

func (*GideView) SplitsSetView

func (ge *GideView) SplitsSetView(split gide.SplitName)

SplitsSetView sets split view splitters to given named setting

func (*GideView) StatusBar

func (ge *GideView) StatusBar() *gi.Frame

StatusBar returns the statusbar widget

func (*GideView) StatusLabel

func (ge *GideView) StatusLabel() *gi.Label

StatusLabel returns the statusbar label widget

func (*GideView) SwapTextViews added in v0.9.15

func (ge *GideView) SwapTextViews() bool

SwapTextViews switches the buffers for the two open textviews only operates if both panels are open

func (*GideView) Symbols added in v0.5.6

func (ge *GideView) Symbols()

Symbols displays the Symbols of a file or package

func (*GideView) TabByName added in v0.9.11

func (ge *GideView) TabByName(label string) gi.Node2D

TabByName returns a tab with given name, nil if not found.

func (*GideView) TabByNameTry added in v0.9.11

func (ge *GideView) TabByNameTry(label string) (gi.Node2D, error)

TabByNameTry returns a tab with given name, error if not found.

func (*GideView) TabDeleted added in v0.9.11

func (ge *GideView) TabDeleted(tabnm string)

TabDeleted is called when a main tab is deleted -- we cancel any running commmands

func (*GideView) Tabs added in v0.9.11

func (ge *GideView) Tabs() *gi.TabView

Tabs returns the main TabView

func (*GideView) TabsToSpaces added in v1.0.9

func (ge *GideView) TabsToSpaces()

TabsToSpaces converts tabs to spaces for given selected region (full text if no selection)

func (*GideView) TextBufForFile added in v0.9.11

func (ge *GideView) TextBufForFile(fpath string, add bool) *giv.TextBuf

TextBufForFile returns TextBuf for given file path. add: if not found in existing tree and external files, then if add is true, it is added to the ExtFiles list.

func (*GideView) TextViewButtonByIndex added in v0.9.15

func (ge *GideView) TextViewButtonByIndex(idx int) *gi.MenuButton

TextViewButtonByIndex returns the top textview menu button by index (0 or 1)

func (*GideView) TextViewButtonMenu added in v0.9.15

func (ge *GideView) TextViewButtonMenu(obj ki.Ki, m *gi.Menu)

func (*GideView) TextViewByIndex

func (ge *GideView) TextViewByIndex(idx int) *gide.TextView

TextViewByIndex returns the TextView by index (0 or 1), nil if not found

func (*GideView) TextViewForFile

func (ge *GideView) TextViewForFile(fnm gi.FileName) (*gide.TextView, int, bool)

TextViewForFile finds FileNode for file, and returns TextView and index that is viewing that FileNode, or false if none is

func (*GideView) TextViewForFileNode

func (ge *GideView) TextViewForFileNode(fn *giv.FileNode) (*gide.TextView, int, bool)

TextViewForFileNode finds a TextView that is viewing given FileNode, and its index, or false if none is

func (*GideView) TextViewIndex

func (ge *GideView) TextViewIndex(av *gide.TextView) int

TextViewIndex finds index of given textview (0 or 1)

func (*GideView) TextViewSig

func (ge *GideView) TextViewSig(tv *gide.TextView, sig giv.TextViewSignals)

TextViewSig handles all signals from the textviews

func (*GideView) ToolBar

func (ge *GideView) ToolBar() *gi.ToolBar

ToolBar returns the main toolbar

func (*GideView) UpdateFiles

func (ge *GideView) UpdateFiles()

UpdateFiles updates the list of files saved in project

func (*GideView) UpdateTextButtons added in v0.9.15

func (ge *GideView) UpdateTextButtons()

UpdateTextButtons updates textview menu buttons is called by SetStatus and is generally under cover of TopUpdateStart / End doesn't do anything unless a change is required -- safe to call frequently.

func (*GideView) VCSLog added in v0.9.13

func (ge *GideView) VCSLog(since string) (vci.Log, error)

VCSLog shows the VCS log of commits for this file, optionally with a since date qualifier: If since is non-empty, it should be a date-like expression that the VCS will understand, such as 1/1/2020, yesterday, last year, etc. SVN only understands a number as a maximum number of items to return. If allFiles is true, then the log will show revisions for all files, not just this one. Returns the Log and also shows it in a VCSLogView which supports further actions.

func (*GideView) VCSUpdateAll added in v0.9.13

func (ge *GideView) VCSUpdateAll()

VCSUpdateAll does an Update (e.g., Pull) on all VCS repositories within the open tree nodes in FileTree.

func (*GideView) VPort

func (ge *GideView) VPort() *gi.Viewport2D

func (*GideView) VersCtrl added in v0.5.7

func (ge *GideView) VersCtrl() giv.VersCtrlName

VersCtrl returns the version control system in effect, using the file tree detected version or whatever is set in project preferences

func (*GideView) ViewFile

func (ge *GideView) ViewFile(fnm gi.FileName) (*gide.TextView, int, bool)

ViewFile views file in an existing TextView if it is already viewing that file, otherwise opens ViewFileNode in active buffer

func (*GideView) ViewFileInIdx added in v0.9.15

func (ge *GideView) ViewFileInIdx(fnm gi.FileName, idx int) (*gide.TextView, int, bool)

ViewFileInIdx views file in given text view index

func (*GideView) ViewFileNode

func (ge *GideView) ViewFileNode(tv *gide.TextView, vidx int, fn *giv.FileNode)

ViewFileNode sets the given text view to view file in given node (opens buffer if not already opened)

func (*GideView) ViewOpenNodeName

func (ge *GideView) ViewOpenNodeName(name string)

ViewOpenNodeName views given open node (by name) in active view

Jump to

Keyboard shortcuts

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