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

add .bounds_ method to Stethoscope #6281

Merged

Conversation

prko
Copy link
Contributor

@prko prko commented May 1, 2024

Purpose and Motivation

This is a reopened PR: #6230
This PR

  • allows you to set the size and position of Stethoscope,
    • e.g. s.scope.bounds_(Rect(100, 200, 300, 100))
  • and change the window resizing behaviour.

demo video:
https://www.dropbox.com/scl/fi/26952qepzu3iczj9bi0cq/s.bounds_-behaviour.mov?rlkey=suub8zyf6ujpksc7ugieggp02&dl=0

Types of changes

  • Documentation
  • New feature

To-do list

  • Code is tested
  • All tests are passing
  • Updated documentation
  • This PR is ready for review

prko added 24 commits March 6, 2024 13:51
documentation update for the method .scope to define the location of scope window
documentation update for the method .scope to define the scope window location
update .scope method to locate scope window position
added variables to have a singleton plotTreeWindow and a singleton scopeWindowDefined
changed position argument in scope method to bounds
The position arguments for the server scope method and the function scope method are changed to bounds. And the server scope is changed so that it displays only one scope and works fine when users use manually assigned bounds and the default bound value of nil in succession.
has been modified to show only one boundary and to work fine when users are using manually assigned bounds and the default boundary value of nil, one after the other. Also, pressing m will change its size based on user-defined bounds, if any.
position argument for scope method is changed to bounds, so the documentation is updated
added bounds argument to the method `.plotTree`
documentation update for the added argument `bounds` for the method `.plotTree`
added point to define the server meter position.
documentation update for the added position argument for .meter method.
spaces within curly brackets are added
The behaviour of resizing has been corrected. It now retains the position as before if the new width and height do not exceed the screen boundary. If the new height exceeds the screen boundary, the vertical point is modified so that it does not exceed the screen boundary. If the new width exceeds the screen boundary, then the horizontal point is modified so that it does not exceed the screen boundary.
added the behaviour of change size if the new size exceeds the screen boundary.
The implementation of .scope has been simplified.
The implementation of .scope has been simplified.
added bounds for scope argument for Bus
bounds = nil in arg 
-> 
bounds
position = nil in arg
-> 
position
@prko prko changed the title Topic/add .bounds method to s.scope add .bounds_ method to s.scope and change resizing behaviour May 1, 2024
@prko
Copy link
Contributor Author

prko commented May 1, 2024

Please let me know if this PR should be split again as follows:

  • add .bounds_ method to s.scope
  • Change resizing behaviour

@mtmccrea
Copy link
Member

mtmccrea commented May 2, 2024

I'm in favor of adding the bounds_ method to Stethoscope, but not making modifications of the requested size based on screen bounds.

The reason is that we found previously that setting geometry based on Window.screenBounds can have unpredictable results when using multiple monitors (a bug you helped uncover, thanks ;)). And in general the user may have a reason for setting bounds in unusual ways, and can handle limiting to screen bounds themselves if they'd like. Open to other opinions on this though.

Please let me know if this PR should be split again as follows:
add .bounds_ method to s.scope
Change resizing behaviour

So given there may be split views on this, the resizing behavior change could delay the other change you want to make

@prko prko changed the title add .bounds_ method to s.scope and change resizing behaviour change resizing behaviour of Stethoscope May 3, 2024
@prko prko changed the title change resizing behaviour of Stethoscope add .bounds_ method to s.scope and change resizing behaviour May 3, 2024
@prko prko changed the title add .bounds_ method to s.scope and change resizing behaviour add .bounds_ method to s.scope May 3, 2024
@prko prko mentioned this pull request May 3, 2024
4 tasks
@prko
Copy link
Contributor Author

prko commented May 3, 2024

Done!

Now I see the benefit of following your and @jrsurge's advice! This PR is also the best for me, as I know at a glance what I have done here!

@mtmccrea mtmccrea changed the title add .bounds_ method to s.scope add .bounds_ method to Stethoscope May 4, 2024
@mtmccrea
Copy link
Member

mtmccrea commented May 4, 2024

Please add documentation for the added method.

Note for the description of the argument that:
rect can be a Rect or anything that responds to .asRect.

For example the scope bounds can be set with:

s.scope.bounds_(Rect(100, 200, 500, 600));
s.scope.bounds_([100, 200, 500, 600]);
s.scope.bounds_(Size(500, 600));

@prko
Copy link
Contributor Author

prko commented May 5, 2024

@mtmccrea

Please add documentation for the added method.

Done!

Thanks for the instructions, and sorry for my clumsy process. A few days ago, I merged by clicking update on each of the outdated branches... So the histories are very dirty. In the future, I will do what you wrote on the wiki.

Copy link
Member

@telephon telephon left a comment

Choose a reason for hiding this comment

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

an object with a setter should also have a getter.

METHOD:: bounds
The position and size of the window. The position is relative to the bottom-left corner of the screen.
argument::
A Rect, a Point interpreted link::Classes/Point#-asRect#.asRect:: or anything that responds to it.
Copy link
Member

@mtmccrea mtmccrea May 5, 2024

Choose a reason for hiding this comment

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

UsingPoint perhaps isn't the best example since, although that's valid, specifying a Point implicitly sets the position to [0,0]. I think omitting an example in the arg description is ok, since you provide examples below anyway.

Something like:

A link::Classes/Rect::, or any object responding to the link::Search#-asRect:: method.

(suggestion untested in the renderer)

As an aside I think Point:-asRect is rather counterintuitive (a point is a position) compared to, say, Size:-asRect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have done!
39802c6

@mtmccrea
Copy link
Member

mtmccrea commented May 5, 2024

an object with a setter should also have a getter.

Good point! I noticed the method documentation listed a return value, though there isn't yet actually a getter method.

- setter bounds_ now has a message if the width is less than 264.
- Added getter bounds.
@prko
Copy link
Contributor Author

prko commented May 5, 2024

@telephon @mtmccrea

an object with a setter should also have a getter.
Good point! I noticed the method documentation listed a return value, though there isn't yet actually a getter method.

I thought about it too! Thank you very much. I have done that.
I also added a message if the width of a Rect is less than the minimum value of 264:
7ea3085

prko added 2 commits May 5, 2024 23:50
- Go to subsection Show
- Correct the argument description
- add about width change to the argument description
- rearrange examples
change display text for link::Search#asRect::
@mtmccrea

This comment was marked as outdated.

@JordanHendersonMusic JordanHendersonMusic added the comp: class library SC class library label May 7, 2024
@prko
Copy link
Contributor Author

prko commented May 11, 2024

@mtmccrea thanks!!!

@telephon telephon merged commit 85eec27 into supercollider:develop May 30, 2024
20 of 21 checks passed
JordanHendersonMusic pushed a commit to JordanHendersonMusic/supercollider that referenced this pull request Jun 3, 2024
add .bounds_ method to Stethoscope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: class library SC class library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants