SleelaDoc API
HTML documentation for the SLeeLa standard library (/lib)
Home › Packages › guidoc

Package guidoc

This package contains 11 source unit(s) defining 12 class(es) / struct(s). Each unit below lists its fields (the values it stores) and methods (the actions it performs), with a plain explanation of each.

guidoc #sleela 3.0 (lib/guidoc/guidoc.sleela)

GuiDoc class

The launcher of the document GUI. It builds the GUI from its spec, runs the readiness gate, optionally opens the file named by the environment variable SLEELA_GUIDOC_OPEN, prints the screen as a text outline and says whether the GUI is ready. SLEELA_GUIDOC_ADMIN=1 makes the session an admin and SLEELA_GUIDOC_LOCK=1 (admin only) locks the system before the screen is printed. With SLEELA_GUIDOC_PLAN=1 it also prints the mount plan a windowing host consumes. On a host with no display it stops there; a windowing host drives the same SLGuiDocApp through click(), type() and accelerate(). Output ends with GUIDOC READY or GUIDOC NOT READY (SLeeLa 3.0 main cannot set an exit status, so scripts match that line).

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
mainvoid main()No description in source.

guidoc-demo #sleela 3.0 (lib/guidoc/guidoc-demo.sleela)

GuiDocDemo class

Runnable, self-checking demonstrator for the document GUI in white: menus and accelerators, tabs, the line editor, the open and save-as dialogs, load and save to real files, the discard confirmations, the 14-tab limit, read-only unsplit files, external changes seen by the GUI document listener, and the white theme. It drives the widget tree with scripted presses (the same calls a host makes from real widgets) and verifies the screen after each step. Prints PASS or FAIL per check and a tally.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
passedint passedNo description in source.
failedint failedNo description in source.
appSLGuiDocApp appNo description in source.
vSLGuiDocView vNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
checkvoid check(String label, boolean ok)No description in source.
bannervoid banner(String t)No description in source.
tString t(String id)No description in source.
visboolean vis(String id)No description in source.
enboolean en(String id)No description in source.
curSLGuiDocTab cur()No description in source.
menuClickint menuClick(String menu, String item)Click a menu then one of its items, the way a user would.
menuClickOnint menuClickOn(SLGuiDocApp a, String menu, String item)No description in source.
auditHasboolean auditHas(SLGuiDocApp a, String entry)No description in source.
outlineHasboolean outlineHas(String line)No description in source.
slurpString slurp(String path)No description in source.
dumpvoid dump(String path, String data)No description in source.
mainvoid main()No description in source.
notesCleanupvoid notesCleanup(String base, String a, String b, String c)No description in source.

SLGuiDocApp #sleela 3.0 (lib/guidoc/SLGuiDocApp.sleela)

SLGuiDocApp class

Defines SLGuiDocApp — the controller of the document GUI, in white. It builds the widget tree from the spec (SLGuiDocSpec, mirrored by gui-document.xml), keeps up to 14 tabs (each a standing document with its own observer and white GUI listener), runs the menu commands, handles keyboard accelerators, the open and save-as dialogs and the discard-changes confirmations, and repaints the view whenever a command or an external change to a document calls for it. Load and save go through SLGuiDocFile.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
specSLGuiDocSpec specNo description in source.
whiteSLGuiDocWhite whiteNo description in source.
fileSLGuiDocFile fileNo description in source.
viewSLGuiDocView viewNo description in source.
tabsSLGuiDocTab[] tabsNo description in source.
tabCountint tabCountNo description in source.
activeint activeNo description in source.
untitledint untitledNo description in source.
dialogint dialogNo description in source.
pendingTabint pendingTabNo description in source.
quitFlagint quitFlagNo description in source.
statusString statusNo description in source.
statusErrorint statusErrorNo description in source.
openMenuString openMenuNo description in source.
executedint executedNo description in source.
refusedCommandsint refusedCommandsNo description in source.
readySLGuiDocReady readyNo description in source.
cmdRunsint[] cmdRunsNo description in source.
itemClicksint[] itemClicksNo description in source.
adminint adminNo description in source.
lockedint lockedNo description in source.
choiceTabint choiceTabNo description in source.
trailString[] trailNo description in source.
trailCountint trailCountNo description in source.
trailLostint trailLostNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configureboolean configure()Build everything from the spec. False if the spec or the white theme is inconsistent (nothing is half-built).
lifecycleSLGuiDocReady lifecycle()No description in source.
isReadyboolean isReady()No description in source.
isCertifiedboolean isCertified()No description in source.
whenReadyboolean whenReady(String subscriber)No description in source.
takeReadyboolean takeReady(String subscriber)No description in source.
auditvoid audit(String entry)No description in source.
auditSizeint auditSize()No description in source.
auditAtString auditAt(int i)No description in source.
isAdminboolean isAdmin()No description in source.
isLockedboolean isLocked()No description in source.
choiceIndexint choiceIndex()No description in source.
inChoiceboolean inChoice()No description in source.
setAdminvoid setAdmin(boolean on)No description in source.
lockAllowsboolean lockAllows(String command)Does the lock let this command run right now?
lockAllTabsvoid lockAllTabs(boolean on)No description in source.
endChoiceboolean endChoice(String reason)End the editor choice session, if any. Returns true when edits were reverted. Callers set their own status text.
applySettingsvoid applySettings()Re-read the settings that are copied at build time (the file limits and the sidecar suffix). New tabs also read the listener flag from the spec when they are made. Call after changing the spec at run time.
requestCloseboolean requestClose()The window was asked to close (the host reports its close button). With a dialog open that cancels the dialog; otherwise it is Quit, which asks first if the spec says so. Returns true only if quitting went ahead or a confirmation was opened.
expectedNodesint expectedNodes()The node count the spec implies: window, menubar, menus, items, tab bar, tabs, new-tab button, editor, two nodes per row, entry, three status labels and the five dialog nodes.
startboolean start()Run the self-checks. Returns true when the GUI is READY. Can be retried after a failure.
specificationSLGuiDocSpec specification()No description in source.
lookSLGuiDocWhite look()No description in source.
widgetsSLGuiDocView widgets()No description in source.
filesSLGuiDocFile files()No description in source.
tabTotalint tabTotal()No description in source.
activeIndexint activeIndex()No description in source.
tabAtSLGuiDocTab tabAt(int i)No description in source.
activeTabSLGuiDocTab activeTab()No description in source.
quitRequestedboolean quitRequested()No description in source.
statusTextString statusText()No description in source.
statusIsErrorboolean statusIsError()No description in source.
dialogModeint dialogMode()No description in source.
menuOpenString menuOpen()No description in source.
executedCountint executedCount()No description in source.
refusedCountint refusedCount()No description in source.
itemTextString itemText(int i, boolean paintedState)The text of a menu item: its label (or, for a toggle that is on, its active label) and its accelerator.
buildViewvoid buildView()No description in source.
whenHoldsboolean whenHolds(String when)No description in source.
sayvoid say(String text)No description in source.
complainvoid complain(String text)No description in source.
tabLabelString tabLabel(SLGuiDocTab t)No description in source.
paintvoid paint()No description in source.
paintEditorvoid paintEditor(SLGuiDocTab cur)No description in source.
paintStatusvoid paintStatus(SLGuiDocTab cur)No description in source.
paintDialogvoid paintDialog(SLGuiDocTab cur)No description in source.
refreshboolean refresh()Called by the host loop after anything outside the GUI may have changed a document: repaint if any tab listener latched a repaint.
typevoid type(String id, String text)No description in source.
clickint click(String id)Report a node activation and service it. Returns commands executed.
pumpint pump()No description in source.
handlevoid handle(String command, int arg)No description in source.
accelerateboolean accelerate(String accel)A keyboard accelerator such as Ctrl+S.
runKeyActionboolean runKeyAction(String action)Enter and Esc while a dialog or a menu is open.
executeboolean execute(String command)No description in source.
dispatchint dispatch(String command, boolean run)The one command table. run=false only asks whether the command has a handler. Returns 1 ran and succeeded, 0 ran and was refused, -1 unknown.
flagint flag(boolean b)No description in source.
commandRunCountint commandRunCount(String command)No description in source.
itemClickCountint itemClickCount(String itemId)No description in source.
commandsCoveredint commandsCovered()No description in source.
itemsCoveredint itemsCovered()No description in source.
coverageCompleteboolean coverageComplete()No description in source.
printCoveragevoid printCoverage()Machine-readable coverage lines, one per command and per item.
addTabboolean addTab(SLGuiDocTab t)No description in source.
cmdNewboolean cmdNew()No description in source.
cmdOpenboolean cmdOpen()No description in source.
cmdSaveAsboolean cmdSaveAs()No description in source.
cmdSaveboolean cmdSave()No description in source.
cmdCloseTabboolean cmdCloseTab()No description in source.
cmdQuitboolean cmdQuit()No description in source.
cmdInsertLineboolean cmdInsertLine()No description in source.
cmdReplaceLineboolean cmdReplaceLine()No description in source.
cmdDeleteLineboolean cmdDeleteLine()No description in source.
moveToboolean moveTo(int to)No description in source.
cmdSelectPrevboolean cmdSelectPrev()No description in source.
cmdSelectNextboolean cmdSelectNext()No description in source.
cmdPageUpboolean cmdPageUp()No description in source.
cmdPageDownboolean cmdPageDown()No description in source.
cmdLoadLineboolean cmdLoadLine()Copy the selected line into the entry box so it can be changed and put back with Replace Line. Needs the same rights as editing.
cmdLockboolean cmdLock()Admin only (the menu item is enabled only for an admin). Locking refuses every command that adds content; unlocking ends any editor choice session.
cmdChoiceboolean cmdChoice()Admin only, and only while the system is locked: start an editor choice session on the active tab, or end the one that is running.
cmdNextTabboolean cmdNextTab()No description in source.
cmdPrevTabboolean cmdPrevTab()No description in source.
cmdAboutboolean cmdAbout()No description in source.
gotoTabvoid gotoTab(int i)No description in source.
selectRowvoid selectRow(int row)No description in source.
saveActiveToboolean saveActiveTo(String path)No description in source.
openPathboolean openPath(String path)Open a path in a new tab (or switch to the tab that already has it).
closeTabboolean closeTab(int idx)No description in source.
dialogOkvoid dialogOk()No description in source.
dialogCancelvoid dialogCancel()No description in source.

SLGuiDocFile #sleela 3.0 (lib/guidoc/SLGuiDocFile.sleela)

SLGuiDocFile class

Defines SLGuiDocFile — load and save for the document GUI over the openFile / read / write / close, osRename, osMakeDir and osRemove bridge. Save writes the document as plain text (lines joined by newline, with a trailing newline) through a temporary file and a rename, then writes a sidecar directory holding one file per line. Load never trusts a split: SLeeLa cannot cut a String into lines, so it reads the whole file and accepts the sidecar lines only if joining them reproduces the file EXACTLY. Otherwise the file is opened unsplit (one block) and the GUI keeps it read-only. Nothing is ever loaded that the file does not literally contain.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
maxBytesint maxBytesNo description in source.
maxLinesint maxLinesNo description in source.
suffixString suffixNo description in source.
lastCodeint lastCodeNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure(String sidecarSuffix, int byteLimit, int lineLimit)The line limit can be lowered below the document capacity (64) but never raised above it.
getMaxLinesint getMaxLines()No description in source.
getLastCodeint getLastCode()No description in source.
getSidecarSuffixValueString getSidecarSuffixValue()No description in source.
sidecarDirString sidecarDir(String path)No description in source.
pad4String pad4(int i)No description in source.
lineFileString lineFile(String path, int i)No description in source.
joinDocumentString joinDocument(SLObserverDocument doc, boolean trailing)The document as text: lines joined by newline, optionally ending in one.
existsboolean exists(String p)No description in source.
writeWholeboolean writeWhole(String path, String data)No description in source.
readWholeString readWhole(String path)No description in source.
saveint save(String path, SLObserverDocument doc)Save the document. The plain-text file is replaced atomically (temporary file then rename). A stale or missing sidecar is harmless: load will simply open the file unsplit.
loadint load(String path, SLObserverDocument into)Load into an EMPTY document. 0 = exact lines, 10 = opened unsplit.
forgetvoid forget(String path)Remove a saved file and its sidecar (used by tests and by a host cleanup).

SLGuiDocHost #sleela 3.0 (lib/guidoc/SLGuiDocHost.sleela)

SLGuiDocHost class

Defines SLGuiDocHost — the host side of the document GUI: how a host sees the screen. outline() renders the visible GUI as plain text lines (the terminal and headless view: window, menus, tabs, editor rows, entry, status, dialog), and mountPlan() lists every visible node in tree order with its tag, parent, background and foreground colour tokens, enabled flag and text, which is exactly what a windowing host needs to mount real widgets. Every node carries its white role, and colours are resolved by role through SLGuiDocWhite, so no style string is ever parsed.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
emitint emit(String[] out, int cap, int n, String line)No description in source.
outlineint outline(SLGuiDocApp app, String[] out, int cap)The visible GUI as text. Returns the number of lines written.
mountPlanint mountPlan(SLGuiDocApp app, String[] out, int cap)Every visible node in tree order, as a mount instruction for a host.
eventint event(SLGuiDocApp app, String kind, String id, String value)The single entry point for a windowing host. Everything a real window can report is one of these events, and nothing else reaches the GUI: press id a widget was activated (menu, menu item, tab, row, button) type id value the user typed into an entry widget key value a key chord, e.g. Ctrl+S, Up, Enter, Esc close the window close button tick a turn of the host loop: repaint if a document changed Returns the number of commands run (press), 1 or 0 (key, close, tick), 0 (type), or -1 for an unknown event kind.
visibleNodesint visibleNodes(SLGuiDocApp app)How many nodes mountPlan() would list (visible nodes).

SLGuiDocListener #sleela 3.0 (lib/guidoc/SLGuiDocListener.sleela)

SLGuiDocListener class

Defines SLGuiDocListener — the GUI document listener, in white. Its nested Responder is an observer module (a drop-in, admitted through a bounded port) that listens to the standing document of one tab. Every change latches a repaint, and the listener tells changes made through the GUI apart from changes made by someone else (an external change is flagged, shown in the status line, and never silently absorbed). It speaks the white theme through SLGuiDocWhite.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Responder class

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
portSLObserverPort portNo description in source.
whiteSLGuiDocWhite whiteNo description in source.
lastRevisionint lastRevisionNo description in source.
changesint changesNo description in source.
externalChangesint externalChangesNo description in source.
lastSourceString lastSourceNo description in source.
lastExternalString lastExternalNo description in source.
repaintint repaintNo description in source.
seenNotesint seenNotesNo description in source.
flaggingint flaggingNo description in source.
quietChangesint quietChangesNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
attachvoid attach(String portName, SLGuiDocWhite look, boolean flagExternal)flagExternal=false still counts every change but never flags one as external: it stays quiet in the status line.
portOfSLObserverPort portOf()No description in source.
revisionSeenint revisionSeen()No description in source.
changeCountint changeCount()No description in source.
externalCountint externalCount()No description in source.
latestSourceString latestSource()No description in source.
latestExternalString latestExternal()No description in source.
noteCountint noteCount()No description in source.
quietCountint quietCount()No description in source.
flagsExternalboolean flagsExternal()No description in source.
pumpint pump()Read the mailbox. Returns the number of messages handled.
takeRepaintboolean takeRepaint()Take-the-latch: true once per batch of changes.
syncTovoid syncTo(int revision)After a load fills the document directly, bring the listener level with its revision (no change message was sent for the load).
hasExternalboolean hasExternal()No description in source.
acknowledgeExternalvoid acknowledgeExternal()Forget the external flag (the user has seen it).
statusRoleString statusRole()No description in source.
statusStyleString statusStyle()No description in source.
statusTextString statusText()No description in source.

SLGuiDocReady #sleela 3.0 (lib/guidoc/SLGuiDocReady.sleela)

SLGuiDocReady class

Defines SLGuiDocReady — the readiness gate and ready lifecycle of the document GUI. Like a document-ready event, the GUI is CREATED, then CHECKING while named self-checks run, then READY (every check passed) or FAILED (the first failure is kept). Nothing may act on the GUI before it is ready. Subscribers register by name with whenReady() and take a one-shot latch once the GUI is ready; a subscriber that registers late still gets its latch. A failed gate never fires a subscriber, and begin() can retry.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
stateint stateNo description in source.
namesString[] namesNo description in source.
passedFlagint[] passedFlagNo description in source.
detailsString[] detailsNo description in source.
countint countNo description in source.
failuresint failuresNo description in source.
firstFailureString firstFailureNo description in source.
subscribersString[] subscribersNo description in source.
latchedint[] latchedNo description in source.
subscriberCountint subscriberCountNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure()No description in source.
getStateint getState()No description in source.
isReadyboolean isReady()No description in source.
hasFailedboolean hasFailed()No description in source.
checkTotalint checkTotal()No description in source.
failureTotalint failureTotal()No description in source.
firstFailureTextString firstFailureText()No description in source.
checkNameString checkName(int i)No description in source.
checkPassedboolean checkPassed(int i)No description in source.
checkDetailString checkDetail(int i)No description in source.
stateNameString stateName()No description in source.
beginboolean begin()Start (or restart) the checks. Subscribers that already fired stay fired.
noteCheckboolean noteCheck(String name, boolean ok, String detail)Note one named check. Only valid while checking. A 25th check is a failure: an overflowing gate is not trusted.
finishboolean finish()Close the gate: READY only if at least one check ran and none failed.
subscriberIndexint subscriberIndex(String name)No description in source.
whenReadyboolean whenReady(String name)Register for the ready event. Late subscribers are latched at once.
takeReadyboolean takeReady(String name)Take-the-latch: true once per subscriber, and only once the GUI is ready.
subscriberTotalint subscriberTotal()No description in source.

SLGuiDocSpec #sleela 3.0 (lib/guidoc/SLGuiDocSpec.sleela)

SLGuiDocSpec class

Defines SLGuiDocSpec — the executable copy of gui-document.xml: the window and theme, the commands, the menus and their items (with accelerators and enabled-when conditions), the tab strip, the editor, the file dialog and the listener. The GUI is built from this spec, and tools/validate_gui_document.py fails if the XML and standard() drift. Every addition is validated and refused (fail closed) when out of vocabulary, duplicated or over a cap.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
winTitleString winTitleNo description in source.
winThemeString winThemeNo description in source.
maxTabsint maxTabsNo description in source.
dirtyMarkerString dirtyMarkerNo description in source.
newTabTitleString newTabTitleNo description in source.
editorRowsint editorRowsNo description in source.
lineNumbersint lineNumbersNo description in source.
readOnlyWhenUnsplitint readOnlyWhenUnsplitNo description in source.
sidecarSuffixString sidecarSuffixNo description in source.
maxLinesint maxLinesNo description in source.
maxBytesint maxBytesNo description in source.
listenerPortString listenerPortNo description in source.
flagExternalint flagExternalNo description in source.
readinessString readinessNo description in source.
releaseString releaseNo description in source.
mIdString[] mIdNo description in source.
mLabelString[] mLabelNo description in source.
mCountint mCountNo description in source.
iMenuString[] iMenuNo description in source.
iIdString[] iIdNo description in source.
iLabelString[] iLabelNo description in source.
iCommandString[] iCommandNo description in source.
iAccelString[] iAccelNo description in source.
iWhenString[] iWhenNo description in source.
iCountint iCountNo description in source.
cIdString[] cIdNo description in source.
cHandlerString[] cHandlerNo description in source.
cConfirmint[] cConfirmNo description in source.
cLockString[] cLockNo description in source.
cCountint cCountNo description in source.
tItemString[] tItemNo description in source.
tKindString[] tKindNo description in source.
tActiveString[] tActiveNo description in source.
tCountint tCountNo description in source.
choiceEditsString choiceEditsNo description in source.
kAccelString[] kAccelNo description in source.
kScopeString[] kScopeNo description in source.
kActionString[] kActionNo description in source.
kCountint kCountNo description in source.
refusedint refusedNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure()No description in source.
refusedCountint refusedCount()No description in source.
noboolean no()No description in source.
knownThemeboolean knownTheme(String t)No description in source.
knownWhenboolean knownWhen(String w)No description in source.
setWindowboolean setWindow(String title, String theme)No description in source.
setTabsboolean setTabs(int max, String marker, String newTitle)No description in source.
setEditorboolean setEditor(int rows, int numbers, int readOnlyUnsplit)No description in source.
setFileDialogboolean setFileDialog(String suffix, int lines, int bytes)No description in source.
setListenerboolean setListener(String port, int external)No description in source.
setReadinessboolean setReadiness(String status, String version)The document is draft or ready. Ready is a claim that tools/ validate_gui_document.py --gate checks against the demo.
getReadinessString getReadiness()No description in source.
getReleaseString getRelease()No description in source.
isCertifiedboolean isCertified()No description in source.
commandIndexint commandIndex(String id)No description in source.
menuIndexint menuIndex(String id)No description in source.
itemIndexint itemIndex(String id)No description in source.
addCommandboolean addCommand(String id, String handler, int confirms, String lockPolicy)lockPolicy: allowed (runs while the system is locked), blocked (refused while locked), choice (refused while locked unless the active tab is in an editor choice session).
addToggleboolean addToggle(String itemId, String kind, String activeLabel)A toggle item shows its label when the state is off and activeLabel when on. kind is lock (the system lock) or choice (an editor choice session).
setConfirmsboolean setConfirms(String command, boolean on)Change whether a command asks before it discards unsaved work.
addKeyboolean addKey(String accel, String scope, String action)A modal key: Enter or Esc, meaningful only while a dialog (ok, cancel) or a menu (close) is open.
keyTotalint keyTotal()No description in source.
keyAccelAtString keyAccelAt(int i)No description in source.
keyScopeAtString keyScopeAt(int i)No description in source.
keyActionAtString keyActionAt(int i)No description in source.
actionForKeyString actionForKey(String accel, String scope)No description in source.
setLockboolean setLock(String choiceEditsPolicy)No description in source.
lockPolicyOfString lockPolicyOf(String command)No description in source.
toggleTotalint toggleTotal()No description in source.
toggleItemAtString toggleItemAt(int i)No description in source.
toggleKindAtString toggleKindAt(int i)No description in source.
toggleActiveLabelAtString toggleActiveLabelAt(int i)No description in source.
toggleKindOfString toggleKindOf(String itemId)The toggle kind of an item ("" if it is not a toggle).
toggleLabelOfString toggleLabelOf(String itemId)No description in source.
getChoiceEditsString getChoiceEdits()No description in source.
choiceRevertsboolean choiceReverts()No description in source.
commandsWithPolicyint commandsWithPolicy(String policy)No description in source.
addMenuboolean addMenu(String id, String label)No description in source.
addItemboolean addItem(String menu, String id, String label, String command, String accel, String when)An item needs an existing menu and command, a unique id, a known enabled-when condition, and an accelerator no other item uses.
menuTotalint menuTotal()No description in source.
menuIdAtString menuIdAt(int i)No description in source.
menuLabelAtString menuLabelAt(int i)No description in source.
itemTotalint itemTotal()No description in source.
itemMenuAtString itemMenuAt(int i)No description in source.
itemIdAtString itemIdAt(int i)No description in source.
itemLabelAtString itemLabelAt(int i)No description in source.
itemCommandAtString itemCommandAt(int i)No description in source.
itemAccelAtString itemAccelAt(int i)No description in source.
itemWhenAtString itemWhenAt(int i)No description in source.
commandTotalint commandTotal()No description in source.
commandIdAtString commandIdAt(int i)No description in source.
handlerOfString handlerOf(String command)No description in source.
confirmsDiscardboolean confirmsDiscard(String command)No description in source.
commandForAccelString commandForAccel(String accel)The command an accelerator runs, or "" if none.
whenForCommandString whenForCommand(String command)The enabled-when condition of the first item that runs a command.
getTitleString getTitle()No description in source.
getThemeString getTheme()No description in source.
getMaxTabsint getMaxTabs()No description in source.
getDirtyMarkerString getDirtyMarker()No description in source.
getNewTabTitleString getNewTabTitle()No description in source.
getEditorRowsint getEditorRows()No description in source.
showsLineNumbersboolean showsLineNumbers()No description in source.
lockUnsplitboolean lockUnsplit()No description in source.
getSidecarSuffixString getSidecarSuffix()No description in source.
getMaxLinesint getMaxLines()No description in source.
getMaxBytesint getMaxBytes()No description in source.
getListenerPortString getListenerPort()No description in source.
flagsExternalboolean flagsExternal()No description in source.
standardint standard()Seed the spec declared in gui-document.xml. Returns the number of seeds refused (0 when everything is consistent).

SLGuiDocTab #sleela 3.0 (lib/guidoc/SLGuiDocTab.sleela)

SLGuiDocTab class

Defines SLGuiDocTab — one open document in the GUI: its standing document, its own dynamic observer, the white GUI listener admitted to that observer, the path it was loaded from or saved to, the saved revision (dirty means the revision moved since), the selected line and the editor scroll position. A tab opened unsplit is read-only.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
titleString titleNo description in source.
pathString pathNo description in source.
docSLObserverDocument docNo description in source.
obsSLDocumentObserver obsNo description in source.
savedRevisionint savedRevisionNo description in source.
readOnlyint readOnlyNo description in source.
selectedint selectedNo description in source.
viewTopint viewTopNo description in source.
lockedint lockedsystem lock: 1 while the system is locked
choiceint choiceeditor choice: 1 while an admin session may edit this tab despite the lock
snapLinesString[] snapLinesNo description in source.
snapCountint snapCountNo description in source.
snapRevisionint snapRevisionNo description in source.
snapSavedint snapSavedNo description in source.
snapSelectedint snapSelectedNo description in source.
snapTopint snapTopNo description in source.
snapTakenint snapTakenNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure(String name, SLGuiDocWhite white, String listenerPort, boolean flagExternal)No description in source.
getTitleString getTitle()No description in source.
setTitlevoid setTitle(String t)No description in source.
getPathString getPath()No description in source.
setPathvoid setPath(String p)No description in source.
bodySLObserverDocument body()No description in source.
observerSLDocumentObserver observer()No description in source.
isReadOnlyboolean isReadOnly()No description in source.
lockvoid lock()No description in source.
selectedLineint selectedLine()No description in source.
topLineint topLine()No description in source.
hasSelectionboolean hasSelection()No description in source.
settlevoid settle()The host cycle for this tab: deliver, let the listener read, route.
isLockedboolean isLocked()No description in source.
inChoiceboolean inChoice()No description in source.
setLockedvoid setLocked(boolean on)Locking the tab freezes its observer, so the lock holds against any other writer too, not just the menu.
editint edit(int op, int line, String text, String source)Edit through the observer. Refused when the tab is read-only, and refused while the system is locked unless an editor choice session is running on this tab (checked here as well as in the menu, so no path around the lock).
editAsint editAs(int op, int line, String text, String source)Someone else changes the document (used for external changes). While the system is locked this is refused even during an editor choice session: the exemption is for the admin editing through the GUI only.
beginChoiceboolean beginChoice()No description in source.
endChoiceboolean endChoice(boolean revert)End the session. With revert=true the document is put back exactly as it was when the session began. Returns true when something was reverted.
isDirtyboolean isDirty()No description in source.
markSavedvoid markSaved()No description in source.
selectvoid select(int line)No description in source.
clampSelectionvoid clampSelection()Keep the selection on a real line after the document changed.
ensureVisiblevoid ensureVisible(int rows)Scroll so the selected line is inside a window of `rows` rows.
loadFromint loadFrom(SLGuiDocFile file, String filePath, boolean lockUnsplit)Load a file into this (still empty) tab. Returns the load code.
saveToint saveTo(SLGuiDocFile file, String filePath)Save to a path. Refused for a read-only tab. Returns the save code.

SLGuiDocView #sleela 3.0 (lib/guidoc/SLGuiDocView.sleela)

SLGuiDocView class

Defines SLGuiDocView — the widget tree of the document GUI: the window, menu bar and menus, tab strip, editor (line gutter and rows), entry, status line and file dialog. Each node has a tag, text, white role (and so a style), visibility, enabled flag and a command; pressing a node latches it and the controller takes the latch. It is self-contained on purpose: a host walks nodeCount() / idAt() / tagAt() / textAt() / styleAt() to mount it on real widgets, and calls press(id) when one is activated.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
MAX_NODESint MAX_NODES = 128No description in source.
idsString[] idsNo description in source.
tagsString[] tagsNo description in source.
textsString[] textsNo description in source.
rolesString[] rolesNo description in source.
parentsString[] parentsNo description in source.
cmdsString[] cmdsNo description in source.
argsint[] argsNo description in source.
enabledint[] enabledNo description in source.
visibleint[] visibleNo description in source.
latchint[] latchNo description in source.
countint countNo description in source.
whiteSLGuiDocWhite whiteNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure(SLGuiDocWhite look)No description in source.
nodeCountint nodeCount()No description in source.
idAtString idAt(int i)No description in source.
tagAtString tagAt(int i)No description in source.
textAtString textAt(int i)No description in source.
roleAtString roleAt(int i)The white role of a node and the style string made from it.
styleAtString styleAt(int i)No description in source.
parentAtString parentAt(int i)No description in source.
commandAtString commandAt(int i)No description in source.
argAtint argAt(int i)No description in source.
visibleAtboolean visibleAt(int i)No description in source.
enabledAtboolean enabledAt(int i)No description in source.
indexOfint indexOf(String id)No description in source.
addboolean add(String parent, String tag, String id, String text, String role)No description in source.
bindvoid bind(String id, String command, int arg)No description in source.
setTextvoid setText(String id, String t)No description in source.
textOfString textOf(String id)No description in source.
setStylevoid setStyle(String id, String role)Give a node a white role (its style follows).
roleOfString roleOf(String id)No description in source.
styleOfString styleOf(String id)No description in source.
setVisiblevoid setVisible(String id, boolean on)No description in source.
isVisibleboolean isVisible(String id)No description in source.
setEnabledvoid setEnabled(String id, boolean on)No description in source.
isEnabledboolean isEnabled(String id)No description in source.
typevoid type(String id, String t)A host reports the user typed into an entry.
pressboolean press(String id)A host reports a node was activated. Only an enabled, visible node with a command latches; anything else is ignored.
takePressint takePress()Take one latched press (the lowest node index), or -1 when idle.
clearPressesvoid clearPresses()No description in source.

SLGuiDocWhite #sleela 3.0 (lib/guidoc/SLGuiDocWhite.sleela)

SLGuiDocWhite class

Defines SLGuiDocWhite — the white look of the document GUI. It takes the White flavor of the standard UI themes (lib/ui SLThemeFlavor: off-white background, white surfaces, dark ink, a single blue accent) and answers a style string for each role the GUI draws (window, menubar, tab, editor row, status, dialog ...). Every widget style in the document GUI comes from here, so the whole GUI stays white and consistent.

Carries the standard Metadata Class record — eleven catalogued provenance attributes (version, id, author, date, copyright, trademark, corporation, origin, birth date, science rating, national schedule) with matching get/set accessors. These are omitted from the tables below for brevity.

Fields — the named values this unit stores.

FieldDeclarationWhat it holds
themeSLStandardTheme themeNo description in source.

Methods — the actions this unit can perform.

MethodSignatureWhat it does
configurevoid configure()No description in source.
standardThemeSLStandardTheme standardTheme()No description in source.
isWhiteboolean isWhite()No description in source.
nameString name()No description in source.
accentColorString accentColor()No description in source.
roleAtString roleAt(int i)Every role the GUI draws, in a fixed order.
roleTotalint roleTotal()No description in source.
bgOfString bgOf(String role)The background colour token of a role. Unknown roles use the surface.
fgOfString fgOf(String role)The foreground (ink) colour token of a role.
styleString style(String role)The style for a role: bg:#RRGGBB;fg:#RRGGBB;
roleOfStyleString roleOfStyle(String s)The role a style string was made from, or "" if it is none of ours. A host uses this with bgOf and fgOf to get colour tokens without parsing text.