OpenModelica / OpenModelica

OpenModelica is an open-source Modelica-based modeling and simulation environment intended for industrial and academic usage.
https://openmodelica.org
Other
820 stars 305 forks source link

Don't open a new plot window when uneeded #12911

Open ceraolo opened 6 days ago

ceraolo commented 6 days ago

Steps to Reproduce

(0. use SubWindow view as a default for Plotting)

  1. Load RL.mo.txt
  2. Run RL
  3. (in plotting perspective) click on "Diagram Window" button
  4. reduce it to a window through its window button
  5. select inductor.i as a variable to plot: Plot2 is open, even though Plot1 was available. This occurs because when doing step 5 input focus is on the Diagram Window, were plots cannot be written on. So, OMEdit decides to open a new window.

But what is the reason to give the Diagram Window input focus? Insofar, AKAIK, no operation can be performed there. If I am wright, when clicking on diagram window the input focus must stay where it was. In this way, when I ask inductor.i to be plotted, it goes, in my example, directly in Plot 1.

Expected Behavior

Opening diagram window should not change the next window where to plot signals. I.e. the next signal should go in the window active before opening (or moving or resizing) the diagram window

Screenshots

A short video showing the behaviour here: https://github.com/user-attachments/assets/31b5a51b-4160-4f27-9873-daa7aceec0eb

Version and OS

OM 1.23.1

Additional Context

adeas31 commented 4 days ago

But what is the reason to give the Diagram Window input focus? Insofar, AKAIK, no operation can be performed there.

That is the default behaviour of the multiple document interface (MDI). Whenever a new window is added, it will become the active window with focus. However, we can plot on the previous plot window, if there is any and make it active. If there is no previous plot window then open a new plot window.

ceraolo commented 4 days ago

That is the default behaviour of the multiple document interface (MDI). Whenever a new window is added, it will become the active window with focus.

Sure. but in our case it needs some adaptation

However, we can plot on the previous plot window, if there is any and make it active. If there is no previous plot window then open a new plot window.

Good. This is what I meant.