Skip to content

Commit

Permalink
Webapp: renamings in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinepouille committed Sep 24, 2024
1 parent 4fff739 commit 7aa8d10
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions gui/JsSim.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ 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 ()))
in

let () = Panel_projects.onload () in
let () = Panel_tab.onload () in
let () = Panel_tabs.onload () in
let () = Panel_settings.onload () in

let _ =
Dom_html.window##.onresize :=
Dom_html.handler (fun _ ->
let () = Panel_projects.onresize () in
let () = Panel_tab.onresize () in
let () = Panel_tabs.onresize () in
let () = Panel_settings.onresize () in
Js._true)
in
Expand Down
8 changes: 4 additions & 4 deletions gui/ui/panel_tab.ml → gui/ui/panel_tabs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand All @@ -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 ();
Expand All @@ -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
Expand All @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 () =
Expand Down Expand Up @@ -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
Expand All @@ -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 =
Expand All @@ -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 () =
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -214,15 +214,15 @@ 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
(element_get_filename element)
(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 =
Expand All @@ -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
Expand All @@ -256,21 +256,21 @@ 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 () =
Common.jquery_on "span[data-file-id]" "click"
(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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
())
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () ->
Expand Down
4 changes: 2 additions & 2 deletions gui/ui/tabs/tab_editor/subtab_influences.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
10 changes: 5 additions & 5 deletions gui/ui/tabs/tab_editor/tab_editor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down Expand Up @@ -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
Expand All @@ -70,7 +70,7 @@ let content () =
else
[ "col-md-6"; "flex-content" ])));
]
[ Subpanel_editor.content () ];
[ Editor.content () ];
rightsubpanel ();
]

Expand Down Expand Up @@ -225,7 +225,7 @@ 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;
Expand All @@ -242,7 +242,7 @@ let onload () =
()

let onresize () : unit =
let () = Subpanel_editor.onresize () in
let () = Editor.onresize () in
let () = Subtab_contact_map.onresize () in
let () = Subtab_influences.onresize () in
let () = Subtab_constraints.onresize () in
Expand Down

0 comments on commit 7aa8d10

Please sign in to comment.