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)
|
start_watching_for_parameter_changes(BControl* control, BParameter ¶meter)
|
||||||
{
|
{
|
||||||
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
||||||
if (roster != NULL) {
|
if (roster == NULL)
|
||||||
roster->StartWatching(control, parameter.Web()->Node(),
|
return;
|
||||||
B_MEDIA_NEW_PARAMETER_VALUE);
|
|
||||||
|
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,11 +185,12 @@ static void
|
|||||||
stop_watching_for_parameter_changes(BControl* control, BParameter ¶meter)
|
stop_watching_for_parameter_changes(BControl* control, BParameter ¶meter)
|
||||||
{
|
{
|
||||||
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
||||||
if (roster != NULL) {
|
if (roster == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
roster->StopWatching(control, parameter.Web()->Node(),
|
roster->StopWatching(control, parameter.Web()->Node(),
|
||||||
B_MEDIA_NEW_PARAMETER_VALUE);
|
B_MEDIA_NEW_PARAMETER_VALUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
@ -296,6 +302,9 @@ CheckBox::~CheckBox()
|
|||||||
void
|
void
|
||||||
CheckBox::AttachedToWindow()
|
CheckBox::AttachedToWindow()
|
||||||
{
|
{
|
||||||
|
BCheckBox::AttachedToWindow();
|
||||||
|
|
||||||
|
SetTarget(this);
|
||||||
start_watching_for_parameter_changes(this, fParameter);
|
start_watching_for_parameter_changes(this, fParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,6 +332,9 @@ OptionPopUp::~OptionPopUp()
|
|||||||
void
|
void
|
||||||
OptionPopUp::AttachedToWindow()
|
OptionPopUp::AttachedToWindow()
|
||||||
{
|
{
|
||||||
|
BOptionPopUp::AttachedToWindow();
|
||||||
|
|
||||||
|
SetTarget(this);
|
||||||
start_watching_for_parameter_changes(this, fParameter);
|
start_watching_for_parameter_changes(this, fParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,6 +362,9 @@ Slider::~Slider()
|
|||||||
void
|
void
|
||||||
Slider::AttachedToWindow()
|
Slider::AttachedToWindow()
|
||||||
{
|
{
|
||||||
|
BSlider::AttachedToWindow();
|
||||||
|
|
||||||
|
SetTarget(this);
|
||||||
start_watching_for_parameter_changes(this, fParameter);
|
start_watching_for_parameter_changes(this, fParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,9 +392,10 @@ ChannelSlider::~ChannelSlider()
|
|||||||
void
|
void
|
||||||
ChannelSlider::AttachedToWindow()
|
ChannelSlider::AttachedToWindow()
|
||||||
{
|
{
|
||||||
start_watching_for_parameter_changes(this, fParameter);
|
|
||||||
|
|
||||||
BChannelSlider::AttachedToWindow();
|
BChannelSlider::AttachedToWindow();
|
||||||
|
|
||||||
|
SetTarget(this);
|
||||||
|
start_watching_for_parameter_changes(this, fParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user