Write a compatibility window controller section to the project file - #14609
Closed
magnesj wants to merge 1 commit into
Closed
Write a compatibility window controller section to the project file#14609magnesj wants to merge 1 commit into
magnesj wants to merge 1 commit into
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative to #14601. Only one of the two should be merged.
Fixes #14600
#14601 solves the problem by making
MdiWindowControllerthe keyword written to file again, and keepingDockWindowControlleras a read alias. This PR keepsDockWindowControlleras 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 readsMdiWindowControllerand the dev branch readsDockWindowController.Both sections cannot live inside the same field.
PdmFieldXmlCap<PdmChildField>::readFieldDatareads a single start element and then does onereadNext()expecting the end element of the field, so a second sibling element desynchronizes the stream.RimViewWindowtherefore has two child fields:Unknown fields are skipped by
PdmXmlObjectHandle::readFields, so the previous release ignoresDockWindowwithout 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, soupdateViewerWidget()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.