rewrote a bunch of pieces of the gui layouts, it's still silly but it might work now

This commit is contained in:
cqc
2024-07-17 20:23:46 -05:00
parent c065a0423b
commit d3dc3d091b
3 changed files with 266 additions and 174 deletions

View File

@ -67,9 +67,6 @@ let main =
(* Thread which is woken up when the main window is closed. *)
let _waiter, _wakener = Lwt.wait () in
F.pr "oplevel.ml: Toploop.initialize_toplevel_env@.";
Toploop.initialize_toplevel_env ();
let rootrepo =
Store.init_default
(F.str "%s/console/rootstore.git" Secrets.giturl)
@ -81,6 +78,7 @@ let main =
load_fonts ui.gv;
(* Format.safe_set_geometry ~max_indent:(500 - 1) ~margin:500; *)
let event_stream, event_push = Lwt_stream.create () in
Ogui.Ui.process_events ui event_stream;
GLFW.setKeyCallback ~window
@ -146,9 +144,12 @@ let main =
}
in
ignore
(Toploop.use_input out_ppf
(String "#use \"topfind\";;\n#list;;#require \"lwt\";;"));
(*F.pr "oplevel.ml: Toploop.initialize_toplevel_env@.";
Toploop.initialize_toplevel_env ();
Clflags.debug := true;
ignore
(Toploop.use_input out_ppf
(String "#use \"topfind\";;\n#list;;#require \"lwt\";;")); *)
(* toplevel execution binding *)
Ui.(
update_bindings ui
@ -166,36 +167,26 @@ let main =
Custom
( "toplevel_execute",
fun () ->
TextBuffer.peek tb_init >>= fun str ->
Toploop.use_input out_ppf (String str)
|> F.epr "Toploop.use_input=%b@.";
TextBuffer.peek tb_init >>= fun _str ->
(*Toploop.use_input out_ppf (String str)
|> F.epr "Toploop.use_input=%b@."; *)
Lwt.return_unit );
]));
Layout.(
system ui `Y
~style:
Style.{ default with margin = Margin.symmetric 10.0 10.0 }
(Lwd.var
~eq:(fun (a, _) (b, _) -> Int.equal a b)
( 0,
WindowManager.make ui
~style:
Layout.Style.
{ default with margin = Margin.symmetric 10.0 10.0 }
(Lwd.var
(`T
( `Y,
[
TextEdit.multiline ui tb_init;
TextEdit.multiline ui to_init;
`TextEdit (TextEdit.multiline ui tb_init, `Ratio 1.0);
`TextEdit (TextEdit.multiline ui to_init, `Ratio 0.5);
] )))
>>= fun page ->
let page_root = Lwd.observe page in
let open GLFW in
let open Event in
Ui.update_bindings ui
Ui.(
adds
[
[ Key (Press, X, [ Control ]); Key (Press, E, [ Control ]) ];
]
[ Custom ("toplevel_execute", fun () -> Lwt.return ()) ]);
let bindings =
ui.bindings |> Lwd.get |> Lwd.observe |> Lwd.quick_sample |> snd
in