mirror of
https://github.com/rgleichman/glance.git
synced 2024-09-11 15:05:41 +03:00
Inline some iconToDiagram sub-functions. Increase size of case result icon.
This commit is contained in:
parent
9b07562120
commit
dec7c48b82
26
app/Icons.hs
26
app/Icons.hs
@ -44,12 +44,12 @@ iconToDiagram icon = case icon of
|
|||||||
PAppIcon n str -> generalTextAppDia (patternTextC colorScheme) (patternC colorScheme) n str
|
PAppIcon n str -> generalTextAppDia (patternTextC colorScheme) (patternC colorScheme) n str
|
||||||
TextBoxIcon s -> textBox s
|
TextBoxIcon s -> textBox s
|
||||||
BindTextBoxIcon s -> identDiaFunc $ bindTextBox s
|
BindTextBoxIcon s -> identDiaFunc $ bindTextBox s
|
||||||
GuardIcon n -> guardIcon n
|
GuardIcon n -> nestedGuardDia $ replicate (1 + (2 * n)) Nothing
|
||||||
CaseIcon n -> caseIcon n
|
CaseIcon n -> nestedCaseDia $ replicate (1 + (2 * n)) Nothing
|
||||||
CaseResultIcon -> identDiaFunc caseResult
|
CaseResultIcon -> identDiaFunc caseResult
|
||||||
FlatLambdaIcon n -> identDiaFunc $ flatLambda n
|
FlatLambdaIcon n -> identDiaFunc $ flatLambda n
|
||||||
NestedApply flavor args -> nestedApplyDia flavor args
|
NestedApply flavor args -> nestedApplyDia flavor args
|
||||||
NestedPApp args -> nestedPAppDia args
|
NestedPApp args -> generalNestedDia apply0Triangle (repeat $ patternC colorScheme) args
|
||||||
NestedCaseIcon args -> nestedCaseDia args
|
NestedCaseIcon args -> nestedCaseDia args
|
||||||
NestedGuardIcon args -> nestedGuardDia args
|
NestedGuardIcon args -> nestedGuardDia args
|
||||||
|
|
||||||
@ -189,10 +189,6 @@ nestedApplyDia flavor = case flavor of
|
|||||||
ApplyNodeFlavor -> generalNestedDia apply0Triangle (nestingC colorScheme)
|
ApplyNodeFlavor -> generalNestedDia apply0Triangle (nestingC colorScheme)
|
||||||
ComposeNodeFlavor -> generalNestedDia composeSemiCircle (repeat $ apply1C colorScheme)
|
ComposeNodeFlavor -> generalNestedDia composeSemiCircle (repeat $ apply1C colorScheme)
|
||||||
|
|
||||||
nestedPAppDia :: SpecialBackend b n =>
|
|
||||||
[Maybe (NodeName, Icon)] -> TransformableDia b n
|
|
||||||
nestedPAppDia = generalNestedDia apply0Triangle (repeat $ patternC colorScheme)
|
|
||||||
|
|
||||||
makeQualifiedPort :: SpecialNum n => NodeName -> Port -> SpecialQDiagram b n
|
makeQualifiedPort :: SpecialNum n => NodeName -> Port -> SpecialQDiagram b n
|
||||||
makeQualifiedPort n x = n .>> makePort x
|
makeQualifiedPort n x = n .>> makePort x
|
||||||
|
|
||||||
@ -336,22 +332,19 @@ generalNestedGuard triangleColor lBracket bottomDia inputAndArgs name nestingLev
|
|||||||
Nothing -> mempty
|
Nothing -> mempty
|
||||||
Just (iconNodeName, icon) -> iconToDiagram icon iconNodeName nestingLevel reflect angle
|
Just (iconNodeName, icon) -> iconToDiagram icon iconNodeName nestingLevel reflect angle
|
||||||
|
|
||||||
|
|
||||||
-- | The ports of the guard icon are as follows:
|
-- | The ports of the guard icon are as follows:
|
||||||
-- Port 0: Top result port
|
-- Port 0: Top result port (not used)
|
||||||
-- Port 1: Bottom result port
|
-- Port 1: Bottom result port
|
||||||
-- Ports 3,5...: The left ports for the booleans
|
-- Ports 3,5...: The left ports for the booleans
|
||||||
-- Ports 2,4...: The right ports for the values
|
-- Ports 2,4...: The right ports for the values
|
||||||
guardIcon :: SpecialBackend b n =>
|
|
||||||
Int -> TransformableDia b n
|
|
||||||
guardIcon n = nestedGuardDia $ replicate (1 + (2 * n)) Nothing--generalGuardIcon lineCol guardLBracket mempty
|
|
||||||
|
|
||||||
nestedGuardDia :: SpecialBackend b n => [Maybe (NodeName, Icon)] -> TransformableDia b n
|
nestedGuardDia :: SpecialBackend b n => [Maybe (NodeName, Icon)] -> TransformableDia b n
|
||||||
nestedGuardDia = generalNestedGuard lineCol guardLBracket mempty
|
nestedGuardDia = generalNestedGuard lineCol guardLBracket mempty
|
||||||
|
|
||||||
-- TODO Improve design to be more than a circle.
|
-- TODO Improve design to be more than a circle.
|
||||||
caseResult :: SpecialBackend b n =>
|
caseResult :: SpecialBackend b n =>
|
||||||
SpecialQDiagram b n
|
SpecialQDiagram b n
|
||||||
caseResult = lw none $ lc caseCColor $ fc caseCColor $ circle (circleRadius * 0.7)
|
caseResult = lw none $ lc caseCColor $ fc caseCColor $ circle circleRadius
|
||||||
where
|
where
|
||||||
caseCColor = caseRhsC colorScheme
|
caseCColor = caseRhsC colorScheme
|
||||||
|
|
||||||
@ -359,16 +352,11 @@ caseC :: SpecialBackend b n =>
|
|||||||
SpecialQDiagram b n -> SpecialQDiagram b n
|
SpecialQDiagram b n -> SpecialQDiagram b n
|
||||||
caseC portDia = caseResult <> portDia
|
caseC portDia = caseResult <> portDia
|
||||||
|
|
||||||
|
|
||||||
-- | The ports of the case icon are as follows:
|
-- | The ports of the case icon are as follows:
|
||||||
-- Port 0: Top result port
|
-- Port 0: Top input port
|
||||||
-- Port 1: Bottom result port
|
-- Port 1: Bottom result port
|
||||||
-- Ports 3,5...: The left ports for the results
|
-- Ports 3,5...: The left ports for the results
|
||||||
-- Ports 2,4...: The right ports for the patterns
|
-- Ports 2,4...: The right ports for the patterns
|
||||||
caseIcon :: SpecialBackend b n =>
|
|
||||||
Int -> TransformableDia b n
|
|
||||||
caseIcon n = nestedCaseDia $ replicate (1 + (2 * n)) Nothing --generalGuardIcon (patternC colorScheme) caseC caseResult
|
|
||||||
|
|
||||||
nestedCaseDia :: SpecialBackend b n => [Maybe (NodeName, Icon)] -> TransformableDia b n
|
nestedCaseDia :: SpecialBackend b n => [Maybe (NodeName, Icon)] -> TransformableDia b n
|
||||||
nestedCaseDia = generalNestedGuard (patternC colorScheme) caseC caseResult
|
nestedCaseDia = generalNestedGuard (patternC colorScheme) caseC caseResult
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user