mtytel / helm

Helm - a free polyphonic synth with lots of modulation
http://tytel.org/helm
GNU General Public License v3.0
2.36k stars 202 forks source link

Legato and porta type labels deform on maximized window in widescreen #302

Open ascopes opened 2 years ago

ascopes commented 2 years ago
Screenshot of the issue screenshot of the issue

Under Windows 10 Professional 21H2 19044.1766 AMD64, maximizing Helm at 3440x1440 (100% scaling in Windows) resolution results in the Legato and Porta-Type labels clipping off the edge of the panel they display within.

This appears to occur regardless of the display height. I am guessing these labels may just have layout boundaries that are slightly misconfigured, since other similar controls on the display seem to not have this issue.


Taking a look at the source code, I spotted what appears to be the code to define this:

dynamic_section.cpp

float space_x = (getWidth() - (knob_width + selector_width + text_width)) / 4.0f;
float space_y = (getHeight() - (knob_width + text_height)) / 2.0f;
float extra_text_space = 2 * (knob_width - text_height) / 3;

portamento_->setBounds(space_x, space_y, knob_width, knob_width);
portamento_type_->setBounds(knob_width + 2 * space_x, space_y + extra_text_space, selector_width, text_height);
legato_->setBounds(knob_width + selector_width + 3 * space_x, space_y + extra_text_space,  text_width, text_height);

In another file, I seem to have spotted a similar thing, but it is configured slightly differently:

voice_section.cpp

float space_x = (getWidth() - (3.0f * knob_width)) / 4.0f;
float space_y = (getHeight() - (knob_width + text_height)) / 2.0f;

polyphony_->setBounds(space_x, space_y, knob_width, knob_width);
pitch_bend_->setBounds(knob_width + 2 * space_x, space_y, knob_width, knob_width);
velocity_track_->setBounds(2 * knob_width + 3 * space_x, space_y, knob_width, knob_width);

My (very uninformed and probably wrong) guess here is that portamento_ is not adding the extra_text_space attribute, but portamento_type_ and legato_ both are, and this might not be necessary? Even if I try to coerce the window to fill to a portrait aspect ratio, I cannot get a situation where that extra_text_space does anything.

Screenshot of window on 1440x2560 monitor (portrait aspect ratio) screenshot of the issue

Would removing that extra_text_space entirely resolve this? If so, I can always put a PR up to fix this?