hnesk/browse-ocrd

allow changing relative width of views

bertsky opened this issue · 6 comments

It would be wonderful if the vertical divider between multiple views was a slider that could be clicked and dragged to change their relative width (as can already be done for the preview pane on the left).

hnesk commented

This is possible with Gtk.Paned: https://developer.gnome.org/gtk3/stable/GtkPaned.html , but it only has two panes.
To use Gtk.Paned for more views, it would be necessary to put Gtk.Paned inside of other Gtk.Paned and do some bookkeeping where to "pane" next. Quite possible but not trivial.
Another idea: Make it possible to open a new window per view and let the window manager do the placement, sizing, etc.. (GIMP style). I will look into it.

This is possible with Gtk.Paned: https://developer.gnome.org/gtk3/stable/GtkPaned.html , but it only has two panes.
To use Gtk.Paned for more views, it would be necessary to put Gtk.Paned inside of other Gtk.Paned and do some bookkeeping where to "pane" next. Quite possible but not trivial.

Yes, maybe even in a mix of vertical and horizontal panes. Indeed not trivial to implement and also probably tricky to use (cmp. awful manual control of column sliders in windows explorer and the like).

As an alternative, you could use a Grid view, and have two instead of one button for adding views: insert/add to row vs insert/add to column.

Another idea: Make it possible to open a new window per view and let the window manager do the placement, sizing, etc.. (GIMP style). I will look into it.

Yes, absolutely no objection here (but I already use a tiling window manager anyway).

This is possible with Gtk.Paned: https://developer.gnome.org/gtk3/stable/GtkPaned.html , but it only has two panes.
To use Gtk.Paned for more views, it would be necessary to put Gtk.Paned inside of other Gtk.Paned and do some bookkeeping where to "pane" next. Quite possible but not trivial.

How about the following: besides the view_menu_button in the header_bar to add views to the view_container as Gtk.Box, add two similar buttons to each view's action_bar (left of CloseButton):

  • a button to re-spawn the current box as a Gtk.HPaned with the existing view on the left and the new view on the right
  • a button to re-spawn the current box as a Gtk.VPaned with the existing view on the top and the new view on the bottom

Thus, the user could easily set up her own horizontal and vertical layout, adapting sizes via sliders. (Some bookkeeping would still be necessary, of course.)

hnesk commented

I'm on it...

hnesk commented

A prototype which initially spawns an empty view, from which a new view can be selected, is here: https://github.com/hnesk/browse-ocrd/tree/resizable-views
Still needs some polish ad testing.

This looks fantastic – thanks!