diff --git a/Makefile b/Makefile index b0776566f..8be7c0de7 100644 --- a/Makefile +++ b/Makefile @@ -15,14 +15,14 @@ SCRIPTSSOURCE = $(wildcard $(MANSCRIPTREP)*.sh) SCRIPTSWITNESS = $(SCRIPTSSOURCE:.sh=.witness) $(MANGENREP)version.tex MODELS = $(wildcard $(MANKAPPAMODELSREP)*.ka) -RESOURCES_HTML=$(wildcard gui/shared/*.js) $(wildcard gui/viz/*.js) $(wildcard gui/viz/*.css) gui/favicon.ico gui/package.json +RESOURCES_HTML=$(wildcard gui/js_lib/*.js) $(wildcard gui/js_lib/viz/*.js) $(wildcard gui/resources/*.css) gui/resources/favicon.ico gui/entry_point/package.json gui/entry_point/main.js # `APP_EXT` defines where to fetch the js libs. # `local` is to download them from the dev website e.g. github and saving them locally. # `cdn` uses `cdnjs.cloudfare.com` to fetch the libs # `debian` and `deploy` are also available APP_EXT?=cdn -INDEX_HTML=gui/use-$(APP_EXT).html +INDEX_HTML=gui/entry_point/use-$(APP_EXT).html ifeq ($(APP_EXT),local) SITE_EXTRAS= build/site/external build/site/external/bootstrap-$(BOOTSTRAP_VERSION)-dist build/site/external/codemirror-$(CODEMIRROR_VERSION) build/site/external/dagre-d3 build/site/external/d3 build/site/external/jquery else @@ -232,12 +232,12 @@ Kappapp.app: +$(MAKE) clean +$(MAKE) build/Kappapp.app -build/Info.plist: gui/Info.plist.skel $(wildcard .git/refs/heads/*) +build/Info.plist: gui/resources/Info.plist.skel $(wildcard .git/refs/heads/*) mkdir -p build sed -e s/'\(.*\)\".*tag: \([^,\"]*\)[,\"].*/\1\"\2\"'/g $< | \ sed -e 's/\$$Format:%D\$$'/"$$(git describe --always --dirty || echo unkown)"/ > $@ -build/Kappa.iconset: gui/Kappa-Logo.png +build/Kappa.iconset: gui/resources/Kappa-Logo.png mkdir -p build rm -rf $@ && mkdir $@ sips -z 16 16 $< --out $@/icon_16x16.png diff --git a/core/simulation/dune b/core/simulation/dune index 5a0efe983..4b76e3451 100644 --- a/core/simulation/dune +++ b/core/simulation/dune @@ -19,8 +19,8 @@ (targets resource_strings.ml) (deps ../../dev/load_files_into_ocaml_string_vars.sh - ../../gui/shared/flux.js - ../../gui/viz/common.js) + ../../gui/js_lib/flux.js + ../../gui/js_lib/viz/common.js) (action (with-stdout-to %{targets} diff --git a/gui/JsSim.ml b/gui/JsSim.ml index 1a6ba6d21..1faf32360 100644 --- a/gui/JsSim.ml +++ b/gui/JsSim.ml @@ -12,22 +12,22 @@ let onload (_ : 'a) : bool Js.t = let () = Dom.appendChild main (Tyxml_js.To_dom.of_div (Panel_projects.content ())) in - let () = Dom.appendChild main (Panel_tab.navtabs ()) in - let () = Dom.appendChild main (Panel_tab.navcontents ()) in + let () = Dom.appendChild main (Panel_tabs.navtabs ()) in + let () = Dom.appendChild main (Panel_tabs.navcontents ()) in let () = - Dom.appendChild main (Tyxml_js.To_dom.of_div (Panel_settings.content ())) + Dom.appendChild main (Tyxml_js.To_dom.of_div (Panel_preferences.content ())) in let () = Panel_projects.onload () in - let () = Panel_tab.onload () in - let () = Panel_settings.onload () in + let () = Panel_tabs.onload () in + let () = Panel_preferences.onload () in let _ = Dom_html.window##.onresize := Dom_html.handler (fun _ -> let () = Panel_projects.onresize () in - let () = Panel_tab.onresize () in - let () = Panel_settings.onresize () in + let () = Panel_tabs.onresize () in + let () = Panel_preferences.onresize () in Js._true) in Js._true diff --git a/gui/README.md b/gui/README.md index 1adcd8100..7d7c02cc2 100644 --- a/gui/README.md +++ b/gui/README.md @@ -1,34 +1,46 @@ -In this dir is the code for the webapp and electron app +In this dir is the code for the _Kappapp_ webapp and electron app! -`.ml` files starting by a capital, as `KaSimWorker.ml` are executable files. +### Directory structure -TODO: revamp this as it's really imprecise and incomplete -`viz/main.js` contains the code for the main electron process -`runtime_processes.ml` setups the manager and runs the local subprocesses on electron -`JsSim.ml` defines the window DOM and its different components - - Panel_tab contains all tabs from a project, other panels manages settings, projects... - - tabs are the tabs of different tools in a given project, some are in fact subtabs in the right hand side of the editor, which is called subpanel_editor -- state_* files manages in part the logic in the given app parts +The `.ml` files in this directory , as `KaSimWorker.ml` are executable files, as indicated by their capitalization. +`JsSim.ml` defines the main executable, with the window DOM and its different components, +while the other are the different workers that can be ran as webworkers/threads in the app. -`secret_method_name` indicate a method that should be called only by inherited classes. However this was not respected thoroughly so it has not be replaced -by `inherit parent as super ... super#private_method` which fills this need in the language +`ui` contains the different panels and tabs making the interface, along with their logic. The logic tries to match in limited fashion the view and controller roles in a Control/Model/View architecture (controller for controller_* files in `ui/tab_editor`) -`_mpi` indicates the message passing interface of the different processes and web workers (threads) used +Files in `state` manages state logic from different app part, similar to a `model` in a Control/Model/View architecture. + +`entry_point` contains the entry point info for the html main page of the webapp and electron app config + +`lib`, `lib_no_jsoo`, `js_lib` contain libs used by the webapp. Those in `lib_no_jsoo` do not depend on js_of_ocaml. Libs in `js_lib` are written in javascript`, while the other are in ocaml. + +`resources` contains resources used to build the webapp and electron app. ### Runtime The app is divided in : - the interface - the agents: kasim, kamoha, kasa, kastor. Which are handling respectively the simulation, the project files, the static analysis, the analysis of traces and computation of stories -There are two different runtimes for the agents (see `state_runtime.ml`) : -- webworkers/threads for the agents (`runtime_web_workers.ml`). +There are two different runtimes for the agents (see `state/state_runtime.ml`) : +- webworkers/threads for the agents (`state/runtime_web_workers.ml`). This is the mode ran in the browser. The app uses a matching client to communicate with each thread e.g. `kasa_client` which are writing _messages_ to the agents. The threads are spawned as _workers_ e.g. `KaSaWorker`, which use the _message passing interface_ logic e.g. `kasa_mpi`, which parses the messages and compute what is asked by the clients. There is a special case for the kasim agent. There is an `KaSimAsEmbedded` option that run it in the main thread and not in a separated web worker thread. The logic for the agent is then not in the `_mpi` but in `kasim_runtime` as it is used in both the _worker_ and in the main thread. Mode with kasim in a separated thread is called `KasimAsWebWorker` -- processes for the agents (`runtime_processes.ml`) +- processes for the agents (`state/runtime_processes.ml`) This is the mode ran in the electron app. The app uses clients to communicate with agent processes. Agents processes are defined in `core/agent` with a name starting with a capital letter. `mpi` files are in in different directories of `core` . Kamoha agent and kastor agent have names that doesn't end in agent, which can be misleading. (TODO: change this?) The app here spawns two processes, Kastor and KappaSwitchman. The KappaSwitchman one then spawns the other agents and manages the communication between them and the app. Kastor is not included with the others as it can be communicated to in raw, and it doesn't have an internal state. +### Misc notes + +This code uses js_of_ocaml, the React lib for reactive programming, and lwt. +Some changes in the code might cause parts of the code to not be called. This happens even with the removal of the dead code elimination in js_of_ocaml. A way to fix these issues is to use the Hooked lib in `lib_no_jsoo`, that is meant to replace the React lib with hooks, which don't have this issue. Replacing `React` by `Hooked` in place, and converting the signals to Hooked and back should help if this issue arise again. +Feel free to add an implementation for needed `React` functions that are not yet implemented in `lib_no_jsoo/hooked.ml`. + +`secret_method_name` indicate a method that should be called only by inherited classes. However this was not respected thoroughly so it has not be replaced +by `inherit parent as super ... super#private_method` which fills this need in the language + +`_mpi` indicates the message passing interface of the different processes and web workers (threads) used + diff --git a/gui/dune_js_of_ocaml_flags.inc b/gui/dune_js_of_ocaml_flags.inc deleted file mode 100644 index 668106426..000000000 --- a/gui/dune_js_of_ocaml_flags.inc +++ /dev/null @@ -1,12 +0,0 @@ -; Windows build only has access to 4.0.0, where --disable flags don't exist yet in jsoo -; TODO: better distinguish this, as this should depend on jsoo version and not OS - -(rule - (with-stdout-to - js_of_ocaml_flags.Unix - (echo "(:standard --disable globaldeadcode --disable deadcode)"))) - -(rule - (with-stdout-to - js_of_ocaml_flags.Win32 - (echo ":standard"))) diff --git a/gui/entry_point/README.md b/gui/entry_point/README.md new file mode 100644 index 000000000..6b0dc41c6 --- /dev/null +++ b/gui/entry_point/README.md @@ -0,0 +1 @@ +`entry_point` contains the entry point info for the html main page of the webapp and electron app config diff --git a/gui/viz/main.js b/gui/entry_point/main.js similarity index 100% rename from gui/viz/main.js rename to gui/entry_point/main.js diff --git a/gui/package.json b/gui/entry_point/package.json similarity index 100% rename from gui/package.json rename to gui/entry_point/package.json diff --git a/gui/use-cdn.html b/gui/entry_point/use-cdn.html similarity index 100% rename from gui/use-cdn.html rename to gui/entry_point/use-cdn.html diff --git a/gui/use-debian.html b/gui/entry_point/use-debian.html similarity index 100% rename from gui/use-debian.html rename to gui/entry_point/use-debian.html diff --git a/gui/use-deploy.html b/gui/entry_point/use-deploy.html similarity index 100% rename from gui/use-deploy.html rename to gui/entry_point/use-deploy.html diff --git a/gui/use-local.html b/gui/entry_point/use-local.html similarity index 100% rename from gui/use-local.html rename to gui/entry_point/use-local.html diff --git a/gui/js_lib/README.md b/gui/js_lib/README.md new file mode 100644 index 000000000..09d3acc12 --- /dev/null +++ b/gui/js_lib/README.md @@ -0,0 +1,9 @@ +This directory contains javascript libraries. + +`viz` contains js libs for vizualization from kappa tools. + +`flux.js` is used by the webapp, and by the html generation in ./core/simulation + +`graphlogger.js` by the webapp. + +`parser.js` might be unused. diff --git a/gui/shared/flux.js b/gui/js_lib/flux.js similarity index 100% rename from gui/shared/flux.js rename to gui/js_lib/flux.js diff --git a/gui/shared/graphlogger.js b/gui/js_lib/graphlogger.js similarity index 100% rename from gui/shared/graphlogger.js rename to gui/js_lib/graphlogger.js diff --git a/gui/shared/parser.js b/gui/js_lib/parser.js similarity index 100% rename from gui/shared/parser.js rename to gui/js_lib/parser.js diff --git a/gui/viz/CONTRIBUTING.md b/gui/js_lib/viz/CONTRIBUTING.md similarity index 100% rename from gui/viz/CONTRIBUTING.md rename to gui/js_lib/viz/CONTRIBUTING.md diff --git a/gui/viz/Kappa.js b/gui/js_lib/viz/Kappa.js similarity index 100% rename from gui/viz/Kappa.js rename to gui/js_lib/viz/Kappa.js diff --git a/gui/js_lib/viz/README.md b/gui/js_lib/viz/README.md new file mode 100644 index 000000000..95884894f --- /dev/null +++ b/gui/js_lib/viz/README.md @@ -0,0 +1,7 @@ +This directory contains js libs for vizualization from kappa tools. + +Some files here are used in the webapp. + +`common.js` is also included by the html generation in `core/simulation` + +`Kappa.js` might be unused, and includes info for kappa language syntax highlighting. diff --git a/gui/viz/class.js b/gui/js_lib/viz/class.js similarity index 100% rename from gui/viz/class.js rename to gui/js_lib/viz/class.js diff --git a/gui/viz/common.js b/gui/js_lib/viz/common.js similarity index 100% rename from gui/viz/common.js rename to gui/js_lib/viz/common.js diff --git a/gui/viz/index.html b/gui/js_lib/viz/index.html similarity index 100% rename from gui/viz/index.html rename to gui/js_lib/viz/index.html diff --git a/gui/viz/plot.js b/gui/js_lib/viz/plot.js similarity index 100% rename from gui/viz/plot.js rename to gui/js_lib/viz/plot.js diff --git a/gui/viz/render-contactmap.js b/gui/js_lib/viz/render-contactmap.js similarity index 100% rename from gui/viz/render-contactmap.js rename to gui/js_lib/viz/render-contactmap.js diff --git a/gui/viz/render-dummy.js b/gui/js_lib/viz/render-dummy.js similarity index 100% rename from gui/viz/render-dummy.js rename to gui/js_lib/viz/render-dummy.js diff --git a/gui/viz/render-snapshot.js b/gui/js_lib/viz/render-snapshot.js similarity index 100% rename from gui/viz/render-snapshot.js rename to gui/js_lib/viz/render-snapshot.js diff --git a/gui/viz/render-story.js b/gui/js_lib/viz/render-story.js similarity index 100% rename from gui/viz/render-story.js rename to gui/js_lib/viz/render-story.js diff --git a/gui/viz/tooltip-contactmap.js b/gui/js_lib/viz/tooltip-contactmap.js similarity index 100% rename from gui/viz/tooltip-contactmap.js rename to gui/js_lib/viz/tooltip-contactmap.js diff --git a/gui/viz/tooltip-snapshot.js b/gui/js_lib/viz/tooltip-snapshot.js similarity index 100% rename from gui/viz/tooltip-snapshot.js rename to gui/js_lib/viz/tooltip-snapshot.js diff --git a/gui/viz/utils.js b/gui/js_lib/viz/utils.js similarity index 100% rename from gui/viz/utils.js rename to gui/js_lib/viz/utils.js diff --git a/gui/lib/dune b/gui/lib/dune index 7b17cbfd7..4c8027d3d 100644 --- a/gui/lib/dune +++ b/gui/lib/dune @@ -11,7 +11,7 @@ lwt_react js_of_ocaml-tyxml ppx_inline_test - kappa_webapp_lib_no_js + kappa_webapp_lib_no_jsoo kappa_parameters kappa_kasa_type_interface) (flags :standard -w +a diff --git a/gui/lib/hooked.ml b/gui/lib/hooked.ml index 12b4d37ba..52ffe8b93 100644 --- a/gui/lib/hooked.ml +++ b/gui/lib/hooked.ml @@ -1,11 +1,11 @@ -module DebugPrint : Kappa_webapp_lib_no_js.Hooked.DebugPrint = struct +module DebugPrint : Kappa_webapp_lib_no_jsoo.Hooked.DebugPrint = struct let debug_print s = let () = Common.debug ~loc:__LOC__ s in () end -module S = Kappa_webapp_lib_no_js.Hooked.MakeS (DebugPrint) -module E = Kappa_webapp_lib_no_js.Hooked.MakeE (DebugPrint) +module S = Kappa_webapp_lib_no_jsoo.Hooked.MakeS (DebugPrint) +module E = Kappa_webapp_lib_no_jsoo.Hooked.MakeE (DebugPrint) type 'a signal = 'a S.t type 'a event = 'a E.t diff --git a/gui/lib/hooked.mli b/gui/lib/hooked.mli index 3f723c571..3d84a2cb4 100644 --- a/gui/lib/hooked.mli +++ b/gui/lib/hooked.mli @@ -1,6 +1,6 @@ -module DebugPrint : Kappa_webapp_lib_no_js.Hooked.DebugPrint -module S : Kappa_webapp_lib_no_js.Hooked.S -module E : Kappa_webapp_lib_no_js.Hooked.E +module DebugPrint : Kappa_webapp_lib_no_jsoo.Hooked.DebugPrint +module S : Kappa_webapp_lib_no_jsoo.Hooked.S +module E : Kappa_webapp_lib_no_jsoo.Hooked.E type 'a signal = 'a S.t type 'a event = 'a E.t diff --git a/gui/lib/utility.ml b/gui/lib/html_utility.ml similarity index 100% rename from gui/lib/utility.ml rename to gui/lib/html_utility.ml diff --git a/gui/lib/utility.mli b/gui/lib/html_utility.mli similarity index 100% rename from gui/lib/utility.mli rename to gui/lib/html_utility.mli diff --git a/gui/lib_no_jsoo/README.md b/gui/lib_no_jsoo/README.md new file mode 100644 index 000000000..fdb3e1159 --- /dev/null +++ b/gui/lib_no_jsoo/README.md @@ -0,0 +1,3 @@ +Here are libs used by the webapp that don't use js_of_ocaml. + +This allows to use ppx_inline_test on them. diff --git a/gui/lib_no_js/dune b/gui/lib_no_jsoo/dune similarity index 84% rename from gui/lib_no_js/dune rename to gui/lib_no_jsoo/dune index 6db38fee5..cc7f5dda0 100644 --- a/gui/lib_no_js/dune +++ b/gui/lib_no_jsoo/dune @@ -1,5 +1,5 @@ (library - (name kappa_webapp_lib_no_js) + (name kappa_webapp_lib_no_jsoo) (inline_tests) (preprocess (pps diff --git a/gui/lib_no_js/hooked.ml b/gui/lib_no_jsoo/hooked.ml similarity index 100% rename from gui/lib_no_js/hooked.ml rename to gui/lib_no_jsoo/hooked.ml diff --git a/gui/lib_no_js/hooked.mli b/gui/lib_no_jsoo/hooked.mli similarity index 100% rename from gui/lib_no_js/hooked.mli rename to gui/lib_no_jsoo/hooked.mli diff --git a/gui/Info.plist.skel b/gui/resources/Info.plist.skel similarity index 100% rename from gui/Info.plist.skel rename to gui/resources/Info.plist.skel diff --git a/gui/viz/JsSim.css b/gui/resources/JsSim.css similarity index 100% rename from gui/viz/JsSim.css rename to gui/resources/JsSim.css diff --git a/gui/Kappa-Logo.png b/gui/resources/Kappa-Logo.png similarity index 100% rename from gui/Kappa-Logo.png rename to gui/resources/Kappa-Logo.png diff --git a/gui/resources/README.md b/gui/resources/README.md new file mode 100644 index 000000000..dad038c4f --- /dev/null +++ b/gui/resources/README.md @@ -0,0 +1 @@ +Here are resources used to build the webapp diff --git a/gui/favicon.ico b/gui/resources/favicon.ico similarity index 100% rename from gui/favicon.ico rename to gui/resources/favicon.ico diff --git a/gui/shared/README.md b/gui/shared/README.md deleted file mode 100644 index 930bc6dfd..000000000 --- a/gui/shared/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains javascript code both used by -- the webapp ./gui -- html generation in ./core/simulation diff --git a/gui/state/README.md b/gui/state/README.md new file mode 100644 index 000000000..cb9ed14fc --- /dev/null +++ b/gui/state/README.md @@ -0,0 +1,13 @@ +Files in `state` manages state logic from different app part, similar to a `model` in a Control/Model/View architecture. + +`state_error.ml` manages errors at the webapp level + +`state_ui.ml` call _init_ and _sync_ for `state_*` files + +`state_file.ml` mainly manages editor & kasa stuff, but is accessed too from settings, state_ui + +`state_perturbation.ml` manages simulation perturbations, only used from panel preferences + +`state_runtime.ml` defines worker runtime, used from other `states_*` + preferences + projects controller + +`state_simulation.ml` sets simulation controls and functions to interact with simulation data diff --git a/gui/state/dune b/gui/state/dune index 3560d86ae..a0770bc27 100644 --- a/gui/state/dune +++ b/gui/state/dune @@ -1,5 +1,3 @@ -(include ../dune_js_of_ocaml_flags.inc) - (library (name kappa_webapp_state) (libraries diff --git a/gui/state/state_settings.ml b/gui/state/state_preferences.ml similarity index 100% rename from gui/state/state_settings.ml rename to gui/state/state_preferences.ml diff --git a/gui/state/state_settings.mli b/gui/state/state_preferences.mli similarity index 100% rename from gui/state/state_settings.mli rename to gui/state/state_preferences.mli diff --git a/gui/state/state_ui.ml b/gui/state/state_ui.ml index 8fbd216f7..60f7263c0 100644 --- a/gui/state/state_ui.ml +++ b/gui/state/state_ui.ml @@ -9,12 +9,12 @@ open Lwt.Infix let sync () : unit Lwt.t = - State_settings.sync () >>= State_runtime.sync >>= State_project.sync + State_preferences.sync () >>= State_runtime.sync >>= State_project.sync >>= fun _ -> State_file.sync () >>= fun _ -> Lwt.return_unit let init () : unit Lwt.t = - Lwt.return_unit >>= State_settings.init >>= State_runtime.init + Lwt.return_unit >>= State_preferences.init >>= State_runtime.init >>= State_project.init >>= State_file.init >>= State_simulation.init >>= sync let onload () : unit = Common.async __LOC__ (fun () -> Lwt.return_unit >>= init) diff --git a/gui/ui/dune b/gui/ui/dune index bca4651b4..41c013019 100644 --- a/gui/ui/dune +++ b/gui/ui/dune @@ -1,4 +1,4 @@ -(include ../dune_js_of_ocaml_flags.inc) +(include_subdirs unqualified) (library (name kappa_webapp_ui) diff --git a/gui/ui/panel_settings.ml b/gui/ui/panel_preferences.ml similarity index 95% rename from gui/ui/panel_settings.ml rename to gui/ui/panel_preferences.ml index 9f92a80e6..c8f8c02da 100644 --- a/gui/ui/panel_settings.ml +++ b/gui/ui/panel_preferences.ml @@ -23,7 +23,7 @@ let visible_on_states ?(a_class = []) a_class @ hidden_class)) module FormPerturbation : Ui_common.Div = struct - let id = "panel_settings_perturbation" + let id = "panel_preferences_perturbation" let input = Html.input @@ -71,7 +71,7 @@ module FormPerturbation : Ui_common.Div = struct let () = form_dom##.onsubmit := Dom.handler (fun _ -> - let () = Panel_settings_controller.intervene_simulation () in + let () = Panel_preferences_controller.intervene_simulation () in Js._false) in let () = input_dom##.onchange := Dom.handler handler in @@ -85,7 +85,7 @@ let signal_change input_dom signal_handler = Js._true) module InputPauseCondition : Ui_common.Div = struct - let id = "panel_settings_pause_condition" + let id = "panel_preferences_pause_condition" let input = Html.input @@ -121,7 +121,7 @@ module InputPauseCondition : Ui_common.Div = struct end module InputPlotPeriod : Ui_common.Div = struct - let id = "panel_settings_plot_period" + let id = "panel_preferences_plot_period" let format_float_string value = let n = string_of_float value in @@ -175,9 +175,9 @@ end module DivErrorMessage : Ui_common.Div = struct let id = "configuration_error_div" - let message_nav_inc_id = "panel_settings_message_nav_inc_id" - let message_nav_dec_id = "panel_settings_message_nav_dec_id" - let message_file_label_id = "panel_settings_message_file_label" + let message_nav_inc_id = "panel_preferences_message_nav_inc_id" + let message_nav_dec_id = "panel_preferences_message_nav_dec_id" + let message_file_label_id = "panel_preferences_message_file_label" let error_index, error_index_set = Hooked.S.create ~debug:"error_index" None let () = @@ -303,7 +303,7 @@ module DivErrorMessage : Ui_common.Div = struct Dom.handler (fun _ -> let () = Common.debug ~loc:__LOC__ - (Js.string "[Panel_settings] clicked file_click_handler") + (Js.string "[Panel_preferences] clicked file_click_handler") in let message : Api_types_t.message option = get_message @@ -317,7 +317,7 @@ module DivErrorMessage : Ui_common.Div = struct in let () = match range with - | Some range -> Panel_settings_controller.focus_range range + | Some range -> Panel_preferences_controller.focus_range range | None -> () in Js._true) @@ -330,7 +330,7 @@ module DivErrorMessage : Ui_common.Div = struct Dom.handler (fun _ -> let () = Common.debug ~loc:__LOC__ - (Js.string "[Panel_settings] clicked index_click_handler") + (Js.string "[Panel_preferences] clicked index_click_handler") in let index : int option = sanitize_index @@ -364,7 +364,7 @@ module DivErrorMessage : Ui_common.Div = struct end module ButtonStart : Ui_common.Div = struct - let id = "panel_settings_start_button" + let id = "panel_preferences_start_button" let button = Html.button @@ -393,7 +393,7 @@ module ButtonStart : Ui_common.Div = struct let () = start_button_dom##.onclick := Dom.handler (fun _ -> - let () = Panel_settings_controller.start_simulation () in + let () = Panel_preferences_controller.start_simulation () in Js._true) in @@ -401,7 +401,7 @@ module ButtonStart : Ui_common.Div = struct end module ButtonClear : Ui_common.Div = struct - let id = "panel_settings_clear_button" + let id = "panel_preferences_clear_button" let button = Html.button @@ -420,14 +420,14 @@ module ButtonClear : Ui_common.Div = struct let () = dom##.onclick := Dom.handler (fun _ -> - let () = Panel_settings_controller.stop_simulation () in + let () = Panel_preferences_controller.stop_simulation () in Js._true) in () end module ButtonPause : Ui_common.Div = struct - let id = "panel_settings_pause_button" + let id = "panel_preferences_pause_button" let button = Html.button @@ -446,14 +446,14 @@ module ButtonPause : Ui_common.Div = struct let () = button_dom##.onclick := Dom.handler (fun _ -> - let () = Panel_settings_controller.pause_simulation () in + let () = Panel_preferences_controller.pause_simulation () in Js._true) in () end module ButtonTrace : Ui_common.Div = struct - let id = "panel_settings_get_trace_button" + let id = "panel_preferences_get_trace_button" let button = Html.button @@ -483,14 +483,14 @@ module ButtonTrace : Ui_common.Div = struct let () = button_dom##.onclick := Dom.handler (fun _ -> - let () = Panel_settings_controller.simulation_trace () in + let () = Panel_preferences_controller.simulation_trace () in Js._true) in () end module ButtonOutputs : Ui_common.Div = struct - let id = "panel_settings_outputs_button" + let id = "panel_preferences_outputs_button" let button = Html.button @@ -509,14 +509,14 @@ module ButtonOutputs : Ui_common.Div = struct let () = button_dom##.onclick := Dom.handler (fun _ -> - let () = Panel_settings_controller.simulation_outputs () in + let () = Panel_preferences_controller.simulation_outputs () in Js._true) in () end module ButtonContinue : Ui_common.Div = struct - let id = "panel_settings_continue_button" + let id = "panel_preferences_continue_button" let button = Html.button @@ -535,7 +535,7 @@ module ButtonContinue : Ui_common.Div = struct let () = button_dom##.onclick := Dom.handler (fun _ -> - let () = Panel_settings_controller.continue_simulation () in + let () = Panel_preferences_controller.continue_simulation () in Js._true) in () diff --git a/gui/ui/panel_settings.mli b/gui/ui/panel_preferences.mli similarity index 100% rename from gui/ui/panel_settings.mli rename to gui/ui/panel_preferences.mli diff --git a/gui/ui/panel_settings_controller.ml b/gui/ui/panel_preferences_controller.ml similarity index 100% rename from gui/ui/panel_settings_controller.ml rename to gui/ui/panel_preferences_controller.ml diff --git a/gui/ui/panel_settings_controller.mli b/gui/ui/panel_preferences_controller.mli similarity index 100% rename from gui/ui/panel_settings_controller.mli rename to gui/ui/panel_preferences_controller.mli diff --git a/gui/ui/modal_preferences.ml b/gui/ui/panel_preferences_modal.ml similarity index 97% rename from gui/ui/modal_preferences.ml rename to gui/ui/panel_preferences_modal.ml index 40522de2e..b37d9378b 100644 --- a/gui/ui/modal_preferences.ml +++ b/gui/ui/panel_preferences_modal.ml @@ -205,7 +205,7 @@ let set_action () = let set_and_save_action () = set_action (); - State_settings.set_parameters_as_default (); + State_preferences.set_parameters_as_default (); State_project.set_parameters_as_default () let onload () = @@ -252,12 +252,12 @@ let onload () = Js._false); - let () = State_settings.updateFontSize ~delta:0. in + let () = State_preferences.updateFontSize ~delta:0. in (Tyxml_js.To_dom.of_button increase_font)##.onclick := Dom_html.handler (fun _ -> - let () = State_settings.updateFontSize ~delta:0.2 in + let () = State_preferences.updateFontSize ~delta:0.2 in Js._false); (Tyxml_js.To_dom.of_button decrease_font)##.onclick := Dom_html.handler (fun _ -> - let () = State_settings.updateFontSize ~delta:(-0.2) in + let () = State_preferences.updateFontSize ~delta:(-0.2) in Js._false) diff --git a/gui/ui/modal_preferences.mli b/gui/ui/panel_preferences_modal.mli similarity index 100% rename from gui/ui/modal_preferences.mli rename to gui/ui/panel_preferences_modal.mli diff --git a/gui/ui/panel_projects.ml b/gui/ui/panel_projects.ml index 88c09a66a..08963f401 100644 --- a/gui/ui/panel_projects.ml +++ b/gui/ui/panel_projects.ml @@ -22,7 +22,7 @@ let project_id_input = () let li_new = Html.li [ Html.a [ Html.cdata "New project" ] ] -let li_prefs = Html.li (Modal_preferences.content ()) +let li_prefs = Html.li (Panel_preferences_modal.content ()) let project_id_input_dom = Tyxml_js.To_dom.of_input project_id_input let content () = @@ -121,7 +121,7 @@ let content () = ] let onload () = - let () = Modal_preferences.onload () in + let () = Panel_preferences_modal.onload () in let () = Common.jquery_on ("#" ^ project_id_modal_id) diff --git a/gui/ui/panel_tab.ml b/gui/ui/panel_tabs/panel_tabs.ml similarity index 93% rename from gui/ui/panel_tab.ml rename to gui/ui/panel_tabs/panel_tabs.ml index 0d8354483..afd366633 100644 --- a/gui/ui/panel_tab.ml +++ b/gui/ui/panel_tabs/panel_tabs.ml @@ -25,7 +25,7 @@ let navtabs () = "editor", None, Tab_editor.navli (); "log", None, Tab_log.navli (); "plot", None, Tab_plot.navli (); - "DIN", None, Tab_flux.navli (); + "DIN", None, Tab_din.navli (); "snapshot", None, Tab_snapshot.navli (); "outputs", None, Tab_outputs.navli (); "stories", story_class, Tab_stories.navli (); @@ -41,7 +41,7 @@ let navcontents () = "editor", [ "row" ], Tab_editor.content (); "log", [], Tab_log.content (); "plot", [], Tab_plot.content (); - "DIN", [], Tab_flux.content (); + "DIN", [], Tab_din.content (); "snapshot", [], Tab_snapshot.content (); "outputs", [], Tab_outputs.content (); "stories", [ "row" ], Tab_stories.content (); @@ -52,7 +52,7 @@ let onload () = let () = Tab_editor.onload () in let () = Tab_log.onload () in let () = Tab_plot.onload () in - let () = Tab_flux.onload () in + let () = Tab_din.onload () in let () = Tab_snapshot.onload () in let () = Tab_outputs.onload () in let () = Tab_stories.onload () in @@ -63,7 +63,7 @@ let onresize () = let () = Tab_editor.onresize () in let () = Tab_log.onresize () in let () = Tab_plot.onresize () in - let () = Tab_flux.onresize () in + let () = Tab_din.onresize () in let () = Tab_snapshot.onresize () in let () = Tab_outputs.onresize () in let () = Tab_stories.onresize () in diff --git a/gui/ui/panel_tab.mli b/gui/ui/panel_tabs/panel_tabs.mli similarity index 100% rename from gui/ui/panel_tab.mli rename to gui/ui/panel_tabs/panel_tabs.mli diff --git a/gui/ui/tab_about.ml b/gui/ui/panel_tabs/tab_about.ml similarity index 100% rename from gui/ui/tab_about.ml rename to gui/ui/panel_tabs/tab_about.ml diff --git a/gui/ui/tab_about.mli b/gui/ui/panel_tabs/tab_about.mli similarity index 100% rename from gui/ui/tab_about.mli rename to gui/ui/panel_tabs/tab_about.mli diff --git a/gui/ui/tab_flux.ml b/gui/ui/panel_tabs/tab_din.ml similarity index 99% rename from gui/ui/tab_flux.ml rename to gui/ui/panel_tabs/tab_din.ml index 425e235d2..31bb2febf 100644 --- a/gui/ui/tab_flux.ml +++ b/gui/ui/panel_tabs/tab_din.ml @@ -179,7 +179,7 @@ let content () : [> Html_types.div ] Html.elt list = ] let navli () : [> `PCDATA | `Span ] Html.elt ReactiveData.RList.t = - Ui_react_sim_status.badge (fun state -> + Ui_track_sim_status.badge (fun state -> match state with | None -> 0 | Some state -> diff --git a/gui/ui/tab_editor.mli b/gui/ui/panel_tabs/tab_din.mli similarity index 100% rename from gui/ui/tab_editor.mli rename to gui/ui/panel_tabs/tab_din.mli diff --git a/gui/ui/subpanel_editor.ml b/gui/ui/panel_tabs/tab_editor/editor.ml similarity index 97% rename from gui/ui/subpanel_editor.ml rename to gui/ui/panel_tabs/tab_editor/editor.ml index a1f07a74f..f3329eab7 100644 --- a/gui/ui/subpanel_editor.ml +++ b/gui/ui/panel_tabs/tab_editor/editor.ml @@ -40,7 +40,7 @@ let panel_heading = [ Html.a_class [ "btn-group" ]; Html.Unsafe.string_attrib "role" "group"; ] - Menu_editor_file.content + Editor_menu_file.content in let buttons = menu_editor_file_content :: [ toggle_button ] in [%html @@ -134,7 +134,7 @@ let jump_to_line (codemirror : codemirror Js.t) (line : int) : unit = () let onload () : unit = - let () = Menu_editor_file.onload () in + let () = Editor_menu_file.onload () in let lint_config = Codemirror.create_lint_configuration () in let () = @@ -165,7 +165,7 @@ let onload () : unit = in let () = codemirror##setValue (Js.string "") in let () = - Subpanel_editor_controller.with_file + Editor_controller.with_file (Result_util.fold ~ok:(fun (content, id) -> let () = set_filename (Some id) in @@ -177,7 +177,7 @@ let onload () : unit = in let () = Codemirror.commands##.save := - fun _ -> Menu_editor_file_controller.export_current_file () + fun _ -> Editor_menu_file_controller.export_current_file () in let timeout : Dom_html.timeout_id option ref = ref None in let handler codemirror change = @@ -199,7 +199,7 @@ let onload () : unit = match React.S.value filename with | None -> () | Some filename -> - Subpanel_editor_controller.set_content ~filename + Editor_controller.set_content ~filename ~filecontent:(Js.to_string codemirror##getValue) in let () = diff --git a/gui/ui/subpanel_editor.mli b/gui/ui/panel_tabs/tab_editor/editor.mli similarity index 100% rename from gui/ui/subpanel_editor.mli rename to gui/ui/panel_tabs/tab_editor/editor.mli diff --git a/gui/ui/subpanel_editor_controller.ml b/gui/ui/panel_tabs/tab_editor/editor_controller.ml similarity index 100% rename from gui/ui/subpanel_editor_controller.ml rename to gui/ui/panel_tabs/tab_editor/editor_controller.ml diff --git a/gui/ui/subpanel_editor_controller.mli b/gui/ui/panel_tabs/tab_editor/editor_controller.mli similarity index 100% rename from gui/ui/subpanel_editor_controller.mli rename to gui/ui/panel_tabs/tab_editor/editor_controller.mli diff --git a/gui/ui/menu_editor_file.ml b/gui/ui/panel_tabs/tab_editor/editor_menu_file.ml similarity index 94% rename from gui/ui/menu_editor_file.ml rename to gui/ui/panel_tabs/tab_editor/editor_menu_file.ml index dd713d995..627502adb 100644 --- a/gui/ui/menu_editor_file.ml +++ b/gui/ui/panel_tabs/tab_editor/editor_menu_file.ml @@ -204,7 +204,7 @@ let content = ~submit: (Dom_html.handler (fun _ -> let filename : string = Js.to_string file_new_input_dom##.value in - let () = Menu_editor_file_controller.create_file filename in + let () = Editor_menu_file_controller.create_file filename in let () = Common.modal ~id:("#" ^ file_new_modal_id) ~action:"hide" in @@ -214,7 +214,7 @@ let content = let order_files (element : Dom_html.element Js.t) = let filenames : string list = Common.children_value element "li[data-file-id]" (fun element -> - let () = Common.log_group "[Menu_editor_file.order_files]" in + let () = Common.log_group "[Editor_menu_file.order_files]" in let () = Common.debug ~loc:__LOC__ element in let () = Common.log_group_end () in Js.Opt.case @@ -222,7 +222,7 @@ let order_files (element : Dom_html.element Js.t) = (fun () -> failwith "missing filename") Js.to_string) in - let () = Menu_editor_file_controller.order_files filenames in + let () = Editor_menu_file_controller.order_files filenames in () let file_select_handler _ _ : unit Lwt.t = @@ -231,7 +231,7 @@ let file_select_handler _ _ : unit Lwt.t = let file = Js.Opt.get (files##item 0) (fun () -> assert false) in let file_id = Js.to_string file##.name in let () = - Menu_editor_file_controller.create_file + Editor_menu_file_controller.create_file ~text:(Js_of_ocaml_lwt.File.readAsText file) file_id in @@ -256,13 +256,13 @@ let onload () = let () = Common.jquery_on ("#" ^ file_close_li_id) "click" (Dom_html.handler (fun _ -> - let () = Menu_editor_file_controller.close_file () in + let () = Editor_menu_file_controller.close_file () in Js._false)) in let () = Common.jquery_on ("#" ^ file_export_li_id) "click" (Dom_html.handler (fun _ -> - let () = Menu_editor_file_controller.export_current_file () in + let () = Editor_menu_file_controller.export_current_file () in Js._false)) in let () = @@ -270,7 +270,7 @@ let onload () = (Dom_html.handler (fun (event : Dom_html.event Js.t) -> (* let () = - Common.log_group "[Menu_editor_file] clicked span[data-file-id]" + Common.log_group "[Editor_menu_file] clicked span[data-file-id]" in let () = Common.debug ~loc:__LOC__ event in let () = Common.log_group_end () in @@ -284,7 +284,7 @@ let onload () = Js.Opt.case file_id (fun _ -> ()) (fun file_id -> - Menu_editor_file_controller.set_file (Js.to_string file_id)) + Editor_menu_file_controller.set_file (Js.to_string file_id)) in Js._false)) in @@ -300,7 +300,7 @@ let onload () = else Common.debug ~loc:__LOC__ (Format.sprintf - "[Menu_editor_file] file dropdown : unexpected id %s" id))) + "[Editor_menu_file] file dropdown : unexpected id %s" id))) in let () = Common.jquery_on @@ -325,13 +325,13 @@ let onload () = (fun file_id -> let () = Common.log_group - "[Menu_editor_file] triggered \ + "[Editor_menu_file] triggered \ input.file_compile_checkbox, file_id:" in let () = Common.debug ~loc:__LOC__ file_id in let () = Common.log_group_end () in let () = - Menu_editor_file_controller.set_file_compile + Editor_menu_file_controller.set_file_compile (Js.to_string file_id) is_checked in ()) diff --git a/gui/ui/menu_editor_file.mli b/gui/ui/panel_tabs/tab_editor/editor_menu_file.mli similarity index 100% rename from gui/ui/menu_editor_file.mli rename to gui/ui/panel_tabs/tab_editor/editor_menu_file.mli diff --git a/gui/ui/menu_editor_file_controller.ml b/gui/ui/panel_tabs/tab_editor/editor_menu_file_controller.ml similarity index 97% rename from gui/ui/menu_editor_file_controller.ml rename to gui/ui/panel_tabs/tab_editor/editor_menu_file_controller.ml index 457849587..00b533e90 100644 --- a/gui/ui/menu_editor_file_controller.ml +++ b/gui/ui/panel_tabs/tab_editor/editor_menu_file_controller.ml @@ -24,7 +24,7 @@ let set_file (file_id : string) : unit = let () = Common.debug ~loc:__LOC__ (Js.string - (Format.sprintf "[Menu_editor_file_controller.set_file] file `%s`" + (Format.sprintf "[Editor_menu_file_controller.set_file] file `%s`" file_id)) in Common.async __LOC__ (fun () -> diff --git a/gui/ui/menu_editor_file_controller.mli b/gui/ui/panel_tabs/tab_editor/editor_menu_file_controller.mli similarity index 100% rename from gui/ui/menu_editor_file_controller.mli rename to gui/ui/panel_tabs/tab_editor/editor_menu_file_controller.mli diff --git a/gui/ui/tab_constraints.ml b/gui/ui/panel_tabs/tab_editor/subtab_constraints.ml similarity index 87% rename from gui/ui/tab_constraints.ml rename to gui/ui/panel_tabs/tab_editor/subtab_constraints.ml index 628340d56..941158a37 100644 --- a/gui/ui/tab_constraints.ml +++ b/gui/ui/panel_tabs/tab_editor/subtab_constraints.ml @@ -40,32 +40,32 @@ let content () = let list = match conclusion with | [ site_graph ] -> - Utility.print_site_graph site_graph - (Utility.print_newline list) + Html_utility.print_site_graph site_graph + (Html_utility.print_newline list) | _ :: _ | [] -> - let list = Utility.print_newline list in - let list = Utility.print_string " ]" list in + let list = Html_utility.print_newline list in + let list = Html_utility.print_string " ]" list in let list = snd (List.fold_left (fun (bool, list) a -> let list = if bool then - Utility.print_string " v " list + Html_utility.print_string " v " list else list in let list = - Utility.print_site_graph a list + Html_utility.print_site_graph a list in true, list) (false, list) (List.rev conclusion)) in - let list = Utility.print_string "[ " list in + let list = Html_utility.print_string "[ " list in list in - let list = Utility.print_string " => " list in - let list = Utility.print_site_graph hyp list in + let list = Html_utility.print_string " => " list in + let list = Html_utility.print_site_graph hyp list in list) [] (List.rev b) in diff --git a/gui/ui/tab_constraints.mli b/gui/ui/panel_tabs/tab_editor/subtab_constraints.mli similarity index 100% rename from gui/ui/tab_constraints.mli rename to gui/ui/panel_tabs/tab_editor/subtab_constraints.mli diff --git a/gui/ui/tab_contact_map.ml b/gui/ui/panel_tabs/tab_editor/subtab_contact_map.ml similarity index 98% rename from gui/ui/tab_contact_map.ml rename to gui/ui/panel_tabs/tab_editor/subtab_contact_map.ml index 2aad33cef..1711661d1 100644 --- a/gui/ui/tab_contact_map.ml +++ b/gui/ui/panel_tabs/tab_editor/subtab_contact_map.ml @@ -26,7 +26,7 @@ let extract_contact_map = function | _ -> failwith "Wrong ugly contact_map extractor" let contact_map_js : Js_contact.contact_map Js.t = - Js_contact.create_contact_map display_id State_settings.agent_coloring + Js_contact.create_contact_map display_id State_preferences.agent_coloring let contact_map_text : string React.signal = State_project.on_project_change_async ~on:tab_is_active None accuracy "null" diff --git a/gui/ui/tab_contact_map.mli b/gui/ui/panel_tabs/tab_editor/subtab_contact_map.mli similarity index 100% rename from gui/ui/tab_contact_map.mli rename to gui/ui/panel_tabs/tab_editor/subtab_contact_map.mli diff --git a/gui/ui/tab_influences.ml b/gui/ui/panel_tabs/tab_editor/subtab_influences.ml similarity index 99% rename from gui/ui/tab_influences.ml rename to gui/ui/panel_tabs/tab_editor/subtab_influences.ml index 3423aed54..d1d7b8f3f 100644 --- a/gui/ui/tab_influences.ml +++ b/gui/ui/panel_tabs/tab_editor/subtab_influences.ml @@ -104,7 +104,7 @@ let influencemap = (Yojson.Basic.from_string (Js.to_string x)) in let () = - Subpanel_editor.move_cursor_hook_send + Editor.move_cursor_hook_send (Public_data.position_of_refined_influence_node node) in let origin = Some (Public_data.short_node_of_refined_node node) in @@ -467,7 +467,7 @@ let pop_cell = function [ Html.a_onclick (fun _ -> let () = - Subpanel_editor.move_cursor_hook_send + Editor.move_cursor_hook_send (Public_data.position_of_refined_influence_node node) in let origin = diff --git a/gui/ui/tab_influences.mli b/gui/ui/panel_tabs/tab_editor/subtab_influences.mli similarity index 100% rename from gui/ui/tab_influences.mli rename to gui/ui/panel_tabs/tab_editor/subtab_influences.mli diff --git a/gui/ui/tab_polymers.ml b/gui/ui/panel_tabs/tab_editor/subtab_polymers.ml similarity index 90% rename from gui/ui/tab_polymers.ml rename to gui/ui/panel_tabs/tab_editor/subtab_polymers.ml index 576344bbb..90cdebb64 100644 --- a/gui/ui/tab_polymers.ml +++ b/gui/ui/panel_tabs/tab_editor/subtab_polymers.ml @@ -15,7 +15,7 @@ let tab_was_active = ref false let site a = [ a, None, Some (Public_data.Bound_to 1), None ] let print_edge ((a, b), (c, d)) list = - Utility.print_newline (Utility.print_site_graph [ a, site b; c, site d ] list) + Html_utility.print_newline (Html_utility.print_site_graph [ a, site b; c, site d ] list) let content () = let scc = @@ -29,23 +29,23 @@ let content () = let scc = List.rev_map List.rev scc in let output = if scc = [] || scc = [ [] ] then - Utility.print_string + Html_utility.print_string "The size of biomolecular compounds is uniformly bounded." [] else ( let list = List.fold_left (fun list list_edges -> - let list = Utility.print_newline list in + let list = Html_utility.print_newline list in List.fold_left (fun list ((a, b), (c, d)) -> print_edge ((a, b), (c, d)) list) list list_edges) [] scc in - let list = Utility.print_newline list in + let list = Html_utility.print_newline list in let list = - Utility.print_string + Html_utility.print_string "The following bonds may form arbitrary long chains of \ agents:" list diff --git a/gui/ui/tab_polymers.mli b/gui/ui/panel_tabs/tab_editor/subtab_polymers.mli similarity index 100% rename from gui/ui/tab_polymers.mli rename to gui/ui/panel_tabs/tab_editor/subtab_polymers.mli diff --git a/gui/ui/tab_editor.ml b/gui/ui/panel_tabs/tab_editor/tab_editor.ml similarity index 86% rename from gui/ui/tab_editor.ml rename to gui/ui/panel_tabs/tab_editor/tab_editor.ml index ea3350717..320299aaf 100644 --- a/gui/ui/tab_editor.ml +++ b/gui/ui/panel_tabs/tab_editor/tab_editor.ml @@ -17,7 +17,7 @@ let rightsubpanel () = ~a: [ Tyxml_js.R.Html.a_class - (React.S.bind Subpanel_editor.editor_full (fun editor_full -> + (React.S.bind Editor.editor_full (fun editor_full -> React.S.const (if editor_full then [ "hidden" ] @@ -27,32 +27,32 @@ let rightsubpanel () = [ Ui_common.navtabs "subnavtab" [ - "contact_map", None, Tab_contact_map.navli (); - "influences", None, Tab_influences.navli (); - "constraints", None, Tab_constraints.navli (); - "polymers", None, Tab_polymers.navli (); + "contact_map", None, Subtab_contact_map.navli (); + "influences", None, Subtab_influences.navli (); + "constraints", None, Subtab_constraints.navli (); + "polymers", None, Subtab_polymers.navli (); ]; Ui_common.navcontent ~id:rightsubpanel_id [] [ - "contact_map", [], Tab_contact_map.content (); - "influences", [], Tab_influences.content (); - "constraints", [], Tab_constraints.content (); - "polymers", [], Tab_polymers.content (); + "contact_map", [], Subtab_contact_map.content (); + "influences", [], Subtab_influences.content (); + "constraints", [], Subtab_constraints.content (); + "polymers", [], Subtab_polymers.content (); ]; ] (** [childs_hide b] triggers change the state of child tabs to hide if b is True, or else to show *) let childs_hide (b : bool) : unit = if b then ( - let () = Tab_contact_map.parent_hide () in - let () = Tab_influences.parent_hide () in - let () = Tab_constraints.parent_hide () in - Tab_polymers.parent_hide () + let () = Subtab_contact_map.parent_hide () in + let () = Subtab_influences.parent_hide () in + let () = Subtab_constraints.parent_hide () in + Subtab_polymers.parent_hide () ) else ( - let () = Tab_contact_map.parent_shown () in - let () = Tab_influences.parent_shown () in - let () = Tab_constraints.parent_shown () in - Tab_polymers.parent_shown () + let () = Subtab_contact_map.parent_shown () in + let () = Subtab_influences.parent_shown () in + let () = Subtab_constraints.parent_shown () in + Subtab_polymers.parent_shown () ) let content () = @@ -61,7 +61,7 @@ let content () = ~a: [ Tyxml_js.R.Html.a_class - (React.S.bind Subpanel_editor.editor_full (fun editor_full -> + (React.S.bind Editor.editor_full (fun editor_full -> (* child hiding set here to avoid "gc" *) let () = childs_hide editor_full in React.S.const @@ -70,7 +70,7 @@ let content () = else [ "col-md-6"; "flex-content" ]))); ] - [ Subpanel_editor.content () ]; + [ Editor.content () ]; rightsubpanel (); ] @@ -225,14 +225,14 @@ let init_non_weakly_reversible_transitions () = let dont_gc_me = ref [] let onload () = - let () = Subpanel_editor.onload () in + let () = Editor.onload () in dont_gc_me := init_dead_rules () :: !dont_gc_me; dont_gc_me := init_dead_agents () :: !dont_gc_me; dont_gc_me := init_non_weakly_reversible_transitions () :: !dont_gc_me; - let () = Tab_contact_map.onload () in - let () = Tab_influences.onload () in - let () = Tab_constraints.onload () in - let () = Tab_polymers.onload () in + let () = Subtab_contact_map.onload () in + let () = Subtab_influences.onload () in + let () = Subtab_constraints.onload () in + let () = Subtab_polymers.onload () in let () = Common.jquery_on "#naveditor" "hide.bs.tab" (fun _ -> childs_hide true) in @@ -242,9 +242,9 @@ let onload () = () let onresize () : unit = - let () = Subpanel_editor.onresize () in - let () = Tab_contact_map.onresize () in - let () = Tab_influences.onresize () in - let () = Tab_constraints.onresize () in - let () = Tab_polymers.onresize () in + let () = Editor.onresize () in + let () = Subtab_contact_map.onresize () in + let () = Subtab_influences.onresize () in + let () = Subtab_constraints.onresize () in + let () = Subtab_polymers.onresize () in () diff --git a/gui/ui/tab_flux.mli b/gui/ui/panel_tabs/tab_editor/tab_editor.mli similarity index 100% rename from gui/ui/tab_flux.mli rename to gui/ui/panel_tabs/tab_editor/tab_editor.mli diff --git a/gui/ui/tab_log.ml b/gui/ui/panel_tabs/tab_log.ml similarity index 97% rename from gui/ui/tab_log.ml rename to gui/ui/panel_tabs/tab_log.ml index ab94adc2d..d868df30c 100644 --- a/gui/ui/tab_log.ml +++ b/gui/ui/panel_tabs/tab_log.ml @@ -20,7 +20,7 @@ let line_count state = state.simulation_info_output.simulation_output_log_messages let navli () = - Ui_react_sim_status.label_news tab_is_active (fun state -> line_count state) + Ui_track_sim_status.label_news tab_is_active (fun state -> line_count state) let content () = let state_log = diff --git a/gui/ui/tab_log.mli b/gui/ui/panel_tabs/tab_log.mli similarity index 100% rename from gui/ui/tab_log.mli rename to gui/ui/panel_tabs/tab_log.mli diff --git a/gui/ui/tab_outputs.ml b/gui/ui/panel_tabs/tab_outputs.ml similarity index 97% rename from gui/ui/tab_outputs.ml rename to gui/ui/panel_tabs/tab_outputs.ml index f9e267743..4b6671df8 100644 --- a/gui/ui/tab_outputs.ml +++ b/gui/ui/panel_tabs/tab_outputs.ml @@ -27,7 +27,7 @@ let file_count state = state.Api_types_t.simulation_info_output .Api_types_t.simulation_output_file_lines -let navli () = Ui_react_sim_status.badge (fun state -> file_count state) +let navli () = Ui_track_sim_status.badge (fun state -> file_count state) let xml () = let select (file_line_ids : string list) : [> Html_types.select ] Html.elt = @@ -126,7 +126,7 @@ let select_outputs () : unit = update_outputs fileindex let content () = - [ Ui_react_sim_status.toggle_element (fun t -> file_count t > 0) (xml ()) ] + [ Ui_track_sim_status.toggle_element (fun t -> file_count t > 0) (xml ()) ] let onload () = let () = diff --git a/gui/ui/tab_outputs.mli b/gui/ui/panel_tabs/tab_outputs.mli similarity index 100% rename from gui/ui/tab_outputs.mli rename to gui/ui/panel_tabs/tab_outputs.mli diff --git a/gui/ui/tab_plot.ml b/gui/ui/panel_tabs/tab_plot.ml similarity index 98% rename from gui/ui/tab_plot.ml rename to gui/ui/panel_tabs/tab_plot.ml index 0f11bb7f6..3612effbe 100644 --- a/gui/ui/tab_plot.ml +++ b/gui/ui/panel_tabs/tab_plot.ml @@ -279,7 +279,7 @@ let xml () = |}] let content () : [> Html_types.div ] Html.elt list = - [ Ui_react_sim_status.toggle_element (fun s -> has_plot s) (xml ()) ] + [ Ui_track_sim_status.toggle_element (fun s -> has_plot s) (xml ()) ] let onload () = let plot_offset_input_dom = Tyxml_js.To_dom.of_input plot_offset_input in @@ -330,7 +330,7 @@ let plot_count = function state.simulation_info_output.simulation_output_plot let navli () = - Ui_react_sim_status.label_news tab_is_active (fun state -> plot_count state) + Ui_track_sim_status.label_news tab_is_active (fun state -> plot_count state) let onresize () = (* recalcuate size *) diff --git a/gui/ui/tab_plot.mli b/gui/ui/panel_tabs/tab_plot.mli similarity index 100% rename from gui/ui/tab_plot.mli rename to gui/ui/panel_tabs/tab_plot.mli diff --git a/gui/ui/tab_snapshot.ml b/gui/ui/panel_tabs/tab_snapshot.ml similarity index 97% rename from gui/ui/tab_snapshot.ml rename to gui/ui/panel_tabs/tab_snapshot.ml index b3710ec8e..cf9c0c383 100644 --- a/gui/ui/tab_snapshot.ml +++ b/gui/ui/panel_tabs/tab_snapshot.ml @@ -30,7 +30,7 @@ let snapshot_count (state : Api_types_j.simulation_info option) : int = state.Api_types_j.simulation_info_output .Api_types_j.simulation_output_snapshots -let navli () = Ui_react_sim_status.badge (fun state -> snapshot_count state) +let navli () = Ui_track_sim_status.badge (fun state -> snapshot_count state) let select_id = "snapshot-select-id" let display_id = "snapshot-map-display" @@ -110,7 +110,7 @@ let render_snapshot_graph (snapshot_js : Js_snapshot.snapshot Js.t) match React.S.value display_format with | Graph -> let json : string = Data.string_of_snapshot snapshot in - let contact_map = React.S.value Tab_contact_map.contact_map_text in + let contact_map = React.S.value Subtab_contact_map.contact_map_text in snapshot_js##setData ~contact_map:(Js.string contact_map) (Js.string json) | Kappa -> () @@ -155,7 +155,8 @@ let select_snapshot (snapshot_js : Js_snapshot.snapshot Js.t) : unit = in Lwt.return (Result_util.ok ())) with - | Failure f -> Lwt.return (Api_common.err_result_of_string f) + | Failure f -> + Lwt.return (Api_common.err_result_of_string f) | Invalid_argument f -> Lwt.return (Api_common.err_result_of_string f))) in @@ -198,7 +199,7 @@ let snapshot_class : State_simulation.model) let snapshot_js : Js_snapshot.snapshot Js.t = - Js_snapshot.create_snapshot display_id State_settings.agent_coloring + Js_snapshot.create_snapshot display_id State_preferences.agent_coloring let xml () = let list = @@ -353,7 +354,7 @@ let xml () = let content () = [ - Ui_react_sim_status.toggle_element + Ui_track_sim_status.toggle_element (fun state -> snapshot_count state > 0) (xml ()); ] diff --git a/gui/ui/tab_snapshot.mli b/gui/ui/panel_tabs/tab_snapshot.mli similarity index 100% rename from gui/ui/tab_snapshot.mli rename to gui/ui/panel_tabs/tab_snapshot.mli diff --git a/gui/ui/tab_stories.ml b/gui/ui/panel_tabs/tab_stories.ml similarity index 100% rename from gui/ui/tab_stories.ml rename to gui/ui/panel_tabs/tab_stories.ml diff --git a/gui/ui/tab_stories.mli b/gui/ui/panel_tabs/tab_stories.mli similarity index 100% rename from gui/ui/tab_stories.mli rename to gui/ui/panel_tabs/tab_stories.mli diff --git a/gui/ui/ui_react_sim_status.ml b/gui/ui/ui_track_sim_status.ml similarity index 100% rename from gui/ui/ui_react_sim_status.ml rename to gui/ui/ui_track_sim_status.ml diff --git a/gui/ui/ui_react_sim_status.mli b/gui/ui/ui_track_sim_status.mli similarity index 100% rename from gui/ui/ui_react_sim_status.mli rename to gui/ui/ui_track_sim_status.mli