ArdourButton: add text for measuring decoupled from display text
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Sat, 20 Aug 2016 13:46:41 +0000 (15:46 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Sat, 20 Aug 2016 14:00:46 +0000 (16:00 +0200)
commitf108bf1373f8fdcf4c5a712756281ac265825b71
tree3ad7aa7e879a80e1dd43b09b70f1822760d267ac
parent23ccf48c28c042a8cb11fecd47196132fc657a7a
ArdourButton: add text for measuring decoupled from display text

In the normal course of events, an ArdourButton requests just enough
space to display its elements. In particular the size will change when
the text does. Yet, in several cases it is better to avoid layout jittering; until now ArdourButton users manually set a static size on the button at creation time.

Introduce new API to set the text used for measuring the button size
separately from the text that will be displayed. In most cases this
enables the callers to replace

    set_size_request_to_display_given_text(button, text, w, h);

where w and h were hard-coded to cater for other button elements, by

    button.set_sizing_text(text);

which will make ArdourButton correctly compute the size request in all
cases with its real elements and padding. ArdourButton users can call

    button.set_sizing_text("");

to get the size request depend on displayed text (which is the default).
gtk2_ardour/ardour_button.cc
gtk2_ardour/ardour_button.h