void gui_layout_window_save_tree (struct t_gui_layout *layout, struct t_gui_layout_window **layout_windows, struct t_gui_layout_window *parent_layout, struct t_gui_window_tree *tree) { struct t_gui_layout_window *layout_window; if (tree->window) { if (tree->window == gui_current_window) layout->internal_id_current_window = layout->internal_id; layout_window = gui_layout_window_add (layout_windows, layout->internal_id, parent_layout, 0, 0, gui_buffer_get_plugin_name (tree->window->buffer), tree->window->buffer->name); } else { layout_window = gui_layout_window_add (layout_windows, layout->internal_id, parent_layout, tree->split_pct, tree->split_horizontal, NULL, NULL); } layout->internal_id++; if (tree->child1) { gui_layout_window_save_tree (layout, layout_windows, layout_window, tree->child1); } if (tree->child2) { gui_layout_window_save_tree (layout, layout_windows, layout_window, tree->child2); } }
int gui_layout_window_save (struct t_gui_layout_window **layout_windows) { gui_layout_window_remove_all (layout_windows); gui_layout_internal_id = 1; gui_layout_internal_id_current_window = -1; gui_layout_window_save_tree (layout_windows, NULL, gui_windows_tree); return gui_layout_internal_id_current_window; }
void gui_layout_window_save (struct t_gui_layout *layout) { if (!layout) return; gui_layout_window_remove (layout->layout_windows); layout->internal_id = 1; layout->internal_id_current_window = -1; gui_layout_window_save_tree (layout, &layout->layout_windows, NULL, gui_windows_tree); }