2008-07-31 20:08:16 -07:00
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2010-01-08 13:43:27 -08:00
|
|
|
extern const char _e_mixer_Name[];
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
typedef struct E_Mixer_App_Dialog_Data
|
|
|
|
{
|
2012-08-24 06:57:22 -07:00
|
|
|
E_Mixer_System *sys;
|
2013-03-01 00:37:22 -08:00
|
|
|
const char *sys_card_name;
|
2012-08-24 06:57:22 -07:00
|
|
|
const char *channel_name;
|
|
|
|
int lock_sliders;
|
|
|
|
Eina_List *cards;
|
2013-02-25 07:05:41 -08:00
|
|
|
Eina_List *channel_infos;
|
2013-02-23 15:53:31 -08:00
|
|
|
E_Mixer_Channel_Info *channel_info;
|
2008-07-31 20:08:16 -07:00
|
|
|
E_Mixer_Channel_State state;
|
|
|
|
|
|
|
|
struct e_mixer_app_ui
|
2009-04-17 13:13:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *hlayout;
|
|
|
|
struct e_mixer_app_ui_cards
|
|
|
|
{
|
|
|
|
Evas_Object *frame;
|
|
|
|
Evas_Object *list;
|
|
|
|
} cards;
|
|
|
|
struct e_mixer_app_ui_channels
|
|
|
|
{
|
|
|
|
Evas_Object *frame;
|
|
|
|
Evas_Object *list;
|
|
|
|
} channels;
|
|
|
|
struct e_mixer_app_ui_channel_editor
|
|
|
|
{
|
|
|
|
Evas_Object *frame;
|
|
|
|
Evas_Object *label_card;
|
|
|
|
Evas_Object *card;
|
|
|
|
Evas_Object *label_channel;
|
|
|
|
Evas_Object *channel;
|
|
|
|
Evas_Object *label_type;
|
|
|
|
Evas_Object *type;
|
|
|
|
Evas_Object *label_left;
|
|
|
|
Evas_Object *left;
|
|
|
|
Evas_Object *label_right;
|
|
|
|
Evas_Object *right;
|
|
|
|
Evas_Object *mute;
|
|
|
|
Evas_Object *lock_sliders;
|
|
|
|
} channel_editor;
|
|
|
|
} ui;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
struct
|
2009-04-17 13:13:17 -07:00
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
void (*func)(E_Dialog *dialog, void *data);
|
|
|
|
} del;
|
2008-07-31 20:08:16 -07:00
|
|
|
} E_Mixer_App_Dialog_Data;
|
|
|
|
|
|
|
|
static void
|
2010-03-10 13:54:23 -08:00
|
|
|
_cb_changed_left(void *data, Evas_Object *obj __UNUSED__)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
|
|
|
E_Mixer_App_Dialog_Data *app = data;
|
|
|
|
E_Mixer_Channel_State *state;
|
|
|
|
|
|
|
|
state = &app->state;
|
|
|
|
if (app->lock_sliders && (state->left != state->right))
|
2010-03-10 13:54:23 -08:00
|
|
|
{
|
2012-08-24 06:57:22 -07:00
|
|
|
state->right = state->left;
|
|
|
|
e_widget_slider_value_int_set(app->ui.channel_editor.right,
|
|
|
|
state->right);
|
2010-03-10 13:54:23 -08:00
|
|
|
}
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-02-27 06:24:30 -08:00
|
|
|
e_mod_mixer_volume_set(app->sys, app->channel_info,
|
2012-08-24 06:57:22 -07:00
|
|
|
state->left, state->right);
|
2008-07-31 20:08:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-10 13:54:23 -08:00
|
|
|
_cb_changed_right(void *data, Evas_Object *obj __UNUSED__)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
|
|
|
E_Mixer_App_Dialog_Data *app = data;
|
|
|
|
E_Mixer_Channel_State *state;
|
|
|
|
|
|
|
|
state = &app->state;
|
|
|
|
if (app->lock_sliders && (state->right != state->left))
|
2010-03-10 13:54:23 -08:00
|
|
|
{
|
2012-08-24 06:57:22 -07:00
|
|
|
state->left = state->right;
|
|
|
|
e_widget_slider_value_int_set(app->ui.channel_editor.left,
|
|
|
|
state->left);
|
2010-03-10 13:54:23 -08:00
|
|
|
}
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-02-27 06:24:30 -08:00
|
|
|
e_mod_mixer_volume_set(app->sys, app->channel_info,
|
2012-08-24 06:57:22 -07:00
|
|
|
state->left, state->right);
|
2008-07-31 20:08:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-10 13:54:23 -08:00
|
|
|
_cb_changed_mute(void *data, Evas_Object *obj __UNUSED__)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
|
|
|
E_Mixer_App_Dialog_Data *app = data;
|
|
|
|
|
2013-02-27 06:24:30 -08:00
|
|
|
e_mod_mixer_mute_set(app->sys, app->channel_info, app->state.mute);
|
2008-07-31 20:08:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-10 13:54:23 -08:00
|
|
|
_cb_changed_lock_sliders(void *data, Evas_Object *obj __UNUSED__)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
|
|
|
E_Mixer_App_Dialog_Data *app = data;
|
|
|
|
E_Mixer_Channel_State *state;
|
|
|
|
|
|
|
|
if (!app->lock_sliders)
|
2010-03-10 13:54:23 -08:00
|
|
|
return;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
state = &app->state;
|
|
|
|
if (state->left == state->right)
|
2010-03-10 13:54:23 -08:00
|
|
|
return;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
state->left = state->right = (state->left + state->right) / 2;
|
|
|
|
|
|
|
|
e_widget_slider_value_int_set(app->ui.channel_editor.left, state->left);
|
|
|
|
e_widget_slider_value_int_set(app->ui.channel_editor.right, state->right);
|
2013-02-27 06:24:30 -08:00
|
|
|
e_mod_mixer_volume_set(app->sys, app->channel_info,
|
2012-08-24 06:57:22 -07:00
|
|
|
state->left, state->right);
|
2008-07-31 20:08:16 -07:00
|
|
|
}
|
|
|
|
|
2012-12-20 20:48:18 -08:00
|
|
|
static void
|
|
|
|
_disable_channel_editor(E_Mixer_App_Dialog_Data *app)
|
|
|
|
{
|
|
|
|
struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor;
|
|
|
|
|
|
|
|
e_widget_entry_text_set(ui->card, "");
|
|
|
|
e_widget_entry_text_set(ui->channel, "");
|
|
|
|
e_widget_entry_text_set(ui->type, "");
|
|
|
|
|
|
|
|
e_widget_slider_value_int_set(ui->left, 0);
|
|
|
|
e_widget_slider_value_int_set(ui->right, 0);
|
|
|
|
e_widget_check_checked_set(ui->mute, 0);
|
|
|
|
e_widget_check_checked_set(ui->lock_sliders, 0);
|
|
|
|
|
|
|
|
e_widget_disabled_set(ui->left, 1);
|
|
|
|
e_widget_disabled_set(ui->right, 1);
|
|
|
|
e_widget_disabled_set(ui->mute, 1);
|
|
|
|
e_widget_disabled_set(ui->lock_sliders, 1);
|
|
|
|
}
|
|
|
|
|
2008-07-31 20:08:16 -07:00
|
|
|
static void
|
|
|
|
_update_channel_editor_state(E_Mixer_App_Dialog_Data *app, const E_Mixer_Channel_State state)
|
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-02-28 14:09:58 -08:00
|
|
|
if (!e_mod_mixer_channel_has_no_volume(app->channel_info))
|
2013-02-16 19:31:45 -08:00
|
|
|
{
|
2013-02-28 14:09:58 -08:00
|
|
|
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);
|
|
|
|
}
|
2013-02-16 19:31:45 -08:00
|
|
|
}
|
2013-02-28 14:09:58 -08:00
|
|
|
|
|
|
|
if (e_mod_mixer_channel_is_mutable(app->channel_info))
|
|
|
|
e_widget_check_checked_set(ui->mute, state.mute);
|
2008-07-31 20:08:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_populate_channel_editor(E_Mixer_App_Dialog_Data *app)
|
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor;
|
2008-07-31 20:08:16 -07:00
|
|
|
E_Mixer_Channel_State state;
|
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
if ((!app->sys_card_name) || (!app->channel_name))
|
2012-12-20 20:48:18 -08:00
|
|
|
{
|
|
|
|
_disable_channel_editor(app);
|
|
|
|
return;
|
|
|
|
}
|
2013-02-14 12:27:46 -08:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
e_widget_entry_text_set(ui->card, app->sys_card_name);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_entry_text_set(ui->channel, app->channel_name);
|
|
|
|
|
2013-02-28 14:09:58 -08:00
|
|
|
if (e_mod_mixer_channel_is_boost(app->channel_info))
|
|
|
|
e_widget_entry_text_set(ui->type, _("Boost"));
|
|
|
|
else if (e_mod_mixer_channel_has_playback(app->channel_info))
|
|
|
|
e_widget_entry_text_set(ui->type, _("Playback"));
|
|
|
|
else if (e_mod_mixer_channel_has_capture(app->channel_info))
|
2013-02-16 19:31:45 -08:00
|
|
|
e_widget_entry_text_set(ui->type, _("Capture"));
|
2008-07-31 20:08:16 -07:00
|
|
|
else
|
2013-02-28 14:09:58 -08:00
|
|
|
e_widget_entry_text_set(ui->type, _("Switch"));
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-02-27 06:24:30 -08:00
|
|
|
e_mod_mixer_state_get(app->sys, app->channel_info, &state);
|
2008-07-31 20:08:16 -07:00
|
|
|
_update_channel_editor_state(app, state);
|
|
|
|
|
2013-02-28 14:09:58 -08:00
|
|
|
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);
|
|
|
|
}
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_check_checked_set(ui->lock_sliders, app->lock_sliders);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_channel_selected(void *data)
|
|
|
|
{
|
2013-02-23 15:53:31 -08:00
|
|
|
E_Mixer_Channel_Info *info = data;
|
2008-07-31 20:08:16 -07:00
|
|
|
E_Mixer_App_Dialog_Data *app;
|
|
|
|
|
|
|
|
app = info->app;
|
|
|
|
app->channel_info = info;
|
|
|
|
_populate_channel_editor(app);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-03-10 13:54:23 -08:00
|
|
|
_cb_system_update(void *data, E_Mixer_System *sys __UNUSED__)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
E_Mixer_App_Dialog_Data *app = data;
|
2008-07-31 20:08:16 -07:00
|
|
|
E_Mixer_Channel_State state;
|
|
|
|
|
|
|
|
if ((!app->sys) || (!app->channel_info))
|
2010-03-10 13:54:23 -08:00
|
|
|
return 1;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-02-27 06:24:30 -08:00
|
|
|
e_mod_mixer_state_get(app->sys, app->channel_info, &state);
|
2008-07-31 20:08:16 -07:00
|
|
|
_update_channel_editor_state(app, state);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_populate_channels(E_Mixer_App_Dialog_Data *app)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2008-07-31 20:08:16 -07:00
|
|
|
Evas_Object *ilist;
|
|
|
|
int header_input;
|
2013-03-01 00:37:22 -08:00
|
|
|
int i, selected;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
ilist = app->ui.channels.list;
|
|
|
|
edje_freeze();
|
|
|
|
e_widget_ilist_freeze(ilist);
|
|
|
|
e_widget_ilist_clear(ilist);
|
|
|
|
|
|
|
|
if (app->sys)
|
2011-09-23 00:56:05 -07:00
|
|
|
e_mod_mixer_del(app->sys);
|
2013-03-01 00:37:22 -08:00
|
|
|
app->sys = e_mod_mixer_new(app->sys_card_name);
|
2011-09-23 00:56:05 -07:00
|
|
|
if (_mixer_using_default)
|
2013-02-16 19:31:45 -08:00
|
|
|
e_mixer_system_callback_set(app->sys, _cb_system_update, app);
|
|
|
|
|
2013-02-25 07:05:41 -08:00
|
|
|
if (app->channel_infos)
|
|
|
|
e_mod_mixer_channel_infos_free(app->channel_infos);
|
|
|
|
app->channel_infos = e_mod_mixer_channel_infos_get(app->sys);
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-02-28 14:09:58 -08:00
|
|
|
i = 0;
|
2013-03-01 00:37:22 -08:00
|
|
|
selected = 0;
|
2013-02-28 14:09:58 -08:00
|
|
|
header_input = 0;
|
2013-02-25 07:05:41 -08:00
|
|
|
for (l = app->channel_infos; l; l = l->next, i++)
|
2013-02-16 19:31:45 -08:00
|
|
|
{
|
2013-02-23 15:53:31 -08:00
|
|
|
E_Mixer_Channel_Info *info = l->data;
|
2011-09-06 20:54:58 -07:00
|
|
|
|
2013-02-28 14:09:58 -08:00
|
|
|
if (header_input != e_mod_mixer_channel_group_get(info))
|
2011-09-06 20:54:58 -07:00
|
|
|
{
|
2013-02-28 14:09:58 -08:00
|
|
|
if (e_mod_mixer_channel_is_boost(info))
|
|
|
|
e_widget_ilist_header_append(ilist, NULL, _("Boost"));
|
|
|
|
else if (e_mod_mixer_channel_has_playback(info))
|
|
|
|
e_widget_ilist_header_append(ilist, NULL, _("Playback"));
|
|
|
|
else if (e_mod_mixer_channel_has_capture(info))
|
|
|
|
e_widget_ilist_header_append(ilist, NULL, _("Capture"));
|
|
|
|
else
|
|
|
|
e_widget_ilist_header_append(ilist, NULL, _("Switch"));
|
|
|
|
header_input = e_mod_mixer_channel_group_get(info);
|
2011-09-06 20:54:58 -07:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->app = app;
|
|
|
|
e_widget_ilist_append(ilist, NULL, info->name, _cb_channel_selected,
|
2012-08-24 06:57:22 -07:00
|
|
|
info, info->name);
|
2013-03-01 00:37:22 -08:00
|
|
|
if ((selected == 0) && app->channel_name && info->name &&
|
2012-08-24 06:57:22 -07:00
|
|
|
(strcmp(app->channel_name, info->name) == 0))
|
2011-09-06 20:54:58 -07:00
|
|
|
{
|
|
|
|
e_widget_ilist_selected_set(ilist, i);
|
|
|
|
app->channel_info = info;
|
2013-03-01 00:37:22 -08:00
|
|
|
selected = 1;
|
2011-09-06 20:54:58 -07:00
|
|
|
}
|
2010-03-10 13:54:23 -08:00
|
|
|
}
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
if ((selected == 0) && (i > 0))
|
|
|
|
e_widget_ilist_selected_set(ilist, 0);
|
|
|
|
else
|
|
|
|
app->channel_name = NULL;
|
|
|
|
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_ilist_go(ilist);
|
|
|
|
e_widget_ilist_thaw(ilist);
|
|
|
|
edje_thaw();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_card_selected(void *data)
|
|
|
|
{
|
2013-03-01 00:37:22 -08:00
|
|
|
_populate_channels(data);
|
2008-07-31 20:08:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-10 13:54:23 -08:00
|
|
|
_create_cards(E_Dialog *dialog __UNUSED__, Evas *evas, E_Mixer_App_Dialog_Data *app)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
struct e_mixer_app_ui_cards *ui = &app->ui.cards;
|
2009-03-11 08:13:42 -07:00
|
|
|
const char *card;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *l;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-02-25 05:15:19 -08:00
|
|
|
app->cards = e_mod_mixer_card_names_get();
|
2008-10-22 04:49:33 -07:00
|
|
|
if (eina_list_count(app->cards) < 2)
|
2010-03-10 13:54:23 -08:00
|
|
|
return;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
ui->list = e_widget_ilist_add(evas, 32, 32, &app->sys_card_name);
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_set(ui->list, 180, 100);
|
2008-10-17 22:15:03 -07:00
|
|
|
e_widget_ilist_go(ui->list);
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FOREACH(app->cards, l, card)
|
2010-03-10 13:54:23 -08:00
|
|
|
{
|
2012-08-24 06:57:22 -07:00
|
|
|
const char *card_name;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2012-08-24 06:57:22 -07:00
|
|
|
card_name = e_mod_mixer_card_name_get(card);
|
2013-02-14 12:27:46 -08:00
|
|
|
|
2012-09-13 17:33:36 -07:00
|
|
|
if (!card_name)
|
|
|
|
continue;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2012-08-24 06:57:22 -07:00
|
|
|
e_widget_ilist_append(ui->list, NULL, card_name, _cb_card_selected,
|
|
|
|
app, card);
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2012-08-24 06:57:22 -07:00
|
|
|
eina_stringshare_del(card_name);
|
2010-03-10 13:54:23 -08:00
|
|
|
}
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->frame = e_widget_framelist_add(evas, _("Cards"), 0);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_framelist_object_append(ui->frame, ui->list);
|
|
|
|
e_widget_list_object_append(app->ui.hlayout, ui->frame, 1, 0, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-10 13:54:23 -08:00
|
|
|
_create_channels(E_Dialog *dialog __UNUSED__, Evas *evas, E_Mixer_App_Dialog_Data *app)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
struct e_mixer_app_ui_channels *ui = &app->ui.channels;
|
2008-07-31 20:08:16 -07:00
|
|
|
ui->list = e_widget_ilist_add(evas, 24, 24, &app->channel_name);
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_set(ui->list, 180, 100);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_ilist_go(ui->list);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->frame = e_widget_framelist_add(evas, _("Channels"), 0);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_framelist_object_append(ui->frame, ui->list);
|
|
|
|
e_widget_list_object_append(app->ui.hlayout, ui->frame, 1, 1, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-10 13:54:23 -08:00
|
|
|
_create_channel_editor(E_Dialog *dialog __UNUSED__, Evas *evas, E_Mixer_App_Dialog_Data *app)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
struct e_mixer_app_ui_channel_editor *ui = &app->ui.channel_editor;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->label_card = e_widget_label_add(evas, _("Card:"));
|
2008-07-31 20:08:16 -07:00
|
|
|
ui->card = e_widget_entry_add(evas, NULL, NULL, NULL, NULL);
|
|
|
|
e_widget_entry_readonly_set(ui->card, 1);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->label_channel = e_widget_label_add(evas, _("Channel:"));
|
2008-07-31 20:08:16 -07:00
|
|
|
ui->channel = e_widget_entry_add(evas, NULL, NULL, NULL, NULL);
|
|
|
|
e_widget_entry_readonly_set(ui->channel, 1);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->label_type = e_widget_label_add(evas, _("Type:"));
|
2008-07-31 20:08:16 -07:00
|
|
|
ui->type = e_widget_entry_add(evas, NULL, NULL, NULL, NULL);
|
|
|
|
e_widget_entry_readonly_set(ui->type, 1);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->label_left = e_widget_label_add(evas, _("Left:"));
|
2008-07-31 20:08:16 -07:00
|
|
|
ui->left = e_widget_slider_add(evas, 1, 0, "%3.0f", 0.0, 100.0, 10.0, 100.0,
|
2009-04-17 13:13:17 -07:00
|
|
|
NULL, &app->state.left, 150);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_on_change_hook_set(ui->left, _cb_changed_left, app);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->label_right = e_widget_label_add(evas, _("Right:"));
|
2008-07-31 20:08:16 -07:00
|
|
|
ui->right = e_widget_slider_add(evas, 1, 0, "%3.0f", 0.0, 100.0, 10.0, 100.0,
|
2009-04-17 13:13:17 -07:00
|
|
|
NULL, &app->state.right, 150);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_on_change_hook_set(ui->right, _cb_changed_right, app);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->mute = e_widget_check_add(evas, _("Mute"), &app->state.mute);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_on_change_hook_set(ui->mute, _cb_changed_mute, app);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->lock_sliders = e_widget_check_add(evas, _("Lock Sliders"),
|
2009-04-17 13:13:17 -07:00
|
|
|
&app->lock_sliders);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_on_change_hook_set(ui->lock_sliders, _cb_changed_lock_sliders, app);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
ui->frame = e_widget_framelist_add(evas, _("Edit"), 0);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_widget_framelist_object_append(ui->frame, ui->label_card);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->card);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->label_channel);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->channel);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->label_type);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->type);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->label_left);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->left);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->label_right);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->right);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->mute);
|
|
|
|
e_widget_framelist_object_append(ui->frame, ui->lock_sliders);
|
|
|
|
|
|
|
|
e_widget_list_object_append(app->ui.hlayout, ui->frame, 1, 1, 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_create_ui(E_Dialog *dialog, E_Mixer_App_Dialog_Data *app)
|
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
struct e_mixer_app_ui *ui = &app->ui;
|
2008-07-31 20:08:16 -07:00
|
|
|
Evas *evas;
|
|
|
|
int mw, mh;
|
|
|
|
|
|
|
|
evas = e_win_evas_get(dialog->win);
|
|
|
|
|
|
|
|
ui->hlayout = e_widget_list_add(evas, 0, 1);
|
|
|
|
_create_cards(dialog, evas, app);
|
|
|
|
_create_channels(dialog, evas, app);
|
|
|
|
_create_channel_editor(dialog, evas, app);
|
|
|
|
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_get(ui->hlayout, &mw, &mh);
|
2008-07-31 20:08:16 -07:00
|
|
|
if (mw < 300)
|
2010-03-10 13:54:23 -08:00
|
|
|
mw = 300;
|
2008-07-31 20:08:16 -07:00
|
|
|
if (mh < 200)
|
2010-03-10 13:54:23 -08:00
|
|
|
mh = 200;
|
2008-07-31 20:08:16 -07:00
|
|
|
e_dialog_content_set(dialog, ui->hlayout, mw, mh);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_mixer_app_dialog_del(E_Dialog *dialog, E_Mixer_App_Dialog_Data *app)
|
|
|
|
{
|
2014-01-14 19:36:27 -08:00
|
|
|
if (!app)
|
|
|
|
return;
|
|
|
|
|
2008-07-31 20:08:16 -07:00
|
|
|
if (app->del.func)
|
2010-03-10 13:54:23 -08:00
|
|
|
app->del.func(dialog, app->del.data);
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
if ((!app->ui.cards.list) && (app->ui.channels.list))
|
|
|
|
eina_stringshare_del(app->sys_card_name);
|
|
|
|
|
2008-07-31 20:08:16 -07:00
|
|
|
if (app->cards)
|
2013-02-25 05:15:19 -08:00
|
|
|
e_mod_mixer_card_names_free(app->cards);
|
2013-02-25 07:05:41 -08:00
|
|
|
if (app->channel_infos)
|
|
|
|
e_mod_mixer_channel_infos_free(app->channel_infos);
|
2011-09-23 00:56:05 -07:00
|
|
|
e_mod_mixer_del(app->sys);
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
e_util_defer_object_del(E_OBJECT(dialog));
|
|
|
|
dialog->data = NULL;
|
|
|
|
E_FREE(app);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_win_del(E_Win *win)
|
|
|
|
{
|
2010-03-10 13:54:23 -08:00
|
|
|
E_Dialog *dialog = win->data;
|
|
|
|
E_Mixer_App_Dialog_Data *app = dialog->data;
|
2008-07-31 20:08:16 -07:00
|
|
|
_mixer_app_dialog_del(dialog, app);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_dialog_dismiss(void *data, E_Dialog *dialog)
|
|
|
|
{
|
|
|
|
_mixer_app_dialog_del(dialog, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
E_Dialog *
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_mixer_app_dialog_new(E_Comp *comp, void (*func)(E_Dialog *dialog, void *data), void *data)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
|
|
|
E_Mixer_App_Dialog_Data *app;
|
|
|
|
E_Dialog *dialog;
|
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
dialog = e_dialog_new(comp, _e_mixer_Name, "e_mixer_app_dialog");
|
2008-07-31 20:08:16 -07:00
|
|
|
if (!dialog)
|
2010-03-10 13:54:23 -08:00
|
|
|
return NULL;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
app = E_NEW(E_Mixer_App_Dialog_Data, 1);
|
|
|
|
if (!app)
|
2010-03-10 13:54:23 -08:00
|
|
|
{
|
2012-08-24 06:57:22 -07:00
|
|
|
e_object_del(E_OBJECT(dialog));
|
|
|
|
return NULL;
|
2010-03-10 13:54:23 -08:00
|
|
|
}
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
dialog->data = app;
|
|
|
|
app->del.data = data;
|
|
|
|
app->del.func = func;
|
|
|
|
|
2010-01-08 13:43:27 -08:00
|
|
|
e_dialog_title_set(dialog, _(_e_mixer_Name));
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
e_win_delete_callback_set(dialog->win, _cb_win_del);
|
|
|
|
|
|
|
|
_create_ui(dialog, app);
|
|
|
|
|
2008-08-25 12:10:07 -07:00
|
|
|
e_dialog_button_add(dialog, _("Close"), NULL, _cb_dialog_dismiss, app);
|
2008-07-31 20:08:16 -07:00
|
|
|
e_dialog_button_focus_num(dialog, 1);
|
|
|
|
e_win_centered_set(dialog->win, 1);
|
|
|
|
e_dialog_show(dialog);
|
2009-03-08 16:09:48 -07:00
|
|
|
e_dialog_border_icon_set(dialog, "preferences-desktop-mixer");
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2008-08-29 23:12:57 -07:00
|
|
|
// FIXME: what if module unloaded while mixer_app dialog up? bad!
|
2009-04-17 13:13:17 -07:00
|
|
|
|
2008-07-31 20:08:16 -07:00
|
|
|
return dialog;
|
|
|
|
}
|
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
int
|
|
|
|
e_mixer_app_dialog_select(E_Dialog *dialog, const char *sys_card_name, const char *channel_name)
|
2008-07-31 20:08:16 -07:00
|
|
|
{
|
2013-03-01 00:37:22 -08:00
|
|
|
int n, i;
|
2013-02-15 08:53:04 -08:00
|
|
|
Eina_List *l;
|
2013-03-01 00:37:22 -08:00
|
|
|
E_Mixer_App_Dialog_Data *app;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
if (!dialog)
|
2010-03-10 13:54:23 -08:00
|
|
|
return 0;
|
2013-02-14 12:27:46 -08:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
if ((!sys_card_name) || (!channel_name))
|
|
|
|
return 0;
|
2013-02-16 19:31:45 -08:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
app = dialog->data;
|
|
|
|
if (!app)
|
2010-03-10 13:54:23 -08:00
|
|
|
return 0;
|
2008-07-31 20:08:16 -07:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
n = -1;
|
|
|
|
for (i = 0, l = app->cards; l; i++, l = l->next)
|
2013-02-15 08:53:04 -08:00
|
|
|
{
|
2013-03-01 00:37:22 -08:00
|
|
|
if (strcmp(sys_card_name, l->data) == 0)
|
2013-02-16 19:31:45 -08:00
|
|
|
{
|
2013-03-01 00:37:22 -08:00
|
|
|
n = i;
|
|
|
|
break;
|
2013-02-16 19:31:45 -08:00
|
|
|
}
|
2013-02-15 08:53:04 -08:00
|
|
|
}
|
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
if (n < 0)
|
|
|
|
{
|
2014-01-14 19:36:27 -08:00
|
|
|
/* FIXME device disappeared, very bad !! */
|
2013-03-01 00:37:22 -08:00
|
|
|
return 0;
|
|
|
|
}
|
2013-02-16 19:31:45 -08:00
|
|
|
|
2013-03-01 00:37:22 -08:00
|
|
|
/* app->channel_name will be overriden by selection in _populate_channels */
|
|
|
|
app->channel_name = channel_name;
|
2013-02-16 19:31:45 -08:00
|
|
|
|
2008-07-31 20:08:16 -07:00
|
|
|
if (app->ui.cards.list)
|
2010-03-10 13:54:23 -08:00
|
|
|
e_widget_ilist_selected_set(app->ui.cards.list, n);
|
2013-03-01 00:37:22 -08:00
|
|
|
else if (app->ui.channels.list)
|
|
|
|
{
|
|
|
|
app->sys_card_name = eina_stringshare_add(sys_card_name);
|
|
|
|
_populate_channels(app);
|
|
|
|
}
|
2008-07-31 20:08:16 -07:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2012-08-24 06:57:22 -07:00
|
|
|
|