Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1-2SP,2.25SP] Investigate if the docking branch of imgui can be used for chart layouts #142

Closed
Tracked by #117
ivan-cukic opened this issue Jan 17, 2024 · 2 comments
Assignees

Comments

@ivan-cukic
Copy link
Contributor

ivan-cukic commented Jan 17, 2024

Check out the docking branch of imgui and see if these are possible:

tiling in a horizontal row, in a vertical column, in a grid (like the current opendigitizer has)

  • Check if there is a built-in feature to layout windows in a row (and others).
  • Check if the windows can be chained one after the other left to right and whether they behave well enough when they are (that they stay chained, resized while staying in a row etc).

full-area/full-screen tiling

  • can the window group be forced to be full-screen?

serialization

  • does it support serialization / saving the layout to a file (and loading it later)
@ivan-cukic ivan-cukic converted this from a draft issue Jan 17, 2024
@RalphSteinhagen RalphSteinhagen moved this from 🆕 Ideas (∞) to 🔖 Selected (3) in Digitizer Reimplementation Jan 17, 2024
@Waqar144 Waqar144 moved this from 🔖 Selected (3) to 🏗 In progress in Digitizer Reimplementation Jan 18, 2024
@Waqar144
Copy link
Contributor

Waqar144 commented Jan 18, 2024

Is there is a built-in feature to layout windows in a row (and others)?

No. But it can be done manually using the DockBuilderXXX private/beta api in imgui_internal.h. Note that most docking api seems to be private/beta

If the windows can be chained one after the other left to right and whether they behave well enough when they are (that they stay chained, resized while staying in a row etc)?

Once we lay out the docks in a given layout, Imgui takes care of internal resizing (using split handles) without breaking our original layout. We do have to make the docks "Undockable" to prevent breakage of a layout. In "Free form" layout, the docks are dockable and the user can reposition them however he likes.

can the window group be forced to be full-screen?

Yes. The docks are normal imgui windows. If you specify position and size for the window, it will ignore the docking constrains and use those values.

serialization

ImGui supports serialization/deserialization of docks. It saves the config to the file specified in ImGuiIO::IniFilename automatically unless disabled by setting this field to null. ImGui also provides a way to get the INI data which can then be stored however the user wants.

There's another way to store data which is to save the size of each dock-node window and then when rebuilding the layout, use DockBuilderSetNodeSize to specify the size of the node. However, this won't work for 'free form' layout as that involves restoring not just the size but also the position and maybe other attributes for which I didn't find an easy way to restore.


Some other points:

  • The imgui-docking branch support lives in the docking branch instead of master branch. The reason is that the final end user api is not stable yet but the branch is recommended for use. See https://github.com/ocornut/imgui/wiki/Docking#preamble
  • Reordering windows when a layout (row/col/grid) is specified is not possible using the apis. When a layout is specified we will most likely disable undocking of the windows. If we allow docking then the user will be able to break the layout i.e., it will be possible for the user to make a Row layout something different.
  • Tabbar can be completely disabled. However disabling the tabbar means now you can't do any kind of docking/undocking because the 'drag handle' is gone. I wasn't able to find a way to change the drag handle that triggers docking.
  • Tabbar can be hidden and it will show up if you click the tiny triangle at the top left corner which can also be used to drag the window
  • Tabbed docking can be disabled. It can be disabled by setting ImGuiDockNodeFlags_NoDockingOverMe on the dock node every frame. If you don't set it on every frame, the dock will eventually allow tabbing as LocalFlags of a dock node get overwritten once you start moving the docks.
  • Programmatically I was able to create "docked" windows, but not floating ones. It is probably possible using DockBuilderAddNode() but somehow I wasn't able to make it work.
  • Implementation wise, it is not difficult to do the basic Row/Column/Grid layouts. However, difficulty level rises quickly as soon as you want something more custom.
  • It is important to note that a lot of the docking apis are not really documented and a lot of documentation/help is spread around in Github issues which are sometimes not that easy to find if you aren't making the right search queries.

Sample code that I used to try out the docking branch: Archive.zip

@Waqar144 Waqar144 moved this from 🏗 In progress to Finished Implementation (2) in Digitizer Reimplementation Jan 31, 2024
@Waqar144 Waqar144 changed the title [1-2SP] Investigate if the docking branch of imgui can be used for chart layouts [1-2SP,2.25SP] Investigate if the docking branch of imgui can be used for chart layouts Jan 31, 2024
@RalphSteinhagen
Copy link
Member

Thanks for the write-up and investigation. Will close this as the primary task is done. 👍

@RalphSteinhagen RalphSteinhagen moved this from Finished Implementation (2) to ✅ QA-Accepted/Merged (∞) in Digitizer Reimplementation Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: QA-Accepted/Merged (∞)
Development

No branches or pull requests

3 participants