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

PSX preparations #1786

Merged
merged 18 commits into from
Jun 16, 2023
Merged

PSX preparations #1786

merged 18 commits into from
Jun 16, 2023

Conversation

t-b
Copy link
Collaborator

@t-b t-b commented Jun 14, 2023

No description provided.

@t-b t-b self-assigned this Jun 14, 2023
@t-b t-b requested a review from timjarsky as a code owner June 14, 2023 20:33
@t-b t-b mentioned this pull request Jun 14, 2023
t-b added 18 commits June 15, 2023 11:51
…dows

It is now possible to store the window coordinates of resizable exterior
subwindows.

This is opt-in so you have to register the exterior subwindow via
PS_InitCoordinates in addition to the main window.

As not all subwindows might want to be saved, we now have to check in
PS_StoreWindowCoordinates if storing is requested or not.

It is not clear why MoveSubWindow needs the points -> pixel conversion.
For a future application we want to read that back.
…rs to allow passing in a check function

If the check function returns 1 we throw an SFH_Assert.
We support more than analysis function tests since 627725e (Generalize
PSQ_TestOverrideActive and MSQ_TestOverrideActive, 2021-10-19).
…eResults

This is much cleaner than duplication the wave getter logic.
By not using the convenience wrapper SFH_ResolveDatasetElementFromJSON we
can issue better error messages for multiple datasets.
@t-b t-b force-pushed the feature/1786-psx-preparations-v9 branch from 93f9453 to 80da1fd Compare June 15, 2023 09:51
@t-b t-b requested a review from MichaelHuth June 15, 2023 19:09
@t-b t-b assigned MichaelHuth and unassigned t-b Jun 15, 2023
@t-b
Copy link
Collaborator Author

t-b commented Jun 15, 2023

@MichaelHuth Please review, thanks.

Copy link
Collaborator

@MichaelHuth MichaelHuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only minor stuff.

Packages/MIES/MIES_GuiUtilities.ipf Show resolved Hide resolved
@@ -136,7 +136,12 @@ static Function PS_ApplyStoredWindowCoordinate(variable JSONid, string win)

AssertOnAndClearRTError()
try
MoveWindow/W=$win left, top, right, bottom; AbortOnRTE
if(IsSubWindow(win))
// correct for pixel/points confusion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect the reason is:
"By default, panels are drawn using pixels if the screen resolution is 96 DPI but using points for higher-DPI settings. This gives backward compatibility on standard screens and reasonably-sized controls on high-resolution screens."

from DisplayHelpTopic "Control Panel Resolution on Windows"
from DisplayHelpTopic "Control Panel Units"

at 100% GUI scaling in windows print screenresolution results in 96 in IP.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why is that only relevant for exterior subwindows?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because MoveWindow coordinates are always in "points".

Whereas MoveSubWindow are in "points" or "control panel units". If it is "control panel units" then the mentioned distinction for screenresolution == 96 dpi -> pixels, otherwise points kicks in.

What is a bit unclear to me is, that the MoveSubWindow docu states: "coordinates are taken to be fixed locations measured in points, or control panel units for control panel hosts".

Because according to that, it should be like:

if(IsControlPanelHost(subWin))
  // "control panel units"
  if(screenresolution == 96)
    return pixels
  else
    return points
  endif
else
  return points
endif

Packages/MIES/MIES_Utilities.ipf Show resolved Hide resolved
@MichaelHuth MichaelHuth assigned t-b and unassigned MichaelHuth Jun 16, 2023
@t-b
Copy link
Collaborator Author

t-b commented Jun 16, 2023

Ragendiff:

$ git range-diff @{u}...HEAD
 1:  0b275b9d2c !  1:  79e5db97af PixelToPoints/PointsToPixel: Add them
    @@ Packages/MIES/MIES_GuiUtilities.ipf: Function IsSubwindow(string win)
     +/// @{
     +Function PointsToPixel(variable var)
     +
    -+   return var * (ScreenResolution/72)
    ++   return var * (ScreenResolution / 72)
     +End
     +
     +Function PixelToPoints(variable var)
     +
    -+   return var * (72/ScreenResolution)
    ++   return var * (72 / ScreenResolution)
     +End
     +/// @}
     +
 2:  9753e1cda3 =  2:  d26d506a3d PS_InitCoordinates: Allow to store the coordinates of exterior subwindows
 3:  97b81e9f06 !  3:  95848c4da4 UpdateInfoButtonHelp: Add it
    @@ Metadata
      ## Commit message ##
         UpdateInfoButtonHelp: Add it

    +    In the future we will have info buttons. These show the text provided in
    +    content as help message. In addition the text can be copied to a clipboard
    +    which will use the unnamed userdata. We are using the unnamed userdata
    +    here as that is always passed into the GUI control procedure.
    +
      ## Packages/MIES/MIES_Utilities.ipf ##
     @@ Packages/MIES/MIES_Utilities.ipf: Function CopySimpleJSONElement(variable srcJsonId, string srcPath, variable tgtJ
                 ASSERT(0, "Unsupported element type")
 4:  2902c0aa09 =  4:  40a34a6361 SFH_GetFormulaGraphs: Factor it out
 5:  0f28b8eda2 =  5:  4e37030e74 SFH_CreateResultsWaveWithCode: Store the name of the browser as well
 6:  974702f57c =  6:  033bc26ad0 LimitWithReplace: Add it
 7:  5d326cc859 =  7:  5f40c61d45 HASH_SHA2_256: Introduce constants
 8:  00b5568ef6 =  8:  996b95e702 SFH_GetArgumentAsNumeric/SFH_GetArgumentAsText: Add optional parameters to allow passing in a check function
 9:  4f5b91ca0f =  9:  be9536bb22 IsFunctionCalledRecursively: Factor it out
10:  c57b1a172a = 10:  ed4f942e98 PS_COORDINATE_SAVING_HOOK: Introduce constant
11:  f08b5f68fa = 11:  f12d129d26 PS_RemoveCoordinateSaving: Add it
12:  13cf1e7bfd = 12:  d4bdb1a33f StoreCurrentPanelsResizeInfo: Fix typo and grammar
13:  2f5073f1a0 = 13:  3144f85c3e CA_OutputCacheStatistics: Output three decimal digits for the timestamps
14:  91605608c1 = 14:  13dadc9f88 GetOverrideResults: Fix comment
15:  7749c59826 = 15:  c5603d7678 PSQ_CreateOverrideResults/TP_CreateOverrideResults: Prefer GetOverrideResults
16:  80da1fdaba = 16:  dcfd510c6a SFH_GetArgumentAsText/SFH_GetArgumentAsNumeric: Enhance error messages

@t-b t-b assigned MichaelHuth and unassigned t-b Jun 16, 2023
Copy link
Collaborator

@MichaelHuth MichaelHuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move the points/pixel origin question to an issue, as you have visual verification that your code shows correctly.

@@ -136,7 +136,12 @@ static Function PS_ApplyStoredWindowCoordinate(variable JSONid, string win)

AssertOnAndClearRTError()
try
MoveWindow/W=$win left, top, right, bottom; AbortOnRTE
if(IsSubWindow(win))
// correct for pixel/points confusion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because MoveWindow coordinates are always in "points".

Whereas MoveSubWindow are in "points" or "control panel units". If it is "control panel units" then the mentioned distinction for screenresolution == 96 dpi -> pixels, otherwise points kicks in.

What is a bit unclear to me is, that the MoveSubWindow docu states: "coordinates are taken to be fixed locations measured in points, or control panel units for control panel hosts".

Because according to that, it should be like:

if(IsControlPanelHost(subWin))
  // "control panel units"
  if(screenresolution == 96)
    return pixels
  else
    return points
  endif
else
  return points
endif

@MichaelHuth MichaelHuth assigned t-b and unassigned MichaelHuth Jun 16, 2023
@t-b t-b merged commit 1b165ef into main Jun 16, 2023
@t-b t-b deleted the feature/1786-psx-preparations-v9 branch June 16, 2023 15:34
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.

2 participants