method split_active_view orientation =
match topwin#active_view with
None -> ()
| Some v ->
let res =
match child1 with
Some (`View v1) when Oo.id v1 = Oo.id v -> Some (1, v1)
| _ ->
match child2 with
Some (`View v2) when Oo.id v2 = Oo.id v -> Some (2, v2)
| _ -> None
in
match res with
None -> prerr_endline "can't split this, not a view"
| Some (n, cur_view) ->
match cur_view#dup topwin with
None -> ()
| Some view_copy ->
let gp = new gui_paned topwin orientation () in
paned#remove cur_view#box;
if n = 1 then
child1 <- Some (`Paned gp)
else
child2 <- Some (`Paned gp);
(if n = 1 then paned#add1 else paned#add2) gp#paned#coerce;
gp#set_on_label_change (fun _ -> self#on_child_label_change);
gp#set_on_destroy (self#on_child_destroy n);
init_view topwin view_copy;
gp#set_children_views cur_view view_copy;
view_copy#grab_focus