src/sound.c

Sun, 17 Oct 2004 23:55:49 +0000

author
Sean Egan <seanegan@pidgin.im>
date
Sun, 17 Oct 2004 23:55:49 +0000
changeset 10108
0897c42d6cb9
parent 9993
ae32679a8892
child 10322
06e23196da4b
permissions
-rw-r--r--

[gaim-migrate @ 11141]
Two things:
a. Added Enter as a gtk_binding to GtkIMHtml. This fixes everything.
Input methods now work. The "Enter sends" and "Ctrl-Enter sends" preferences
were removed and defaulted to yes and no respectively, BUT, in a very super-cool
turn of events, you can now add your own bindings to .gtkrc to make WHATEVER
YOU WANT send. Awesome. Someone should use g_signal_accumulator_true_handled
or something to make profiles and away messages able to insert newlines.

b. Removed "Use multi-colored screennames in chats," defaulted to yes, and
wrote a nifty algorithm to automatically adjust the colors to accomodate the
background (see http://gaim.sf.net/sean/porn-chat.png). People should play
around and tweak it a bit. The algorithm takes into consideration the
luminosity of the current background and the base hue to use for the screenname
in generating the new colors. Note that it does this while maintaining the hues.
Someone should optimize this so it skips over the floating point arithmatic when
the background color is white.

1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7035
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7035
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 7035
diff changeset
6 * source distribution.
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 *
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * (at your option) any later version.
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 *
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * GNU General Public License for more details.
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 *
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 *
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 */
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5684
diff changeset
23 #include "internal.h"
3630
caa952062dc2 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3367
diff changeset
24
4561
2a82628d7345 [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
25 #include "sound.h"
5545
a8b1a1262402 [gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
26 #include "prefs.h"
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
28 static GaimSoundUiOps *sound_ui_ops = NULL;
3319
620cde89665a [gaim-migrate @ 3337]
Sean Egan <seanegan@pidgin.im>
parents: 3284
diff changeset
29
7035
76bca80cd91d [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
30 void gaim_sound_set_ui_ops(GaimSoundUiOps *ops)
4430
95df701e8cdf [gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents: 4429
diff changeset
31 {
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
32 if(sound_ui_ops && sound_ui_ops->shutdown)
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
33 sound_ui_ops->shutdown();
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
34 sound_ui_ops = ops;
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
35 if(sound_ui_ops && sound_ui_ops->init)
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
36 sound_ui_ops->init();
4430
95df701e8cdf [gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents: 4429
diff changeset
37 }
95df701e8cdf [gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents: 4429
diff changeset
38
7035
76bca80cd91d [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
39 GaimSoundUiOps *gaim_sound_get_ui_ops(void)
4430
95df701e8cdf [gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents: 4429
diff changeset
40 {
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
41 return sound_ui_ops;
4581
f6dc4d97a8af [gaim-migrate @ 4864]
Nathan Walp <nwalp@pidgin.im>
parents: 4579
diff changeset
42 }
f6dc4d97a8af [gaim-migrate @ 4864]
Nathan Walp <nwalp@pidgin.im>
parents: 4579
diff changeset
43
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
44 void gaim_sound_init()
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
45 {
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
46 gaim_prefs_add_none("/core/sound");
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
47 gaim_prefs_add_bool("/core/sound/while_away", FALSE);
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
48 }
4581
f6dc4d97a8af [gaim-migrate @ 4864]
Nathan Walp <nwalp@pidgin.im>
parents: 4579
diff changeset
49
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
50 void gaim_sound_shutdown()
4430
95df701e8cdf [gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents: 4429
diff changeset
51 {
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
52 if(sound_ui_ops && sound_ui_ops->shutdown)
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
53 sound_ui_ops->shutdown();
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
54 }
4430
95df701e8cdf [gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents: 4429
diff changeset
55
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
56 void gaim_sound_play_file(const char *filename)
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
57 {
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
58 /* FIXME */
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
59 #if 0
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
60 if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away"))
4561
2a82628d7345 [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
61 return;
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
62 #endif
4430
95df701e8cdf [gaim-migrate @ 4705]
Robert McQueen <robot101@debian.org>
parents: 4429
diff changeset
63
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
64 if(sound_ui_ops && sound_ui_ops->play_file)
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
65 sound_ui_ops->play_file(filename);
1006
fb2f2a403962 [gaim-migrate @ 1016]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 899
diff changeset
66 }
fb2f2a403962 [gaim-migrate @ 1016]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 899
diff changeset
67
4561
2a82628d7345 [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
68 void gaim_sound_play_event(GaimSoundEventID event)
1
efe077a7e70d [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
69 {
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
70 /* FIXME */
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
71 #if 0
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
72 if(awaymessage && !gaim_prefs_get_bool("/core/sound/while_away"))
4561
2a82628d7345 [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
73 return;
9944
71ef020ec4b0 [gaim-migrate @ 10838]
Christian Hammond <chipx86@chipx86.com>
parents: 9791
diff changeset
74 #endif
4561
2a82628d7345 [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
75
5684
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
76 if(sound_ui_ops && sound_ui_ops->play_event)
10b916deb20c [gaim-migrate @ 6104]
Nathan Walp <nwalp@pidgin.im>
parents: 5612
diff changeset
77 sound_ui_ops->play_event(event);
4561
2a82628d7345 [gaim-migrate @ 4842]
Nathan Walp <nwalp@pidgin.im>
parents: 4491
diff changeset
78 }

mercurial