basic
This commit is contained in:
29
ogui.ml
29
ogui.ml
@ -1475,7 +1475,7 @@ module WindowManager = struct
|
||||
]
|
||||
|> pack Fun.id;
|
||||
]);
|
||||
|
||||
let i = ref 0 in
|
||||
Lwd.map_s (Lwd.get t) ~f:(fun (t : t) ->
|
||||
let rec fold dir (t : tt) : Layout.frame Lwd.t Lwt.t =
|
||||
let size =
|
||||
@ -1494,14 +1494,16 @@ module WindowManager = struct
|
||||
fst trest
|
||||
| `T (_, []) -> Layout.none |> Lwd.return |> Lwt.return
|
||||
| `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
|
||||
| `TextEdit t' ->
|
||||
Layout.textedit
|
||||
~size:(`Ratio 1.0, `Fun (fun b -> Gg.Box2.h b -. 30.))
|
||||
t'
|
||||
>>= 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
|
||||
fold `X { t; dim = `Ratio 1.; bindings = [] })
|
||||
>>= fun d -> Lwd.join d |> Lwt.return
|
||||
@ -1541,7 +1543,7 @@ module Painter = struct
|
||||
let string ?(style = Style.default) (t : Gv.t) (rect : box2)
|
||||
((contents, format) : string * TextLayout.format) : box2 Lwt.t =
|
||||
(* draw_box t ~box:rect ~style; *)
|
||||
F.epr "string";
|
||||
(* F.epr "string"; *)
|
||||
set_text_format t format;
|
||||
let rect' = Margin.inner style.margin rect in
|
||||
V2.v
|
||||
@ -1636,13 +1638,13 @@ module Painter = struct
|
||||
| `Fun f -> f 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;
|
||||
(match t with
|
||||
| `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 ->
|
||||
F.epr ",@ ";
|
||||
(* F.epr ",@ "; *)
|
||||
let c' =
|
||||
Box2.(
|
||||
match dir with
|
||||
@ -1651,21 +1653,20 @@ module Painter = struct
|
||||
| `Z -> box')
|
||||
in
|
||||
layout c' ui b >>= fun rb ->
|
||||
F.epr "@])";
|
||||
(* F.epr "@])"; *)
|
||||
Gg.Box2.union ra rb |> Lwt.return
|
||||
| `TextEdit tt ->
|
||||
F.epr "`TextEdit";
|
||||
(* F.epr "`TextEdit"; *)
|
||||
text_layout ui.gv box' tt >>= fun _ -> Lwt.return box'
|
||||
| `None ->
|
||||
F.epr "`None";
|
||||
(* F.epr "`None"; *)
|
||||
Lwt.return Gg.Box2.(v (o box') Gg.V2.zero)
|
||||
| `String s -> string ui.gv box' s
|
||||
| _ ->
|
||||
F.epr "_ !!Unimplemented!!";
|
||||
Lwt.return Gg.Box2.zero)
|
||||
>>= fun r ->
|
||||
F.epr "@]";
|
||||
|
||||
(* F.epr "@]"; *)
|
||||
let r' = Margin.outer style.margin r in
|
||||
|
||||
(*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'
|
||||
|
||||
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
|
||||
F.epr "@]@.";
|
||||
(* F.epr "@]@."; *)
|
||||
r
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user