e_mixer: ui uses e_mod_mixer_channel_is_mono

SVN revision: 83918
This commit is contained in:
Jérémy Zurcher 2013-02-14 20:28:31 +00:00
parent 0c42626d89
commit e648742e2d
2 changed files with 70 additions and 48 deletions

View File

@ -140,35 +140,24 @@ static void
_update_channel_editor_state(E_Mixer_App_Dialog_Data *app, const E_Mixer_Channel_State state)
{
struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor;
int disabled;
if (e_mod_mixer_channel_has_no_volume(app->channel_info))
if (!e_mod_mixer_channel_has_no_volume(app->channel_info))
{
disabled = 1;
e_widget_slider_value_int_set(ui->right, 0);
e_widget_slider_value_int_set(ui->right, 0);
if (e_mod_mixer_channel_is_mono(app->channel_info))
{
e_widget_slider_value_int_set(ui->left, state.left);
}
else
{
e_widget_slider_value_int_set(ui->left, state.left);
e_widget_slider_value_int_set(ui->right, state.right);
}
}
else
{
disabled = 0;
e_widget_slider_value_int_set(ui->left, state.left);
e_widget_slider_value_int_set(ui->right, state.right);
}
e_widget_disabled_set(ui->left, disabled);
e_widget_disabled_set(ui->right, disabled);
e_widget_disabled_set(ui->lock_sliders, disabled);
if (e_mod_mixer_channel_is_mutable(app->channel_info))
{
e_widget_disabled_set(ui->mute, 0);
e_widget_check_checked_set(ui->mute, state.mute);
}
else
{
e_widget_disabled_set(ui->mute, 1);
e_widget_check_checked_set(ui->mute, 0);
}
}
static void
@ -203,7 +192,40 @@ _populate_channel_editor(E_Mixer_App_Dialog_Data *app)
e_mod_mixer_state_get(app->sys, app->channel_info->id, &state);
_update_channel_editor_state(app, state);
app->lock_sliders = (state.left == state.right);
if (e_mod_mixer_channel_is_mutable(app->channel_info))
{
e_widget_disabled_set(ui->mute, 0);
}
else
{
e_widget_disabled_set(ui->mute, 1);
e_widget_check_checked_set(ui->mute, 0);
}
if (e_mod_mixer_channel_has_no_volume(app->channel_info))
{
app->lock_sliders = 1;
e_widget_slider_value_int_set(ui->left, 0);
e_widget_slider_value_int_set(ui->right, 0);
e_widget_disabled_set(ui->lock_sliders, 1);
e_widget_disabled_set(ui->left, 1);
e_widget_disabled_set(ui->right, 1);
}
else if (e_mod_mixer_channel_is_mono(app->channel_info))
{
app->lock_sliders = 0;
e_widget_slider_value_int_set(ui->right, 0);
e_widget_disabled_set(ui->lock_sliders, 1);
e_widget_disabled_set(ui->left, 0);
e_widget_disabled_set(ui->right, 1);
}
else
{
app->lock_sliders = (state.left == state.right);
e_widget_disabled_set(ui->lock_sliders, 0);
e_widget_disabled_set(ui->left, 0);
e_widget_disabled_set(ui->right, 0);
}
e_widget_check_checked_set(ui->lock_sliders, app->lock_sliders);
}

View File

@ -644,11 +644,12 @@ _mixer_popup_new(E_Mixer_Instance *inst)
state = &inst->mixer_state;
e_mod_mixer_state_get(inst->sys, inst->channel_info->id, state);
if ((state->right >= 0) &&
(inst->conf->show_locked || (!inst->conf->lock_sliders)))
colspan = 2;
else
if (e_mod_mixer_channel_has_no_volume(inst->channel_info) ||
e_mod_mixer_channel_is_mono(inst->channel_info) ||
(inst->conf->lock_sliders && !inst->conf->show_locked))
colspan = 1;
else
colspan = 2;
inst->popup = e_gadcon_popup_new(inst->gcc);
evas = inst->popup->win->evas;
@ -659,36 +660,35 @@ _mixer_popup_new(E_Mixer_Instance *inst)
e_widget_table_object_append(inst->ui.table, inst->ui.label,
0, 0, colspan, 1, 0, 0, 0, 0);
if (!e_mod_mixer_channel_has_no_volume(inst->channel_info))
if (colspan==1)
{
if (state->left >= 0)
if (e_mod_mixer_channel_has_no_volume(inst->channel_info))
{
inst->ui.left = _mixer_popup_add_slider(
inst, state->left, _mixer_popup_cb_volume_left_change);
inst->ui.left = _mixer_popup_add_slider(inst, 0, NULL);
e_widget_table_object_append(inst->ui.table, inst->ui.left,
0, 1, 1, 1, 1, 1, 1, 1);
e_slider_disabled_set(inst->ui.left, 1);
}
else
{
inst->ui.left = _mixer_popup_add_slider(inst, state->left,
_mixer_popup_cb_volume_left_change);
e_widget_table_object_append(inst->ui.table, inst->ui.left,
0, 1, 1, 1, 1, 1, 1, 1);
}
else
inst->ui.left = NULL;
if ((state->right >= 0) &&
(inst->conf->show_locked || (!inst->conf->lock_sliders)))
{
inst->ui.right = _mixer_popup_add_slider(
inst, state->right, _mixer_popup_cb_volume_right_change);
e_widget_table_object_append(inst->ui.table, inst->ui.right,
1, 1, 1, 1, 1, 1, 1, 1);
}
else
inst->ui.right = NULL;
inst->ui.right = NULL;
}
else
{
inst->ui.left = _mixer_popup_add_slider(inst, 0, NULL);
e_widget_table_object_append(inst->ui.table, inst->ui.left,
0, 1, 1, 1, 1, 1, 1, 1);
e_slider_disabled_set(inst->ui.left, 1);
inst->ui.right = NULL;
inst->ui.left = _mixer_popup_add_slider(inst, state->left,
_mixer_popup_cb_volume_left_change);
e_widget_table_object_append(inst->ui.table, inst->ui.left,
0, 1, 1, 1, 1, 1, 1, 1);
inst->ui.right = _mixer_popup_add_slider(inst, state->right,
_mixer_popup_cb_volume_right_change);
e_widget_table_object_append(inst->ui.table, inst->ui.right,
1, 1, 1, 1, 1, 1, 1, 1);
}
if (e_mod_mixer_channel_is_mutable(inst->channel_info))