Issie logo Issie

Symbol Module

Nested modules

Modules Description

Constants

--------- STATIC VARIABLES --------- ///

Functions and values

Function or value Description

addPortToMaps edge portMaps portId

Full Usage: addPortToMaps edge portMaps portId

Parameters:
Returns: PortMaps
edge : Edge
portMaps : PortMaps
portId : PortId
Returns: PortMaps

addToPortModel model sym

Full Usage: addToPortModel model sym

Parameters:
Returns: Map<PortId, Port>
model : Model
sym : Symbol
Returns: Map<PortId, Port>

arrayIOProperties arrayText compType

Full Usage: arrayIOProperties arrayText compType

Parameters:
Returns: int * int * float * float

return (num inputs, num outputs, height, width) The port counts and size of one of an ARRAY COMPONENT's IO symbols, sized to the legend it will actually draw. Its own function because the legend can hold a channel EXPRESSION - `Join[i+10]` where the component type alone says `Join[1]` - and only a symbol knows that text. getComponentProperties sizes from the type and so passes None; SymbolReplaceHelpers.resizedForLegend has the symbol and passes what it draws, which is what keeps the text inside the shape.

arrayText : string option
compType : ComponentType
Returns: int * int * float * float

arrayLegend t n

Full Usage: arrayLegend t n

Parameters:
    t : string
    n : int

Returns: string

The legend of an array component's IO: what the copies do with the value, and its width. One line, unlike busTitleAndBits, which puts the width on a second line by way of a "." that addLegendText splits on. Two lines were what stopped these resizing with their width - the symbol is sized by its widest LINE, which was always the first, so the bit range never reached it - and there is room for one line because the symbol is as long as it needs to be.

t : string
n : int
Returns: string

arrayLegendStyle

Full Usage: arrayLegendStyle

Returns: Text

The style an array component's legend is drawn in. Lighter and smaller than every other legend, because these say a name, a channel and a bit range where an ordinary legend says one word. Written down once because getComponentProperties SIZES the symbol with it and SymbolView DRAWS with it: a symbol sized against a different font is one the text runs out of.

Returns: Text

autoScaleHAndW sym

Full Usage: autoScaleHAndW sym

Parameters:
Returns: Symbol

adjust symbol (and component) dimensions based on current ports and labels of a custom component. leaves other symbols unchanged

sym : Symbol
Returns: Symbol

busSelectTitle wob lsb

Full Usage: busSelectTitle wob lsb

Parameters:
    wob : int
    lsb : int

Returns: string

Insert titles for bus select

wob : int
lsb : int
Returns: string

busTitleAndBits t n

Full Usage: busTitleAndBits t n

Parameters:
    t : string
    n : int

Returns: string

Insert titles compatible with greater than 1 buswidth

t : string
n : int
Returns: string

calcLabelBoundingBox sym

Full Usage: calcLabelBoundingBox sym

Parameters:
Returns: Symbol

Work out a label bounding box from symbol, return symbol with box added. The box has a margin Constants. componentLabelOffsetDistance around the label text outline. This function should be included at the end of any function that changes component or label position or orientation or shape.

sym : Symbol
Returns: Symbol

clockedSheetsOf

Full Usage: clockedSheetsOf

Returns: LoadedComponent list -> Set<string>

Function to generate a new symbol Which sheets of a design hold something clocked, worked out once per design rather than once per symbol. Keyed on the LoadedComponent list by identity: it is replaced rather than mutated when the project changes, so a new one is exactly the signal that this is stale.

Returns: LoadedComponent list -> Set<string>

combineRotation r1 r2

Full Usage: combineRotation r1 r2

Parameters:
Returns: Rotation
Modifiers: inline

the output is the rotation got from the two inputs one after the other.

r1 : Rotation
r2 : Rotation
Returns: Rotation

createNewSymbol ldcs pos comptype label theme

Full Usage: createNewSymbol ldcs pos comptype label theme

Parameters:
Returns: Symbol
ldcs : LoadedComponent list
pos : XYPos
comptype : ComponentType
label : string
theme : ThemeType
Returns: Symbol

customStringToLength lst

Full Usage: customStringToLength lst

Parameters:
    lst : string list

Returns: float

get the max length (in pixels) of any of the Text strings in a list Hack - for now assume text char width is constant

lst : string list
Returns: float

customToLength lst

Full Usage: customToLength lst

Parameters:
    lst : (string * int) list

Returns: int
lst : (string * int) list
Returns: int

deletePortFromMaps port portMaps

Full Usage: deletePortFromMaps port portMaps

Parameters:
Returns: PortMaps
port : PortId
portMaps : PortMaps
Returns: PortMaps

getBoundingBox symModel compid

Full Usage: getBoundingBox symModel compid

Parameters:
Returns: BoundingBox
Modifiers: inline

Returns bounding box of a component based on component id

symModel : Model
compid : ComponentId
Returns: BoundingBox

getBoundingBoxes symModel

Full Usage: getBoundingBoxes symModel

Parameters:
Returns: Map<ComponentId, BoundingBox>

Returns all the bounding boxes of all components in the model

symModel : Model
Returns: Map<ComponentId, BoundingBox>

getCompRotatedHAndW comp transform hScale vScale

Full Usage: getCompRotatedHAndW comp transform hScale vScale

Parameters:
Returns: float * float
Modifiers: inline

Returns the correct height and width of a transformed symbol as the tuple (real H, real W). Needed because H & W in Component do not change with rotation. NB Pos in component = Pos in Symbol and DOES change with rotation!

comp : Component
transform : STransform
hScale : float option
vScale : float option
Returns: float * float

getComponentLegend arrayText componentType rotation

Full Usage: getComponentLegend arrayText componentType rotation

Parameters:
Returns: string

`arrayText` is what an ARRAY COMPONENT's symbol draws in place of a number - see SymbolT.Symbol.ArrayText. A join uses it for its channel, so a carry chain reads `Join[i+1]` against `Join[i]` rather than showing what those expressions come to in copy 0. None everywhere else, and on a join whose channel is a plain number, which draws that number as it always did.

arrayText : string option
componentType : ComponentType
rotation : Rotation
Returns: string

getComponentProperties compType label

Full Usage: getComponentProperties compType label

Parameters:
Returns: int * int * float * float
compType : ComponentType
label : string
Returns: int * int * float * float

getCustomPortIdMap comp

Full Usage: getCustomPortIdMap comp

Parameters:
Returns: Map<PortId, string>

obtain map from port IDs to port names for Custom Component. for other components types this returns empty map

comp : Component
Returns: Map<PortId, string>

getGateComponentLegend gType

Full Usage: getGateComponentLegend gType

Parameters:
Returns: string
gType : GateComponentType
Returns: string

getGateNComponentLegend numInputs gType

Full Usage: getGateNComponentLegend numInputs gType

Parameters:
Returns: string
numInputs : int
gType : GateComponentType
Returns: string

getInputPortLocation defPos model portId

Full Usage: getInputPortLocation defPos model portId

Parameters:
Returns: XYPos
Modifiers: inline

Returns the location of an input port based on their portId

defPos : XYPos option
model : Model
portId : InputPortId
Returns: XYPos

getInputPortsLocationMap model symbols

Full Usage: getInputPortsLocationMap model symbols

Parameters:
Returns: Map<InputPortId, XYPos>

Returns the input port positions of the specified symbols in model

model : Model
symbols : Symbol list
Returns: Map<InputPortId, XYPos>

getLabelBoundingBox model compId

Full Usage: getLabelBoundingBox model compId

Parameters:
Returns: BoundingBox

Returns the bounding box of the symbol associated with compId

model : Model
compId : ComponentId
Returns: BoundingBox

getLabelBoundingBoxes model

Full Usage: getLabelBoundingBoxes model

Parameters:
Returns: Map<ComponentId, BoundingBox>

Returns the bounding boxes of all symbol labels in the model

model : Model
Returns: Map<ComponentId, BoundingBox>

getMuxSelOffset sym side

Full Usage: getMuxSelOffset sym side

Parameters:
Returns: XYPos

Based on a symbol and an edge, if the port is a mux select, return an extra offset required for the port (because of the weird shape of the mux)

sym : Symbol
side : Edge
Returns: XYPos

getOutputPortLocation defPos model portId

Full Usage: getOutputPortLocation defPos model portId

Parameters:
Returns: XYPos
Modifiers: inline

Returns the location of an output port based on their portId

defPos : XYPos option
model : Model
portId : OutputPortId
Returns: XYPos

getOutputPortsLocationMap model symbols

Full Usage: getOutputPortsLocationMap model symbols

Parameters:
Returns: Map<OutputPortId, XYPos>

Returns the output port positions of the specified symbols in model

model : Model
symbols : Symbol list
Returns: Map<OutputPortId, XYPos>

getPortBaseOffset sym side

Full Usage: getPortBaseOffset sym side

Parameters:
Returns: XYPos
Modifiers: inline

Returns the xy offset of a side relative to the symbol topleft

sym : Symbol
side : Edge
Returns: XYPos

getPortLocation defPos model portId

Full Usage: getPortLocation defPos model portId

Parameters:
Returns: XYPos

Returns the location of a given portId, with good efficiency

defPos : XYPos option
model : Model
portId : PortId
Returns: XYPos

getPortLocations model symbolIds

Full Usage: getPortLocations model symbolIds

Parameters:
Returns: Map<InputPortId, XYPos> * Map<OutputPortId, XYPos>

Returns all the port locations of the given components

model : Model
symbolIds : ComponentId list
Returns: Map<InputPortId, XYPos> * Map<OutputPortId, XYPos>

getPortPos sym port

Full Usage: getPortPos sym port

Parameters:
Returns: XYPos

Given a symbol and a port, it returns the offset of the port from the top left corner of the symbol

sym : Symbol
port : Port
Returns: XYPos

getPortPosEdgeGap ct

Full Usage: getPortPosEdgeGap ct

Parameters:
Returns: float
Modifiers: inline

hack so that bounding box of splitwire, mergewires can be smaller height relative to ports

ct : ComponentType
Returns: float

getPortPosModel model port

Full Usage: getPortPosModel model port

Parameters:
Returns: XYPos
Modifiers: inline
model : Model
port : Port
Returns: XYPos

getPortPosToRender sym port

Full Usage: getPortPosToRender sym port

Parameters:
Returns: XYPos
Modifiers: inline

Gives the port positions to the render function, it gives the moving port pos where the mouse is, if there is a moving port

sym : Symbol
port : Port
Returns: XYPos

getPrefix compType

Full Usage: getPrefix compType

Parameters:
Returns: string

Decodes the component type into component labels

compType : ComponentType
Returns: string

getRotatedCompCentre comp transform hScale vScale

Full Usage: getRotatedCompCentre comp transform hScale vScale

Parameters:
Returns: XYPos
Modifiers: inline

returns the true centre of a component's symbol

comp : Component
transform : STransform
hScale : float option
vScale : float option
Returns: XYPos

getRotatedHAndW sym

Full Usage: getRotatedHAndW sym

Parameters:
Returns: float * float
Modifiers: inline

Returns the correct height and width of a transformed symbol as the tuple (real H, real W). Needed because H & W in Component do not change with rotation. NB Pos in component = Pos in Symbol and DOES change with rotation!

sym : Symbol
Returns: float * float

getRotatedSymbolCentre symbol

Full Usage: getRotatedSymbolCentre symbol

Parameters:
Returns: XYPos
Modifiers: inline

returns the true centre of a symbol, taking into account its current rotation

symbol : Symbol
Returns: XYPos

getSymbolBoundingBox sym

Full Usage: getSymbolBoundingBox sym

Parameters:
Returns: BoundingBox
Modifiers: inline

Returns the bounding box of a symbol. It is defined by the height and the width as well as the x,y position of the symbol. Works with rotation. For a rotated symbol, TopLeft = Pos, and H,W swapped in getrotatedHAndW

sym : Symbol
Returns: BoundingBox

getSymbolColour compType clocked theme

Full Usage: getSymbolColour compType clocked theme

Parameters:
Returns: string

Returns color for the fill of a symbol (when not selected) Depends on theme and whether symbol is closed or not.

compType : ComponentType
clocked : bool
theme : ThemeType
Returns: string

getSymbolPortOrientation sym port

Full Usage: getSymbolPortOrientation sym port

Parameters:
Returns: Edge
Modifiers: inline

Given a symbol and a Port, it returns the orientation of the port

sym : Symbol
port : Port
Returns: Edge

getTextGateComponentLegend gType

Full Usage: getTextGateComponentLegend gType

Parameters:
Returns: string
gType : GateComponentType
Returns: string

getTwoPortLocations model inputPortId outputPortId

Full Usage: getTwoPortLocations model inputPortId outputPortId

Parameters:
Returns: XYPos * XYPos
Modifiers: inline

Returns the locations of a given input port and output port based on their portId

model : Model
inputPortId : InputPortId
outputPortId : OutputPortId
Returns: XYPos * XYPos

initPortOrientation comp

Full Usage: initPortOrientation comp

Parameters:
Returns: PortMaps

work out the initial (default) port placing for a componenent. also used for legacy circuits loaded without port layoiut info.

comp : Component
Returns: PortMaps

invertRotation rot

Full Usage: invertRotation rot

Parameters:
Returns: Rotation
Modifiers: inline
rot : Rotation
Returns: Rotation

isMuxSel sym side

Full Usage: isMuxSel sym side

Parameters:
Returns: bool

Returns true if an edge has the select port of a mux

sym : Symbol
side : Edge
Returns: bool

makeComponent pos compType id label

Full Usage: makeComponent pos compType id label

Parameters:
Returns: Component

make a completely new component

pos : XYPos
compType : ComponentType
id : ComponentId
label : string
Returns: Component

makeMapsConsistent portIdMap sym

Full Usage: makeMapsConsistent portIdMap sym

Parameters:
Returns: PortMaps

Needed because the I/Os of a custom component can be changed on anotehr sheet. When the component is reloaded its port maps will be inconsistent. This function keeps existing layout, and adds new I/Os or deletes old ones.

portIdMap : Map<PortId, string>
sym : Symbol
Returns: PortMaps

movePortToBottom portMaps index

Full Usage: movePortToBottom portMaps index

Parameters:
Returns: PortMaps

Modify port position maps to move an existing Lefthand port (index in the list) to the bottom edge

portMaps : PortMaps
index : int
Returns: PortMaps

movePortsToCorrectEdgeForComponentType ct portMaps

Full Usage: movePortsToCorrectEdgeForComponentType ct portMaps

Parameters:
Returns: PortMaps

By default all output ports are on the right, input ports on lefty, (of a normal orientation symbol). A few symbols have ports on top or bottom as defined here. Note that custom components can have ports positioned by user.

ct : ComponentType
portMaps : PortMaps
Returns: PortMaps

nBitsGateTitle gateType n

Full Usage: nBitsGateTitle gateType n

Parameters:
    gateType : string
    n : int

Returns: string
gateType : string
n : int
Returns: string

portLists numOfPorts hostID portType

Full Usage: portLists numOfPorts hostID portType

Parameters:
Returns: Port list

Generates a new list of ports of specified type

numOfPorts : int
hostID : ComponentId
portType : PortType
Returns: Port list

widestExpectedJoinLegend

Full Usage: widestExpectedJoinLegend

Returns: string

The widest legend a join is expected to have. Joins are sized to fit at least this, so that changing a width moves the symbol only where the text really is longer than a common case - a symbol that resizes under every keystroke in the properties box is a symbol that jumps about while being read.

Returns: string

Type extensions

Type extension Description

this.SymbolBoundingBox

Full Usage: this.SymbolBoundingBox

Parameters:
    () : unit

Returns: BoundingBox

Extended Type: Symbol

() : unit
Returns: BoundingBox

this.SymbolBoundingBox

Full Usage: this.SymbolBoundingBox

Returns: BoundingBox

Extended Type: Symbol

Returns: BoundingBox

Type something to start searching.