Issie logo Issie

MenuHelpers Module

Types and nested modules

Type/Module Description

Constants

SheetInstance

One custom component instance on a sheet's canvas. The field names are prefixed because F# resolves an unannotated record field to the LAST type declaring it: `Label`, `Id` and `Sheet` would each capture uses meant for Component and for the Elmish Model, in every file compiled after this one.

SheetShapes

What is directly inside each sheet of a project, by sheet NAME - so one entry however many times a sheet is instantiated, with the sheets inside it NAMED rather than held. That costs one pass over each canvas and not the design's expansion, and it makes a sheet that contains itself representable without anything lazy. It deliberately holds nothing that depends on where a sheet sits: label path, access path, breadcrumb name, size and depth are all properties of an OCCURRENCE, and a design several routes reach one sheet by has many occurrences of one entry here. Those are filled in by materialiseTree, for the occurrences that are going to be looked at.

SheetTree

Node in the sheet tree, child nodes correspond to custom components in sheet.

Functions and values

Function or value Description

addToRecents path recents

Full Usage: addToRecents path recents

Parameters:
    path : string
    recents : string list option

Returns: string list option
path : string
recents : string list option
Returns: string list option

allRootSheets sTrees

Full Usage: allRootSheets sTrees

Parameters:
Returns: Set<string>
sTrees : Map<string, SheetTree>
Returns: Set<string>

breadcrumbName_

Full Usage: breadcrumbName_

Returns: Lens<SheetTree, string>
Returns: Lens<SheetTree, string>

convertProjectIdsOnDisk ldcs

Full Usage: convertProjectIdsOnDisk ldcs

Parameters:
Returns: LoadedComponent list * string list

Put a project's files into the current id form when they were read in the old one. Ids became integers; a .dgm written before that holds uuids, and every load allocates integers for them afresh. The mapping is deterministic, so the design works either way - but nothing on disk ever changes, so the ids in the file match nothing anyone can see in the running app, and every open pays the conversion again. Opening the project is where it is settled, once. The WHOLE project or none of it. Component ids are design-unique, and admitting the sheets re-mints any that collide - so a sheet whose own ids were already integers can still have come out of the load different from its file, and writing only the uuid ones would leave the design half-converted. Not for a project Issie may only write nothing to - the shipped demos read from the read-only static directory, a folder on a read-only share. There is no asking in advance whether a directory can be written, so the first refusal is the answer: the write is attempted, and a project that refuses it simply keeps its old ids. Said in the log and nowhere else, because nothing about the design is wrong and there is nothing for the user to do. A library sheet belongs to its library and is never written back, whatever asks. A library opened AS a project is written like anything else - its components are the sheets - and needs no exception here: one whose ids are already integers needs no conversion, so nothing is written for it. Returns the sheets, and the names of those actually written - empty when nothing needed converting, and empty when the project could not be written. That is what the caller tells the user about: this is a legacy conversion, it changes every file of the project, and it should not happen silently.

ldcs : LoadedComponent list
Returns: LoadedComponent list * string list

currWaveSimModel model

Full Usage: currWaveSimModel model

Parameters:
Returns: WaveSimModel option

returns a WaveSimModel option if a file is loaded, otherwise None

model : Model
Returns: WaveSimModel option

deleteFileConfirmationPopup sheetName model dispatch

Full Usage: deleteFileConfirmationPopup sheetName model dispatch

Parameters:
    sheetName : string
    model : Model
    dispatch : Msg -> unit

Returns: Unit
sheetName : string
model : Model
dispatch : Msg -> unit
Returns: Unit

displayFileErrorNotification err dispatch

Full Usage: displayFileErrorNotification err dispatch

Parameters:
    err : string
    dispatch : Msg -> 'a

Returns: 'a
err : string
dispatch : Msg -> 'a
Returns: 'a

extractLabelBase text

Full Usage: extractLabelBase text

Parameters:
    text : string

Returns: string
text : string
Returns: string

fileEntryBox files fName dialog dispatch

Full Usage: fileEntryBox files fName dialog dispatch

Parameters:
Returns: ReactElement

maybe no longer needed...

files : string list
fName : string
dialog : PopupDialogData
dispatch : Msg -> unit
Returns: ReactElement

foldOverTree isSubSheet folder tree model

Full Usage: foldOverTree isSubSheet folder tree model

Parameters:
Returns: Model
isSubSheet : bool
folder : bool -> SheetTree -> Model -> Model
tree : SheetTree
model : Model
Returns: Model

forgetRecentProject path model dispatch

Full Usage: forgetRecentProject path model dispatch

Parameters:
    path : string
    model : Model
    dispatch : Msg -> 'a

Returns: 'a

Take one project off the recent list. The project itself is untouched.

path : string
model : Model
dispatch : Msg -> 'a
Returns: 'a

formatLabel comp text

Full Usage: formatLabel comp text

Parameters:
Returns: string
comp : Component
text : string
Returns: string

formatLabelAsBus width text

Full Usage: formatLabelAsBus width text

Parameters:
    width : int
    text : string

Returns: string
width : int
text : string
Returns: string

formatLabelFromType compType text

Full Usage: formatLabelFromType compType text

Parameters:
Returns: string
compType : ComponentType
text : string
Returns: string

getFileInProject name project

Full Usage: getFileInProject name project

Parameters:
Returns: LoadedComponent option
name : string
project : Project
Returns: LoadedComponent option

getHintPaneElement model

Full Usage: getHintPaneElement model

Parameters:
Returns: ReactElement list
model : Model
Returns: ReactElement list

getSavedWave ldcs model

Full Usage: getSavedWave ldcs model

Parameters:
Returns: SavedWaveInfo option

extract SavedWaveInfo from model to be saved. Takes the design to walk rather than reading it off the project, because the selection is saved as label paths and the project's copy of the sheet being saved is the version before the save - see designWithSheet, which is what every caller passes.

ldcs : LoadedComponent list
model : Model
Returns: SavedWaveInfo option

getSheetShapes showLibrarySheet ldcs

Full Usage: getSheetShapes showLibrarySheet ldcs

Parameters:
Returns: SheetShapes

What is directly inside each sheet of the project: one pass over each canvas, and so a cost that is the design's own size whatever that design expands to. showLibrarySheet: a library sheet it answers false for is left out, and so are the instances that would put it inside someone else - a library component is one thing, not a sheet with innards. It has to be decided here rather than by filtering the project first: the shapes are read off each sheet's canvas, so a sheet removed from LoadedComponents still leaves its instance naming it, with nothing to find under that name. A predicate rather than one flag for the lot, because a library component the user has asked to look inside appears in the Sheets menu while the rest of the library stays hidden. The sheets are given as a list rather than as a project, because not every hierarchy is drawn from the project: the wave selector draws the design that was SIMULATED, which the simulation carries as a list of exactly the sheets it needed.

showLibrarySheet : string -> bool
ldcs : LoadedComponent list
Returns: SheetShapes

getSheetTrees allowAllInstances p

Full Usage: getSheetTrees allowAllInstances p

Parameters:
    allowAllInstances : bool
    p : Project

Returns: Map<string, SheetTree>

Get the subsheet tree for all sheets in the current project, library sheets included.

allowAllInstances : bool
p : Project
Returns: Map<string, SheetTree>

getSheetTreesFiltered showLibrarySheet allowAllInstances p

Full Usage: getSheetTreesFiltered showLibrarySheet allowAllInstances p

Parameters:
    showLibrarySheet : string -> bool
    allowAllInstances : bool
    p : Project

Returns: Map<string, SheetTree>

Get the subsheet tree for all sheets in the current project. Returns a map from sheet name to tree of SheetTree nodes. Every sheet is a root here and every node is built: callers that draw one hierarchy, and that can leave part of it unopened, should use getSheetShapes and materialiseTree directly.

showLibrarySheet : string -> bool
allowAllInstances : bool
p : Project
Returns: Map<string, SheetTree>

isFileInProject name project

Full Usage: isFileInProject name project

Parameters:
Returns: bool
name : string
project : Project
Returns: bool

librarySheetsShown model sheet

Full Usage: librarySheetsShown model sheet

Parameters:
    model : Model
    sheet : string

Returns: bool

Which library sheets the Sheets menu and the design hierarchy show: none, unless the developer toggle is on, or the user has asked to look inside that particular component.

model : Model
sheet : string
Returns: bool

loadComponentWithRAMChanges (arg1, arg2) savedWaveSim ldc model

Full Usage: loadComponentWithRAMChanges (arg1, arg2) savedWaveSim ldc model

Parameters:
Returns: Model
arg0 : Component list
arg1 : Connection list
savedWaveSim : SavedWaveInfo option
ldc : LoadedComponent
model : Model
Returns: Model

makeSourceMenu model updateMem cid dispatch modelCurrent

Full Usage: makeSourceMenu model updateMem cid dispatch modelCurrent

Parameters:
Returns: ReactElement

Make a poup with menu to view and select a memory data source

model : Model
updateMem : ComponentId -> (Memory1 -> Memory1) -> Unit
cid : ComponentId
dispatch : Msg -> Unit
modelCurrent : Model
Returns: ReactElement

materialiseTree expand allInstances shapes root

Full Usage: materialiseTree expand allInstances shapes root

Parameters:
    expand : string list -> bool
    allInstances : bool
    shapes : SheetShapes
    root : string

Returns: SheetTree

Build the part of a hierarchy that is going to be looked at. `expand` is asked of each node's SheetPath: a node it says false to comes back as a leaf and nothing below it is built at all. That is what lets a design many routes reach one sheet in be drawn without being walked, since the drawn tree is then the only tree there is. `fun _ -> true` builds the whole thing, which is what the Sheets menu asks for. allInstances = false collapses several instances of one sheet inside one parent into one node, dropping the others BEFORE their subtrees are built rather than after. Instances of a sheet expand identically - same children, same depth - so this is the same tree; what it is not is the same amount of work. A sheet reached from inside itself is not descended into. The guard is on the ancestor path, so the shapes may name each other in a cycle and this still terminates.

expand : string list -> bool
allInstances : bool
shapes : SheetShapes
root : string
Returns: SheetTree

multiPathSheets shapes root

Full Usage: multiPathSheets shapes root

Parameters:
Returns: Set<string>

The sheets that more than one route from the root reaches, and which therefore appear more than once in its hierarchy. Worked out from the design graph - each sheet's parents are counted, not its occurrences - so a design whose expansion is astronomical still costs its own size. Everything below such a sheet is one too: a sheet inside a sheet that appears twice appears twice itself, however singular its own parent is.

shapes : SheetShapes
root : string
Returns: Set<string>

openDemoProjectFromPath path model dispatch

Full Usage: openDemoProjectFromPath path model dispatch

Parameters:
    path : string
    model : Model
    dispatch : Msg -> unit

Returns: Unit

open an existing demo project from its path

path : string
model : Model
dispatch : Msg -> unit
Returns: Unit

openFileInProject name project model dispatch

Full Usage: openFileInProject name project model dispatch

Parameters:

Open a sheet of the project, SAVING the one being left if it has unsaved changes. That is what every ordinary way of changing sheet goes through - the Sheets menu, following a custom component into its sheet, and the waveform viewer's jump to a sheet. Whether it has changes is worked out here rather than read off Model.SavedSheetIsOutOfDate: that flag is only recomputed on DRAW BLOCK messages, so a change made by anything else - the Properties pane setting a sheet's array settings, or its parameters - left it saying what was true before the change, and the switch then dropped the edit. See ModelHelpers.currentSheetIsOutOfDate.

name : string
project : Project
model : Model
dispatch : Msg -> unit

openFileInProject' saveCurrent name project model dispatch

Full Usage: openFileInProject' saveCurrent name project model dispatch

Parameters:
    saveCurrent : bool
    name : string
    project : Project
    model : Model
    dispatch : Msg -> unit

Open the specified file, saving the current file if needed. Creates messages sufficient to do all necessary model and diagram change Terminates a simulation if one is running Closes waveadder if it is open

saveCurrent : bool
name : string
project : Project
model : Model
dispatch : Msg -> unit

openLibraryAsProject library model dispatch

Full Usage: openLibraryAsProject library model dispatch

Parameters:
Returns: Unit

Open a component library as a project, so that its components can be edited where they are. The catalogue's door to what the project browser reaches by navigating to the folder: one open path, so the refusal above and the recent-projects entry are the same either way in.

library : ComponentLibrary
model : Model
dispatch : Msg -> unit
Returns: Unit

openProjectFromPath path model dispatch

Full Usage: openProjectFromPath path model dispatch

Parameters:
    path : string
    model : Model
    dispatch : Msg -> unit

Returns: Unit

open an existing project from its path

path : string
model : Model
dispatch : Msg -> unit
Returns: Unit

quantifyChanges ldc1 ldc2

Full Usage: quantifyChanges ldc1 ldc2

Parameters:
Returns: int * int

Works out number of components and connections changed between two LoadedComponent circuits a new ID => a change even if the circuit topology is identical. Layout differences do not mean changes, as is implemented in the reduce functions which remove layout.

ldc1 : LoadedComponent
ldc2 : LoadedComponent
Returns: int * int

raiseFileNotification dispatch msg

Full Usage: raiseFileNotification dispatch msg

Parameters:
    dispatch : Msg -> unit
    msg : string option

temporary shim for compatibility while dispatch is still being used.

dispatch : Msg -> unit
msg : string option

readLastBackup comp

Full Usage: readLastBackup comp

Parameters:
Returns: (int * string * string) option

return an option containing sequence data and file name and directory of the latest backup file for given component, if it exists.

comp : LoadedComponent
Returns: (int * string * string) option

recentProjectItem path label openIt model dispatch

Full Usage: recentProjectItem path label openIt model dispatch

Parameters:
Returns: ReactElement

One row of a recent-projects list: the project, which opens on a click, and a cross that takes it off the list. Only opening a project ever put one here, and only opening four others ever took it away - so a project opened once by mistake, or one whose folder has since been moved or deleted, sat at the top of the list of five for as long as it took to open five more. The cross is worded and coloured as removal from a list rather than deletion, because that is all it is: nothing on disk changes.

path : string
label : ReactElement
openIt : string -> unit
model : Model
dispatch : Msg -> unit
Returns: ReactElement

recentProjects model

Full Usage: recentProjects model

Parameters:
Returns: string list

The recent projects to offer, newest first. Read the list through this rather than from UserData directly.

model : Model
Returns: string list

removeAllCustomComps name project

Full Usage: removeAllCustomComps name project

Parameters:
Returns: LoadedComponent list
name : string
project : Project
Returns: LoadedComponent list

removeFileInProject name project model dispatch

Full Usage: removeFileInProject name project model dispatch

Parameters:

Remove file.

name : string
project : Project
model : Model
dispatch : Msg -> unit

resolveComponentOpenPopup pPath components resolves model dispatch

Full Usage: resolveComponentOpenPopup pPath components resolves model dispatch

Parameters:
pPath : string
components : LoadedComponent list
resolves : LoadStatus list
model : Model
dispatch : Msg -> Unit

saveDirtyClosedSheets openSheet ldcs

Full Usage: saveDirtyClosedSheets openSheet ldcs

Parameters:
Returns: LoadedComponent list

Write every sheet that differs from its file, except the open one, and clear its flag. ONLY THE OPEN SHEET MAY BE UNSAVED. A change to one sheet routinely reaches others - binding a parameter writes it on every instance, reconciling ports rewrites the sheets that hold them, setting the top sheet rewrites the flag on all of them - and a closed sheet left waiting for a save is a sheet the user cannot see, did not knowingly edit, and has no reason to save. Several places used to mark such sheets and leave them, so the state existed and had to be handled at project close. A library component's sheet belongs to its library and is never written back, whatever asks; it is left alone here and not called unsaved either.

openSheet : string
ldcs : LoadedComponent list
Returns: LoadedComponent list

saveOpenFileAction isAuto model dispatch

Full Usage: saveOpenFileAction isAuto model dispatch

Parameters:
Returns: (LoadedComponent * (Component list * Connection list)) option

Save the sheet currently open, return the new sheet's Loadedcomponent if this has changed. Do not change model. update Symbol model with new RAM contents.

isAuto : bool
model : Model
dispatch : Msg -> Unit
Returns: (LoadedComponent * (Component list * Connection list)) option

saveOpenFileActionWithModelUpdate model dispatch

Full Usage: saveOpenFileActionWithModelUpdate model dispatch

Parameters:
Returns: (LoadedComponent * (Component list * Connection list)) option

save current open file, updating model etc, and returning the loaded component and the saved (unreduced) canvas state

model : Model
dispatch : Msg -> Unit
Returns: (LoadedComponent * (Component list * Connection list)) option

saveOpenFileToModel model

Full Usage: saveOpenFileToModel model

Parameters:
Returns: Model option

Save the sheet currently open, return updated model dispatch not needed. currently errors in saving are not processed: because without dispatch we cannot add an alert. this could be changed by using the Notification field in the returned model

model : Model
Returns: Model option

saveOpenProjectInNewFormat model

Full Usage: saveOpenProjectInNewFormat model

Parameters:
Returns: unit list
model : Model
Returns: unit list

setComponentLabel model sheetDispatch comp text

Full Usage: setComponentLabel model sheetDispatch comp text

Parameters:
model : Model
sheetDispatch : Dispatch<Msg>
comp : Component
text : string

setTopSheetState sheetName model

Full Usage: setTopSheetState sheetName model

Parameters:
    sheetName : string
    model : Model

Returns: Model

Make the named sheet the current top sheet governing parameter display, clearing the flag from every other sheet. The flag is per-sheet view state persisted in the .dgm file. Every sheet but the open one is written at once, so the choice survives without a manual save.

sheetName : string
model : Model
Returns: Model

setupProjectFromComponents finishUI sheetName ldComps model dispatch

Full Usage: setupProjectFromComponents finishUI sheetName ldComps model dispatch

Parameters:
Returns: Unit

Load a new project as defined by parameters. Ends any existing simulation Closes WaveSim if this is being used

finishUI : bool
sheetName : string
ldComps : LoadedComponent list
model : Model
dispatch : Msg -> Unit
Returns: Unit

sheetOpenedOnLoad ldcs

Full Usage: sheetOpenedOnLoad ldcs

Parameters:
Returns: string option

Which sheet a project opens at. The most recently saved sheet says what the user was WORKING ON; it is rarely what they want to look at first. A subsheet opened on its own is a block out of context - the design it belongs to is not on screen, its parameters show whatever its own defaults give, and the first thing anyone does is climb back up. So the timestamp picks the DESIGN, and the design is opened at its top. The top is the highest sheet EVERY route to the last-saved one passes through. Where the project is one tree, which is nearly all of them, that is simply its root. Where two roots both reach the sheet it belongs to two designs and there is no saying which was meant, so the answer is the highest sheet they have in common on the way to it - which may be the sheet itself. Note that a sheet reached by two routes is not by itself an ambiguity: one design using a block twice still has one root, and that root is still what opens. Climbing while there was a single PARENT would stop at such a sheet and open a block out of context, which is the thing this exists to avoid. Library sheets are left out of the graph entirely. A library component is one thing rather than a sheet with innards, so it is neither a design to open nor a route that makes one ambiguous. Only a sheet the user made is a candidate for "last worked on" - a generated or protected sheet carries a timestamp from something the user did not do - but any of them can be climbed through, since a design is opened at its top whoever wrote the sheets in between. The cost is a walk of the design graph per sheet above the one chosen, which is the project's own size squared and not its expansion - and it is paid once, while a project is being opened. None only for a project with no user sheets at all.

ldcs : LoadedComponent list
Returns: string option

subSheets_

Full Usage: subSheets_

Returns: Lens<SheetTree, SheetTree list>
Returns: Lens<SheetTree, SheetTree list>

sweepUnusedLibrarySheets model

Full Usage: sweepUnusedLibrarySheets model

Parameters:
Returns: Model

Drop library sheets that nothing instantiates any more, deleting their files. Run when the project is saved rather than when an instance is deleted: undo restores model snapshots, so deleting the sheet at deletion time would leave undo unable to bring it back.

model : Model
Returns: Model

tidyRecents recents

Full Usage: tidyRecents recents

Parameters:
    recents : string list option

Returns: string list option

A recent list as it came out of the settings file, in the form the rest of the code holds it in. Settings written before paths were normalised have the same project under two spellings, and one written by an older version can be longer than the limit; tidying on the way IN means the next write of the settings file heals it, rather than leaving that to the next project opened.

recents : string list option
Returns: string list option

updateLoadedComponents name setFun lcLst dispatch

Full Usage: updateLoadedComponents name setFun lcLst dispatch

Parameters:
Returns: LoadedComponent list

Return LoadedComponents with sheet name updated according to setFun. Do not update model.

name : string
setFun : LoadedComponent -> LoadedComponent
lcLst : LoadedComponent list
dispatch : Msg -> Unit
Returns: LoadedComponent list

updateProjectFromCanvas model dispatch

Full Usage: updateProjectFromCanvas model dispatch

Parameters:
Returns: Project option

return current project with current sheet updated from canvas if needed. Do not update model.

model : Model
dispatch : Msg -> Unit
Returns: Project option

updateSymbolRAMs ramCheck sModel

Full Usage: updateSymbolRAMs ramCheck sModel

Parameters:
Returns: Model
ramCheck : Component list
sModel : Model
Returns: Model

warnAppWidth dispatch afterFun

Full Usage: warnAppWidth dispatch afterFun

Parameters:
    dispatch : Msg -> unit
    afterFun : unit -> unit

Returns: Unit
dispatch : Msg -> unit
afterFun : unit -> unit
Returns: Unit

writeComponentToBackupFile numCircuitChanges numHours comp dispatch

Full Usage: writeComponentToBackupFile numCircuitChanges numHours comp dispatch

Parameters:

Write Loadedcomponent comp to a backup file if there has been any change. Overwrite the existing backup file only if it is a small, and recent, change. Parameters determine thresholds of smallness and recency return () - display an error if the write goes wrong.

numCircuitChanges : int
numHours : float
comp : LoadedComponent
dispatch : Msg -> Unit

writeComponentToBackupFileNow numCircuitChanges numHours comp

Full Usage: writeComponentToBackupFileNow numCircuitChanges numHours comp

Parameters:

Write Loadedcomponent comp to a backup file if there has been any change. Overwrite the existing backup file only if it is a small, and recent, change. Parameters determine thresholds of smallness and recency return () - ignore errors

numCircuitChanges : int
numHours : float
comp : LoadedComponent

writeComponentToFile comp

Full Usage: writeComponentToFile comp

Parameters:
Returns: Result<unit, string>

Write a sheet to the file it came from, whichever of the two forms that file is: an ordinary .dgm, or a component of a library opened as a project. See ComponentLibraries.writeSheetFile.

comp : LoadedComponent
Returns: Result<unit, string>

Type something to start searching.