Header menu 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>

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 model

Full Usage: getSavedWave model

Parameters:
Returns: SavedWaveInfo option

extract SavedWaveInfo from model to be saved

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:
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

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:

work out what to do opening a file

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

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

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>
comp : LoadedComponent
Returns: Result<unit, string>

Type something to start searching.