benfry / processing4

Processing 4.x releases for Java 17
https://processing.org
Other
1.33k stars 239 forks source link

Feature Request: Editor Font Size using Command + and Command - #845

Open CubeOfCheese opened 1 month ago

CubeOfCheese commented 1 month ago

Description

Almost all editors/IDEs allow you to dynamically change your font size using Command + and Command - keyboard commands. As a teacher this is essential for me. I would like to use Processing in my computer science class, but if I can't dynamically resize my editor font, then I won't be able to effectively display code for the students in the back of my class. Going to preferences and adjusting it manually is not a sufficient solution because I need to be able to quickly switch between showing the general structure of the code and specific sections quickly. I hope I have clearly communicated why this feature is important.

Your Environment

Tsufael commented 1 month ago

Hi, I started working on a PR for this issue.

I thought about adding 2 font size control options to the Edit menu with the ctrl = and ctrl - shortcuts (meta = and meta - for mac) just after the indent options as in the picture:

fontSize

I'm not sure what's the proper way to make the text editor ignore the '=' and '-' keys when Ctrl/Meta is pressed though. Currently I'm adding an entry for those keys to public boolean handleTyped(KeyEvent event) in java/src/processing/mode/java/JavaInputHandler.java (that's the function that consumes VK_COMMA and VK_SPACE when used with ctrl).

However doing it that way doesn't feel right since no other menu shortcut has to do that. Could someone please point me to the right direction?

Also, would it be helpful to have the same feature for the console font size (maybe with Meta+Shift+= and Meta+Shift+-)?