-
Notifications
You must be signed in to change notification settings - Fork 295
Fixes to binarization adjust board #717
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
Conversation
…ge AND the original image file cannot be found. Previously, the program would throw an exception in this case because it would be calling Picture.adjustImageFormat() on the unexisting (null) image.
…able. It also checks to make sure the current view is ready before applying a repaint.
See my comments based on the code of your first PR (especially the use of Regarding this second PR, I think you made the right modifications to cope with no-longer-existing input files. I'd suggest a few minor code simplifications below.
instead of:
and same thing for the method
instead of:
|
I'm glad you gave your suggestions! I want to get this right.
Done!
Done! Sorry about that, I forgot to check that you had overwritten the equals method. Yours is a better way to do it.
Good point. How about the board is added, but only pre-selected if a gray source exists? If the board is not even added to the BoardsPane when a gray source does not exist, the user might think there is a bug, because a UI board they are used to having is suddenly completely missing. If the BinarizationAdjustBoard is at least added, and the user manually selects it, then they will see the reason that it cannot be used, ie, the message "No source image available for binarization" is displayed on the board.
Perfect, I was just going to ask you your suggestion for this. Unfortunately, I have to keep the empty onEvent method override because this method requires an implementation.
This is great! Those base classes are very convenient! Sorry for creating two pull requests. Is there a way to add another commit to this pull request? I feel like there should be, let me try it. |
Another thing: looking at the Binarization settings in the BookParameters pane in the options menu, I feel like you should keep it. The reason is that the options menu provides fine-grained control over global-scope, book-scope, and sheet-scope variables, so a user with a large book (with many sheets) would probably benefit from that. By contrast, the BinarizationAdjustBoard provides a quick way to change the current sheet and all sheets, but doesn't provide the sort of control of variable scopes that the BookParameters provides. Although I think this will be useful for most use cases, adding different scopes to this BinarizationAdjustBoard would make it overly complex (with too many apply buttons or options). So personally, I feel that you can keep both, since they do something similar, but in a different way. |
We can keep both entry points as you said.
We must however make sure that the modifications done "on the job" are persisted correctly in the hierarchy of parameters (the same ones used by book parameters dialog) |
Ok, I went back and made sure that the BookParameter settings and the BinarizationAdjustBoard settings are in sync. Here are the behaviors of the buttons on the BinarizationAdjustBoard: apply -> sets a sheet-level scoped filter on this sheet This way, the scopes and values work correctly, and are properly reflected in the BookParameters menu. |
…er key for apply, the reset button now resets the sheet to book-level scope values, and other issues from PR Audiveris#717
…er key for apply, the reset button now resets the sheet to book-level scope values, and other issues from PR Audiveris#717
[Re-phrasing and extending my comments sent by email]
OK for a multi-sheet book.
OK for a multi-sheet book.
I disagree here. For consistency, the button "Apply to all sheets" should be in fact named "Apply to whole book" I just checked the book parameters dialog:
Still for consistency, in BinarizationAdjustBoard for a single-sheet book:
|
Got it, I just finished adding in these details. I hadn't realized that the program treated single-sheet and multi-sheet books a little differently. See my new PR for details, and if you can think of anything else, let me know. |
Hi Herve! I used your feedback to make the improvements in PR #719. If you have any suggestions, let me know. |
…er key for apply, the reset button now resets the sheet to book-level scope values, and other issues from PR #717
…er key for apply, the reset button now resets the sheet to book-level scope values, and other issues from PR Audiveris#717
This update fixes the Binarization Adjust Board issues when opening files from .OMR.
1.) The method Picture.getGrayImage() previously would call adjustImageFormat() after trying to load the gray source. If the source was not available, it would throw an exception. I added a null check here so that this method can return null. This way, Picture.getSource(SourceKey.GRAY) will properly return null if the source is not available (which happens if an OMR is loaded which contains an invalid image file path).
2.) As a result of #1 above, the BinarizationAdjustBoard is now able to check for a gray source using Picture.getSource(SourceKey.GRAY), and if not found, it disables itself with a message to the user.
3.) Also as a result of #1 above, the original BinarizationBoard no longer causes an exception when it uses Picture.getSource() to check for a gray source.
4.) The BinarizationAdjustBoard also checks to make sure the SheetView is properly loaded before calling .repaint() on the component. Not checking this caused an issue when loading an OMR file (but not when loading directly from an input image).
I also rearranged the binarizationadjustboard methods to be in alphabetical order... sorry for making it harder to read.
Herve - if you think there is anything else I should address please tell me. I was looking at some other things, but wanted to get to this quickly since I would hate to introduce a bug.