brummer10 / Fluida.lv2

Fluidsynth as LV2 plugin
GNU General Public License v2.0
33 stars 4 forks source link

Incorrect highlighting in instrument combobox when advancing instrument via click #20

Closed sebageek closed 1 year ago

sebageek commented 1 year ago

After loading a sf2, clicking on the instrument name in the instrument dropdown (when not unfolded) advances the dropdown to the next instrument and the correct instrument is displayed. When I now click the dropdown arrow the wrong instrument is highlighted. When I now select an instrument from the dropdown, the highlight is correct again.

I think this might be due to different handlers for when clicking to advance to next instruments and selecting from the dropdown, though after an hour of reading code I have not found the specific eventhandlers for this in Fluida / libxputty.

This came across me when I shuffled through several soundfont and, after clicking through it for a bit, wanted to know what's in "the general vicinity of the current instrument" (as they often have a similar sound), but was then only shown the instrument from which I started my "journey".

brummer10 commented 1 year ago

Yes, I noticed that as well was just to lazy to fix it. It's in /libxputty/xputty/widgets/xcombobox_private.c line 407 w->label = comboboxlist->list_names[v]; below that line we need comboboxlist->active_item = v; to set the active item in the list to correspondent with the selection. I need to do that in libxputty and then update the submodule in fluida.

sebageek commented 1 year ago

Tried it out, seems to work, nice!

Only downside GUI-wise now is that the highlighted item might scroll out of the visible dropdown. Maybe it would make sense to scroll the dropdown down to the highlighted item when it would go out of view (this of course does not happen when choosing via dropdown, as the selected item always has to be in view, i.e. the user needs to scroll to it). Anyway, not sure this is easily fixable.

brummer10 commented 1 year ago

I've pushed the fix to libxputty now and update it in Fluida. Should work now as expected.

sebageek commented 1 year ago

Highlighting and scrolling to active item look good, thanks!