Skip to content

Write a compatibility window controller section to the project file - #14609

Closed
magnesj wants to merge 1 commit into
devfrom
project-file-window-controller-compat-section
Closed

Write a compatibility window controller section to the project file#14609
magnesj wants to merge 1 commit into
devfrom
project-file-window-controller-compat-section

Conversation

@magnesj

@magnesj magnesj commented Aug 25, 2026

Copy link
Copy Markdown
Member

Alternative to #14601. Only one of the two should be merged.

Fixes #14600

#14601 solves the problem by making MdiWindowController the keyword written to file again, and keeping DockWindowController as a read alias. This PR keeps DockWindowController as the keyword of the window controller in use, and writes the main window id a second time using the old keyword, so the previous release reads MdiWindowController and the dev branch reads DockWindowController.

Both sections cannot live inside the same field. PdmFieldXmlCap<PdmChildField>::readFieldData reads a single start element and then does one readNext() expecting the end element of the field, so a second sibling element desynchronizes the stream. RimViewWindow therefore has two child fields:

<WindowController>                      <!-- read by 2026.06 and older -->
  <MdiWindowController>
    <MainWindowID>1</MainWindowID>
  </MdiWindowController>
</WindowController>
<DockWindow>                            <!-- read by the dev branch, unknown field to older versions -->
  <DockWindowController>
    <MainWindowID>1</MainWindowID>
    <ViewToControl>...</ViewToControl>
  </DockWindowController>
</DockWindow>

Unknown fields are skipped by PdmXmlObjectHandle::readFields, so the previous release ignores DockWindow without complaining.

The compatibility section cannot be empty. The old controller resolves its main window using mainWindowByID( m_mainWindowID ), and the default value -1 returns a null main window, so updateViewerWidget() returns early and the plot is still invisible. The main window id has to be written. The geometry fields can be left out, RimMdiWindowGeometry::isValid() returns false and the previous version falls back to a default subwindow size, the same path the 3D views already take.

Removing the compatibility section after 2-3 major releases is deleting one field and one class.

… file

The MDI to dock widget refactoring renamed the PDM class RimMdiWindowController to RimDockWindowController, and with it the class keyword written to the project file. Previous versions of ResInsight have no factory entry for DockWindowController, so the window controller of a plot is never created and the plot is silently invisible when the project file is opened by such a version.

Keep DockWindowController as the keyword written for the window controller in use, and write the main window id a second time using the old keyword. RimViewWindow now has two child fields, the previous keyword WindowController holds the compatibility object and the new keyword DockWindow holds the window controller in use. Previous versions read the compatibility section and ignore the unknown DockWindow field, current versions read both and keep them in sync in dockInWindow().

RimMdiWindowController_OBSOLETE owns the keyword MdiWindowController and is derived from RimDockWindowController, so project files written by intermediate development versions using DockWindowController in the compatibility section are read into the same field without a type mismatch. RimDockWindowController::initAfterRead() restores the window controller in use from the compatibility section, covering both file layouts.

The dropped geometry fields are harmless, RimMdiWindowGeometry::isValid() returns false and the previous version falls back to a default subwindow size, which is the same path the 3D views already take.
@magnesj
magnesj requested a review from jonjenssen August 25, 2026 17:26
@magnesj
magnesj marked this pull request as ready for review August 26, 2026 05:34
@magnesj magnesj self-assigned this Aug 26, 2026
@magnesj magnesj closed this Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sure project files from latest dev can be opened in previous version

1 participant