MenuHelpers Module
Types and nested modules
Functions and values
| Function or value | Description |
Full Usage:
addToRecents path recents
Parameters:
string
recents : string list option
Returns: string list option
|
|
|
|
|
|
Full Usage:
convertProjectIdsOnDisk ldcs
Parameters:
LoadedComponent list
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.
|
|
|
|
|
Full Usage:
displayFileErrorNotification err dispatch
Parameters:
string
dispatch : Msg -> 'a
Returns: 'a
|
|
Full Usage:
extractLabelBase text
Parameters:
string
Returns: string
|
|
Full Usage:
fileEntryBox files fName dialog dispatch
Parameters:
string list
fName : string
dialog : PopupDialogData
dispatch : Msg -> unit
Returns: ReactElement
|
|
|
|
|
|
|
|
Full Usage:
formatLabelAsBus width text
Parameters:
int
text : string
Returns: string
|
|
Full Usage:
formatLabelFromType compType text
Parameters:
ComponentType
text : string
Returns: string
|
|
Full Usage:
getFileInProject name project
Parameters:
string
project : Project
Returns: LoadedComponent option
|
|
|
|
Full Usage:
getSavedWave ldcs model
Parameters:
LoadedComponent list
model : Model
Returns: SavedWaveInfo option
|
|
Full Usage:
getSheetShapes showLibrarySheet ldcs
Parameters:
string -> bool
ldcs : LoadedComponent list
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.
|
|
|
|
|
|
|
|
|
Full Usage:
loadComponentWithRAMChanges (arg1, arg2) savedWaveSim ldc model
Parameters:
Component list
arg1 : Connection list
savedWaveSim : SavedWaveInfo option
ldc : LoadedComponent
model : Model
Returns: Model
|
|
Full Usage:
makeSourceMenu model updateMem cid dispatch modelCurrent
Parameters:
Model
updateMem : ComponentId -> (Memory1 -> Memory1) -> Unit
cid : ComponentId
dispatch : Msg -> Unit
modelCurrent : Model
Returns: ReactElement
|
|
Full Usage:
materialiseTree expand allInstances shapes root
Parameters:
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.
|
Full Usage:
multiPathSheets shapes root
Parameters:
SheetShapes
root : string
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.
|
|
|
|
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. |
|
|
Full Usage:
openLibraryAsProject library model dispatch
Parameters:
ComponentLibrary
model : Model
dispatch : Msg -> unit
Returns: Unit
|
|
|
|
Full Usage:
quantifyChanges ldc1 ldc2
Parameters:
LoadedComponent
ldc2 : LoadedComponent
Returns: int * int
|
|
Full Usage:
raiseFileNotification dispatch msg
Parameters:
Msg -> unit
msg : string option
|
|
Full Usage:
readLastBackup comp
Parameters:
LoadedComponent
Returns: (int * string * string) option
|
|
Full Usage:
recentProjectItem path label openIt model dispatch
Parameters:
string
label : ReactElement
openIt : string -> unit
model : Model
dispatch : Msg -> unit
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.
|
|
|
Full Usage:
removeAllCustomComps name project
Parameters:
string
project : Project
Returns: LoadedComponent list
|
|
|
|
Full Usage:
resolveComponentOpenPopup pPath components resolves model dispatch
Parameters:
string
components : LoadedComponent list
resolves : LoadStatus list
model : Model
dispatch : Msg -> Unit
|
|
Full Usage:
saveDirtyClosedSheets openSheet ldcs
Parameters:
string
ldcs : LoadedComponent list
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.
|
Full Usage:
saveOpenFileAction isAuto model dispatch
Parameters: Returns: (LoadedComponent * (Component list * Connection list)) option
|
|
Full Usage:
saveOpenFileActionWithModelUpdate model dispatch
Parameters: Returns: (LoadedComponent * (Component list * Connection list)) option
|
|
|
|
|
|
|
|
|
|
Full Usage:
setupProjectFromComponents finishUI sheetName ldComps model dispatch
Parameters:
bool
sheetName : string
ldComps : LoadedComponent list
model : Model
dispatch : Msg -> Unit
Returns: Unit
|
|
|
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.
|
|
|
|
|
Full Usage:
tidyRecents recents
Parameters:
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.
|
Full Usage:
updateLoadedComponents name setFun lcLst dispatch
Parameters:
string
setFun : LoadedComponent -> LoadedComponent
lcLst : LoadedComponent list
dispatch : Msg -> Unit
Returns: LoadedComponent list
|
|
|
|
|
|
|
|
Full Usage:
writeComponentToBackupFile numCircuitChanges numHours comp dispatch
Parameters:
int
numHours : float
comp : LoadedComponent
dispatch : Msg -> Unit
|
|
Full Usage:
writeComponentToBackupFileNow numCircuitChanges numHours comp
Parameters:
int
numHours : float
comp : LoadedComponent
|
|
Full Usage:
writeComponentToFile comp
Parameters:
LoadedComponent
Returns: Result<unit, string>
|