progress towards adding load functionality'
This commit is contained in:
@@ -355,6 +355,15 @@ struct
|
||||
|
||||
fun trianglesLoadError model = (model, NO_MAILBOX)
|
||||
|
||||
fun enterBrowseMode model =
|
||||
let
|
||||
val model = AppWith.mode (model, AppType.BROWSE_MODE)
|
||||
(* should draw modal window as well, but that's not needed right now *)
|
||||
val fileMsg = LOAD_FILES (#openFilePath model)
|
||||
in
|
||||
(model, FILE fileMsg)
|
||||
end
|
||||
|
||||
fun updateNormalMode (model: app_type, inputMsg) =
|
||||
case inputMsg of
|
||||
MOUSE_MOVE {x = mouseX, y = mouseY} =>
|
||||
@@ -370,6 +379,7 @@ struct
|
||||
| KEY_CTRL_S => getSaveTrianglesMsg model
|
||||
| KEY_CTRL_L => getLoadTrianglesMsg model
|
||||
| KEY_CTRL_E => getExportTrianglesMsg model
|
||||
| KEY_CTRL_O => enterBrowseMode model
|
||||
| ARROW_UP => moveArrowUp model
|
||||
| ARROW_LEFT => moveArrowLeft model
|
||||
| ARROW_RIGHT => moveArrowRight model
|
||||
@@ -380,5 +390,7 @@ struct
|
||||
| TRIANGLES_LOAD_ERROR => trianglesLoadError model
|
||||
|
||||
fun update (model: app_type, inputMsg) =
|
||||
case #mode model of NORMAL_MODE => updateNormalMode (model, inputMsg)
|
||||
case #mode model of
|
||||
NORMAL_MODE => updateNormalMode (model, inputMsg)
|
||||
| BROWSE_MODE => updateNormalMode (model, inputMsg)
|
||||
end
|
||||
|
||||
@@ -2,6 +2,8 @@ signature APP_WITH =
|
||||
sig
|
||||
val graphVisibility: AppType.app_type * bool -> AppType.app_type
|
||||
|
||||
val mode: AppType.app_type * AppType.app_mode -> AppType.app_type
|
||||
|
||||
val windowResize: AppType.app_type * int * int -> AppType.app_type
|
||||
|
||||
val mousePosition: AppType.app_type * Real32.real * Real32.real
|
||||
@@ -489,6 +491,48 @@ struct
|
||||
}
|
||||
end
|
||||
|
||||
fun mode (app: app_type, newMode) =
|
||||
let
|
||||
val
|
||||
{ mode = _
|
||||
, triangleStage
|
||||
, triangles
|
||||
, numClickPoints
|
||||
, xClickPoints
|
||||
, yClickPoints
|
||||
, windowWidth
|
||||
, windowHeight
|
||||
, undo
|
||||
, redo
|
||||
, mouseX
|
||||
, mouseY
|
||||
, arrowX
|
||||
, arrowY
|
||||
, showGraph
|
||||
, openFilePath
|
||||
, fileBrowser
|
||||
} = app
|
||||
in
|
||||
{ mode = newMode
|
||||
, showGraph = showGraph
|
||||
, triangleStage = triangleStage
|
||||
, triangles = triangles
|
||||
, undo = undo
|
||||
, redo = redo
|
||||
, numClickPoints = numClickPoints
|
||||
, xClickPoints = xClickPoints
|
||||
, yClickPoints = yClickPoints
|
||||
, windowWidth = windowWidth
|
||||
, windowHeight = windowHeight
|
||||
, mouseX = mouseX
|
||||
, mouseY = mouseY
|
||||
, arrowX = arrowX
|
||||
, arrowY = arrowY
|
||||
, openFilePath = openFilePath
|
||||
, fileBrowser = fileBrowser
|
||||
}
|
||||
end
|
||||
|
||||
fun useTriangles (app: app_type, triangles) =
|
||||
let
|
||||
val
|
||||
|
||||
Reference in New Issue
Block a user