It is when we apply session info to the image window we unmaximize, so
don't apply session info to the image window when all we do is
switching tabs in single-window mode.
Session manage empty- and single-image window separately. So when
starting up, the default 2.6 UI is the same. But when enabling
single-window mode, the image window will become much larger then the
empty-image window. These conceptually different windows will then
from that point be session managed separately: switching mode switches
size of the image window.
Refactor session management with the "gimp-empty-image-window" in
GimpImageWindow. In particular, only have one entry point to
gimp_dialog_factory_add_foreign() and remove the is_empty instance
struct member.
Update Windows->Toolbox menu entry depending on if toolbox exists. If
an existing toolbox will be raised, set "Toolbox". If it will create a
new toolbox, set "New Toolbox". We need this special treatment since
there can be only one toolbox, so "New Toolbox" will remove any
toolbox docks from Recently Closed Docks. If we would just have
"Toolbox" it could be misinterpreted as "get me the toolbox I just
closed".
Don't use gimp_image_window_keep_canvas_pos() only for docks, use it
for all widgets in the display shell: the rulers, the menu bar, the
statusbar and the scrollbars. It is not really necessary for the two
latter ones because they are below and/or to the right of the canvas,
but we include them for completeness. Plus, they might get moved
around some day...
Add a "hide-docks" config and connect the Windows->Hide docks menu
item to it. Also connect the image window to the config property so it
can hide/show its docks when it needs to.
Also add and use a utility function
gimp_image_window_keep_canvas_pos() to ensure that the image in the
window remains fixed when toggling visiblity of docks. One problem:
When GimpDrawTool is active on the canvas, there is flicker. The end
position is correct though.
Also add regression testing for this fix to test-ui.c
Update image window side docks visiblity from the image window itself
instead of from the ui configurer. The image window has a dependency
to the config object anyway, so no need to complicate things.
Add "dialog-factory", "ui-manager" properties to GimpDockColumns and
let GimpDock look for these before trying to look for a dock window
which does not exist in single-window mode.
Add and use gimp_dock_columns_new() and add a GimpContext property to
GimpDockColumns. Also move the widget construction from _init() to
_constructor() in GimpDockWindow so we have a context object to pass
to gimp_dock_columns_new().
The image window must not disconnect from the active shell when any
page is removed, only when the active page is removed. This fixes the
bug with this step-by-step:
1. Start GIMP with a clean gimpdir
2. Create two windows
3. Enable single-window mode
4. Disable single-window mode
5. Try to execute a menu action, e.g. Select -> Invert, on both images
Expected result:
It works
Actual result:
It won't work in the image window that was reused and thus once had
two notebook pages, since it disconnected from page 1 when page 2 was
removed.
Also add some debug output.
In order to make a GimpDock get hold of a GimpContext both in
single-window mode and in multi-window mode, don't make it look for a
GimpContext in a GimpDockWindow, put the context in GimpDockColumns
instead. GimpDockColumns exists both in s-w-m and m-w-m, contrary to
GimpDockWindow. Still use the GimpDockWindow as a backup though.
With the introduction of a single-window mode, not only dock windows
needs to be able to create docks, the image window also needs to. So
give it a "dock-factory" property.
We must disconnect from the last display shell when it is removed
when rearranging the UI, so connect to GtkNotebook::page-removed
in GimpImageWindow and do that.
In places where the pattern
if (show)
gtk_widget_show (widget);
else
gtk_widget_hide (widget);
is used, change to
gtk_widget_set_visible (widget, show);
Also do some other minor cleanups.
Keep around a boolean state "is_empty" and update it when adding and
removing shells, and when the image of any shell changes. Do empty
display voodoo only when the "is_empty" state changes.
(gimp_image_window_image_notify): update the ui manager unconditionally
(both when a display is emptied *and* filled)
(gui_display_create): remove updating code here. It was not belonging
here anyway and the image window does the right thing now.
Add a GtkNotebook::switch_page() handler and move all shell switching
code there. In gimp_image_window_set_active_shell(), simply set the
right notebook page.