This commit is contained in:
cqc
2024-08-02 22:07:07 -05:00
parent c604345886
commit 73d6e2233b
2 changed files with 15 additions and 17 deletions

29
ogui.ml
View File

@ -1475,7 +1475,7 @@ module WindowManager = struct
] ]
|> pack Fun.id; |> pack Fun.id;
]); ]);
let i = ref 0 in
Lwd.map_s (Lwd.get t) ~f:(fun (t : t) -> Lwd.map_s (Lwd.get t) ~f:(fun (t : t) ->
let rec fold dir (t : tt) : Layout.frame Lwd.t Lwt.t = let rec fold dir (t : tt) : Layout.frame Lwd.t Lwt.t =
let size = let size =
@ -1494,14 +1494,16 @@ module WindowManager = struct
fst trest fst trest
| `T (_, []) -> Layout.none |> Lwd.return |> Lwt.return | `T (_, []) -> Layout.none |> Lwd.return |> Lwt.return
| `Frame f' -> | `Frame f' ->
frame_of_window 314 cursor style size (Lwd.return f') i := !i + 1;
frame_of_window !i cursor style size (Lwd.return f')
|> Lwt.return |> Lwt.return
| `TextEdit t' -> | `TextEdit t' ->
Layout.textedit Layout.textedit
~size:(`Ratio 1.0, `Fun (fun b -> Gg.Box2.h b -. 30.)) ~size:(`Ratio 1.0, `Fun (fun b -> Gg.Box2.h b -. 30.))
t' t'
>>= fun tt -> >>= fun tt ->
frame_of_window 314 cursor style size tt |> Lwt.return i := !i + 1;
frame_of_window !i cursor style size tt |> Lwt.return
in in
fold `X { t; dim = `Ratio 1.; bindings = [] }) fold `X { t; dim = `Ratio 1.; bindings = [] })
>>= fun d -> Lwd.join d |> Lwt.return >>= fun d -> Lwd.join d |> Lwt.return
@ -1541,7 +1543,7 @@ module Painter = struct
let string ?(style = Style.default) (t : Gv.t) (rect : box2) let string ?(style = Style.default) (t : Gv.t) (rect : box2)
((contents, format) : string * TextLayout.format) : box2 Lwt.t = ((contents, format) : string * TextLayout.format) : box2 Lwt.t =
(* draw_box t ~box:rect ~style; *) (* draw_box t ~box:rect ~style; *)
F.epr "string"; (* F.epr "string"; *)
set_text_format t format; set_text_format t format;
let rect' = Margin.inner style.margin rect in let rect' = Margin.inner style.margin rect in
V2.v V2.v
@ -1636,13 +1638,13 @@ module Painter = struct
| `Fun f -> f box)) | `Fun f -> f box))
in in
let box' = Margin.inner style.margin box in let box' = Margin.inner style.margin box in
F.epr "@[<hv 3>%a " pp_box2 box; (* F.epr "@[<hv 3>%a " pp_box2 box; *)
draw_box ui.gv ~box ~style; draw_box ui.gv ~box ~style;
(match t with (match t with
| `Join (dir, (a, b)) -> | `Join (dir, (a, b)) ->
F.epr "`Join %a @,(@[<hv>" pp_dir dir; (* F.epr "`Join %a @,(@[<hv>" pp_dir dir; *)
layout box' ui a >>= fun ra -> layout box' ui a >>= fun ra ->
F.epr ",@ "; (* F.epr ",@ "; *)
let c' = let c' =
Box2.( Box2.(
match dir with match dir with
@ -1651,21 +1653,20 @@ module Painter = struct
| `Z -> box') | `Z -> box')
in in
layout c' ui b >>= fun rb -> layout c' ui b >>= fun rb ->
F.epr "@])"; (* F.epr "@])"; *)
Gg.Box2.union ra rb |> Lwt.return Gg.Box2.union ra rb |> Lwt.return
| `TextEdit tt -> | `TextEdit tt ->
F.epr "`TextEdit"; (* F.epr "`TextEdit"; *)
text_layout ui.gv box' tt >>= fun _ -> Lwt.return box' text_layout ui.gv box' tt >>= fun _ -> Lwt.return box'
| `None -> | `None ->
F.epr "`None"; (* F.epr "`None"; *)
Lwt.return Gg.Box2.(v (o box') Gg.V2.zero) Lwt.return Gg.Box2.(v (o box') Gg.V2.zero)
| `String s -> string ui.gv box' s | `String s -> string ui.gv box' s
| _ -> | _ ->
F.epr "_ !!Unimplemented!!"; F.epr "_ !!Unimplemented!!";
Lwt.return Gg.Box2.zero) Lwt.return Gg.Box2.zero)
>>= fun r -> >>= fun r ->
F.epr "@]"; (* F.epr "@]"; *)
let r' = Margin.outer style.margin r in let r' = Margin.outer style.margin r in
(*F.epr "layout: box=%a box'=%a r=%a r'=%a@." Gg.Box2.pp box (*F.epr "layout: box=%a box'=%a r=%a r'=%a@." Gg.Box2.pp box
@ -1673,8 +1674,8 @@ module Painter = struct
Lwt.return r' Lwt.return r'
let layout box ui frame = let layout box ui frame =
F.epr "layout:@ @[%a@]@.as:@.@[<hv>" Layout.pp_frame_rec frame; (* F.epr "layout:@ @[%a@]@.as:@.@[<hv>" Layout.pp_frame_rec frame; *)
let r = layout box ui frame in let r = layout box ui frame in
F.epr "@]@."; (* F.epr "@]@."; *)
r r
end end

View File

@ -64,9 +64,6 @@ let main =
let min_fps = ref Float.max_float in let min_fps = ref Float.max_float in
let max_fps = ref Float.min_float in let max_fps = ref Float.min_float in
(* Thread which is woken up when the main window is closed. *)
let _waiter, _wakener = Lwt.wait () in
let rootrepo = let rootrepo =
Store.init_default Store.init_default
(F.str "%s/console/rootstore.git" Secrets.giturl) (F.str "%s/console/rootstore.git" Secrets.giturl)