DefaultMediaTheme: Properly set control targets.
In removing the "GroupView" class and replacing it with a real BGroupView, I missed that it its AttachedToWindow() implementation iterated over all child controls and set their targets to themselves. It seems this is how the Media Kit gets change messages from them, and so the lack of this broke changing parameter values. Whoops. But it seems that changing menu option values has been broken for a long time (perhaps forever?), as in order for a BOptionPopUp to send messages to anything, its AttachedToWindow() must be called (as this sets the BMenuItem's targets to itself, so it can forward the messages.) So now that is fixed too.
This commit is contained in:
parent
132990ecdc
commit
4bf8cf7a1b
@ -169,9 +169,14 @@ static void
|
||||
start_watching_for_parameter_changes(BControl* control, BParameter ¶meter)
|
||||
{
|
||||
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
||||
if (roster != NULL) {
|
||||
roster->StartWatching(control, parameter.Web()->Node(),
|
||||
B_MEDIA_NEW_PARAMETER_VALUE);
|
||||
if (roster == NULL)
|
||||
return;
|
||||
|
||||
if (roster->StartWatching(control, parameter.Web()->Node(),
|
||||
B_MEDIA_NEW_PARAMETER_VALUE) != B_OK) {
|
||||
fprintf(stderr, "DefaultMediaTheme: Failed to start watching parameter"
|
||||
"\"%s\"\n", parameter.Name());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,10 +185,11 @@ static void
|
||||
stop_watching_for_parameter_changes(BControl* control, BParameter ¶meter)
|
||||
{
|
||||
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
||||
if (roster != NULL) {
|
||||
roster->StopWatching(control, parameter.Web()->Node(),
|
||||
B_MEDIA_NEW_PARAMETER_VALUE);
|
||||
}
|
||||
if (roster == NULL)
|
||||
return;
|
||||
|
||||
roster->StopWatching(control, parameter.Web()->Node(),
|
||||
B_MEDIA_NEW_PARAMETER_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@ -296,6 +302,9 @@ CheckBox::~CheckBox()
|
||||
void
|
||||
CheckBox::AttachedToWindow()
|
||||
{
|
||||
BCheckBox::AttachedToWindow();
|
||||
|
||||
SetTarget(this);
|
||||
start_watching_for_parameter_changes(this, fParameter);
|
||||
}
|
||||
|
||||
@ -323,6 +332,9 @@ OptionPopUp::~OptionPopUp()
|
||||
void
|
||||
OptionPopUp::AttachedToWindow()
|
||||
{
|
||||
BOptionPopUp::AttachedToWindow();
|
||||
|
||||
SetTarget(this);
|
||||
start_watching_for_parameter_changes(this, fParameter);
|
||||
}
|
||||
|
||||
@ -350,6 +362,9 @@ Slider::~Slider()
|
||||
void
|
||||
Slider::AttachedToWindow()
|
||||
{
|
||||
BSlider::AttachedToWindow();
|
||||
|
||||
SetTarget(this);
|
||||
start_watching_for_parameter_changes(this, fParameter);
|
||||
}
|
||||
|
||||
@ -377,9 +392,10 @@ ChannelSlider::~ChannelSlider()
|
||||
void
|
||||
ChannelSlider::AttachedToWindow()
|
||||
{
|
||||
start_watching_for_parameter_changes(this, fParameter);
|
||||
|
||||
BChannelSlider::AttachedToWindow();
|
||||
|
||||
SetTarget(this);
|
||||
start_watching_for_parameter_changes(this, fParameter);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user