-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Serial/network monitor and editor console dynamic font size hotkeys and improved updating #8704
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
Add "CTRL =" as additional shortcut to increase the editor font size. This shortcut should be added because the '+' and '=' characters are often on the same key on the keyboard and having to press SHIFT as well is not intuitive for all users (especially since many common applications support "CTRL =").
Add CTRL +/- and CTRL scroll shortcuts to increase/decrease serial/network monitor output text size. This font size is shared with the editor and adjusting either will update both. Partially fixes arduino#8615
No functional changes: - Fix compiler/IDE warnings in monitor classes. - Replace listeners to use lambda classes where convenient in monitor classes. - Code cleanup.
Make the editor console font properly update with editor font size changes. Before this commit, only newly added text would have an adjusted size, making it possible to have multiple text sizes in the editor console.
Add CTRL +/- and CTRL scroll shortcuts to increase/decrease editor console output text size. This font size is shared with the editor and serial/network monitor. Adjusting the font size on any of these will update them all. Partially fixes arduino#8615.
@ArduinoBot build this please
✅ Build completed.
Please test this code using one of the following:
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8704-BUILD-848-linux32.tar.xz
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8704-BUILD-848-linux64.tar.xz
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8704-BUILD-848-windows.zip
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8704-BUILD-848-macosx.zip
⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-8704-BUILD-848-linuxarm.tar.xz
i️ The linuxarm
build is still experimental and may not be always available.
- Move editor font resize listener code to the Base class. - Cache and share the same listener for all components.
Now I have a failing test here:
[javac] Compiling 41 source files to <http://jenkins.arduino.cc:8080/job/arduino-linux64/ws/app/test-bin>
[javac] <http://jenkins.arduino.cc:8080/job/arduino-linux64/ws/app/test/processing/app/UpdateTextAreaActionTest.java>:17: error: constructor AbstractTextMonitor in class AbstractTextMonitor cannot be applied to given types;
[javac] super(boardPort);
[javac] ^
[javac] required: Base,BoardPort
[javac] found: BoardPort
[javac] reason: actual and formal argument lists differ in length
[javac] 1 error
I'm wondering if passing Base in the constructor is the correct thing to do.
@cmaglie Ah I see, for some reason I didn't have app/test
added as a source directory. Usually, I would use Mockito to create a mock object for the Base
class and pass this in the test. However, this project does not have Mockito as a dependency. How do you think about adding Mockito as a dependency to support JUnit tests and increase testability? Another option would be to allow a null Base
in the constructor and do not add these listeners in this case.
Either options looks good to me (Mockito and checking for null
-ness of Base).
I was wondering about a third option: now AbstractTextMonitor
depends on Base because it has to call this method base.addEditorFontResizeListeners(...)
, what about inverting the dependency, for example we could add a addMouseWheelListener(..)
method to AbstractTextMonitor
and call it from the outside (where the monitor is created) to set the wheel listener.
Also, now that I'm thinking more about it, AbstractTextMonitor
is a JFrame that is in turn a Component
, it should already have this method.
afbeelding
These changes combined cause the editor, editor console, serial monitor and network monitor to share their font in such a way that the font size can be updated using CTRL +/-/scroll in these elements and the new font size immediately applies to all these elements on change.
Fixes #8615.
Outdates #8698 (this is added to this PR).