Play sounds by number in stead of by name. Enable disabling specific sounds.

SVN revision: 38142
This commit is contained in:
Kim Woelders 2008-12-14 16:44:45 +00:00
parent 5f7a501b59
commit e42a80764f
31 changed files with 265 additions and 85 deletions

View File

@ -29,7 +29,7 @@
#include "alert.h" #include "alert.h"
#include "edebug.h" #include "edebug.h"
#include "lang.h" #include "lang.h"
#include "sound.h" #include "sounds.h"
#include "util.h" #include "util.h"
#include <X11/X.h> #include <X11/X.h>

View File

@ -92,6 +92,7 @@ e16_SOURCES = \
slideout.c \ slideout.c \
snaps.c snaps.h \ snaps.c snaps.h \
sound.c sound.h \ sound.c sound.h \
sounds.h \
stacking.c \ stacking.c \
startup.c \ startup.c \
string.c \ string.c \

View File

@ -58,7 +58,7 @@ static const DialogDef DlgAbout = {
"ABOUT_ENLIGHTENMENT", "ABOUT_ENLIGHTENMENT",
NULL, NULL,
NULL, NULL,
NULL, SOUND_NONE,
NULL, NULL,
NULL, NULL,
_DlgFillAbout, _DlgFillAbout,

View File

@ -31,7 +31,7 @@
#include "alert.h" #include "alert.h"
#include "lang.h" #include "lang.h"
#include "session.h" #include "session.h"
#include "sound.h" #include "sounds.h"
#include "util.h" #include "util.h"
#define ExTextExtents XmbTextExtents #define ExTextExtents XmbTextExtents
@ -187,7 +187,7 @@ ShowAlert(const char *title,
XFontStruct **font_struct_list_return; XFontStruct **font_struct_list_return;
char **font_name_list_return; char **font_name_list_return;
SoundPlay("SOUND_ALERT"); SoundPlay(SOUND_ALERT);
if (!text) if (!text)
return; return;

View File

@ -675,7 +675,7 @@ SnapEwin(EWin * ewin, int dx, int dy, int *new_dx, int *new_dy)
{ {
if (!last_res) if (!last_res)
{ {
/* SoundPlay("SOUND_MOVE_RESIST"); */ /* SoundPlay(SOUND_MOVE_RESIST); */
last_res = 1; last_res = 1;
} }
} }

View File

@ -1716,7 +1716,7 @@ CB_BGScan(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
{ {
int num; int num;
SoundPlay("SOUND_WAIT"); SoundPlay(SOUND_WAIT);
ScanBackgroundMenu(); ScanBackgroundMenu();
num = ecore_list_count(bg_list); num = ecore_list_count(bg_list);
@ -2221,7 +2221,7 @@ const DialogDef DlgBackground = {
"CONFIGURE_BG", "CONFIGURE_BG",
N_("Background"), N_("Background"),
N_("Desktop Background Settings"), N_("Desktop Background Settings"),
"SOUND_SETTINGS_BG", SOUND_SETTINGS_BG,
"pix/bg.png", "pix/bg.png",
N_("Enlightenment Desktop\n" "Background Settings Dialog\n"), N_("Enlightenment Desktop\n" "Background Settings Dialog\n"),
_DlgFillBackground, _DlgFillBackground,

View File

@ -241,7 +241,7 @@ ClientHandleComms(XClientMessageEvent * ev)
_("Received Unknown Client Message.\n" _("Received Unknown Client Message.\n"
"Client Name: %s\n" "Client Version: %s\n" "Client Name: %s\n" "Client Version: %s\n"
"Message Contents:\n\n" "%s\n"), s1, s2, s); "Message Contents:\n\n" "%s\n"), s1, s2, s);
SoundPlay("SOUND_ERROR_IPC"); SoundPlay(SOUND_ERROR_IPC);
} }
done: done:

View File

@ -1708,7 +1708,7 @@ static const DialogDef DlgContainer = {
"CONFIGURE_ICONBOX", "CONFIGURE_ICONBOX",
NULL, NULL,
NULL, NULL,
"SOUND_SETTINGS_ICONBOX", SOUND_SETTINGS_ICONBOX,
"pix/iconbox.png", "pix/iconbox.png",
N_("Enlightenment Iconbox\n" "Settings Dialog\n"), N_("Enlightenment Iconbox\n" "Settings Dialog\n"),
_DlgFillContainer, _DlgFillContainer,

View File

@ -1609,13 +1609,13 @@ DeskCurrentGotoArea(int ax, int ay)
dy = WinGetH(VROOT) * (ay - pay); dy = WinGetH(VROOT) * (ay - pay);
if (dx < 0) if (dx < 0)
SoundPlay("SOUND_MOVE_AREA_LEFT"); SoundPlay(SOUND_MOVE_AREA_LEFT);
else if (dx > 0) else if (dx > 0)
SoundPlay("SOUND_MOVE_AREA_RIGHT"); SoundPlay(SOUND_MOVE_AREA_RIGHT);
else if (dy < 0) else if (dy < 0)
SoundPlay("SOUND_MOVE_AREA_UP"); SoundPlay(SOUND_MOVE_AREA_UP);
else if (dy > 0) else if (dy > 0)
SoundPlay("SOUND_MOVE_AREA_DOWN"); SoundPlay(SOUND_MOVE_AREA_DOWN);
ActionsSuspend(); ActionsSuspend();
@ -2376,7 +2376,7 @@ const DialogDef DlgDesks = {
"CONFIGURE_DESKTOPS", "CONFIGURE_DESKTOPS",
N_("Desks"), N_("Desks"),
N_("Multiple Desktop Settings"), N_("Multiple Desktop Settings"),
"SOUND_SETTINGS_DESKTOPS", SOUND_SETTINGS_DESKTOPS,
"pix/desktops.png", "pix/desktops.png",
N_("Enlightenment Multiple Desktop\n" "Settings Dialog\n"), N_("Enlightenment Multiple Desktop\n" "Settings Dialog\n"),
_DlgFillDesks, _DlgFillDesks,
@ -2546,7 +2546,7 @@ const DialogDef DlgAreas = {
"CONFIGURE_AREA", "CONFIGURE_AREA",
N_("Areas"), N_("Areas"),
N_("Virtual Desktop Settings"), N_("Virtual Desktop Settings"),
"SOUND_SETTINGS_AREA", SOUND_SETTINGS_AREA,
"pix/areas.png", "pix/areas.png",
N_("Enlightenment Virtual Desktop\n" "Settings Dialog\n"), N_("Enlightenment Virtual Desktop\n" "Settings Dialog\n"),
_DlgFillAreas, _DlgFillAreas,
@ -2571,7 +2571,7 @@ DeskOpGoto(unsigned int desk)
DeskGoto(dsk); DeskGoto(dsk);
if (DesksGetCurrent() != pd) if (DesksGetCurrent() != pd)
SoundPlay("SOUND_DESKTOP_SHUT"); SoundPlay(SOUND_DESKTOP_SHUT);
} }
static void static void
@ -2654,13 +2654,13 @@ DesksIpcDesk(const char *params)
else if (!strncmp(cmd, "raise", 2)) else if (!strncmp(cmd, "raise", 2))
{ {
sscanf(prm, "%i", &desk); sscanf(prm, "%i", &desk);
SoundPlay("SOUND_DESKTOP_RAISE"); SoundPlay(SOUND_DESKTOP_RAISE);
DeskRaise(desk); DeskRaise(desk);
} }
else if (!strncmp(cmd, "lower", 2)) else if (!strncmp(cmd, "lower", 2))
{ {
sscanf(prm, "%i", &desk); sscanf(prm, "%i", &desk);
SoundPlay("SOUND_DESKTOP_LOWER"); SoundPlay(SOUND_DESKTOP_LOWER);
DeskLower(desk); DeskLower(desk);
} }
else if (!strcmp(cmd, "drag")) else if (!strcmp(cmd, "drag"))

View File

@ -642,7 +642,7 @@ DialogShowSimpleWithName(const DialogDef * dd, const char *name, void *data)
d = DialogFind(name); d = DialogFind(name);
if (d) if (d)
{ {
SoundPlay("SOUND_SETTINGS_ACTIVE"); SoundPlay(SOUND_SETTINGS_ACTIVE);
DialogShow(d); DialogShow(d);
return; return;
} }

View File

@ -61,7 +61,7 @@ typedef struct {
const char *name; const char *name;
const char *label; const char *label;
const char *title; const char *title;
const char *sound; int sound;
const char *header_image; const char *header_image;
const char *header_text; const char *header_text;
void (*fill) (Dialog * d, DItem * table, void *data); void (*fill) (Dialog * d, DItem * table, void *data);

View File

@ -389,7 +389,7 @@ HandleEvent(XEvent * ev)
break; break;
case ButtonPress: /* 4 */ case ButtonPress: /* 4 */
SoundPlay("SOUND_BUTTON_CLICK"); SoundPlay(SOUND_BUTTON_CLICK);
Mode.events.double_click = Mode.events.double_click =
((ev->xbutton.time - Mode.events.last_btime < DOUBLE_CLICK_TIME) && ((ev->xbutton.time - Mode.events.last_btime < DOUBLE_CLICK_TIME) &&
@ -402,7 +402,7 @@ HandleEvent(XEvent * ev)
Mode.events.last_button = ev->xbutton.button; Mode.events.last_button = ev->xbutton.button;
break; break;
case ButtonRelease: /* 5 */ case ButtonRelease: /* 5 */
SoundPlay("SOUND_BUTTON_RAISE"); SoundPlay(SOUND_BUTTON_RAISE);
break; break;
} }

View File

@ -1417,7 +1417,7 @@ EwinOpClose(EWin * ewin, int source __UNUSED__)
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
ICCCM_Delete(gwins[i]); ICCCM_Delete(gwins[i]);
SoundPlay("SOUND_WINDOW_CLOSE"); SoundPlay(SOUND_WINDOW_CLOSE);
} }
Efree(gwins); Efree(gwins);
} }
@ -1425,7 +1425,7 @@ EwinOpClose(EWin * ewin, int source __UNUSED__)
void void
EwinOpKill(EWin * ewin, int source __UNUSED__) EwinOpKill(EWin * ewin, int source __UNUSED__)
{ {
SoundPlay("SOUND_WINDOW_CLOSE"); SoundPlay(SOUND_WINDOW_CLOSE);
EwinKill(ewin); EwinKill(ewin);
} }
@ -1435,7 +1435,7 @@ EwinOpRaise(EWin * ewin, int source __UNUSED__)
EWin **gwins = NULL; EWin **gwins = NULL;
int i, num; int i, num;
SoundPlay("SOUND_RAISE"); SoundPlay(SOUND_RAISE);
gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_RAISE, gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_RAISE,
Mode.nogroup, &num); Mode.nogroup, &num);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
@ -1449,7 +1449,7 @@ EwinOpLower(EWin * ewin, int source __UNUSED__)
EWin **gwins = NULL; EWin **gwins = NULL;
int i, num; int i, num;
SoundPlay("SOUND_LOWER"); SoundPlay(SOUND_LOWER);
gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_LOWER, gwins = ListWinGroupMembersForEwin(ewin, GROUP_ACTION_LOWER,
Mode.nogroup, &num); Mode.nogroup, &num);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
@ -1503,13 +1503,13 @@ EwinOpRaiseLower(EWin * ewin)
if (!raise) if (!raise)
{ {
SoundPlay("SOUND_LOWER"); SoundPlay(SOUND_LOWER);
for (j = 0; j < gnum; j++) for (j = 0; j < gnum; j++)
EwinLower(gwins[j]); EwinLower(gwins[j]);
} }
else else
{ {
SoundPlay("SOUND_RAISE"); SoundPlay(SOUND_RAISE);
for (j = 0; j < gnum; j++) for (j = 0; j < gnum; j++)
EwinRaise(gwins[j]); EwinRaise(gwins[j]);
} }
@ -1533,13 +1533,13 @@ EwinOpStick(EWin * ewin, int source __UNUSED__, int on)
if (EoIsSticky(gwins[i]) if (EoIsSticky(gwins[i])
&& ((curr_group && !curr_group->cfg.mirror) || !on)) && ((curr_group && !curr_group->cfg.mirror) || !on))
{ {
SoundPlay("SOUND_WINDOW_UNSTICK"); SoundPlay(SOUND_WINDOW_UNSTICK);
EwinUnStick(gwins[i]); EwinUnStick(gwins[i]);
} }
else if (!EoIsSticky(gwins[i]) else if (!EoIsSticky(gwins[i])
&& ((curr_group && !curr_group->cfg.mirror) || on)) && ((curr_group && !curr_group->cfg.mirror) || on))
{ {
SoundPlay("SOUND_WINDOW_STICK"); SoundPlay(SOUND_WINDOW_STICK);
EwinStick(gwins[i]); EwinStick(gwins[i]);
} }
} }
@ -1642,13 +1642,13 @@ EwinOpShade(EWin * ewin, int source __UNUSED__, int on)
if (gwins[i]->state.shaded if (gwins[i]->state.shaded
&& ((curr_group && !curr_group->cfg.mirror) || !on)) && ((curr_group && !curr_group->cfg.mirror) || !on))
{ {
SoundPlay("SOUND_UNSHADE"); SoundPlay(SOUND_UNSHADE);
EwinUnShade(gwins[i]); EwinUnShade(gwins[i]);
} }
else if (!gwins[i]->state.shaded else if (!gwins[i]->state.shaded
&& ((curr_group && !curr_group->cfg.mirror) || on)) && ((curr_group && !curr_group->cfg.mirror) || on))
{ {
SoundPlay("SOUND_SHADE"); SoundPlay(SOUND_SHADE);
EwinShade(gwins[i]); EwinShade(gwins[i]);
} }
SnapshotEwinUpdate(gwins[i], SNAP_USE_SHADED); SnapshotEwinUpdate(gwins[i], SNAP_USE_SHADED);
@ -1661,11 +1661,11 @@ EwinOpSetLayer(EWin * ewin, int source __UNUSED__, int layer)
{ {
if (EoGetLayer(ewin) > layer) if (EoGetLayer(ewin) > layer)
{ {
SoundPlay("SOUND_WINDOW_CHANGE_LAYER_DOWN"); SoundPlay(SOUND_WINDOW_CHANGE_LAYER_DOWN);
} }
else if (EoGetLayer(ewin) < layer) else if (EoGetLayer(ewin) < layer)
{ {
SoundPlay("SOUND_WINDOW_CHANGE_LAYER_UP"); SoundPlay(SOUND_WINDOW_CHANGE_LAYER_UP);
} }
EoSetLayer(ewin, layer); EoSetLayer(ewin, layer);
EwinRaise(ewin); EwinRaise(ewin);
@ -1710,7 +1710,7 @@ EwinOpSetBorder(EWin * ewin, int source __UNUSED__, const char *name)
{ {
if (b != gwins[i]->border) if (b != gwins[i]->border)
{ {
SoundPlay("SOUND_WINDOW_BORDER_CHANGE"); SoundPlay(SOUND_WINDOW_BORDER_CHANGE);
shadechange = 0; shadechange = 0;
if (gwins[i]->state.shaded) if (gwins[i]->state.shaded)
{ {

View File

@ -416,7 +416,7 @@ doFocusToEwin(EWin * ewin, int why)
break; break;
} }
SoundPlay("SOUND_FOCUS_SET"); SoundPlay(SOUND_FOCUS_SET);
done: done:
ClickGrabsUpdate(); ClickGrabsUpdate();
@ -838,7 +838,7 @@ const DialogDef DlgFocus = {
"CONFIGURE_FOCUS", "CONFIGURE_FOCUS",
N_("Focus"), N_("Focus"),
N_("Focus Settings"), N_("Focus Settings"),
"SOUND_SETTINGS_FOCUS", SOUND_SETTINGS_FOCUS,
"pix/focus.png", "pix/focus.png",
N_("Enlightenment Focus\n" "Settings Dialog\n"), N_("Enlightenment Focus\n" "Settings Dialog\n"),
_DlgFillFocus, _DlgFillFocus,

View File

@ -949,7 +949,7 @@ const DialogDef DlgFx = {
"CONFIGURE_FX", "CONFIGURE_FX",
N_("FX"), N_("FX"),
N_("Special FX Settings"), N_("Special FX Settings"),
"SOUND_SETTINGS_FX", SOUND_SETTINGS_FX,
"pix/fx.png", "pix/fx.png",
N_("Enlightenment Special Effects\n" "Settings Dialog\n"), N_("Enlightenment Special Effects\n" "Settings Dialog\n"),
_DlgFillFx, _DlgFillFx,

View File

@ -697,7 +697,7 @@ static const DialogDef DlgGroupChoose = {
"GROUP_SELECTION", "GROUP_SELECTION",
NULL, NULL,
N_("Window Group Selection"), N_("Window Group Selection"),
"SOUND_SETTINGS_GROUP", SOUND_SETTINGS_GROUP,
"pix/group.png", "pix/group.png",
N_("Enlightenment Window Group\n" "Selection Dialog\n"), N_("Enlightenment Window Group\n" "Selection Dialog\n"),
_DlgFillGroupChoose, _DlgFillGroupChoose,
@ -910,7 +910,7 @@ static const DialogDef DlgGroups = {
"CONFIGURE_GROUP", "CONFIGURE_GROUP",
NULL, NULL,
N_("Window Group Settings"), N_("Window Group Settings"),
"SOUND_SETTINGS_GROUP", SOUND_SETTINGS_GROUP,
"pix/group.png", "pix/group.png",
N_("Enlightenment Window Group\n" "Settings Dialog\n"), N_("Enlightenment Window Group\n" "Settings Dialog\n"),
_DlgFillGroups, _DlgFillGroups,
@ -1025,7 +1025,7 @@ const DialogDef DlgGroupDefaults = {
"CONFIGURE_DEFAULT_GROUP_CONTROL", "CONFIGURE_DEFAULT_GROUP_CONTROL",
N_("Groups"), N_("Groups"),
N_("Default Group Control Settings"), N_("Default Group Control Settings"),
"SOUND_SETTINGS_GROUP", SOUND_SETTINGS_GROUP,
"pix/group.png", "pix/group.png",
N_("Enlightenment Default\n" "Group Control Settings Dialog\n"), N_("Enlightenment Default\n" "Group Control Settings Dialog\n"),
_DlgFillGroupDefaults, _DlgFillGroupDefaults,

View File

@ -302,7 +302,7 @@ IconboxesEwinIconify(EWin * ewin)
if (!ct) if (!ct)
return; return;
SoundPlay("SOUND_ICONIFY"); SoundPlay(SOUND_ICONIFY);
if (EoIsShown(ewin) && ct->anim_mode && !ewin->state.showingdesk) if (EoIsShown(ewin) && ct->anim_mode && !ewin->state.showingdesk)
IB_Animate(ct, 1, ewin); IB_Animate(ct, 1, ewin);
@ -319,7 +319,7 @@ IconboxesEwinDeIconify(EWin * ewin)
if (!ct) if (!ct)
return; return;
SoundPlay("SOUND_DEICONIFY"); SoundPlay(SOUND_DEICONIFY);
if (ct->anim_mode && !ewin->state.showingdesk) if (ct->anim_mode && !ewin->state.showingdesk)
IB_Animate(ct, 0, ewin); IB_Animate(ct, 0, ewin);

View File

@ -1376,7 +1376,7 @@ IPC_InsertKeys(const char *params, Client * c __UNUSED__)
if (win == None) if (win == None)
return; return;
SoundPlay("SOUND_INSERT_KEYS"); SoundPlay(SOUND_INSERT_KEYS);
ev.window = win; ev.window = win;
for (i = 0; i < (int)strlen(s); i++) for (i = 0; i < (int)strlen(s); i++)
{ {

View File

@ -699,7 +699,7 @@ MenusCreateInternal(const char *type, const char *name, const char *style,
} }
else if (!strcmp(type, "dirscan")) else if (!strcmp(type, "dirscan"))
{ {
SoundPlay("SOUND_SCANNING"); SoundPlay(SOUND_SCANNING);
m = MenuCreateFromDirectory(name, NULL, ms, prm); m = MenuCreateFromDirectory(name, NULL, ms, prm);
} }
else if (!strcmp(type, "borders")) else if (!strcmp(type, "borders"))

View File

@ -2095,7 +2095,7 @@ const DialogDef DlgMenus = {
"CONFIGURE_MENUS", "CONFIGURE_MENUS",
N_("Menus"), N_("Menus"),
N_("Menu Settings"), N_("Menu Settings"),
"SOUND_SETTINGS_MENUS", SOUND_SETTINGS_MENUS,
"pix/place.png", "pix/place.png",
N_("Enlightenment Menu\n" "Settings Dialog\n"), N_("Enlightenment Menu\n" "Settings Dialog\n"),
_DlgFillMenus, _DlgFillMenus,
@ -2145,7 +2145,7 @@ MenusIpc(const char *params)
Esnprintf(prm, sizeof(prm), "%s", p); Esnprintf(prm, sizeof(prm), "%s", p);
p = NULL; p = NULL;
} }
SoundPlay("SOUND_MENU_SHOW"); SoundPlay(SOUND_MENU_SHOW);
MenusShowNamed(prm, p); MenusShowNamed(prm, p);
} }
} }

View File

@ -274,7 +274,7 @@ const DialogDef DlgThemeTrans = {
"CONFIGURE_TRANS", "CONFIGURE_TRANS",
N_("Transparency"), N_("Transparency"),
N_("Selective Transparency Settings"), N_("Selective Transparency Settings"),
"SOUND_SETTINGS_TRANS", SOUND_SETTINGS_TRANS,
"pix/tips.png", "pix/tips.png",
N_("Enlightenment Selective Transparency\n" "Settings Dialog\n"), N_("Enlightenment Selective Transparency\n" "Settings Dialog\n"),
_DlgFillThemeTrans, _DlgFillThemeTrans,

View File

@ -90,7 +90,7 @@ ActionMoveStart(EWin * ewin, char constrained, int nogroup)
EventsGetXY(&cx, &cy); EventsGetXY(&cx, &cy);
SoundPlay("SOUND_MOVE_START"); SoundPlay(SOUND_MOVE_START);
GrabPointerSet(EoGetWin(ewin), ECSR_ACT_MOVE, 1); GrabPointerSet(EoGetWin(ewin), ECSR_ACT_MOVE, 1);
@ -144,7 +144,7 @@ ActionMoveEnd(EWin * ewin)
GrabPointerRelease(); GrabPointerRelease();
SoundPlay("SOUND_MOVE_STOP"); SoundPlay(SOUND_MOVE_STOP);
ewin = Mode_mr.ewin; ewin = Mode_mr.ewin;
if (!ewin) if (!ewin)
@ -299,7 +299,7 @@ ActionResizeStart(EWin * ewin, int hv)
EventsGetXY(&cx, &cy); EventsGetXY(&cx, &cy);
SoundPlay("SOUND_RESIZE_START"); SoundPlay(SOUND_RESIZE_START);
if (Conf.movres.mode_resize < 0 || Conf.movres.mode_resize > 4) if (Conf.movres.mode_resize < 0 || Conf.movres.mode_resize > 4)
Conf.movres.mode_resize = 0; Conf.movres.mode_resize = 0;
@ -431,7 +431,7 @@ ActionResizeEnd(EWin * ewin)
GrabPointerRelease(); GrabPointerRelease();
SoundPlay("SOUND_RESIZE_STOP"); SoundPlay(SOUND_RESIZE_STOP);
ewin = Mode_mr.ewin; ewin = Mode_mr.ewin;
if (!ewin) if (!ewin)
@ -847,7 +847,7 @@ SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
firstlast = 0; firstlast = 0;
FocusEnable(0); FocusEnable(0);
SoundPlay("SOUND_WINDOW_SLIDE"); SoundPlay(SOUND_WINDOW_SLIDE);
Mode_mr.grab_server = _NeedServerGrab(mode); Mode_mr.grab_server = _NeedServerGrab(mode);
if (Mode_mr.grab_server) if (Mode_mr.grab_server)
@ -893,5 +893,5 @@ SlideEwinsTo(EWin ** ewin, int *fx, int *fy, int *tx, int *ty, int num_wins,
if (Mode_mr.grab_server) if (Mode_mr.grab_server)
EUngrabServer(); EUngrabServer();
SoundPlay("SOUND_WINDOW_SLIDE_END"); SoundPlay(SOUND_WINDOW_SLIDE_END);
} }

View File

@ -1457,7 +1457,7 @@ PagerHandleMouseUp(Pager * p, int px, int py, int button)
{ {
DeskGoto(p->dsk); DeskGoto(p->dsk);
if (p->dsk != DesksGetCurrent()) if (p->dsk != DesksGetCurrent())
SoundPlay("SOUND_DESKTOP_SHUT"); SoundPlay(SOUND_DESKTOP_SHUT);
DeskCurrentGotoArea(px / p->dw, py / p->dh); DeskCurrentGotoArea(px / p->dw, py / p->dh);
} }
else if (button == Conf_pagers.win_button) else if (button == Conf_pagers.win_button)
@ -1992,7 +1992,7 @@ const DialogDef DlgPagers = {
"CONFIGURE_PAGER", "CONFIGURE_PAGER",
N_("Pagers"), N_("Pagers"),
N_("Pager Settings"), N_("Pager Settings"),
"SOUND_SETTINGS_PAGER", SOUND_SETTINGS_PAGER,
"pix/pager.png", "pix/pager.png",
N_("Enlightenment Desktop & Area\n" "Pager Settings Dialog\n"), N_("Enlightenment Desktop & Area\n" "Pager Settings Dialog\n"),
_DlgFillPagers, _DlgFillPagers,

View File

@ -527,7 +527,7 @@ doSMExit(int mode, const char *params)
switch (mode) switch (mode)
{ {
case EEXIT_EXEC: case EEXIT_EXEC:
SoundPlay("SOUND_EXIT"); SoundPlay(SOUND_EXIT);
EDisplayClose(); EDisplayClose();
Esnprintf(s, sizeof(s), "exec %s", params); Esnprintf(s, sizeof(s), "exec %s", params);
@ -539,7 +539,7 @@ doSMExit(int mode, const char *params)
case EEXIT_THEME: case EEXIT_THEME:
ss = params; ss = params;
case EEXIT_RESTART: case EEXIT_RESTART:
SoundPlay("SOUND_WAIT"); SoundPlay(SOUND_WAIT);
#ifdef USE_EXT_INIT_WIN #ifdef USE_EXT_INIT_WIN
if (disp && !Mode.wm.window) if (disp && !Mode.wm.window)
new_init_win_ext = ExtInitWinCreate(); new_init_win_ext = ExtInitWinCreate();
@ -575,7 +575,7 @@ doSMExit(int mode, const char *params)
} }
restarting = False; restarting = False;
SoundPlay("SOUND_EXIT"); SoundPlay(SOUND_EXIT);
EExit(0); EExit(0);
} }
@ -636,7 +636,7 @@ SessionLogoutConfirm(void)
d = DialogFind("LOGOUT_DIALOG"); d = DialogFind("LOGOUT_DIALOG");
if (!d) if (!d)
{ {
SoundPlay("SOUND_LOGOUT"); SoundPlay(SOUND_LOGOUT);
d = DialogCreate("LOGOUT_DIALOG"); d = DialogCreate("LOGOUT_DIALOG");
table = DialogInitItem(d); table = DialogInitItem(d);
DialogSetTitle(d, _("Are you sure?")); DialogSetTitle(d, _("Are you sure?"));
@ -807,7 +807,7 @@ const DialogDef DlgSession = {
"CONFIGURE_SESSION", "CONFIGURE_SESSION",
N_("Session"), N_("Session"),
N_("Session Settings"), N_("Session Settings"),
"SOUND_SETTINGS_SESSION", SOUND_SETTINGS_SESSION,
"pix/miscellaneous.png", "pix/miscellaneous.png",
N_("Enlightenment Session\n" "Settings Dialog\n"), N_("Enlightenment Session\n" "Settings Dialog\n"),
_DlgFillSession, _DlgFillSession,

View File

@ -220,7 +220,7 @@ const DialogDef DlgMoveResize = {
"CONFIGURE_MOVERESIZE", "CONFIGURE_MOVERESIZE",
N_("Move/Resize"), N_("Move/Resize"),
N_("Move & Resize Settings"), N_("Move & Resize Settings"),
"SOUND_SETTINGS_MOVERESIZE", SOUND_SETTINGS_MOVERESIZE,
"pix/moveres.png", "pix/moveres.png",
N_("Enlightenment Move & Resize\n" "Method Settings Dialog\n"), N_("Enlightenment Move & Resize\n" "Method Settings Dialog\n"),
_DlgFillMoveResize, _DlgFillMoveResize,
@ -446,7 +446,7 @@ const DialogDef DlgPlacement = {
"CONFIGURE_PLACEMENT", "CONFIGURE_PLACEMENT",
N_("Placement"), N_("Placement"),
N_("Window Placement Settings"), N_("Window Placement Settings"),
"SOUND_SETTINGS_PLACEMENT", SOUND_SETTINGS_PLACEMENT,
"pix/place.png", "pix/place.png",
N_("Enlightenment Window Placement\n" "Settings Dialog\n"), N_("Enlightenment Window Placement\n" "Settings Dialog\n"),
_DlgFillPlacement, _DlgFillPlacement,
@ -498,7 +498,7 @@ const DialogDef DlgAutoraise = {
"CONFIGURE_AUTORAISE", "CONFIGURE_AUTORAISE",
N_("Autoraise"), N_("Autoraise"),
N_("Autoraise Settings"), N_("Autoraise Settings"),
"SOUND_SETTINGS_AUTORAISE", SOUND_SETTINGS_AUTORAISE,
"pix/raise.png", "pix/raise.png",
N_("Enlightenment Automatic Raising\n" "of Windows Settings Dialog\n"), N_("Enlightenment Automatic Raising\n" "of Windows Settings Dialog\n"),
_DlgFillAutoraise, _DlgFillAutoraise,
@ -568,7 +568,7 @@ const DialogDef DlgMisc = {
"CONFIGURE_MISCELLANEOUS", "CONFIGURE_MISCELLANEOUS",
N_("Miscellaneous"), N_("Miscellaneous"),
N_("Miscellaneous Settings"), N_("Miscellaneous Settings"),
"SOUND_SETTINGS_MISCELLANEOUS", SOUND_SETTINGS_MISCELLANEOUS,
"pix/miscellaneous.png", "pix/miscellaneous.png",
N_("Enlightenment Miscellaneous\n" "Settings Dialog\n"), N_("Enlightenment Miscellaneous\n" "Settings Dialog\n"),
_DlgFillMisc, _DlgFillMisc,
@ -702,7 +702,7 @@ const DialogDef DlgComposite = {
"CONFIGURE_COMPOSITE", "CONFIGURE_COMPOSITE",
N_("Composite"), N_("Composite"),
N_("Composite Settings"), N_("Composite Settings"),
"SOUND_SETTINGS_COMPOSITE", SOUND_SETTINGS_COMPOSITE,
"pix/pager.png", "pix/pager.png",
N_("Enlightenment Composite\n" "Settings Dialog\n"), N_("Enlightenment Composite\n" "Settings Dialog\n"),
_DlgFillComposite, _DlgFillComposite,
@ -790,7 +790,7 @@ static const DialogDef DlgConfiguration = {
"CONFIGURE_ALL", "CONFIGURE_ALL",
NULL, NULL,
N_("Enlightenment Settings"), N_("Enlightenment Settings"),
"SOUND_SETTINGS_ALL", SOUND_SETTINGS_ALL,
NULL, NULL,
NULL, NULL,
_DlgFillConfiguration, _DlgFillConfiguration,

View File

@ -486,7 +486,7 @@ IPC_Slideout(const char *params)
if (!s) if (!s)
return; return;
SoundPlay("SOUND_SLIDEOUT_SHOW"); SoundPlay(SOUND_SLIDEOUT_SHOW);
SlideoutShow(s, GetContextEwin(), Mode.context_win); SlideoutShow(s, GetContextEwin(), Mode.context_win);
} }

View File

@ -918,7 +918,7 @@ static const DialogDef DlgSnap = {
NULL, NULL,
NULL, NULL,
N_("Remembered Application Attributes"), N_("Remembered Application Attributes"),
NULL, SOUND_NONE,
"pix/snapshots.png", "pix/snapshots.png",
N_("Select the attributes of this\n" N_("Select the attributes of this\n"
"window you wish to Remember\n" "from now on\n"), "window you wish to Remember\n" "from now on\n"),
@ -1066,7 +1066,7 @@ const DialogDef DlgRemember = {
"CONFIGURE_PAGER", "CONFIGURE_PAGER",
N_("Remember"), N_("Remember"),
N_("Remembered Windows Settings"), N_("Remembered Windows Settings"),
"SOUND_SETTINGS_PAGER", SOUND_SETTINGS_PAGER,
"pix/snapshots.png", "pix/snapshots.png",
N_("Enlightenment Remembered\n" "Windows Settings Dialog\n"), N_("Enlightenment Remembered\n" "Windows Settings Dialog\n"),
_DlgFillRemember, _DlgFillRemember,

View File

@ -28,6 +28,9 @@
#include "emodule.h" #include "emodule.h"
#include "settings.h" #include "settings.h"
#include "sound.h" #include "sound.h"
#include "sounds.h"
#define N_SOUNDS (SOUND_NOT_USED - 1)
typedef struct { typedef struct {
char *name; char *name;
@ -40,6 +43,7 @@ typedef struct {
static struct { static struct {
char enable; char enable;
char *theme; char *theme;
unsigned int mask1, mask2;
} Conf_sound; } Conf_sound;
static struct { static struct {
@ -65,6 +69,68 @@ static const SoundOps *ops = &SoundOps_pa;
static void _SoundConfigLoad(void); static void _SoundConfigLoad(void);
static const char *const sound_names[N_SOUNDS] = {
"SOUND_ALERT", /* 0 0x00000001 */
"SOUND_BUTTON_CLICK",
"SOUND_BUTTON_RAISE",
"SOUND_DEICONIFY",
"SOUND_DESKTOP_LOWER", /* 4 0x00000010 */
"SOUND_DESKTOP_RAISE",
"SOUND_DESKTOP_SHUT",
"SOUND_ERROR_IPC",
"SOUND_EXIT", /* 8 0x00000100 */
"SOUND_FOCUS_SET",
"SOUND_ICONIFY",
"SOUND_INSERT_KEYS",
"SOUND_LOGOUT", /* 12 0x00001000 */
"SOUND_LOWER",
"SOUND_MENU_SHOW",
"SOUND_MOVE_AREA_DOWN",
"SOUND_MOVE_AREA_LEFT", /* 16 0x00010000 */
"SOUND_MOVE_AREA_RIGHT",
"SOUND_MOVE_AREA_UP",
"SOUND_MOVE_RESIST",
"SOUND_MOVE_START", /* 20 0x00100000 */
"SOUND_MOVE_STOP",
"SOUND_RAISE",
"SOUND_RESIZE_START",
"SOUND_RESIZE_STOP", /* 24 0x01000000 */
"SOUND_SCANNING",
"SOUND_SETTINGS_ACTIVE",
"SOUND_SETTINGS_ALL",
"SOUND_SETTINGS_AREA", /* 28 0x10000000 */
"SOUND_SETTINGS_AUDIO",
"SOUND_SETTINGS_AUTORAISE",
"SOUND_SETTINGS_BG",
"SOUND_SETTINGS_COMPOSITE", /* 0 0x00000001 */
"SOUND_SETTINGS_DESKTOPS",
"SOUND_SETTINGS_FOCUS",
"SOUND_SETTINGS_FX",
"SOUND_SETTINGS_GROUP", /* 4 0x00000010 */
"SOUND_SETTINGS_ICONBOX",
"SOUND_SETTINGS_MENUS",
"SOUND_SETTINGS_MISCELLANEOUS",
"SOUND_SETTINGS_MOVERESIZE", /* 8 0x00000100 */
"SOUND_SETTINGS_PAGER",
"SOUND_SETTINGS_PLACEMENT",
"SOUND_SETTINGS_SESSION",
"SOUND_SETTINGS_TOOLTIPS", /* 12 0x00001000 */
"SOUND_SETTINGS_TRANS",
"SOUND_SHADE",
"SOUND_SLIDEOUT_SHOW",
"SOUND_STARTUP", /* 16 0x00010000 */
"SOUND_UNSHADE",
"SOUND_WAIT",
"SOUND_WINDOW_BORDER_CHANGE",
"SOUND_WINDOW_CHANGE_LAYER_DOWN", /* 20 0x00100000 */
"SOUND_WINDOW_CHANGE_LAYER_UP",
"SOUND_WINDOW_CLOSE",
"SOUND_WINDOW_SLIDE",
"SOUND_WINDOW_SLIDE_END", /* 24 0x01000000 */
"SOUND_WINDOW_STICK",
"SOUND_WINDOW_UNSTICK",
};
static void static void
_SclassSampleDestroy(void *data, void *user_data __UNUSED__) _SclassSampleDestroy(void *data, void *user_data __UNUSED__)
{ {
@ -162,8 +228,8 @@ SclassFind(const char *name)
return (SoundClass *) ecore_list_find(sound_list, _SclassMatchName, name); return (SoundClass *) ecore_list_find(sound_list, _SclassMatchName, name);
} }
void static void
SoundPlay(const char *name) _SoundPlayByName(const char *name)
{ {
SoundClass *sclass; SoundClass *sclass;
@ -181,6 +247,24 @@ SoundPlay(const char *name)
SclassApply(sclass); SclassApply(sclass);
} }
#define _SoundMasked(i) \
(((i) <= 32) ? Conf_sound.mask1 & (1 << ((i) - 1)) : \
Conf_sound.mask2 & (1 << ((i) - 1)))
void
SoundPlay(int sound)
{
if (!Conf_sound.enable)
return;
if (sound <= 0 || sound > N_SOUNDS)
return;
if (_SoundMasked(sound))
return;
_SoundPlayByName(sound_names[sound - 1]);
}
static int static int
SoundFree(const char *name) SoundFree(const char *name)
{ {
@ -322,7 +406,7 @@ SoundSighan(int sig, void *prm __UNUSED__)
case ESIGNAL_START: case ESIGNAL_START:
if (!Conf_sound.enable) if (!Conf_sound.enable)
break; break;
SoundPlay("SOUND_STARTUP"); SoundPlay(SOUND_STARTUP);
SoundFree("SOUND_STARTUP"); SoundFree("SOUND_STARTUP");
break; break;
case ESIGNAL_EXIT: case ESIGNAL_EXIT:
@ -371,7 +455,7 @@ const DialogDef DlgSound = {
"CONFIGURE_AUDIO", "CONFIGURE_AUDIO",
N_("Sound"), N_("Sound"),
N_("Audio Settings"), N_("Audio Settings"),
"SOUND_SETTINGS_AUDIO", SOUND_SETTINGS_AUDIO,
"pix/sound.png", "pix/sound.png",
N_("Enlightenment Audio\n" "Settings Dialog\n"), N_("Enlightenment Audio\n" "Settings Dialog\n"),
_DlgFillSound, _DlgFillSound,
@ -424,7 +508,7 @@ SoundIpc(const char *params)
} }
else if (!strncmp(cmd, "play", 2)) else if (!strncmp(cmd, "play", 2))
{ {
SoundPlay(prm); _SoundPlayByName(prm);
} }
} }
@ -445,6 +529,8 @@ static const IpcItem SoundIpcArray[] = {
static const CfgItem SoundCfgItems[] = { static const CfgItem SoundCfgItems[] = {
CFG_ITEM_BOOL(Conf_sound, enable, 0), CFG_ITEM_BOOL(Conf_sound, enable, 0),
CFG_FUNC_STR(Conf_sound, theme, _SoundThemeChange), CFG_FUNC_STR(Conf_sound, theme, _SoundThemeChange),
CFG_ITEM_HEX(Conf_sound, mask1, 0),
CFG_ITEM_HEX(Conf_sound, mask2, 0),
}; };
#define N_CFG_ITEMS (sizeof(SoundCfgItems)/sizeof(CfgItem)) #define N_CFG_ITEMS (sizeof(SoundCfgItems)/sizeof(CfgItem))

View File

@ -23,8 +23,6 @@
#ifndef _SOUND_H_ #ifndef _SOUND_H_
#define _SOUND_H_ #define _SOUND_H_
#include "config.h"
typedef struct { typedef struct {
unsigned int channels; unsigned int channels;
unsigned int bit_per_sample; unsigned int bit_per_sample;
@ -43,13 +41,6 @@ typedef struct {
void (*SamplePlay) (Sample * s); void (*SamplePlay) (Sample * s);
} SoundOps; } SoundOps;
/* sound.c */
#if HAVE_SOUND
void SoundPlay(const char *name);
#else
#define SoundPlay(name) do{}while(0)
#endif
int SoundSampleGetData(const char *file, SoundSampleData * ssd); int SoundSampleGetData(const char *file, SoundSampleData * ssd);
#endif /* _SOUND_H_ */ #endif /* _SOUND_H_ */

102
src/sounds.h Normal file
View File

@ -0,0 +1,102 @@
/*
* Copyright (C) 2008 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _SOUNDS_H_
#define _SOUNDS_H_
#include "config.h"
typedef enum {
SOUND_NONE = 0,
SOUND_ALERT,
SOUND_BUTTON_CLICK,
SOUND_BUTTON_RAISE,
SOUND_DEICONIFY,
SOUND_DESKTOP_LOWER,
SOUND_DESKTOP_RAISE,
SOUND_DESKTOP_SHUT,
SOUND_ERROR_IPC,
SOUND_EXIT,
SOUND_FOCUS_SET,
SOUND_ICONIFY,
SOUND_INSERT_KEYS,
SOUND_LOGOUT,
SOUND_LOWER,
SOUND_MENU_SHOW,
SOUND_MOVE_AREA_DOWN,
SOUND_MOVE_AREA_LEFT,
SOUND_MOVE_AREA_RIGHT,
SOUND_MOVE_AREA_UP,
SOUND_MOVE_RESIST,
SOUND_MOVE_START,
SOUND_MOVE_STOP,
SOUND_RAISE,
SOUND_RESIZE_START,
SOUND_RESIZE_STOP,
SOUND_SCANNING,
SOUND_SETTINGS_ACTIVE,
SOUND_SETTINGS_ALL,
SOUND_SETTINGS_AREA,
SOUND_SETTINGS_AUDIO,
SOUND_SETTINGS_AUTORAISE,
SOUND_SETTINGS_BG,
SOUND_SETTINGS_COMPOSITE,
SOUND_SETTINGS_DESKTOPS,
SOUND_SETTINGS_FOCUS,
SOUND_SETTINGS_FX,
SOUND_SETTINGS_GROUP,
SOUND_SETTINGS_ICONBOX,
SOUND_SETTINGS_MENUS,
SOUND_SETTINGS_MISCELLANEOUS,
SOUND_SETTINGS_MOVERESIZE,
SOUND_SETTINGS_PAGER,
SOUND_SETTINGS_PLACEMENT,
SOUND_SETTINGS_SESSION,
SOUND_SETTINGS_TOOLTIPS,
SOUND_SETTINGS_TRANS,
SOUND_SHADE,
SOUND_SLIDEOUT_SHOW,
SOUND_STARTUP,
SOUND_UNSHADE,
SOUND_WAIT,
SOUND_WINDOW_BORDER_CHANGE,
SOUND_WINDOW_CHANGE_LAYER_DOWN,
SOUND_WINDOW_CHANGE_LAYER_UP,
SOUND_WINDOW_CLOSE,
SOUND_WINDOW_SLIDE,
SOUND_WINDOW_SLIDE_END,
SOUND_WINDOW_STICK,
SOUND_WINDOW_UNSTICK,
SOUND_NOT_USED
} sound_e;
#if HAVE_SOUND
void SoundPlay(int sound);
#else
#define SoundPlay(sound) do{}while(0)
#endif
#endif /* _SOUNDS_H_ */

View File

@ -886,7 +886,7 @@ const DialogDef DlgTooltips = {
"CONFIGURE_TOOLTIPS", "CONFIGURE_TOOLTIPS",
N_("Tooltips"), N_("Tooltips"),
N_("Tooltip Settings"), N_("Tooltip Settings"),
"SOUND_SETTINGS_TOOLTIPS", SOUND_SETTINGS_TOOLTIPS,
"pix/tips.png", "pix/tips.png",
N_("Enlightenment Tooltip\n" "Settings Dialog\n"), N_("Enlightenment Tooltip\n" "Settings Dialog\n"),
_DlgFillTooltips, _DlgFillTooltips,