progress towards being able to load files dynamically
This commit is contained in:
@@ -35,6 +35,8 @@ struct
|
||||
, showGraph = true
|
||||
, arrowX = 0
|
||||
, arrowY = 0
|
||||
, openFilePath = ""
|
||||
, fileBrowser = Vector.fromList []
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
signature APP_TYPE =
|
||||
sig
|
||||
datatype app_mode = NORMAL_MODE | SAVE_MODE
|
||||
datatype app_mode = NORMAL_MODE | BROWSE_MODE
|
||||
|
||||
datatype file_browser_item = FILE of string | FOLDER of string
|
||||
|
||||
datatype triangle_stage =
|
||||
NO_TRIANGLE
|
||||
@@ -33,12 +35,16 @@ sig
|
||||
, mouseY: Real32.real
|
||||
, arrowX: int
|
||||
, arrowY: int
|
||||
, openFilePath: string
|
||||
, fileBrowser: file_browser_item vector
|
||||
}
|
||||
end
|
||||
|
||||
structure AppType :> APP_TYPE =
|
||||
struct
|
||||
datatype app_mode = NORMAL_MODE | SAVE_MODE
|
||||
datatype app_mode = NORMAL_MODE | BROWSE_MODE
|
||||
|
||||
datatype file_browser_item = FILE of string | FOLDER of string
|
||||
|
||||
type triangle =
|
||||
{ x1: Real32.real
|
||||
@@ -79,5 +85,7 @@ struct
|
||||
, mouseY: Real32.real
|
||||
, arrowX: int
|
||||
, arrowY: int
|
||||
, openFilePath: string
|
||||
, fileBrowser: file_browser_item vector
|
||||
}
|
||||
end
|
||||
|
||||
@@ -355,7 +355,7 @@ struct
|
||||
|
||||
fun trianglesLoadError model = (model, NO_MAILBOX)
|
||||
|
||||
fun update (model: app_type, inputMsg) =
|
||||
fun updateNormalMode (model: app_type, inputMsg) =
|
||||
case inputMsg of
|
||||
MOUSE_MOVE {x = mouseX, y = mouseY} =>
|
||||
let val model = AppWith.mousePosition (model, mouseX, mouseY)
|
||||
@@ -378,4 +378,7 @@ struct
|
||||
| KEY_SPACE => enterOrSpaceCoordinates model
|
||||
| USE_TRIANGLES triangles => useTriangles (model, triangles)
|
||||
| TRIANGLES_LOAD_ERROR => trianglesLoadError model
|
||||
|
||||
fun update (model: app_type, inputMsg) =
|
||||
case #mode model of NORMAL_MODE => updateNormalMode (model, inputMsg)
|
||||
end
|
||||
|
||||
@@ -78,6 +78,8 @@ struct
|
||||
, mouseY
|
||||
, arrowX = _
|
||||
, arrowY = _
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
|
||||
val newUndo = newUndoHd :: undo
|
||||
@@ -97,6 +99,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -120,6 +124,8 @@ struct
|
||||
, mouseY
|
||||
, arrowX = _
|
||||
, arrowY = _
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
|
||||
val newTriangle = {x1 = x1, y1 = y1, x2 = x2, y2 = y2, x3 = x3, y3 = y3}
|
||||
@@ -141,6 +147,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -162,6 +170,8 @@ struct
|
||||
, mouseY
|
||||
, arrowX = _
|
||||
, arrowY
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
in
|
||||
{ mode = mode
|
||||
@@ -179,6 +189,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -200,6 +212,8 @@ struct
|
||||
, mouseY
|
||||
, arrowX
|
||||
, arrowY = _
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
in
|
||||
{ mode = mode
|
||||
@@ -217,6 +231,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -240,6 +256,8 @@ struct
|
||||
, mouseY
|
||||
, arrowX
|
||||
, arrowY
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
|
||||
val xClickPoints = ClickPoints.generate (wStart, wFinish, numClickPoints)
|
||||
@@ -260,6 +278,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -304,6 +324,8 @@ struct
|
||||
, showGraph
|
||||
, arrowX
|
||||
, arrowY
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
in
|
||||
{ mode = mode
|
||||
@@ -321,6 +343,8 @@ struct
|
||||
, showGraph = showGraph
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -343,6 +367,8 @@ struct
|
||||
, mouseY
|
||||
, arrowX
|
||||
, arrowY
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
|
||||
val newUndo =
|
||||
@@ -367,6 +393,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -389,6 +417,8 @@ struct
|
||||
, mouseY
|
||||
, arrowX
|
||||
, arrowY
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
|
||||
val newUndo = newUndoHd :: undo
|
||||
@@ -412,6 +442,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -433,6 +465,8 @@ struct
|
||||
, arrowX
|
||||
, arrowY
|
||||
, showGraph = _
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
in
|
||||
{ mode = mode
|
||||
@@ -450,6 +484,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
@@ -471,6 +507,8 @@ struct
|
||||
, arrowY
|
||||
, triangles = _
|
||||
, triangleStage = _
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
|
||||
val triangleStage = NO_TRIANGLE
|
||||
@@ -490,6 +528,8 @@ struct
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user