diff options
67 files changed, 3436 insertions, 1820 deletions
diff --git a/configure.ac b/configure.ac index 493926ec..0acd0c92 100644 --- a/configure.ac +++ b/configure.ac @@ -24,18 +24,12 @@ AC_SUBST(GETTEXT_PACKAGE) test "$prefix" = NONE && prefix=/usr/local AC_DEFINE_UNQUOTED(LOCALEDIR, "${prefix}/${DATADIRNAME}/locale", [Name of gettext locale directory]) -if test "x$USE_MAINTAINER_MODE" = "xyes" ; then - AM_PROG_VALAC([0.7.0]) - if test "x$VALAC" = "x" ; then - AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH]) - fi -fi - case "$host" in i386-*-* | i486-*-* | i586-*-* | i686-*-* | i86pc-*-*) AC_DEFINE(ARCH_X86_32, 1, [architecture is x86]) LIB="../deadbeef-deps/lib-x86-32" YASM_FLAGS="-f elf -D ARCH_X86_32 -m x86" + APE_USE_YASM=yes ;; x86_64-apple-*) AC_DEFINE(ARCH_X86_64_OSX, 1, [architecture is x86_64 for OSX]) @@ -45,6 +39,7 @@ case "$host" in AC_DEFINE(ARCH_X86_64, 1, [architecture is x86_64]) LIB="../deadbeef-deps/lib-x86-64" YASM_FLAGS="-f elf -D ARCH_X86_64 -m amd64" + APE_USE_YASM=yes ;; powerpc-*-* ) AC_DEFINE(ARCH_PPC_32, 1, [architecture is ppc32]) @@ -74,8 +69,9 @@ AC_ARG_ENABLE(nullout, [AS_HELP_STRING([--disable-nullout ], [disable NULL outp AC_ARG_ENABLE(alsa, [AS_HELP_STRING([--disable-alsa ], [disable ALSA output plugin (default: enabled)])], [enable_alsa=$enableval], [enable_alsa=yes]) AC_ARG_ENABLE(oss, [AS_HELP_STRING([--disable-oss ], [disable Open Sound System output plugin (default: enabled)])], [enable_oss=$enableval], [enable_oss=yes]) AC_ARG_ENABLE(pulse, [AS_HELP_STRING([--disable-pulse ], [disable PulseAudio output plugin (default: enabled)])], [enable_pulse=$enableval], [enable_pulse=yes]) -AC_ARG_ENABLE(gtkui, [AS_HELP_STRING([--disable-gtkui ], [disable standard GTK2 user interface plugin (default: enabled)])], [enable_gtkui=$enableval], [enable_gtkui=yes]) -dnl AC_ARG_ENABLE(gtk3, [AS_HELP_STRING([--enable-gtk3 ], [use GTK3 library (default: disabled)])], [enable_gtk3=$enableval], [enable_gtk3=no]) +AC_ARG_ENABLE(gtkui, [AS_HELP_STRING([--disable-gtkui ], [disable standard GTK+ user interface plugin (default: enabled)])], [enable_gtkui=$enableval], [enable_gtkui=yes]) +AC_ARG_ENABLE(gtk3, [AS_HELP_STRING([--enable-gtk3 ], [build GTK3 version of gtkui plugin (default: disabled)])], [enable_gtk3=$enableval], [enable_gtk3=no]) +AC_ARG_ENABLE(gtk2, [AS_HELP_STRING([--disable-gtk2 ], [build GTK2 version of gtkui plugin (default: enabled)])], [enable_gtk2=$enableval], [enable_gtk2=yes]) AC_ARG_ENABLE(vfs_curl, [AS_HELP_STRING([--disable-vfs-curl], [disable HTTP streaming vfs plugin (default: enabled)])], [enable_vfs_curl=$enableval], [enable_vfs_curl=yes]) AC_ARG_ENABLE(lfm, [AS_HELP_STRING([--disable-lfm ], [disable last.fm/libre.fm scrobbler plugin (default: enabled)])], [enable_lfm=$enableval], [enable_lfm=yes]) AC_ARG_ENABLE(artwork, [AS_HELP_STRING([--disable-artwork ], [disable album art loader plugin (default: enabled)])], [enable_artwork=$enableval], [enable_artwork=yes]) @@ -162,14 +158,16 @@ else fi AC_SUBST(ZIP_LIBS) -if test "x$enable_gtkui" != "xno" ; then -dnl if test "x$enable_gtk3" == "xyes" ; then -dnl PKG_CHECK_MODULES(GTKUI_DEPS, gtk+-3.0 >= 2.90 gthread-2.0 glib-2.0, HAVE_GTK=yes, HAVE_GTK=no) -dnl else - PKG_CHECK_MODULES(GTKUI_DEPS, gtk+-2.0 >= 2.12 gthread-2.0 glib-2.0, HAVE_GTK=yes, HAVE_GTK=no) -dnl fi +if test "x$enable_gtk3" == "xyes" ; then + PKG_CHECK_MODULES(GTK3_DEPS, gtk+-3.0 >= 3.0 gthread-2.0 glib-2.0, HAVE_GTK3=yes, HAVE_GTK3=no) +else + HAVE_GTK3=no +fi + +if test "x$enable_gtk2" == "xyes" ; then + PKG_CHECK_MODULES(GTK2_DEPS, gtk+-2.0 >= 2.12 gthread-2.0 glib-2.0, HAVE_GTK2=yes, HAVE_GTK2=no) else - HAVE_GTK=no + HAVE_GTK2=no fi if test "x$enable_alsa" != "xno" ; then @@ -334,7 +332,7 @@ fi dnl gtkui plugin if test "x$enable_gtkui" != "xno" ; then - if test "x$HAVE_GTK" = "xyes" ; then + if test "x$HAVE_GTK2" == "xyes" || test "x$HAVE_GTK3" == "xyes" ; then HAVE_GTKUI=yes fi fi @@ -452,7 +450,7 @@ if test "x$enable_adplug" != "xno" ; then HAVE_ADPLUG=yes fi -if test "x$enable_ffap" != "xno" ; then +if test "x$enable_ffap" != "xno" && ( test "x$HAVE_YASM" == "xyes" || test "x$APE_USE_YASM" != "xyes" ) ; then HAVE_FFAP=yes fi @@ -545,7 +543,7 @@ if test "x$enable_vfs_zip" != "xno" ; then fi if test "x$enable_converter" != "xno" ; then - if test "x$HAVE_GTK" = "xyes" ; then + if test "x$HAVE_GTK2" = "xyes" || test "x$HAVE_GTK3" = "xyes" ; then HAVE_CONVERTER=yes fi fi @@ -562,6 +560,8 @@ AM_CONDITIONAL(HAVE_WAVPACK, test "x$HAVE_WAVPACKPLUGIN" = "xyes") AM_CONDITIONAL(HAVE_SNDFILE, test "x$HAVE_SNDFILEPLUGIN" = "xyes") AM_CONDITIONAL(HAVE_CDDA, test "x$HAVE_CDDAPLUGIN" = "xyes") AM_CONDITIONAL(HAVE_GTKUI, test "x$HAVE_GTKUI" = "xyes") +AM_CONDITIONAL(HAVE_GTK2, test "x$HAVE_GTK2" = "xyes") +AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_GTK3" = "xyes") AM_CONDITIONAL(HAVE_ALSA, test "x$HAVE_ALSAPLUGIN" = "xyes") AM_CONDITIONAL(HAVE_FFMPEG, test "x$HAVE_FFMPEGPLUGIN" = "xyes") AM_CONDITIONAL(HAVE_PULSE, test "x$HAVE_PULSEPLUGIN" = "xyes") @@ -606,7 +606,6 @@ echo echo "Build Configuration:" echo echo "* Maintainer Mode: $USE_MAINTAINER_MODE" -echo " * Vala: $VALAC" fi dnl print summary @@ -640,7 +639,7 @@ PRINT_PLUGIN_INFO([vtx],[vtx file player (ay8910/12 emulation)],[test "x$HAVE_VT PRINT_PLUGIN_INFO([adplug],[adplug player (OPL2/OPL3 emulation)],[test "x$HAVE_ADPLUG" = "xyes"]) PRINT_PLUGIN_INFO([vfs_curl],[http/ftp streaming support],[test "x$HAVE_VFS_CURL" = "xyes"]) PRINT_PLUGIN_INFO([cdda],[cd audio player],[test "x$HAVE_CDDAPLUGIN" = "xyes"]) -PRINT_PLUGIN_INFO([gtkui],[GTK user interface],[test "x$HAVE_GTK" = "xyes"]) +PRINT_PLUGIN_INFO([gtkui],[GTK user interface],[test "x$HAVE_GTKUI" = "xyes"]) PRINT_PLUGIN_INFO([hotkeys],[Global hotkeys support],[test "x$HAVE_HOTKEYS" = "xyes"]) PRINT_PLUGIN_INFO([ffmpeg],[ffmpeg codecs],[test "x$HAVE_FFMPEGPLUGIN" = "xyes"]) PRINT_PLUGIN_INFO([oss],[oss output plugin],[test "x$HAVE_OSS" = "xyes"]) @@ -636,7 +636,7 @@ typedef struct { // junk reading/writing int (*junk_id3v1_read) (DB_playItem_t *it, DB_FILE *fp); int (*junk_id3v1_find) (DB_FILE *fp); - int (*junk_id3v1_write) (FILE *fp, DB_playItem_t *it); + int (*junk_id3v1_write) (FILE *fp, DB_playItem_t *it, const char *enc); int (*junk_id3v2_find) (DB_FILE *fp, int *psize); int (*junk_id3v2_read) (DB_playItem_t *it, DB_FILE *fp); int (*junk_id3v2_read_full) (DB_playItem_t *it, DB_id3v2_tag_t *tag, DB_FILE *fp); @@ -729,16 +729,20 @@ typedef struct { int (*dsp_preset_save) (const char *fname, struct ddb_dsp_context_s *head); void (*dsp_preset_free) (struct ddb_dsp_context_s *head); - // new 1.2 APIs + // ******* new 1.2 APIs ******** ddb_playlist_t *(*plt_alloc) (const char *title); void (*plt_free) (ddb_playlist_t *plt); - //int (*plt_insert) (ddb_playlist_t *plt, int before); + void (*plt_set_fast_mode) (ddb_playlist_t *plt, int fast); int (*plt_is_fast_mode) (ddb_playlist_t *plt); + const char * (*metacache_add_string) (const char *str); void (*metacache_remove_string) (const char *str); void (*metacache_ref) (const char *str); void (*metacache_unref) (const char *str); + + // this function must return original un-overriden value (ignoring the keys prefixed with '!') + const char *(*pl_find_meta_raw) (DB_playItem_t *it, const char *key); } DB_functions_t; enum { @@ -734,7 +734,7 @@ convstr_id3v2 (int version, uint8_t encoding, const unsigned char* str, int sz) } } // trim trailing linebreaks - for (n = converted_sz-2; n >= 0; n--) { + for (n = converted_sz-1; n >= 0; n--) { if (out[n] == '\n') { out[n] = 0; } @@ -877,7 +877,7 @@ junk_id3v1_read (playItem_t *it, DB_FILE *fp) { } int -junk_id3v1_write (FILE *fp, playItem_t *it) { +junk_id3v1_write (FILE *fp, playItem_t *it, const char *enc) { char title[30] = ""; char artist[30] = ""; char album[30] = ""; @@ -893,7 +893,7 @@ junk_id3v1_write (FILE *fp, playItem_t *it) { meta = pl_find_meta (it, name);\ if (meta) {\ char temp[1000];\ - int l = junk_iconv (meta, strlen (meta), temp, sizeof (temp), UTF8_STR, "ASCII");\ + int l = junk_iconv (meta, strlen (meta), temp, sizeof (temp), UTF8_STR, enc);\ if (l == -1) {\ memset (store, 0, sizeof (store));\ }\ @@ -3731,7 +3731,7 @@ junk_rewrite_tags (playItem_t *it, uint32_t junk_flags, int id3v2_version, const } else if (write_id3v1) { trace ("writing new id3v1 tag\n"); - if (junk_id3v1_write (out, it) != 0) { + if (junk_id3v1_write (out, it, id3v1_encoding) != 0) { trace ("cmp3_write_metadata: failed to write id3v1 tag to %s\n", pl_find_meta (it, ":URI")) goto error; } @@ -30,7 +30,7 @@ int junk_id3v1_find (DB_FILE *fp); int -junk_id3v1_write (FILE *fp, struct playItem_s *it); +junk_id3v1_write (FILE *fp, struct playItem_s *it, const char *enc); int junk_id3v2_find (DB_FILE *fp, int *psize); diff --git a/metacache.c b/metacache.c index 13616516..e7fa1619 100644 --- a/metacache.c +++ b/metacache.c @@ -117,7 +117,7 @@ metacache_remove_string (const char *str) { void metacache_ref (const char *str) { - uint32_t *refc = (uint32_t)(str-5); + uint32_t *refc = (uint32_t *)(str-5); *refc++; } @@ -79,6 +79,7 @@ #define trace(fmt,...) #define SKIP_BLANK_CUE_TRACKS 0 +#define MAX_CUE_TRACKS 99 #define min(x,y) ((x)<(y)?(x):(y)) @@ -145,7 +146,7 @@ pl_free (void) { for (playItem_t *it = playlists_head->head[PL_MAIN]; it; it = it->next[PL_MAIN]) { if (it->_refc > 1) { - fprintf (stderr, "\033[0;31mWARNING: playitem %p %s has refc=%d at delete time\033[37;0m\n", it, pl_find_meta (it, ":URI"), it->_refc); + fprintf (stderr, "\033[0;31mWARNING: playitem %p %s(%s) has refc=%d at delete time\033[37;0m\n", it, pl_find_meta_raw (it, ":URI"), pl_find_meta_raw (it, "track"), it->_refc); } } @@ -876,19 +877,19 @@ pl_cue_parse_time (const char *p) { } static playItem_t * -plt_process_cue_track (playlist_t *playlist, playItem_t *after, const char *fname, playItem_t **prev, char *track, char *index00, char *index01, char *pregap, char *title, char *albumperformer, char *performer, char *albumtitle, char *genre, char *date, char *replaygain_album_gain, char *replaygain_album_peak, char *replaygain_track_gain, char *replaygain_track_peak, const char *decoder_id, const char *ftype, int samplerate) { +plt_process_cue_track (playlist_t *playlist, const char *fname, playItem_t **prev, char *track, char *index00, char *index01, char *pregap, char *title, char *albumperformer, char *performer, char *albumtitle, char *genre, char *date, char *replaygain_album_gain, char *replaygain_album_peak, char *replaygain_track_gain, char *replaygain_track_peak, const char *decoder_id, const char *ftype, int samplerate) { if (!track[0]) { trace ("pl_process_cue_track: invalid track (file=%s, title=%s)\n", fname, title); - return after; + return NULL; } if (!index00[0] && !index01[0]) { trace ("pl_process_cue_track: invalid index (file=%s, title=%s, track=%s)\n", fname, title, track); - return after; + return NULL; } #if SKIP_BLANK_CUE_TRACKS if (!title[0]) { trace ("pl_process_cue_track: invalid title (file=%s, title=%s, track=%s)\n", fname, title, track); - return after; + return NULL; } #endif // fix track number @@ -917,7 +918,7 @@ plt_process_cue_track (playlist_t *playlist, playItem_t *after, const char *fnam } else { trace ("pl_process_cue_track: invalid pregap or index01 (pregap=%s, index01=%s)\n", pregap, index01); - return after; + return NULL; } (*prev)->endsample = (prevtime * samplerate) - 1; plt_set_item_duration (playlist, *prev, (float)((*prev)->endsample - (*prev)->startsample + 1) / samplerate); @@ -942,7 +943,7 @@ plt_process_cue_track (playlist_t *playlist, playItem_t *after, const char *fnam if (!index01[0]) { *prev = NULL; trace ("pl_process_cue_track: invalid index01 (pregap=%s, index01=%s)\n", pregap, index01); - return after; + return NULL; } playItem_t *it = pl_item_alloc_init (fname, decoder_id); pl_set_meta_int (it, ":TRACKNUM", atoi (track)); @@ -986,8 +987,6 @@ plt_process_cue_track (playlist_t *playlist, playItem_t *after, const char *fnam pl_set_item_replaygain (it, DDB_REPLAYGAIN_TRACKPEAK, atof (replaygain_track_peak)); } it->_flags |= DDB_IS_SUBTRACK | DDB_TAG_CUESHEET; - after = plt_insert_item (playlist, after, it); - pl_item_unref (it); *prev = it; return it; } @@ -1011,6 +1010,11 @@ plt_insert_cue_from_buffer (playlist_t *playlist, playItem_t *after, playItem_t char replaygain_album_peak[256] = ""; char replaygain_track_gain[256] = ""; char replaygain_track_peak[256] = ""; + const char *filetype = pl_find_meta_raw (origin, ":FILETYPE"); + + playItem_t *cuetracks[MAX_CUE_TRACKS]; + int ncuetracks = 0; + playItem_t *prev = NULL; while (buffersize > 0) { const uint8_t *p = buffer; @@ -1060,12 +1064,17 @@ plt_insert_cue_from_buffer (playlist_t *playlist, playItem_t *after, playItem_t pl_get_value_from_cue (p + 9, sizeof (date), date); } else if (!strncmp (p, "TRACK ", 6)) { - trace ("cue: adding track: %s %s %s\n", pl_find_meta (origin, ":URI"), title, track); + trace ("cue: adding track: %s %s %s\n", pl_find_meta_raw (origin, ":URI"), title, track); if (title[0]) { // add previous track - const char *filetype = pl_find_meta (origin, ":FILETYPE"); - after = plt_process_cue_track (playlist, after, pl_find_meta (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta (origin, ":DECODER"), filetype, samplerate); - trace ("cue: added %p (%p)\n", after); + playItem_t *it = plt_process_cue_track (playlist, pl_find_meta_raw (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta_raw (origin, ":DECODER"), filetype, samplerate); + trace ("cue: added %p\n", it); + if (it) { + if (it->startsample >= numsamples || it->endsample >= numsamples) { + goto error; + } + cuetracks[ncuetracks++] = it; + } } track[0] = 0; @@ -1108,34 +1117,57 @@ plt_insert_cue_from_buffer (playlist_t *playlist, playItem_t *after, playItem_t UNLOCK; return NULL; } - const char *filetype = pl_find_meta (origin, ":FILETYPE"); - after = plt_process_cue_track (playlist, after, pl_find_meta (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta (origin, ":DECODER"), filetype, samplerate); - if (after) { + // handle last track + playItem_t *it = plt_process_cue_track (playlist, pl_find_meta_raw (origin, ":URI"), &prev, track, index00, index01, pregap, title, albumperformer, performer, albumtitle, genre, date, replaygain_album_gain, replaygain_album_peak, replaygain_track_gain, replaygain_track_peak, pl_find_meta_raw (origin, ":DECODER"), filetype, samplerate); + if (it) { trace ("last track endsample: %d\n", numsamples-1); - after->endsample = numsamples-1; - plt_set_item_duration (playlist, after, (float)(after->endsample - after->startsample + 1) / samplerate); + it->endsample = numsamples-1; + if (it->endsample >= numsamples || it->startsample >= numsamples) { + goto error; + } + plt_set_item_duration (playlist, it, (float)(it->endsample - it->startsample + 1) / samplerate); + cuetracks[ncuetracks++] = it; + } + + if (!ncuetracks) { + UNLOCK; + return NULL; } - // add caller ref - if (after && after != ins) { - pl_item_ref (after); + + playItem_t *last = cuetracks[ncuetracks-1]; + pl_item_ref (last); + + for (int i = 0; i < ncuetracks; i++) { + after = plt_insert_item (playlist, after, cuetracks[i]); + pl_item_unref (cuetracks[i]); } - // copy metadata from embedded tags playItem_t *first = ins ? ins->next[PL_MAIN] : playlist->head[PL_MAIN]; + if (!first) { + UNLOCK; + return NULL; + } + // copy metadata from embedded tags uint32_t f = pl_get_item_flags (origin); f |= DDB_TAG_CUESHEET | DDB_IS_SUBTRACK; - if (pl_find_meta (origin, "cuesheet")) { + if (pl_find_meta_raw (origin, "cuesheet")) { f |= DDB_HAS_EMBEDDED_CUESHEET; } pl_set_item_flags (origin, f); pl_items_copy_junk (origin, first, after); UNLOCK; return after; +error: + for (int i = 0; i < ncuetracks; i++) { + pl_item_unref (cuetracks[i]); + } + UNLOCK; + return NULL; } playItem_t * plt_insert_cue (playlist_t *plt, playItem_t *after, playItem_t *origin, int numsamples, int samplerate) { trace ("pl_insert_cue numsamples=%d, samplerate=%d\n", numsamples, samplerate); - const char *fname = pl_find_meta (origin, ":URI"); + const char *fname = pl_find_meta_raw (origin, ":URI"); int len = strlen (fname); char cuename[len+5]; strcpy (cuename, fname); @@ -1170,6 +1202,7 @@ plt_insert_cue (playlist_t *plt, playItem_t *after, playItem_t *origin, int nums return plt_insert_cue_from_buffer (plt, after, origin, buf, sz, numsamples, samplerate); } +#if 0 playItem_t * plt_insert_m3u (playlist_t *plt, playItem_t *after, const char *fname, int *pabort, int (*cb)(playItem_t *it, void *data), void *user_data) { trace ("enter pl_insert_m3u\n"); @@ -1426,6 +1459,7 @@ plt_insert_pls (playlist_t *playlist, playItem_t *after, const char *fname, int } return after; } +#endif static int follow_symlinks = 0; static int ignore_archives = 0; @@ -1472,7 +1506,7 @@ plt_insert_file (playlist_t *playlist, playItem_t *after, const char *fname, int else { fn++; } - +#if 0 // detect pls/m3u files // they must be handled before checking for http://, // so that remote playlist files referenced from other playlist files could @@ -1484,6 +1518,7 @@ plt_insert_file (playlist_t *playlist, playItem_t *after, const char *fname, int return plt_insert_pls (playlist, after, fname, pabort, cb, user_data); } +#endif // add all posible streams as special-case: // set decoder to NULL, and filetype to "content" @@ -1718,10 +1753,9 @@ plt_remove_item (playlist_t *playlist, playItem_t *it) { if (!no_remove_notify) { streamer_song_removed_notify (it); + pl_playqueue_remove (it); } - pl_playqueue_remove (it); - // remove from both lists LOCK; for (int iter = PL_MAIN; iter <= PL_SEARCH; iter++) { @@ -1887,7 +1921,7 @@ plt_insert_item (playlist_t *playlist, playItem_t *after, playItem_t *it) { // shuffle playItem_t *prev = it->prev[PL_MAIN]; - if (pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS && prev && pl_find_meta (prev, "album") == pl_find_meta (it, "album") && pl_find_meta (prev, "artist") == pl_find_meta (it, "artist")) { + if (pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS && prev && pl_find_meta_raw (prev, "album") == pl_find_meta_raw (it, "album") && pl_find_meta_raw (prev, "artist") == pl_find_meta_raw (it, "artist")) { it->shufflerating = prev->shufflerating; } else { @@ -1966,7 +2000,7 @@ void pl_item_ref (playItem_t *it) { LOCK; it->_refc++; - //trace ("\033[0;34m+it %p: refc=%d: %s\033[37;0m\n", it, it->_refc, pl_find_meta (it, ":URI")); + //fprintf (stderr, "\033[0;34m+it %p: refc=%d: %s\033[37;0m\n", it, it->_refc, pl_find_meta_raw (it, ":URI")); UNLOCK; } @@ -1990,12 +2024,12 @@ void pl_item_unref (playItem_t *it) { LOCK; it->_refc--; - //trace ("\033[0;31m-it %p: refc=%d: %s\033[37;0m\n", it, it->_refc, pl_find_meta (it, ":URI")); + //trace ("\033[0;31m-it %p: refc=%d: %s\033[37;0m\n", it, it->_refc, pl_find_meta_raw (it, ":URI")); if (it->_refc < 0) { trace ("\033[0;31mplaylist: bad refcount on item %p\033[37;0m\n", it); } if (it->_refc <= 0) { - //printf ("\033[0;31mdeleted %s\033[37;0m\n", pl_find_meta (it, ":URI")); + //printf ("\033[0;31mdeleted %s\033[37;0m\n", pl_find_meta_raw (it, ":URI")); pl_item_free (it); } UNLOCK; @@ -2100,7 +2134,7 @@ plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fnam uint16_t l; uint8_t ll; #if (PLAYLIST_MINOR_VER==2) - const char *fname = pl_find_meta (it, ":URI"); + const char *fname = pl_find_meta_raw (it, ":URI"); l = strlen (fname); if (fwrite (&l, 1, 2, fp) != 2) { goto save_fail; @@ -2108,7 +2142,7 @@ plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fnam if (fwrite (fname, 1, l, fp) != l) { goto save_fail; } - const char *decoder_id = pl_find_meta (it, ":DECODER"); + const char *decoder_id = pl_find_meta_raw (it, ":DECODER"); if (decoder_id) { ll = strlen (decoder_id); if (fwrite (&ll, 1, 1, fp) != 1) { @@ -2140,7 +2174,7 @@ plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fnam goto save_fail; } #if (PLAYLIST_MINOR_VER==2) - const char *filetype = pl_find_meta (it, ":FILETYPE"); + const char *filetype = pl_find_meta_raw (it, ":FILETYPE"); if (!filetype) { filetype = ""; } @@ -2177,7 +2211,7 @@ plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fnam int16_t nm = 0; DB_metaInfo_t *m; for (m = it->meta; m; m = m->next) { - if (m->key[0] == '_') { + if (m->key[0] == '_' || m->key[0] == '!') { continue; // skip reserved names } nm++; @@ -2186,7 +2220,7 @@ plt_save (playlist_t *plt, playItem_t *first, playItem_t *last, const char *fnam goto save_fail; } for (m = it->meta; m; m = m->next) { - if (m->key[0] == '_') { + if (m->key[0] == '_' || m->key[0] == '!') { continue; // skip reserved names } @@ -2691,7 +2725,7 @@ plt_reshuffle (playlist_t *playlist, playItem_t **ppmin, playItem_t **ppmax) { playItem_t *pmax = NULL; playItem_t *prev = NULL; for (playItem_t *it = playlist->head[PL_MAIN]; it; it = it->next[PL_MAIN]) { - if (pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS && prev && pl_find_meta (prev, "album") == pl_find_meta (it, "album") && pl_find_meta (prev, "artist") == pl_find_meta (it, "artist")) { + if (pl_order == PLAYBACK_ORDER_SHUFFLE_ALBUMS && prev && pl_find_meta_raw (prev, "album") == pl_find_meta_raw (it, "album") && pl_find_meta_raw (prev, "artist") == pl_find_meta_raw (it, "artist")) { it->shufflerating = prev->shufflerating; } else { @@ -2718,7 +2752,7 @@ plt_reshuffle (playlist_t *playlist, playItem_t **ppmin, playItem_t **ppmax) { void plt_set_item_duration (playlist_t *playlist, playItem_t *it, float duration) { LOCK; - if (it->in_playlist) { + if (it->in_playlist && playlist) { if (it->_duration > 0) { playlist->totaltime -= it->_duration; } @@ -2787,7 +2821,7 @@ pl_format_item_queue (playItem_t *it, char *s, int size) { LOCK; *s = 0; int initsize = size; - const char *val = pl_find_meta (it, "_playing"); + const char *val = pl_find_meta_raw (it, "_playing"); while (val && *val) { while (*val && *val != '=') { val++; @@ -2977,7 +3011,7 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, l = min (l, sizeof (nm)-1); strncpy (nm, fmt+1, l); nm[l] = 0; - meta = pl_find_meta (it, nm); + meta = pl_find_meta_raw (it, nm); if (!meta) { meta = "?"; } @@ -2985,15 +3019,15 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } } else if (*fmt == 'a') { - meta = pl_find_meta (it, "artist"); + meta = pl_find_meta_raw (it, "artist"); if (!meta) { meta = "Unknown artist"; } } else if (*fmt == 't') { - meta = pl_find_meta (it, "title"); + meta = pl_find_meta_raw (it, "title"); if (!meta) { - const char *f = pl_find_meta (it, ":URI"); + const char *f = pl_find_meta_raw (it, ":URI"); if (f) { const char *start = strrchr (f, '/'); if (start) { @@ -3020,28 +3054,28 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } } else if (*fmt == 'b') { - meta = pl_find_meta (it, "album"); + meta = pl_find_meta_raw (it, "album"); if (!meta) { meta = "Unknown album"; } } else if (*fmt == 'B') { - meta = pl_find_meta (it, "band"); + meta = pl_find_meta_raw (it, "band"); if (!meta) { - meta = pl_find_meta (it, "album artist"); + meta = pl_find_meta_raw (it, "album artist"); if (!meta) { - meta = pl_find_meta (it, "albumartist"); + meta = pl_find_meta_raw (it, "albumartist"); if (!meta) { - meta = pl_find_meta (it, "artist"); + meta = pl_find_meta_raw (it, "artist"); } } } } else if (*fmt == 'C') { - meta = pl_find_meta (it, "composer"); + meta = pl_find_meta_raw (it, "composer"); } else if (*fmt == 'n') { - meta = pl_find_meta (it, "track"); + meta = pl_find_meta_raw (it, "track"); if (meta) { // check if it's numbers only const char *p = meta; @@ -3058,19 +3092,19 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } } else if (*fmt == 'N') { - meta = pl_find_meta (it, "numtracks"); + meta = pl_find_meta_raw (it, "numtracks"); } else if (*fmt == 'y') { - meta = pl_find_meta (it, "year"); + meta = pl_find_meta_raw (it, "year"); } else if (*fmt == 'g') { - meta = pl_find_meta (it, "genre"); + meta = pl_find_meta_raw (it, "genre"); } else if (*fmt == 'c') { - meta = pl_find_meta (it, "comment"); + meta = pl_find_meta_raw (it, "comment"); } else if (*fmt == 'r') { - meta = pl_find_meta (it, "copyright"); + meta = pl_find_meta_raw (it, "copyright"); } else if (*fmt == 'l') { const char *value = (duration = pl_format_duration (it, duration, dur, sizeof (dur))); @@ -3088,7 +3122,7 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } } else if (*fmt == 'f') { - const char *f = pl_find_meta (it, ":URI"); + const char *f = pl_find_meta_raw (it, ":URI"); meta = strrchr (f, '/'); if (meta) { meta++; @@ -3098,7 +3132,7 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } } else if (*fmt == 'F') { - meta = pl_find_meta (it, ":URI"); + meta = pl_find_meta_raw (it, ":URI"); } else if (*fmt == 'T') { char *t = tags; @@ -3145,7 +3179,7 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } else if (*fmt == 'd') { // directory - const char *f = pl_find_meta (it, ":URI"); + const char *f = pl_find_meta_raw (it, ":URI"); const char *end = strrchr (f, '/'); if (!end) { meta = ""; // got relative path without folder (should not happen) @@ -3170,7 +3204,7 @@ pl_format_title_int (const char *escape_chars, playItem_t *it, int idx, char *s, } } else if (*fmt == 'D') { - const char *f = pl_find_meta (it, ":URI"); + const char *f = pl_find_meta_raw (it, ":URI"); // directory with path const char *end = strrchr (f, '/'); if (!end) { @@ -3307,14 +3341,14 @@ pl_sort_compare_str (playItem_t *a, playItem_t *b) { int t1; int t2; const char *t; - t = pl_find_meta (a, "track"); + t = pl_find_meta_raw (a, "track"); if (t && !isdigit (*t)) { t1 = 999999; } else { t1 = t ? atoi (t) : -1; } - t = pl_find_meta (b, "track"); + t = pl_find_meta_raw (b, "track"); if (t && !isdigit (*t)) { t2 = 999999; } @@ -3656,7 +3690,7 @@ plt_search_process (playlist_t *playlist, const char *text) { if (*text) { DB_metaInfo_t *m = NULL; for (m = it->meta; m; m = m->next) { - if (m->key[0] == ':' || m->key[0] == '_') { + if (m->key[0] == ':' || m->key[0] == '_' || m->key[0] == '!') { break; } if (m->key!=cuesheet && m->key!=log) { @@ -3678,7 +3712,7 @@ plt_search_process (playlist_t *playlist, const char *text) { } } else if (utfcasestr_fast (m->value, lc)) { - //fprintf (stderr, "%s -> %s match (%s.%s)\n", text, m->value, pl_find_meta (it, ":URI"), m->key); + //fprintf (stderr, "%s -> %s match (%s.%s)\n", text, m->value, pl_find_meta_raw (it, ":URI"), m->key); // add to list it->next[PL_SEARCH] = NULL; if (playlist->tail[PL_SEARCH]) { @@ -244,9 +244,13 @@ pl_append_meta (playItem_t *it, const char *key, const char *value); // must be used in explicit pl_lock/unlock block // that makes it possible to avoid copying metadata on every access +// pl_find_meta may return overriden value (where the key is prefixed with '!') const char * pl_find_meta (playItem_t *it, const char *key); +const char * +pl_find_meta_raw (playItem_t *it, const char *key); + int pl_find_meta_int (playItem_t *it, const char *key, int def); @@ -41,10 +41,10 @@ pl_add_meta (playItem_t *it, const char *key, const char *value) { return; } // find end of normal metadata - if (!normaltail && (m->key[0] == ':' || m->key[0] == '_')) { + if (!normaltail && (m->key[0] == ':' || m->key[0] == '_' || m->key[0] == '!')) { normaltail = tail; propstart = m; - if (key[0] != ':' && key[0] != '_') { + if (key[0] != ':' && key[0] != '_' && key[0] != '!') { break; } } @@ -63,7 +63,7 @@ pl_add_meta (playItem_t *it, const char *key, const char *value) { m->key = metacache_add_string (key); m->value = metacache_add_string (value); - if (key[0] == ':' || key[0] == '_') { + if (key[0] == ':' || key[0] == '_' || key[0] == '!') { if (tail) { tail->next = m; } @@ -86,7 +86,7 @@ pl_add_meta (playItem_t *it, const char *key, const char *value) { void pl_append_meta (playItem_t *it, const char *key, const char *value) { pl_lock (); - const char *old = pl_find_meta (it, key); + const char *old = pl_find_meta_raw (it, key); if (old && (!strcasecmp (key, "cuesheet") || !strcasecmp (key, "log"))) { pl_unlock (); @@ -192,6 +192,34 @@ const char * pl_find_meta (playItem_t *it, const char *key) { pl_lock (); DB_metaInfo_t *m = it->meta; + + if (key && key[0] == ':') { + // try to find an override + while (m) { + if (m->key[0] == '!' && !strcasecmp (key+1, m->key+1)) { + pl_unlock (); + return m->value; + } + m = m->next; + } + } + + m = it->meta; + while (m) { + if (!strcasecmp (key, m->key)) { + pl_unlock (); + return m->value; + } + m = m->next; + } + pl_unlock (); + return NULL; +} + +const char * +pl_find_meta_raw (playItem_t *it, const char *key) { + pl_lock (); + DB_metaInfo_t *m = it->meta; while (m) { if (!strcasecmp (key, m->key)) { pl_unlock (); @@ -257,7 +285,7 @@ pl_delete_all_meta (playItem_t *it) { DB_metaInfo_t *prev = NULL; while (m) { DB_metaInfo_t *next = m->next; - if (m->key[0] == ':') { + if (m->key[0] == ':' || m->key[0] == '_' || m->key[0] == '!') { prev = m; } else { @@ -242,7 +242,7 @@ static DB_functions_t deadbeef_api = { // junk reading .junk_id3v1_read = (int (*)(DB_playItem_t *it, DB_FILE *fp))junk_id3v1_read, .junk_id3v1_find = junk_id3v1_find, - .junk_id3v1_write = (int (*) (FILE *, DB_playItem_t *))junk_id3v1_write, + .junk_id3v1_write = (int (*) (FILE *, DB_playItem_t *, const char *))junk_id3v1_write, .junk_id3v2_find = junk_id3v2_find, .junk_id3v2_read = (int (*)(DB_playItem_t *it, DB_FILE *fp))junk_id3v2_read, .junk_id3v2_read_full = (int (*)(DB_playItem_t *, DB_id3v2_tag_t *tag, DB_FILE *fp))junk_id3v2_read_full, @@ -328,6 +328,7 @@ static DB_functions_t deadbeef_api = { .metacache_remove_string = metacache_remove_string, .metacache_ref = metacache_ref, .metacache_unref = metacache_unref, + .pl_find_meta_raw = (const char *(*) (DB_playItem_t *it, const char *key))pl_find_meta_raw, }; DB_functions_t *deadbeef = &deadbeef_api; diff --git a/plugins/aac/aac.c b/plugins/aac/aac.c index 6f3e4273..f42b9d2f 100644 --- a/plugins/aac/aac.c +++ b/plugins/aac/aac.c @@ -94,6 +94,7 @@ typedef struct { char *samplebuffer; int remap[10]; int noremap; + int eof; } aac_info_t; // allocate codec control structure @@ -407,8 +408,8 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { int totalsamples = -1; int offs = -1; + int skip = deadbeef->junk_get_leading_size (info->file); if (!info->file->vfs->is_streaming ()) { - int skip = deadbeef->junk_get_leading_size (info->file); if (skip >= 0) { deadbeef->fseek (info->file, skip, SEEK_SET); } @@ -565,14 +566,23 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { if (!info->mp4file) { trace ("mp4 track not found, looking for aac stream...\n"); - // not an mp4, try raw aac - deadbeef->rewind (info->file); + if (skip >= 0) { + deadbeef->fseek (info->file, skip, SEEK_SET); + } + else { + deadbeef->rewind (info->file); + } if (parse_aac_stream (info->file, &samplerate, &channels, &duration, &totalsamples) == -1) { trace ("aac stream not found\n"); return -1; } - deadbeef->rewind (info->file); - trace ("found aac stream\n"); + if (skip >= 0) { + deadbeef->fseek (info->file, skip, SEEK_SET); + } + else { + deadbeef->rewind (info->file); + } + trace ("found aac stream (junk: %d, offs: %d)\n", skip, offs); } _info->fmt.channels = channels; @@ -607,6 +617,7 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { trace ("NeAACDecOpen\n"); info->dec = NeAACDecOpen (); + trace ("prepare for NeAACDecInit: fread %d from offs %lld\n", AAC_BUFFER_SIZE, deadbeef->ftell (info->file)); info->remaining = deadbeef->fread (info->buffer, 1, AAC_BUFFER_SIZE, info->file); NeAACDecConfigurationPtr conf = NeAACDecGetCurrentConfiguration (info->dec); @@ -614,9 +625,9 @@ aac_init (DB_fileinfo_t *_info, DB_playItem_t *it) { NeAACDecSetConfiguration (info->dec, conf); unsigned long srate; unsigned char ch; - trace ("NeAACDecInit\n"); + trace ("NeAACDecInit (%d bytes)\n", info->remaining); int consumed = NeAACDecInit (info->dec, info->buffer, info->remaining, &srate, &ch); - trace ("NeAACDecInit returned samplerate=%d, channels=%d\n", (int)srate, (int)ch); + trace ("NeAACDecInit returned samplerate=%d, channels=%d, consumed: %d\n", (int)srate, (int)ch, consumed); if (consumed < 0) { trace ("NeAACDecInit returned %d\n", consumed); return -1; @@ -682,6 +693,10 @@ aac_free (DB_fileinfo_t *_info) { static int aac_read (DB_fileinfo_t *_info, char *bytes, int size) { aac_info_t *info = (aac_info_t *)_info; + if (info->eof) { + trace ("aac_read: received call after eof\n"); + return 0; + } int samplesize = _info->fmt.channels * _info->fmt.bps / 8; if (!info->file->vfs->is_streaming ()) { if (info->currentsample + size / samplesize > info->endsample) { @@ -805,6 +820,7 @@ aac_read (DB_fileinfo_t *_info, char *bytes, int size) { #ifdef USE_MP4FF int rc = mp4ff_read_sample (info->mp4file, info->mp4track, info->mp4sample, &buffer, &buffer_size); if (rc == 0) { + info->eof = 1; break; } #else @@ -841,22 +857,37 @@ aac_read (DB_fileinfo_t *_info, char *bytes, int size) { } else { if (info->remaining < AAC_BUFFER_SIZE) { + trace ("fread from offs %lld\n", deadbeef->ftell (info->file)); size_t res = deadbeef->fread (info->buffer + info->remaining, 1, AAC_BUFFER_SIZE-info->remaining, info->file); if (res == 0) { eof = 1; } info->remaining += res; + if (!info->remaining) { + break; + } } + trace ("NeAACDecDecode %d bytes\n", info->remaining) samples = NeAACDecDecode (info->dec, &info->frame_info, info->buffer, info->remaining); if (!samples) { - trace ("NeAACDecDecode failed, consumed=%d\n", info->frame_info.bytesconsumed); + trace ("NeAACDecDecode failed with error %s (%d), consumed=%d\n", NeAACDecGetErrorMessage(info->frame_info.error), (int)info->frame_info.error, info->frame_info.bytesconsumed); + if (info->num_errors > 10) { trace ("NeAACDecDecode failed %d times, interrupting\n", info->num_errors); break; } info->num_errors++; - info->remaining = 0; + int s = 0; + while (!s && info->remaining > 0) { + int ch, sr, br, sm; + s = aac_sync (info->buffer, &ch, &sr, &br, &sm); + if (s == 0) { + memmove (info->buffer, info->buffer+1, info->remaining-1); + info->remaining--; + } + } +// info->remaining = 0; continue; } info->num_errors=0; @@ -881,6 +912,7 @@ aac_read (DB_fileinfo_t *_info, char *bytes, int size) { } info->currentsample += (initsize-size) / samplesize; + trace ("aac_read return: %d\n", initsize-size); return initsize-size; } @@ -949,14 +981,12 @@ aac_seek_sample (DB_fileinfo_t *_info, int sample) { info->skipsamples = sample - info->mp4sample * (info->mp4framesize-1); } else { - if (sample < info->currentsample, 1) { - int skip = deadbeef->junk_get_leading_size (info->file); - if (skip >= 0) { - deadbeef->fseek (info->file, skip, SEEK_SET); - } - else { - deadbeef->fseek (info->file, 0, SEEK_SET); - } + int skip = deadbeef->junk_get_leading_size (info->file); + if (skip >= 0) { + deadbeef->fseek (info->file, skip, SEEK_SET); + } + else { + deadbeef->fseek (info->file, 0, SEEK_SET); } int res = seek_raw_aac (info, sample); @@ -1164,6 +1194,11 @@ aac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { trace ("not found\n"); return NULL; } + int skip = deadbeef->junk_get_leading_size (fp); + if (skip > 0) { + trace ("mpgmad: skipping %d bytes (tag)\n", skip); + deadbeef->fseek(fp, skip, SEEK_SET); + } const char *ftype = NULL; float duration = -1; diff --git a/plugins/aac/aac_parser.c b/plugins/aac/aac_parser.c index 07c1ca6a..ea274989 100644 --- a/plugins/aac/aac_parser.c +++ b/plugins/aac/aac_parser.c @@ -88,7 +88,10 @@ aac_sync(const uint8_t *buf, int *channels, int *sample_rate, int *bit_rate, int return 0; } int adts_buffer_fullness = ((buf[5] & 0x1F) << 3) | ((buf[6] & 0xFC) >> 2); - rdb = buf[7] & 0x03; + rdb = buf[6] & 0x03; + if (!rdb) { + rdb = buf[7] & 0x03; + } trace ("rdb: %d\n", rdb); *channels = aac_channels[channel_conf]; diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index fd71c89a..0cc458db 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -672,7 +672,7 @@ palsa_thread (void *context) { UNLOCK; int sleeptime = period_size-frames_to_deliver; if (sleeptime > 0 && plugin.fmt.samplerate > 0 && plugin.fmt.channels > 0) { - usleep (sleeptime * 1000000 / plugin.fmt.samplerate / plugin.fmt.channels); + usleep (sleeptime * 1000 / plugin.fmt.samplerate / plugin.fmt.channels * 1000); } } } diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index e395756d..458737fb 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -31,7 +31,7 @@ static uintptr_t imlib_mutex; #define trace(...) static char default_cover[PATH_MAX]; -#define DEFAULT_FILEMASK "*cover*.jpg;*front*.jpg;*folder*.jpg" +#define DEFAULT_FILEMASK "*cover*.jpg;*front*.jpg;*folder*.jpg;*cover*.png;*front*.png;*folder*.png" static DB_artwork_plugin_t plugin; DB_functions_t *deadbeef; diff --git a/plugins/artwork/lastfm.c b/plugins/artwork/lastfm.c index 91972c8a..5b5cedd4 100644 --- a/plugins/artwork/lastfm.c +++ b/plugins/artwork/lastfm.c @@ -11,7 +11,7 @@ #include "escape.h" #define BASE_URL "http://ws.audioscrobbler.com/2.0/" -#define API_KEY "b25b959554ed76058ac220b7b2e0a026" +#define API_KEY "6b33c8ae4d598a9aff8fe63e334e6e86" //#define trace(...) { fprintf(stderr, __VA_ARGS__); } #define trace(...) diff --git a/plugins/converter/Makefile.am b/plugins/converter/Makefile.am index 70ef9013..26691bab 100644 --- a/plugins/converter/Makefile.am +++ b/plugins/converter/Makefile.am @@ -1,6 +1,16 @@ if HAVE_CONVERTER -pkglib_LTLIBRARIES = converter.la converter_gtkui.la +if HAVE_GTK2 +if HAVE_GTK3 +pkglib_LTLIBRARIES = converter.la converter_gtk2.la converter_gtk3.la +else +pkglib_LTLIBRARIES = converter.la converter_gtk2.la +endif +else +if HAVE_GTK3 +pkglib_LTLIBRARIES = converter.la converter_gtk3.la +endif +endif convdatadir = $(libdir)/deadbeef/convpresets convdata_DATA = \ @@ -17,21 +27,34 @@ convdata_DATA = \ EXTRA_DIST = $(convdata_DATA) AM_CFLAGS = $(CFLAGS) -std=c99 -fPIC + converter_la_SOURCES = converter.c converter.h converter_la_LDFLAGS = -module -converter_gtkui_la_SOURCES = convgui.c interface.c support.c callbacks.h converter.h interface.h support.h -converter_gtkui_la_LDFLAGS = -module +if HAVE_GTK2 +converter_gtk2_la_SOURCES = convgui.c interface.c support.c callbacks.h converter.h interface.h support.h +converter_gtk2_la_LDFLAGS = -module +endif +if HAVE_GTK3 +converter_gtk3_la_SOURCES = convgui.c interface.c support.c callbacks.h converter.h interface.h support.h +converter_gtk3_la_LDFLAGS = -module +endif if STATICLINK GTK_ROOT=@top_srcdir@/$(LIB)/gtk-2.12.12/usr -converter_gtkui_la_LIBADD = $(LDADD) -L$(GTK_ROOT)/lib $(GTK_ROOT)/lib/libgtk-x11-2.0.la $(GTK_ROOT)/lib/libgdk-x11-2.0.la $(GTK_ROOT)/lib/libpangoft2-1.0.la $(GTK_ROOT)/lib/libpangocairo-1.0.la $(GTK_ROOT)/lib/libgdk_pixbuf-2.0.la -lm $(GTK_ROOT)/lib/libcairo.la $(GTK_ROOT)/lib/libpango-1.0.la $(GTK_ROOT)/lib/libgobject-2.0.la $(GTK_ROOT)/lib/libgmodule-2.0.la $(GTK_ROOT)/lib/libgthread-2.0.la -lrt $(GTK_ROOT)/lib/libglib-2.0.la +converter_gtk2_la_LIBADD = $(LDADD) -L$(GTK_ROOT)/lib $(GTK_ROOT)/lib/libgtk-x11-2.0.la $(GTK_ROOT)/lib/libgdk-x11-2.0.la $(GTK_ROOT)/lib/libpangoft2-1.0.la $(GTK_ROOT)/lib/libpangocairo-1.0.la $(GTK_ROOT)/lib/libgdk_pixbuf-2.0.la -lm $(GTK_ROOT)/lib/libcairo.la $(GTK_ROOT)/lib/libpango-1.0.la $(GTK_ROOT)/lib/libgobject-2.0.la $(GTK_ROOT)/lib/libgmodule-2.0.la $(GTK_ROOT)/lib/libgthread-2.0.la -lrt $(GTK_ROOT)/lib/libglib-2.0.la -converter_gtkui_la_CFLAGS = -std=c99 -I $(GTK_ROOT)/include -I $(GTK_ROOT)/lib/gtk-2.0/include -I $(GTK_ROOT)/include/glib-2.0 -I $(GTK_ROOT)/include/gtk-2.0 -I $(GTK_ROOT)/include/cairo -I $(GTK_ROOT)/lib/glib-2.0/include/ -I $(GTK_ROOT)/include/pango-1.0 -I $(GTK_ROOT)/include/atk-1.0 -DULTRA_COMPATIBLE=1 +converter_gtk2_la_CFLAGS = -std=c99 -I $(GTK_ROOT)/include -I $(GTK_ROOT)/lib/gtk-2.0/include -I $(GTK_ROOT)/include/glib-2.0 -I $(GTK_ROOT)/include/gtk-2.0 -I $(GTK_ROOT)/include/cairo -I $(GTK_ROOT)/lib/glib-2.0/include/ -I $(GTK_ROOT)/include/pango-1.0 -I $(GTK_ROOT)/include/atk-1.0 -DULTRA_COMPATIBLE=1 else -converter_gtkui_la_LIBADD = $(LDADD) $(GTKUI_DEPS_LIBS) -converter_gtkui_la_CFLAGS = -std=c99 $(GTKUI_DEPS_CFLAGS) +if HAVE_GTK2 +converter_gtk2_la_LIBADD = $(LDADD) $(GTK2_DEPS_LIBS) +converter_gtk2_la_CFLAGS = -std=c99 $(GTK2_DEPS_CFLAGS) +endif +if HAVE_GTK3 +converter_gtk3_la_LIBADD = $(LDADD) $(GTK3_DEPS_LIBS) +converter_gtk3_la_CFLAGS = -std=c99 $(GTK3_DEPS_CFLAGS) endif +endif endif diff --git a/plugins/converter/converter.glade b/plugins/converter/converter.glade index 8dea540f..8ad62319 100644 --- a/plugins/converter/converter.glade +++ b/plugins/converter/converter.glade @@ -1649,6 +1649,7 @@ Temporary file</property> <child> <widget class="GtkComboBox" id="plugin"> + <property name="width_request">232</property> <property name="visible">True</property> <property name="add_tearoffs">False</property> <property name="focus_on_click">True</property> @@ -1678,6 +1679,8 @@ Temporary file</property> </widget> <widget class="GtkDialog" id="preset_list"> + <property name="width_request">450</property> + <property name="height_request">254</property> <property name="visible">True</property> <property name="title" translatable="yes">Presets</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> @@ -1806,7 +1809,7 @@ Temporary file</property> <child> <widget class="GtkTreeView" id="presets"> <property name="width_request">400</property> - <property name="height_request">176</property> + <property name="height_request">160</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="headers_visible">False</property> diff --git a/plugins/converter/converter.gladep b/plugins/converter/converter.gladep index fc0e5ab2..f08332d4 100644 --- a/plugins/converter/converter.gladep +++ b/plugins/converter/converter.gladep @@ -7,5 +7,6 @@ <source_directory></source_directory> <gnome_support>FALSE</gnome_support> <output_main_file>FALSE</output_main_file> + <output_support_files>FALSE</output_support_files> <output_build_files>FALSE</output_build_files> </glade-project> diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c index 9a20d274..bd54eb0e 100644 --- a/plugins/converter/convgui.c +++ b/plugins/converter/convgui.c @@ -246,7 +246,7 @@ converter_process (converter_ctx_t *conv) } GtkWidget *progress = gtk_dialog_new_with_buttons (_("Converting..."), GTK_WINDOW (gtkui_plugin->get_mainwin ()), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); - GtkWidget *vbox = GTK_DIALOG (progress)->vbox; + GtkWidget *vbox = gtk_dialog_get_content_area (GTK_DIALOG (progress)); GtkWidget *entry = gtk_entry_new (); gtk_widget_set_size_request (entry, 400, -1); gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); @@ -1265,7 +1265,11 @@ convgui_get_actions (DB_playItem_t *it) int convgui_connect (void) { +#if GTK_CHECK_VERSION(3,0,0) + gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui3"); +#else gtkui_plugin = (ddb_gtkui_t *)deadbeef->plug_get_for_id ("gtkui"); +#endif converter_plugin = (ddb_converter_t *)deadbeef->plug_get_for_id ("converter"); if (!gtkui_plugin || !converter_plugin) { return -1; @@ -1312,7 +1316,11 @@ DB_misc_t plugin = { }; DB_plugin_t * -converter_gtkui_load (DB_functions_t *api) { +#if GTK_CHECK_VERSION(3,0,0) +converter_gtk3_load (DB_functions_t *api) { +#else +converter_gtk2_load (DB_functions_t *api) { +#endif deadbeef = api; return DB_PLUGIN (&plugin); } diff --git a/plugins/converter/interface.c b/plugins/converter/interface.c index 7cba6062..76044196 100644 --- a/plugins/converter/interface.c +++ b/plugins/converter/interface.c @@ -21,7 +21,7 @@ #define GLADE_HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ - gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + g_object_ref(G_OBJECT(widget)), (GDestroyNotify) g_object_unref) #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ g_object_set_data (G_OBJECT (component), name, widget) @@ -56,7 +56,7 @@ create_converterdlg (void) GtkWidget *image470; GtkWidget *hbox88; GtkWidget *label116; - GtkObject *numthreads_adj; + GObject *numthreads_adj; GtkWidget *numthreads; GtkWidget *hbox89; GtkWidget *label117; @@ -71,9 +71,6 @@ create_converterdlg (void) GtkWidget *dialog_action_area5; GtkWidget *converter_cancel; GtkWidget *converter_ok; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); converterdlg = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (converterdlg), "Converter"); @@ -82,7 +79,7 @@ create_converterdlg (void) gtk_window_set_type_hint (GTK_WINDOW (converterdlg), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_dialog_set_has_separator (GTK_DIALOG (converterdlg), FALSE); - dialog_vbox6 = GTK_DIALOG (converterdlg)->vbox; + dialog_vbox6 = gtk_dialog_get_content_area (GTK_DIALOG (converterdlg)); gtk_widget_show (dialog_vbox6); vbox26 = gtk_vbox_new (FALSE, 8); @@ -126,14 +123,14 @@ create_converterdlg (void) output_file = gtk_entry_new (); gtk_widget_show (output_file); gtk_box_pack_start (GTK_BOX (hbox101), output_file, TRUE, TRUE, 0); - gtk_tooltips_set_tip (tooltips, output_file, _("Extension (e.g. .mp3) will be appended automatically.\nLeave the field empty for default (%a - %t)."), NULL); + gtk_widget_set_tooltip_text (output_file, _("Extension (e.g. .mp3) will be appended automatically.\nLeave the field empty for default (%a - %t).")); gtk_entry_set_invisible_char (GTK_ENTRY (output_file), 8226); custom6 = title_formatting_help_link_create ("custom6", "", "", 0, 0); gtk_widget_show (custom6); gtk_box_pack_start (GTK_BOX (hbox101), custom6, TRUE, TRUE, 0); - GTK_WIDGET_UNSET_FLAGS (custom6, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (custom6, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(custom6, FALSE); + gtk_widget_set_can_default(custom6, FALSE); hbox69 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox69); @@ -147,7 +144,7 @@ create_converterdlg (void) gtk_widget_show (hbox90); gtk_box_pack_start (GTK_BOX (hbox69), hbox90, TRUE, TRUE, 0); - encoder = gtk_combo_box_new_text (); + encoder = gtk_combo_box_text_new (); gtk_widget_show (encoder); gtk_box_pack_start (GTK_BOX (hbox90), encoder, TRUE, TRUE, 0); @@ -171,7 +168,7 @@ create_converterdlg (void) gtk_widget_show (hbox91); gtk_box_pack_start (GTK_BOX (hbox86), hbox91, TRUE, TRUE, 0); - dsp_preset = gtk_combo_box_new_text (); + dsp_preset = gtk_combo_box_text_new (); gtk_widget_show (dsp_preset); gtk_box_pack_start (GTK_BOX (hbox91), dsp_preset, TRUE, TRUE, 0); @@ -190,7 +187,7 @@ create_converterdlg (void) gtk_widget_show (label116); gtk_box_pack_start (GTK_BOX (hbox88), label116, FALSE, FALSE, 0); - numthreads_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 0); + numthreads_adj = G_OBJECT(gtk_adjustment_new (1, 0, 100, 1, 10, 0)); numthreads = gtk_spin_button_new (GTK_ADJUSTMENT (numthreads_adj), 1, 0); gtk_widget_show (numthreads); gtk_box_pack_start (GTK_BOX (hbox88), numthreads, TRUE, TRUE, 0); @@ -203,15 +200,15 @@ create_converterdlg (void) gtk_widget_show (label117); gtk_box_pack_start (GTK_BOX (hbox89), label117, FALSE, FALSE, 0); - output_format = gtk_combo_box_new_text (); + output_format = gtk_combo_box_text_new (); gtk_widget_show (output_format); gtk_box_pack_start (GTK_BOX (hbox89), output_format, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (output_format), _("Keep source format")); - gtk_combo_box_append_text (GTK_COMBO_BOX (output_format), _("8 bit signed int")); - gtk_combo_box_append_text (GTK_COMBO_BOX (output_format), _("16 bit signed int")); - gtk_combo_box_append_text (GTK_COMBO_BOX (output_format), _("24 bit signed int")); - gtk_combo_box_append_text (GTK_COMBO_BOX (output_format), _("32 bit signed int")); - gtk_combo_box_append_text (GTK_COMBO_BOX (output_format), _("32 bit float")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (output_format), _("Keep source format")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (output_format), _("8 bit signed int")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (output_format), _("16 bit signed int")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (output_format), _("24 bit signed int")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (output_format), _("32 bit signed int")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (output_format), _("32 bit float")); hbox99 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox99); @@ -221,11 +218,11 @@ create_converterdlg (void) gtk_widget_show (label121); gtk_box_pack_start (GTK_BOX (hbox99), label121, FALSE, FALSE, 0); - overwrite_action = gtk_combo_box_new_text (); + overwrite_action = gtk_combo_box_text_new (); gtk_widget_show (overwrite_action); gtk_box_pack_start (GTK_BOX (hbox99), overwrite_action, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (overwrite_action), _("Prompt")); - gtk_combo_box_append_text (GTK_COMBO_BOX (overwrite_action), _("Overwrite")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (overwrite_action), _("Prompt")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (overwrite_action), _("Overwrite")); preserve_folders = gtk_check_button_new_with_mnemonic (_("Preserve folder structure, starting from:")); gtk_box_pack_start (GTK_BOX (vbox26), preserve_folders, FALSE, FALSE, 0); @@ -242,19 +239,19 @@ create_converterdlg (void) gtk_widget_show (preserve_folder_browse); gtk_box_pack_start (GTK_BOX (hbox102), preserve_folder_browse, FALSE, FALSE, 0); - dialog_action_area5 = GTK_DIALOG (converterdlg)->action_area; + dialog_action_area5 = gtk_dialog_get_action_area (GTK_DIALOG (converterdlg)); gtk_widget_show (dialog_action_area5); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area5), GTK_BUTTONBOX_END); converter_cancel = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (converter_cancel); gtk_dialog_add_action_widget (GTK_DIALOG (converterdlg), converter_cancel, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (converter_cancel, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(converter_cancel, TRUE); converter_ok = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (converter_ok); gtk_dialog_add_action_widget (GTK_DIALOG (converterdlg), converter_ok, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (converter_ok, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(converter_ok, TRUE); g_signal_connect ((gpointer) output_folder, "changed", G_CALLBACK (on_output_folder_changed), @@ -338,7 +335,6 @@ create_converterdlg (void) GLADE_HOOKUP_OBJECT_NO_REF (converterdlg, dialog_action_area5, "dialog_action_area5"); GLADE_HOOKUP_OBJECT (converterdlg, converter_cancel, "converter_cancel"); GLADE_HOOKUP_OBJECT (converterdlg, converter_ok, "converter_ok"); - GLADE_HOOKUP_OBJECT_NO_REF (converterdlg, tooltips, "tooltips"); return converterdlg; } @@ -378,16 +374,13 @@ create_convpreset_editor (void) GtkWidget *dialog_action_area6; GtkWidget *convpreset_cancel; GtkWidget *convpreset_ok; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); convpreset_editor = gtk_dialog_new (); gtk_window_set_title (GTK_WINDOW (convpreset_editor), _("Edit Encoder Preset")); gtk_window_set_modal (GTK_WINDOW (convpreset_editor), TRUE); gtk_window_set_type_hint (GTK_WINDOW (convpreset_editor), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox7 = GTK_DIALOG (convpreset_editor)->vbox; + dialog_vbox7 = gtk_dialog_get_content_area (GTK_DIALOG (convpreset_editor)); gtk_widget_show (dialog_vbox7); vbox27 = gtk_vbox_new (FALSE, 8); @@ -421,7 +414,7 @@ create_convpreset_editor (void) ext = gtk_entry_new (); gtk_widget_show (ext); gtk_box_pack_start (GTK_BOX (hbox96), ext, TRUE, TRUE, 0); - gtk_tooltips_set_tip (tooltips, ext, _("E.g. mp3"), NULL); + gtk_widget_set_tooltip_text (ext, _("E.g. mp3")); gtk_entry_set_invisible_char (GTK_ENTRY (ext), 9679); gtk_entry_set_activates_default (GTK_ENTRY (ext), TRUE); @@ -440,15 +433,15 @@ create_convpreset_editor (void) encoder = gtk_entry_new (); gtk_widget_show (encoder); gtk_box_pack_start (GTK_BOX (hbox93), encoder, TRUE, TRUE, 0); - gtk_tooltips_set_tip (tooltips, encoder, _("Example: lame - %o\n%i for input file, %o for output file, - for stdin"), NULL); + gtk_widget_set_tooltip_text (encoder, _("Example: lame - %o\n%i for input file, %o for output file, - for stdin")); gtk_entry_set_invisible_char (GTK_ENTRY (encoder), 9679); gtk_entry_set_activates_default (GTK_ENTRY (encoder), TRUE); custom4 = encoder_cmdline_help_link_create ("custom4", "", "", 0, 0); gtk_widget_show (custom4); gtk_box_pack_start (GTK_BOX (hbox93), custom4, TRUE, TRUE, 0); - GTK_WIDGET_UNSET_FLAGS (custom4, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (custom4, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(custom4, FALSE); + gtk_widget_set_can_default(custom4, FALSE); label124 = gtk_label_new (_("<small>%o - output file name\n%i - temporary input file name</small>")); gtk_widget_show (label124); @@ -463,11 +456,11 @@ create_convpreset_editor (void) gtk_widget_show (label107); gtk_box_pack_start (GTK_BOX (hbox73), label107, FALSE, FALSE, 0); - method = gtk_combo_box_new_text (); + method = gtk_combo_box_text_new (); gtk_widget_show (method); gtk_box_pack_start (GTK_BOX (hbox73), method, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (method), _("Pipe")); - gtk_combo_box_append_text (GTK_COMBO_BOX (method), _("Temporary file")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (method), _("Pipe")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (method), _("Temporary file")); frame9 = gtk_frame_new (NULL); gtk_widget_show (frame9); @@ -518,30 +511,30 @@ create_convpreset_editor (void) gtk_widget_show (id3v2); gtk_box_pack_start (GTK_BOX (hbox104), id3v2, FALSE, FALSE, 0); - id3v2_version = gtk_combo_box_new_text (); + id3v2_version = gtk_combo_box_text_new (); gtk_widget_show (id3v2_version); gtk_box_pack_start (GTK_BOX (hbox104), id3v2_version, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (id3v2_version), "2.3"); - gtk_combo_box_append_text (GTK_COMBO_BOX (id3v2_version), "2.4"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id3v2_version), "2.3"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id3v2_version), "2.4"); label125 = gtk_label_new (_("<b>Tag writer</b>")); gtk_widget_show (label125); gtk_frame_set_label_widget (GTK_FRAME (frame9), label125); gtk_label_set_use_markup (GTK_LABEL (label125), TRUE); - dialog_action_area6 = GTK_DIALOG (convpreset_editor)->action_area; + dialog_action_area6 = gtk_dialog_get_action_area (GTK_DIALOG (convpreset_editor)); gtk_widget_show (dialog_action_area6); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area6), GTK_BUTTONBOX_END); convpreset_cancel = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (convpreset_cancel); gtk_dialog_add_action_widget (GTK_DIALOG (convpreset_editor), convpreset_cancel, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (convpreset_cancel, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(convpreset_cancel, TRUE); convpreset_ok = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (convpreset_ok); gtk_dialog_add_action_widget (GTK_DIALOG (convpreset_editor), convpreset_ok, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (convpreset_ok, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(convpreset_ok, TRUE); g_signal_connect ((gpointer) encoder, "changed", G_CALLBACK (on_encoder_changed), @@ -580,7 +573,6 @@ create_convpreset_editor (void) GLADE_HOOKUP_OBJECT_NO_REF (convpreset_editor, dialog_action_area6, "dialog_action_area6"); GLADE_HOOKUP_OBJECT (convpreset_editor, convpreset_cancel, "convpreset_cancel"); GLADE_HOOKUP_OBJECT (convpreset_editor, convpreset_ok, "convpreset_ok"); - GLADE_HOOKUP_OBJECT_NO_REF (convpreset_editor, tooltips, "tooltips"); return convpreset_editor; } @@ -615,7 +607,7 @@ create_dsppreset_editor (void) gtk_window_set_modal (GTK_WINDOW (dsppreset_editor), TRUE); gtk_window_set_type_hint (GTK_WINDOW (dsppreset_editor), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox9 = GTK_DIALOG (dsppreset_editor)->vbox; + dialog_vbox9 = gtk_dialog_get_content_area (GTK_DIALOG (dsppreset_editor)); gtk_widget_show (dialog_vbox9); vbox30 = gtk_vbox_new (FALSE, 8); @@ -686,19 +678,19 @@ create_dsppreset_editor (void) gtk_widget_show (down); gtk_box_pack_start (GTK_BOX (vbox34), down, FALSE, FALSE, 0); - dialog_action_area8 = GTK_DIALOG (dsppreset_editor)->action_area; + dialog_action_area8 = gtk_dialog_get_action_area (GTK_DIALOG (dsppreset_editor)); gtk_widget_show (dialog_action_area8); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area8), GTK_BUTTONBOX_END); cancelbutton6 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton6); gtk_dialog_add_action_widget (GTK_DIALOG (dsppreset_editor), cancelbutton6, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton6, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton6, TRUE); okbutton6 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton6); gtk_dialog_add_action_widget (GTK_DIALOG (dsppreset_editor), okbutton6, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton6, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton6, TRUE); g_signal_connect ((gpointer) add, "clicked", G_CALLBACK (on_dsp_preset_add_plugin_clicked), @@ -759,7 +751,7 @@ create_select_dsp_plugin (void) gtk_window_set_modal (GTK_WINDOW (select_dsp_plugin), TRUE); gtk_window_set_type_hint (GTK_WINDOW (select_dsp_plugin), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox10 = GTK_DIALOG (select_dsp_plugin)->vbox; + dialog_vbox10 = gtk_dialog_get_content_area (GTK_DIALOG (select_dsp_plugin)); gtk_widget_show (dialog_vbox10); vbox31 = gtk_vbox_new (FALSE, 8); @@ -775,23 +767,24 @@ create_select_dsp_plugin (void) gtk_widget_show (label113); gtk_box_pack_start (GTK_BOX (hbox85), label113, FALSE, FALSE, 0); - plugin = gtk_combo_box_new_text (); + plugin = gtk_combo_box_text_new (); gtk_widget_show (plugin); gtk_box_pack_start (GTK_BOX (hbox85), plugin, TRUE, TRUE, 0); + gtk_widget_set_size_request (plugin, 232, -1); - dialog_action_area9 = GTK_DIALOG (select_dsp_plugin)->action_area; + dialog_action_area9 = gtk_dialog_get_action_area (GTK_DIALOG (select_dsp_plugin)); gtk_widget_show (dialog_action_area9); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area9), GTK_BUTTONBOX_END); cancelbutton7 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton7); gtk_dialog_add_action_widget (GTK_DIALOG (select_dsp_plugin), cancelbutton7, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton7, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton7, TRUE); okbutton7 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton7); gtk_dialog_add_action_widget (GTK_DIALOG (select_dsp_plugin), okbutton7, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton7, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton7, TRUE); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (select_dsp_plugin, select_dsp_plugin, "select_dsp_plugin"); @@ -823,11 +816,12 @@ create_preset_list (void) GtkWidget *okbutton8; preset_list = gtk_dialog_new (); + gtk_widget_set_size_request (preset_list, 450, 254); gtk_window_set_title (GTK_WINDOW (preset_list), _("Presets")); gtk_window_set_modal (GTK_WINDOW (preset_list), TRUE); gtk_window_set_type_hint (GTK_WINDOW (preset_list), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox11 = GTK_DIALOG (preset_list)->vbox; + dialog_vbox11 = gtk_dialog_get_content_area (GTK_DIALOG (preset_list)); gtk_widget_show (dialog_vbox11); vbox33 = gtk_vbox_new (FALSE, 8); @@ -860,17 +854,17 @@ create_preset_list (void) presets = gtk_tree_view_new (); gtk_widget_show (presets); gtk_container_add (GTK_CONTAINER (scrolledwindow8), presets); - gtk_widget_set_size_request (presets, 400, 176); + gtk_widget_set_size_request (presets, 400, 160); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (presets), FALSE); - dialog_action_area10 = GTK_DIALOG (preset_list)->action_area; + dialog_action_area10 = gtk_dialog_get_action_area (GTK_DIALOG (preset_list)); gtk_widget_show (dialog_action_area10); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area10), GTK_BUTTONBOX_END); okbutton8 = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (okbutton8); gtk_dialog_add_action_widget (GTK_DIALOG (preset_list), okbutton8, GTK_RESPONSE_CLOSE); - GTK_WIDGET_SET_FLAGS (okbutton8, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton8, TRUE); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (preset_list, preset_list, "preset_list"); diff --git a/plugins/converter/support.c b/plugins/converter/support.c index 00aff298..ae0b71d5 100644 --- a/plugins/converter/support.c +++ b/plugins/converter/support.c @@ -27,7 +27,7 @@ lookup_widget (GtkWidget *widget, if (GTK_IS_MENU (widget)) parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); else - parent = widget->parent; + parent = gtk_widget_get_parent (widget); if (!parent) parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); if (parent == NULL) @@ -142,3 +142,12 @@ glade_set_atk_action_description (AtkAction *action, } } +#if GTK_CHECK_VERSION(3,0,0) +GtkWidget * +gtk_combo_box_entry_new_text(void) { + GtkWidget *w = gtk_combo_box_text_new_with_entry (); +} +void +gtk_dialog_set_has_separator (GtkDialog *dlg, gboolean has) { +} +#endif diff --git a/plugins/converter/support.h b/plugins/converter/support.h index a32649e5..7037765f 100644 --- a/plugins/converter/support.h +++ b/plugins/converter/support.h @@ -67,3 +67,11 @@ void glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description); + +#if GTK_CHECK_VERSION(3,0,0) +GtkWidget * +gtk_combo_box_entry_new_text(void); + +void +gtk_dialog_set_has_separator (GtkDialog *dlg, gboolean has); +#endif diff --git a/plugins/ffmpeg/ffmpeg.c b/plugins/ffmpeg/ffmpeg.c index cd7edf4a..4fe3d0de 100644 --- a/plugins/ffmpeg/ffmpeg.c +++ b/plugins/ffmpeg/ffmpeg.c @@ -38,12 +38,17 @@ #include <ffmpeg/avcodec.h> #include <ffmpeg/avutil.h> #include <ffmpeg/avstring.h> + #define AVERROR_EOF AVERROR(EPIPE) #if LIBAVFORMAT_VERSION_MAJOR < 53 #define av_register_protocol register_protocol #endif +#ifndef AV_VERSION_INT +#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#endif + #endif //#define trace(...) { fprintf(stderr, __VA_ARGS__); } @@ -59,6 +64,8 @@ static DB_functions_t *deadbeef; #define EXT_MAX 100 +#define FFMPEG_MAX_ANALYZE_DURATION 500000 + static char * exts[EXT_MAX] = {NULL}; enum { @@ -136,11 +143,17 @@ ffmpeg_init (DB_fileinfo_t *_info, DB_playItem_t *it) { trace ("\033[0;31mffmpeg av_find_stream_info\033[37;0m\n"); info->stream_id = -1; + info->fctx->max_analyze_duration = FFMPEG_MAX_ANALYZE_DURATION; av_find_stream_info(info->fctx); for (i = 0; i < info->fctx->nb_streams; i++) { info->ctx = info->fctx->streams[i]->codec; - if (info->ctx->codec_type == CODEC_TYPE_AUDIO) + if (info->ctx->codec_type == +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) + AVMEDIA_TYPE_AUDIO) +#else + CODEC_TYPE_AUDIO) +#endif { info->codec = avcodec_find_decoder (info->ctx->codec_id); if (info->codec != NULL) { @@ -163,7 +176,7 @@ ffmpeg_init (DB_fileinfo_t *_info, DB_playItem_t *it) { return -1; } - deadbeef->pl_replace_meta (it, ":FILETYPE", info->codec->name); + deadbeef->pl_replace_meta (it, "!FILETYPE", info->codec->name); int bps = av_get_bits_per_sample_format (info->ctx->sample_fmt); int samplerate = info->ctx->sample_rate; @@ -279,10 +292,10 @@ ffmpeg_read (DB_fileinfo_t *_info, char *bytes, int size) { int out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE; int len; //trace ("in: out_size=%d(%d), size=%d\n", out_size, AVCODEC_MAX_AUDIO_FRAME_SIZE, size); -#if (LIBAVCODEC_VERSION_MAJOR <= 52) && (LIBAVCODEC_VERSION_MINOR <= 25) - len = avcodec_decode_audio2 (info->ctx, (int16_t *)info->buffer, &out_size, info->pkt.data, info->pkt.size); -#else +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,25,0) len = avcodec_decode_audio3 (info->ctx, (int16_t *)info->buffer, &out_size, &info->pkt); +#else + len = avcodec_decode_audio2 (info->ctx, (int16_t *)info->buffer, &out_size, info->pkt.data, info->pkt.size); #endif trace ("out: out_size=%d, len=%d\n", out_size, len); if (len <= 0) { @@ -418,7 +431,7 @@ static const char *map[] = { static int ffmpeg_read_metadata_internal (DB_playItem_t *it, AVFormatContext *fctx) { -#if LIBAVFORMAT_VERSION_MAJOR <= 52 && LIBAVFORMAT_VERSION_MINOR < 43 +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,43,0) if (!strlen (fctx->title)) { // title is empty, this call will set track title to filename without extension deadbeef->pl_add_meta (it, "title", NULL); @@ -486,11 +499,17 @@ ffmpeg_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { return NULL; } + fctx->max_analyze_duration = FFMPEG_MAX_ANALYZE_DURATION; av_find_stream_info(fctx); for (i = 0; i < fctx->nb_streams; i++) { ctx = fctx->streams[i]->codec; - if (ctx->codec_type == CODEC_TYPE_AUDIO) + if (ctx->codec_type == +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) + AVMEDIA_TYPE_AUDIO) +#else + CODEC_TYPE_AUDIO) +#endif { codec = avcodec_find_decoder(ctx->codec_id); if (codec != NULL && !strcasecmp (codec->name, "alac")) { // only open alac streams @@ -704,7 +723,11 @@ ffmpeg_start (void) { ffmpeg_init_exts (); avcodec_init (); av_register_all (); +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52, 69, 0) + av_register_protocol2 (&vfswrapper, sizeof(vfswrapper)); +#else av_register_protocol (&vfswrapper); +#endif return 0; } @@ -745,7 +768,12 @@ ffmpeg_read_metadata (DB_playItem_t *it) { for (i = 0; i < fctx->nb_streams; i++) { ctx = fctx->streams[i]->codec; - if (ctx->codec_type == CODEC_TYPE_AUDIO) + if (ctx->codec_type == +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) + AVMEDIA_TYPE_AUDIO) +#else + CODEC_TYPE_AUDIO) +#endif { codec = avcodec_find_decoder(ctx->codec_id); if (codec != NULL) diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 440759e1..a577ad30 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -704,6 +704,11 @@ cflac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { } FLAC__stream_decoder_delete(decoder); decoder = NULL; + + if (info.info.fmt.samplerate <= 0) { + goto cflac_insert_fail; + } + deadbeef->pl_add_meta (it, ":FILETYPE", isogg ? "OggFLAC" : "FLAC"); char s[100]; @@ -716,8 +721,10 @@ cflac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { deadbeef->pl_add_meta (it, ":BPS", s); snprintf (s, sizeof (s), "%d", info.info.fmt.samplerate); deadbeef->pl_add_meta (it, ":SAMPLERATE", s); - snprintf (s, sizeof (s), "%d", (int)roundf((fsize-info.tagsize) / deadbeef->pl_get_item_duration (it) * 8 / 1000)); - deadbeef->pl_add_meta (it, ":BITRATE", s); + if ( deadbeef->pl_get_item_duration (it) > 0) { + snprintf (s, sizeof (s), "%d", (int)roundf((fsize-info.tagsize) / deadbeef->pl_get_item_duration (it) * 8 / 1000)); + deadbeef->pl_add_meta (it, ":BITRATE", s); + } // try embedded cue const char *cuesheet = deadbeef->pl_find_meta (it, "cuesheet"); diff --git a/plugins/gme/cgme.c b/plugins/gme/cgme.c index 41915e20..6a28a878 100644 --- a/plugins/gme/cgme.c +++ b/plugins/gme/cgme.c @@ -18,6 +18,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <math.h> #include "gme/gme.h" #include <zlib.h> #include "../../deadbeef.h" @@ -39,6 +40,7 @@ int _Unwind_GetIPInfo; static DB_decoder_t plugin; static DB_functions_t *deadbeef; +static int conf_fadeout = 10; typedef struct { DB_fileinfo_t info; @@ -197,6 +199,22 @@ cgme_read (DB_fileinfo_t *_info, char *bytes, int size) { if (gme_play (info->emu, size/2, (short*)bytes)) { return 0; } + if (conf_fadeout > 0 && info->duration >= conf_fadeout && info->reallength <= 0 && _info->readpos >= info->duration - conf_fadeout) { + float fade_amnt = (info->duration - _info->readpos) / (float)conf_fadeout; + int nsamples = size/2; + float fade_incr = 1.f / (_info->fmt.samplerate * conf_fadeout) * 256; + const float ln10=2.3025850929940002f; + float fade = exp(ln10*(-(1.f-fade_amnt) * 3)); + + for (int i = 0; i < nsamples; i++) { + ((short*)bytes)[i] *= fade; + if (!(i & 0xff)) { + fade_amnt += fade_incr; + fade = exp(ln10*(-(1.f-fade_amnt) * 3)); + } + } + } + _info->readpos += t; if (info->reallength == -1) { if (gme_track_ended (info->emu)) { @@ -402,8 +420,19 @@ cgme_stop (void) { return 0; } +int +cgme_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) { + switch (id) { + case DB_EV_CONFIGCHANGED: + conf_fadeout = deadbeef->conf_get_int ("gme.fadeout", 10); + break; + } + return 0; +} + static const char settings_dlg[] = "property \"Max song length (in minutes)\" entry gme.songlength 3;\n" + "property \"Fadeout length (seconds)\" entry gme.fadeout 10;\n" ; // define plugin interface diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am index 7c82d4e5..8d5c8860 100644 --- a/plugins/gtkui/Makefile.am +++ b/plugins/gtkui/Makefile.am @@ -1,19 +1,5 @@ if HAVE_GTKUI gtkuidir = $(libdir)/$(PACKAGE) -gtkui_VALASOURCES = ddbequalizer.vala ddbseekbar.vala ddbcellrenderertextmultiline.vala -gtkui_VALABUILTSOURCES = $(gtkui_VALASOURCES:.vala=.c) ddbequalizer.h ddbseekbar.h ddbcellrenderertextmultiline.h -if MAINTAINER_MODE -BUILT_SOURCES = vala.stamp -vala.stamp: $(gtkui_VALASOURCES) - $(VALAC) -C -H ddbcellrenderertextmultiline.h --library ddbcellrenderertextmultiline --pkg=gtk+-2.0 gdk-keysyms.vapi ddbcellrenderertextmultiline.vala - $(VALAC) -C -H ddbequalizer.h --library ddbequalizer gtkui.vapi --pkg=gtk+-2.0 ddbequalizer.vala - $(VALAC) -C -H ddbseekbar.h --library ddbseekbar gtkui.vapi --pkg=gtk+-2.0 ddbseekbar.vala - touch $@ - -CLEANFILES = \ - $(BUILT_SOURCES) \ - $(gtkui_VALABUILTSOURCES) -endif GTKUI_SOURCES = gtkui.c gtkui.h\ callbacks.c interface.c support.c callbacks.h interface.h support.h\ @@ -37,31 +23,50 @@ GTKUI_SOURCES = gtkui.c gtkui.h\ tagwritersettings.c tagwritersettings.h\ wingeom.c wingeom.h\ pluginconf.h\ - widgets.c widgets.h + widgets.c widgets.h\ + ddbseekbar.h ddbequalizer.h ddbcellrenderertextmultiline.h\ + ddbseekbar.c ddbequalizer.c ddbcellrenderertextmultiline.c sdkdir = $(pkgincludedir) sdk_HEADERS = gtkui_api.h -EXTRA_DIST = $(gtkui_VALASOURCES) deadbeef.glade +EXTRA_DIST = deadbeef.glade if STATICLINK pkglib_LTLIBRARIES = ddb_gui_GTK2.la ddb_gui_GTK2.fallback.la else +if HAVE_GTK2 +if HAVE_GTK3 +pkglib_LTLIBRARIES = ddb_gui_GTK2.la ddb_gui_GTK3.la +else pkglib_LTLIBRARIES = ddb_gui_GTK2.la endif +else +if HAVE_GTK3 +pkglib_LTLIBRARIES = ddb_gui_GTK3.la +endif +endif +endif # normal lib -ddb_gui_GTK2_la_SOURCES = $(gtkui_VALABUILTSOURCES) $(GTKUI_SOURCES) +if HAVE_GTK2 +ddb_gui_GTK2_la_SOURCES = $(GTKUI_SOURCES) ddb_gui_GTK2_la_LDFLAGS = -module -ddb_gui_GTK2_la_LIBADD = $(LDADD) $(GTKUI_DEPS_LIBS) -ddb_gui_GTK2_la_CFLAGS = -std=c99 $(GTKUI_DEPS_CFLAGS) +ddb_gui_GTK2_la_LIBADD = $(LDADD) $(GTK2_DEPS_LIBS) +ddb_gui_GTK2_la_CFLAGS = -std=c99 $(GTK2_DEPS_CFLAGS) +endif +if HAVE_GTK3 +ddb_gui_GTK3_la_SOURCES = $(GTKUI_SOURCES) +ddb_gui_GTK3_la_LDFLAGS = -module +ddb_gui_GTK3_la_LIBADD = $(LDADD) $(GTK3_DEPS_LIBS) +ddb_gui_GTK3_la_CFLAGS = -std=c99 $(GTK3_DEPS_CFLAGS) +endif # fallback lib if STATICLINK GTK_ROOT=@top_srcdir@/$(LIB)/gtk-2.12.12/usr -#../../../deadbeef-deps/gtk-debian/usr -ddb_gui_GTK2_fallback_la_SOURCES = $(gtkui_VALABUILTSOURCES) $(GTKUI_SOURCES) +ddb_gui_GTK2_fallback_la_SOURCES = $(GTKUI_SOURCES) ddb_gui_GTK2_fallback_la_LDFLAGS = -module ddb_gui_GTK2_fallback_la_LIBADD = $(LDADD) -L$(GTK_ROOT)/lib $(GTK_ROOT)/lib/libgtk-x11-2.0.la $(GTK_ROOT)/lib/libgdk-x11-2.0.la $(GTK_ROOT)/lib/libpangoft2-1.0.la $(GTK_ROOT)/lib/libpangocairo-1.0.la $(GTK_ROOT)/lib/libgdk_pixbuf-2.0.la -lm $(GTK_ROOT)/lib/libcairo.la $(GTK_ROOT)/lib/libpango-1.0.la $(GTK_ROOT)/lib/libgobject-2.0.la $(GTK_ROOT)/lib/libgmodule-2.0.la $(GTK_ROOT)/lib/libgthread-2.0.la -lrt $(GTK_ROOT)/lib/libglib-2.0.la diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index ffff9a5a..8d86f1ec 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -95,12 +95,14 @@ file_filter_func (const GtkFileFilterInfo *filter_info, gpointer data) { } } } +#if 0 if (!strcasecmp (p, "pls")) { return TRUE; } if (!strcasecmp (p, "m3u")) { return TRUE; } +#endif // test container (vfs) formats DB_vfs_t **vfsplugs = deadbeef->plug_get_vfs_list (); @@ -130,7 +132,7 @@ set_file_filter (GtkWidget *dlg, const char *name) { gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dlg), flt); gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dlg), flt); flt = gtk_file_filter_new (); - gtk_file_filter_set_name (flt, _("Other files (*)")); + gtk_file_filter_set_name (flt, _("All files (*)")); gtk_file_filter_add_pattern (flt, "*"); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dlg), flt); return flt; @@ -306,7 +308,34 @@ void on_playbtn_clicked (GtkButton *button, gpointer user_data) { - deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + DB_output_t *output = deadbeef->get_output (); + if (output->state () == OUTPUT_STATE_PAUSED) { + ddb_playlist_t *plt = deadbeef->plt_get_curr (); + int cur = deadbeef->plt_get_cursor (plt, PL_MAIN); + if (cur != -1) { + ddb_playItem_t *it = deadbeef->plt_get_item_for_idx (plt, cur, PL_MAIN); + ddb_playItem_t *it_playing = deadbeef->streamer_get_playing_track (); + if (it) { + deadbeef->pl_item_unref (it); + } + if (it_playing) { + deadbeef->pl_item_unref (it_playing); + } + if (it != it_playing) { + deadbeef->sendmessage (DB_EV_PLAY_NUM, 0, cur, 0); + } + else { + deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + } + } + else { + deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + } + deadbeef->plt_unref (plt); + } + else { + deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 0, 0); + } } @@ -478,24 +507,28 @@ int seekbar_moving = 0; int seekbar_move_x = 0; void -seekbar_draw (GtkWidget *widget) { +seekbar_draw (GtkWidget *widget, cairo_t *cr) { if (!widget) { return; } -// gdk_draw_rectangle (seekbar_backbuf, widget->style->bg_gc[0], TRUE, 0, 0, widget->allocation.width, widget->allocation.height); - cairo_t *cr; - cr = gdk_cairo_create (gtk_widget_get_window (widget)); - if (!cr) { - return; - } + +#if GTK_CHECK_VERSION(3,0,0) + GtkAllocation allocation; + gtk_widget_get_allocation (widget, &allocation); + cairo_translate (cr, -allocation.x, -allocation.y); +#endif + GdkColor clr_selection, clr_back; gtkui_get_bar_foreground_color (&clr_selection); gtkui_get_bar_background_color (&clr_back); - int ax = widget->allocation.x; - int ay = widget->allocation.y; - int aw = widget->allocation.width; - int ah = widget->allocation.height; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + + int ax = a.x; + int ay = a.y; + int aw = a.width; + int ah = a.height; DB_playItem_t *trk = deadbeef->streamer_get_playing_track (); if (!trk || deadbeef->pl_get_item_duration (trk) < 0) { @@ -503,11 +536,10 @@ seekbar_draw (GtkWidget *widget) { deadbeef->pl_item_unref (trk); } // empty seekbar, just a frame - clearlooks_rounded_rectangle (cr, 2+ax, widget->allocation.height/2-4+ay, aw-4, 8, 4, 0xff); + clearlooks_rounded_rectangle (cr, 2+ax, a.height/2-4+ay, aw-4, 8, 4, 0xff); cairo_set_source_rgb (cr, clr_selection.red/65535.f, clr_selection.green/65535.f, clr_selection.blue/65535.f ); cairo_set_line_width (cr, 2); cairo_stroke (cr); - cairo_destroy (cr); return; } float pos = 0; @@ -516,15 +548,15 @@ seekbar_draw (GtkWidget *widget) { if (x < 0) { x = 0; } - if (x > widget->allocation.width-1) { - x = widget->allocation.width-1; + if (x > a.width-1) { + x = a.width-1; } pos = x; } else { if (deadbeef->pl_get_item_duration (trk) > 0) { pos = deadbeef->streamer_get_playpos () / deadbeef->pl_get_item_duration (trk); - pos *= widget->allocation.width; + pos *= a.width; } } // left @@ -545,39 +577,19 @@ seekbar_draw (GtkWidget *widget) { cairo_fill (cr); cairo_reset_clip (cr); - cairo_destroy (cr); if (trk) { deadbeef->pl_item_unref (trk); } } -#if 0 -void -seekbar_expose (GtkWidget *widget, int x, int y, int w, int h) { - gdk_draw_drawable (widget->window, widget->style->black_gc, seekbar_backbuf, x, y, x, y, w, h); -} - -gboolean -on_seekbar_configure_event (GtkWidget *widget, - GdkEventConfigure *event, - gpointer user_data) -{ - if (seekbar_backbuf) { - g_object_unref (seekbar_backbuf); - seekbar_backbuf = NULL; - } - seekbar_backbuf = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1); - seekbar_draw (widget); - return FALSE; -} -#endif - gboolean on_seekbar_motion_notify_event (GtkWidget *widget, GdkEventMotion *event) { if (seekbar_moving) { - seekbar_move_x = event->x - widget->allocation.x; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + seekbar_move_x = event->x - a.x; gtk_widget_queue_draw (widget); } return FALSE; @@ -591,7 +603,9 @@ on_seekbar_button_press_event (GtkWidget *widget, return FALSE; } seekbar_moving = 1; - seekbar_move_x = event->x - widget->allocation.x; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + seekbar_move_x = event->x - a.x; gtk_widget_queue_draw (widget); return FALSE; } @@ -604,7 +618,9 @@ on_seekbar_button_release_event (GtkWidget *widget, seekbar_moving = 0; DB_playItem_t *trk = deadbeef->streamer_get_playing_track (); if (trk) { - float time = (event->x - widget->allocation.x) * deadbeef->pl_get_item_duration (trk) / (widget->allocation.width); + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + float time = (event->x - a.x) * deadbeef->pl_get_item_duration (trk) / (a.width); if (time < 0) { time = 0; } @@ -619,8 +635,6 @@ void seekbar_redraw (void) { GtkWidget *widget = lookup_widget (mainwin, "seekbar"); gtk_widget_queue_draw (widget); - //seekbar_draw (widget); - //seekbar_expose (widget, 0, 0, widget->allocation.width, widget->allocation.height); } gboolean @@ -828,6 +842,7 @@ on_toggle_status_bar_activate (GtkMenuItem *menuitem, gtk_widget_show (sb); } } + deadbeef->conf_save (); } void @@ -847,6 +862,7 @@ on_toggle_column_headers_activate (GtkMenuItem *menuitem, ddb_listview_show_header (DDB_LISTVIEW (playlist), 1); } } + deadbeef->conf_save (); } void @@ -912,6 +928,7 @@ on_toggle_tabs (GtkMenuItem *menuitem, deadbeef->conf_set_int ("gtkui.tabs.visible", 1); gtk_widget_show (ts); } + deadbeef->conf_save (); } @@ -927,6 +944,7 @@ on_toggle_eq (GtkMenuItem *menuitem, deadbeef->conf_set_int ("gtkui.eq.visible", 1); eq_window_show (); } + deadbeef->conf_save (); } @@ -995,18 +1013,21 @@ on_mainwin_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) { - if (event->window != mainwin->window) { + if (event->window != gtk_widget_get_window (mainwin)) { return FALSE; } GtkWidget *volumebar = lookup_widget (mainwin, "volumebar"); GtkWidget *seekbar = lookup_widget (mainwin, "seekbar"); - if (event->x >= volumebar->allocation.x && event->x < volumebar->allocation.x + volumebar->allocation.width - && event->y >= volumebar->allocation.y && event->y < volumebar->allocation.y + volumebar->allocation.height) { + GtkAllocation a, b; + gtk_widget_get_allocation (volumebar, &a); + gtk_widget_get_allocation (seekbar, &b); + if (event->x >= a.x && event->x < a.x + a.width + && event->y >= a.y && event->y < a.y + a.height) { capture = volumebar; return gtk_widget_event (volumebar, (GdkEvent *)event); } - else if (event->x >= seekbar->allocation.x && event->x < seekbar->allocation.x + seekbar->allocation.width - && event->y >= seekbar->allocation.y && event->y < seekbar->allocation.y + seekbar->allocation.height) { + else if (event->x >= b.x && event->x < b.x + b.width + && event->y >= b.y && event->y < b.y + b.height) { capture = seekbar; return gtk_widget_event (seekbar, (GdkEvent *)event); } @@ -1036,17 +1057,21 @@ on_mainwin_scroll_event (GtkWidget *widget, gpointer user_data) { GdkEventScroll *event = (GdkEventScroll *)ev; - if (event->window != mainwin->window) { + if (event->window != gtk_widget_get_window (mainwin)) { return FALSE; } GtkWidget *volumebar = lookup_widget (mainwin, "volumebar"); GtkWidget *seekbar = lookup_widget (mainwin, "seekbar"); - if (event->x >= volumebar->allocation.x && event->x < volumebar->allocation.x + volumebar->allocation.width - && event->y >= volumebar->allocation.y && event->y < volumebar->allocation.y + volumebar->allocation.height) { + GtkAllocation a; + gtk_widget_get_allocation (volumebar, &a); + GtkAllocation b; + gtk_widget_get_allocation (seekbar, &b); + if (event->x >= a.x && event->x < a.x + a.width + && event->y >= a.y && event->y < a.y + a.height) { return gtk_widget_event (volumebar, (GdkEvent *)event); } - else if (event->x >= seekbar->allocation.x && event->x < seekbar->allocation.x + seekbar->allocation.width - && event->y >= seekbar->allocation.y && event->y < seekbar->allocation.y + seekbar->allocation.height) { + else if (event->x >= b.x && event->x < b.x + b.width + && event->y >= b.y && event->y < b.y + b.height) { return gtk_widget_event (seekbar, (GdkEvent *)event); } return FALSE; diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h index 1c407678..9af9a4bf 100644 --- a/plugins/gtkui/callbacks.h +++ b/plugins/gtkui/callbacks.h @@ -277,10 +277,6 @@ on_volumebar_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, gpointer user_data); -void -on_main_quit (GtkObject *object, - gpointer user_data); - gboolean on_mainwin_delete_event (GtkWidget *widget, GdkEvent *event, @@ -1105,6 +1101,10 @@ on_replaygain_preamp_value_changed (GtkRange *range, gpointer user_data); void +on_global_preamp_value_changed (GtkRange *range, + gpointer user_data); + +void on_tabstrip_text_color_set (GtkColorButton *colorbutton, gpointer user_data); diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.c b/plugins/gtkui/ddbcellrenderertextmultiline.c index aff449b5..5bd97a9a 100644 --- a/plugins/gtkui/ddbcellrenderertextmultiline.c +++ b/plugins/gtkui/ddbcellrenderertextmultiline.c @@ -1,6 +1,3 @@ -/* ddbcellrenderertextmultiline.c generated by valac, the Vala compiler - * generated from ddbcellrenderertextmultiline.vala, do not modify */ - /* DeaDBeeF - ultimate music player for GNU/Linux systems with X11 Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> @@ -25,8 +22,8 @@ #include <gtk/gtk.h> #include <stdlib.h> #include <string.h> -#include <gdk/gdkkeysyms.h> #include <gdk/gdk.h> +#include "support.h" #define DDB_TYPE_CELL_EDITABLE_TEXT_VIEW (ddb_cell_editable_text_view_get_type ()) @@ -58,7 +55,7 @@ struct _DdbCellEditableTextView { GtkTextView parent_instance; DdbCellEditableTextViewPrivate * priv; gboolean editing_canceled; - char* tree_path; + gchar* tree_path; }; struct _DdbCellEditableTextViewClass { @@ -89,7 +86,10 @@ enum { DDB_CELL_EDITABLE_TEXT_VIEW_DUMMY_PROPERTY }; static gboolean ddb_cell_editable_text_view_real_key_press_event (GtkWidget* base, GdkEventKey* event); -void ddb_cell_editable_text_view_start_editing (DdbCellEditableTextView* self, GdkEvent* event); +static void ddb_cell_editable_text_view_real_start_editing (GtkCellEditable* base, GdkEvent* event); +#if GTK_CHECK_VERSION(2,20,0) +static void ddb_cell_editable_text_view_real_editing_canceled (GtkCellRenderer*); +#endif DdbCellEditableTextView* ddb_cell_editable_text_view_new (void); DdbCellEditableTextView* ddb_cell_editable_text_view_construct (GType object_type); static void ddb_cell_editable_text_view_finalize (GObject* obj); @@ -100,22 +100,34 @@ enum { }; static void ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done (DdbCellEditableTextView* entry, DdbCellRendererTextMultiline* _self_); static gboolean ddb_cell_renderer_text_multiline_gtk_cell_renderer_focus_out_event (DdbCellEditableTextView* entry, GdkEvent* event, DdbCellRendererTextMultiline* _self_); -static GtkCellEditable* ddb_cell_renderer_text_multiline_real_start_editing (GtkCellRenderer* base, GdkEvent* event, GtkWidget* widget, const char* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags); +static GtkCellEditable* ddb_cell_renderer_text_multiline_real_start_editing (GtkCellRenderer* base, GdkEvent* event, GtkWidget* widget, const gchar* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags); DdbCellRendererTextMultiline* ddb_cell_renderer_text_multiline_new (void); DdbCellRendererTextMultiline* ddb_cell_renderer_text_multiline_construct (GType object_type); static void ddb_cell_renderer_text_multiline_finalize (GObject* obj); - static gboolean ddb_cell_editable_text_view_real_key_press_event (GtkWidget* base, GdkEventKey* event) { DdbCellEditableTextView * self; gboolean result = FALSE; gboolean res; + GdkEventKey _tmp0_; + guint _tmp1_; self = (DdbCellEditableTextView*) base; + g_return_val_if_fail (event != NULL, FALSE); res = TRUE; - if ((*event).keyval == GDK_Return) { - if (((*event).state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0) { - res = GTK_WIDGET_CLASS (ddb_cell_editable_text_view_parent_class)->key_press_event ((GtkWidget*) GTK_TEXT_VIEW (self), event); + _tmp0_ = *event; + _tmp1_ = _tmp0_.keyval; + if (_tmp1_ == ((guint) GDK_Return)) { + GdkEventKey _tmp2_; + GdkModifierType _tmp3_; + _tmp2_ = *event; + _tmp3_ = _tmp2_.state; + if ((_tmp3_ & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) != 0) { + GdkEventKey _tmp4_; + gboolean _tmp5_ = FALSE; + _tmp4_ = *event; + _tmp5_ = GTK_WIDGET_CLASS (ddb_cell_editable_text_view_parent_class)->key_press_event ((GtkWidget*) GTK_TEXT_VIEW (self), &_tmp4_); + res = _tmp5_; } else { gtk_cell_editable_editing_done ((GtkCellEditable*) self); gtk_cell_editable_remove_widget ((GtkCellEditable*) self); @@ -123,30 +135,43 @@ static gboolean ddb_cell_editable_text_view_real_key_press_event (GtkWidget* bas return result; } } else { - if ((*event).keyval == GDK_Escape) { + GdkEventKey _tmp6_; + guint _tmp7_; + _tmp6_ = *event; + _tmp7_ = _tmp6_.keyval; + if (_tmp7_ == ((guint) GDK_Escape)) { self->editing_canceled = TRUE; gtk_cell_editable_editing_done ((GtkCellEditable*) self); gtk_cell_editable_remove_widget ((GtkCellEditable*) self); result = TRUE; return result; } else { - res = GTK_WIDGET_CLASS (ddb_cell_editable_text_view_parent_class)->key_press_event ((GtkWidget*) GTK_TEXT_VIEW (self), event); + GdkEventKey _tmp8_; + gboolean _tmp9_ = FALSE; + _tmp8_ = *event; + _tmp9_ = GTK_WIDGET_CLASS (ddb_cell_editable_text_view_parent_class)->key_press_event ((GtkWidget*) GTK_TEXT_VIEW (self), &_tmp8_); + res = _tmp9_; } } result = res; return result; } - -void ddb_cell_editable_text_view_start_editing (DdbCellEditableTextView* self, GdkEvent* event) { - g_return_if_fail (self != NULL); - g_return_if_fail (event != NULL); +static void ddb_cell_editable_text_view_real_start_editing (GtkCellEditable* base, GdkEvent* event) { + DdbCellEditableTextView * self; + self = (DdbCellEditableTextView*) base; + g_return_if_fail (event != NULL); } +#if GTK_CHECK_VERSION(2,20,0) +static void ddb_cell_editable_text_view_real_editing_canceled (GtkCellRenderer* base) { +} +#endif + DdbCellEditableTextView* ddb_cell_editable_text_view_construct (GType object_type) { - DdbCellEditableTextView * self; - self = g_object_newv (object_type, 0, NULL); + DdbCellEditableTextView * self = NULL; + self = (DdbCellEditableTextView*) g_object_new (object_type, NULL); return self; } @@ -162,9 +187,14 @@ static void ddb_cell_editable_text_view_class_init (DdbCellEditableTextViewClass G_OBJECT_CLASS (klass)->finalize = ddb_cell_editable_text_view_finalize; } +void ddb_cell_editable_text_view_start_editing (DdbCellEditableTextView* self, GdkEvent* event) { + g_return_if_fail (self != NULL); + g_return_if_fail (event != NULL); +} static void ddb_cell_editable_text_view_gtk_cell_editable_interface_init (GtkCellEditableIface * iface) { ddb_cell_editable_text_view_gtk_cell_editable_parent_iface = g_type_interface_peek_parent (iface); + iface->start_editing = (void (*)(GtkCellEditable*, GdkEvent*)) ddb_cell_editable_text_view_real_start_editing; } @@ -201,19 +231,54 @@ static gpointer _g_object_ref0 (gpointer self) { static void ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done (DdbCellEditableTextView* entry, DdbCellRendererTextMultiline* _self_) { + DdbCellEditableTextView* _tmp0_; + DdbCellRendererTextMultiline* _tmp1_; + gulong _tmp2_; + DdbCellRendererTextMultiline* _tmp3_; + DdbCellEditableTextView* _tmp4_; + gboolean _tmp5_; + DdbCellEditableTextView* _tmp6_; + GtkTextBuffer* _tmp7_ = NULL; + GtkTextBuffer* _tmp8_; GtkTextBuffer* buf; GtkTextIter begin = {0}; GtkTextIter end = {0}; - char* new_text; + GtkTextIter _tmp9_ = {0}; + GtkTextIter _tmp10_ = {0}; + GtkTextIter _tmp11_; + GtkTextIter _tmp12_; + gchar* _tmp13_ = NULL; + gchar* new_text; + DdbCellRendererTextMultiline* _tmp14_; + DdbCellEditableTextView* _tmp15_; + const gchar* _tmp16_; g_return_if_fail (entry != NULL); g_return_if_fail (_self_ != NULL); - g_signal_handler_disconnect ((GObject*) entry, _self_->priv->focus_out_id); - gtk_cell_renderer_stop_editing ((GtkCellRenderer*) _self_, entry->editing_canceled); - buf = _g_object_ref0 (gtk_text_view_get_buffer ((GtkTextView*) entry)); - gtk_text_buffer_get_iter_at_offset (buf, &begin, 0); - gtk_text_buffer_get_iter_at_offset (buf, &end, -1); - new_text = g_strdup (gtk_text_buffer_get_text (buf, &begin, &end, TRUE)); - g_signal_emit_by_name ((GtkCellRendererText*) _self_, "edited", entry->tree_path, new_text); + _tmp0_ = entry; + _tmp1_ = _self_; + _tmp2_ = _tmp1_->priv->focus_out_id; + g_signal_handler_disconnect ((GObject*) _tmp0_, _tmp2_); + _tmp3_ = _self_; + _tmp4_ = entry; + _tmp5_ = _tmp4_->editing_canceled; + gtk_cell_renderer_stop_editing ((GtkCellRenderer*) _tmp3_, _tmp5_); + _tmp6_ = entry; + _tmp7_ = gtk_text_view_get_buffer ((GtkTextView*) _tmp6_); + _tmp8_ = _g_object_ref0 (_tmp7_); + buf = _tmp8_; + gtk_text_buffer_get_iter_at_offset (buf, &_tmp9_, 0); + begin = _tmp9_; + gtk_text_buffer_get_iter_at_offset (buf, &_tmp10_, -1); + end = _tmp10_; + _tmp11_ = begin; + _tmp12_ = end; + _tmp13_ = gtk_text_buffer_get_text (buf, &_tmp11_, &_tmp12_, TRUE); + new_text = _tmp13_; + _tmp14_ = _self_; + _tmp15_ = entry; + _tmp16_ = _tmp15_->tree_path; + g_signal_emit_by_name ((GtkCellRendererText*) _tmp14_, "edited", _tmp16_, new_text); + _g_free0 (new_text); _g_object_unref0 (buf); _g_free0 (new_text); } @@ -221,67 +286,156 @@ static void ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done static gboolean ddb_cell_renderer_text_multiline_gtk_cell_renderer_focus_out_event (DdbCellEditableTextView* entry, GdkEvent* event, DdbCellRendererTextMultiline* _self_) { gboolean result = FALSE; + DdbCellEditableTextView* _tmp0_; + DdbCellEditableTextView* _tmp1_; g_return_val_if_fail (entry != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE); g_return_val_if_fail (_self_ != NULL, FALSE); - entry->editing_canceled = TRUE; - gtk_cell_editable_remove_widget ((GtkCellEditable*) entry); + _tmp0_ = entry; + _tmp0_->editing_canceled = TRUE; + _tmp1_ = entry; + gtk_cell_editable_remove_widget ((GtkCellEditable*) _tmp1_); result = FALSE; return result; } -static GtkCellEditable* ddb_cell_renderer_text_multiline_real_start_editing (GtkCellRenderer* base, GdkEvent* event, GtkWidget* widget, const char* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags) { +static GtkCellEditable* ddb_cell_renderer_text_multiline_real_start_editing (GtkCellRenderer* base, GdkEvent* event, GtkWidget* widget, const gchar* path, GdkRectangle* background_area, GdkRectangle* cell_area, GtkCellRendererState flags) { DdbCellRendererTextMultiline * self; GtkCellEditable* result = NULL; - gboolean _tmp0_; + gboolean _tmp0_ = FALSE; + gboolean _tmp1_; + const gchar* _tmp2_; + GtkTreePath* _tmp3_; GtkTreePath* p; + GtkWidget* _tmp4_; + GtkTreeView* _tmp5_; GtkTreeView* tv; + GtkTreeView* _tmp6_; + GtkTreeModel* _tmp7_ = NULL; + GtkListStore* _tmp8_; GtkListStore* store; GtkTreeIter iter = {0}; + GtkListStore* _tmp9_; + GtkTreePath* _tmp10_; + GtkTreeIter _tmp11_ = {0}; GValue v = {0}; - GValue _tmp2_; - GValue _tmp1_ = {0}; + GtkListStore* _tmp12_; + GtkTreeIter _tmp13_; + GValue _tmp14_ = {0}; + gint _tmp15_ = 0; gint mult; - DdbCellEditableTextView* _tmp3_; - char* _tmp4_; + DdbCellEditableTextView* _tmp16_; + DdbCellEditableTextView* _tmp17_; + gint _tmp18_; + DdbCellEditableTextView* _tmp19_; + const gchar* _tmp20_; + gchar* _tmp21_; + GtkTextBuffer* _tmp22_; GtkTextBuffer* buf; - char* _tmp6_; - char* _tmp5_ = NULL; - gboolean _tmp7_; + gchar* _tmp23_ = NULL; + gchar* _tmp24_; + gchar* _tmp25_; + gboolean _tmp26_; + DdbCellEditableTextView* _tmp31_; + GtkTextBuffer* _tmp32_; + DdbCellEditableTextView* _tmp33_; + DdbCellEditableTextView* _tmp34_; + gulong _tmp35_ = 0UL; + DdbCellEditableTextView* _tmp36_; + GdkRectangle _tmp37_; + gint _tmp38_; + GdkRectangle _tmp39_; + gint _tmp40_; + DdbCellEditableTextView* _tmp41_; + DdbCellEditableTextView* _tmp42_; self = (DdbCellRendererTextMultiline*) base; g_return_val_if_fail (event != NULL, NULL); g_return_val_if_fail (widget != NULL, NULL); g_return_val_if_fail (path != NULL, NULL); - if (!(g_object_get ((GtkCellRendererText*) self, "editable", &_tmp0_, NULL), _tmp0_)) { + g_return_val_if_fail (background_area != NULL, NULL); + g_return_val_if_fail (cell_area != NULL, NULL); + g_object_get ((GtkCellRendererText*) self, "editable", &_tmp0_, NULL); + _tmp1_ = _tmp0_; + if (!_tmp1_) { result = GTK_CELL_EDITABLE (NULL); return result; } - p = gtk_tree_path_new_from_string (path); - tv = _g_object_ref0 (GTK_TREE_VIEW (widget)); - store = _g_object_ref0 (GTK_LIST_STORE (gtk_tree_view_get_model (tv))); - gtk_tree_model_get_iter ((GtkTreeModel*) store, &iter, p); - gtk_tree_model_get_value ((GtkTreeModel*) store, &iter, 3, &_tmp1_); - v = (_tmp2_ = _tmp1_, G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL, _tmp2_); - mult = g_value_get_int (&v); - self->priv->entry = (_tmp3_ = g_object_ref_sink (ddb_cell_editable_text_view_new ()), _g_object_unref0 (self->priv->entry), _tmp3_); - if (mult != 0) { + _tmp2_ = path; + _tmp3_ = gtk_tree_path_new_from_string (_tmp2_); + p = _tmp3_; + _tmp4_ = widget; + _tmp5_ = _g_object_ref0 (GTK_TREE_VIEW (_tmp4_)); + tv = _tmp5_; + _tmp6_ = tv; + _tmp7_ = gtk_tree_view_get_model (_tmp6_); + _tmp8_ = _g_object_ref0 (GTK_LIST_STORE (_tmp7_)); + store = _tmp8_; + _tmp9_ = store; + _tmp10_ = p; + gtk_tree_model_get_iter ((GtkTreeModel*) _tmp9_, &_tmp11_, _tmp10_); + iter = _tmp11_; + _tmp12_ = store; + _tmp13_ = iter; + gtk_tree_model_get_value ((GtkTreeModel*) _tmp12_, &_tmp13_, 3, &_tmp14_); + G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL; + v = _tmp14_; + _tmp15_ = g_value_get_int (&v); + mult = _tmp15_; + _tmp16_ = ddb_cell_editable_text_view_new (); + _tmp17_ = g_object_ref_sink (_tmp16_); + _g_object_unref0 (self->priv->entry); + self->priv->entry = _tmp17_; + _tmp18_ = mult; + if (_tmp18_ != 0) { g_object_set ((GtkCellRendererText*) self, "text", "", NULL); } - self->priv->entry->tree_path = (_tmp4_ = g_strdup (path), _g_free0 (self->priv->entry->tree_path), _tmp4_); - buf = gtk_text_buffer_new (NULL); - if ((_tmp7_ = (_tmp6_ = (g_object_get ((GtkCellRendererText*) self, "text", &_tmp5_, NULL), _tmp5_)) != NULL, _g_free0 (_tmp6_), _tmp7_)) { - char* _tmp9_; - char* _tmp8_ = NULL; - gtk_text_buffer_set_text (buf, _tmp9_ = (g_object_get ((GtkCellRendererText*) self, "text", &_tmp8_, NULL), _tmp8_), -1); - _g_free0 (_tmp9_); + _tmp19_ = self->priv->entry; + _tmp20_ = path; + _tmp21_ = g_strdup (_tmp20_); + _g_free0 (_tmp19_->tree_path); + _tmp19_->tree_path = _tmp21_; + _tmp22_ = gtk_text_buffer_new (NULL); + buf = _tmp22_; + g_object_get ((GtkCellRendererText*) self, "text", &_tmp23_, NULL); + _tmp24_ = _tmp23_; + _tmp25_ = _tmp24_; + _tmp26_ = _tmp25_ != NULL; + _g_free0 (_tmp25_); + if (_tmp26_) { + GtkTextBuffer* _tmp27_; + gchar* _tmp28_ = NULL; + gchar* _tmp29_; + gchar* _tmp30_; + _tmp27_ = buf; + g_object_get ((GtkCellRendererText*) self, "text", &_tmp28_, NULL); + _tmp29_ = _tmp28_; + _tmp30_ = _tmp29_; + gtk_text_buffer_set_text (_tmp27_, _tmp30_, -1); + _g_free0 (_tmp30_); } - gtk_text_view_set_buffer ((GtkTextView*) self->priv->entry, buf); - g_signal_connect (self->priv->entry, "editing-done", (GCallback) ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done, self); - self->priv->focus_out_id = g_signal_connect_after (self->priv->entry, "focus-out-event", (GCallback) ddb_cell_renderer_text_multiline_gtk_cell_renderer_focus_out_event, self); - gtk_widget_set_size_request ((GtkWidget*) self->priv->entry, (*cell_area).width, (*cell_area).height); - gtk_widget_show ((GtkWidget*) self->priv->entry); - result = GTK_CELL_EDITABLE (self->priv->entry); + _tmp31_ = self->priv->entry; + _tmp32_ = buf; + gtk_text_view_set_buffer ((GtkTextView*) _tmp31_, _tmp32_); + _tmp33_ = self->priv->entry; + g_signal_connect (_tmp33_, "editing-done", (GCallback) ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done, self); + _tmp34_ = self->priv->entry; + _tmp35_ = g_signal_connect_after (_tmp34_, "focus-out-event", (GCallback) ddb_cell_renderer_text_multiline_gtk_cell_renderer_focus_out_event, self); + self->priv->focus_out_id = _tmp35_; + _tmp36_ = self->priv->entry; + _tmp37_ = *cell_area; + _tmp38_ = _tmp37_.width; + _tmp39_ = *cell_area; + _tmp40_ = _tmp39_.height; + gtk_widget_set_size_request ((GtkWidget*) _tmp36_, _tmp38_, _tmp40_); + _tmp41_ = self->priv->entry; + gtk_widget_show ((GtkWidget*) _tmp41_); + _tmp42_ = self->priv->entry; + result = GTK_CELL_EDITABLE (_tmp42_); + _g_object_unref0 (buf); + G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL; + _g_object_unref0 (store); + _g_object_unref0 (tv); _gtk_tree_path_free0 (p); _g_object_unref0 (tv); _g_object_unref0 (store); @@ -292,8 +446,8 @@ static GtkCellEditable* ddb_cell_renderer_text_multiline_real_start_editing (Gtk DdbCellRendererTextMultiline* ddb_cell_renderer_text_multiline_construct (GType object_type) { - DdbCellRendererTextMultiline * self; - self = g_object_newv (object_type, 0, NULL); + DdbCellRendererTextMultiline * self = NULL; + self = (DdbCellRendererTextMultiline*) g_object_new (object_type, NULL); return self; } @@ -306,8 +460,10 @@ DdbCellRendererTextMultiline* ddb_cell_renderer_text_multiline_new (void) { static void ddb_cell_renderer_text_multiline_class_init (DdbCellRendererTextMultilineClass * klass) { ddb_cell_renderer_text_multiline_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (DdbCellRendererTextMultilinePrivate)); - GTK_CELL_RENDERER_CLASS (klass)->start_editing = ddb_cell_renderer_text_multiline_real_start_editing; G_OBJECT_CLASS (klass)->finalize = ddb_cell_renderer_text_multiline_finalize; +#if GTK_CHECK_VERSION(2,20,0) + GTK_CELL_RENDERER_CLASS (klass)->editing_canceled = (void (*)(GtkCellRenderer*)) ddb_cell_editable_text_view_real_editing_canceled; +#endif } @@ -337,4 +493,3 @@ GType ddb_cell_renderer_text_multiline_get_type (void) { - diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.h b/plugins/gtkui/ddbcellrenderertextmultiline.h index 55d4a82c..ca461f34 100644 --- a/plugins/gtkui/ddbcellrenderertextmultiline.h +++ b/plugins/gtkui/ddbcellrenderertextmultiline.h @@ -1,6 +1,3 @@ -/* ddbcellrenderertextmultiline.h generated by valac, the Vala compiler, do not modify */ - - #ifndef __DDBCELLRENDERERTEXTMULTILINE_H__ #define __DDBCELLRENDERERTEXTMULTILINE_H__ @@ -39,7 +36,7 @@ struct _DdbCellEditableTextView { GtkTextView parent_instance; DdbCellEditableTextViewPrivate * priv; gboolean editing_canceled; - char* tree_path; + gchar* tree_path; }; struct _DdbCellEditableTextViewClass { diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.vala b/plugins/gtkui/ddbcellrenderertextmultiline.vala index 4587cff9..c23aed69 100644 --- a/plugins/gtkui/ddbcellrenderertextmultiline.vala +++ b/plugins/gtkui/ddbcellrenderertextmultiline.vala @@ -23,7 +23,7 @@ namespace Ddb { public bool editing_canceled = false; public string tree_path; - private override bool key_press_event (Gdk.EventKey event) { + public override bool key_press_event (Gdk.EventKey event) { bool res = true; if (event.keyval == Gdk.KeySyms.Return) { if ((event.state & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK)) != 0) { diff --git a/plugins/gtkui/ddbequalizer.c b/plugins/gtkui/ddbequalizer.c index cf1c10eb..8f69f073 100644 --- a/plugins/gtkui/ddbequalizer.c +++ b/plugins/gtkui/ddbequalizer.c @@ -1,6 +1,3 @@ -/* ddbequalizer.c generated by valac, the Vala compiler - * generated from ddbequalizer.vala, do not modify */ - /* SuperEQ GTK Widget for for DeaDBeeF Copyright (C) 2010 Viktor Semykin <thesame.ml@gmail.com> @@ -28,8 +25,10 @@ #include <float.h> #include <math.h> #include <gdk/gdk.h> -#include <gtkui.h> #include <drawing.h> +#include <gtkui.h> +#include <cairo.h> +#include <pango/pangocairo.h> #include <pango/pango.h> @@ -46,7 +45,7 @@ typedef struct _DdbEqualizerPrivate DdbEqualizerPrivate; #define _gdk_cursor_unref0(var) ((var == NULL) ? NULL : (var = (gdk_cursor_unref (var), NULL))) #define _g_free0(var) (var = (g_free (var), NULL)) #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) -#define _pango_font_description_free0(var) ((var == NULL) ? NULL : (var = (pango_font_description_free (var), NULL))) +#define _cairo_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_destroy (var), NULL))) struct _DdbEqualizer { GtkDrawingArea parent_instance; @@ -58,15 +57,15 @@ struct _DdbEqualizerClass { }; struct _DdbEqualizerPrivate { - double* values; + gdouble* values; gint values_length1; gint _values_size_; - double preamp; + gdouble preamp; gint mouse_y; gboolean curve_hook; gboolean preamp_hook; - gint margin_bottom; - gint margin_left; + gint eq_margin_bottom; + gint eq_margin_left; GdkCursor* pointer_cursor; }; @@ -82,31 +81,51 @@ enum { #define DDB_EQUALIZER_spot_size 3 static gboolean ddb_equalizer_real_configure_event (GtkWidget* base, GdkEventConfigure* event); static void ddb_equalizer_real_realize (GtkWidget* base); -static inline double ddb_equalizer_scale (DdbEqualizer* self, double val); +#if !GTK_CHECK_VERSION(3,0,0) static gboolean ddb_equalizer_real_expose_event (GtkWidget* base, GdkEventExpose* event); -static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, double x, double y); -static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, double x, double y); +#endif +static inline gdouble ddb_equalizer_scale (DdbEqualizer* self, gdouble val); +static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, gdouble x, gdouble y); +static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, gdouble x, gdouble y); static gboolean ddb_equalizer_real_button_press_event (GtkWidget* base, GdkEventButton* event); static gboolean ddb_equalizer_real_button_release_event (GtkWidget* base, GdkEventButton* event); static gboolean ddb_equalizer_real_leave_notify_event (GtkWidget* base, GdkEventCrossing* event); static gboolean ddb_equalizer_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event); -void ddb_equalizer_set_band (DdbEqualizer* self, gint band, double v); -double ddb_equalizer_get_band (DdbEqualizer* self, gint band); -void ddb_equalizer_set_preamp (DdbEqualizer* self, double v); -double ddb_equalizer_get_preamp (DdbEqualizer* self); +void ddb_equalizer_set_band (DdbEqualizer* self, gint band, gdouble v); +gdouble ddb_equalizer_get_band (DdbEqualizer* self, gint band); +void ddb_equalizer_set_preamp (DdbEqualizer* self, gdouble v); +gdouble ddb_equalizer_get_preamp (DdbEqualizer* self); DdbEqualizer* ddb_equalizer_new (void); DdbEqualizer* ddb_equalizer_construct (GType object_type); static GObject * ddb_equalizer_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void ddb_equalizer_finalize (GObject* obj); -const char* freqs[18] = {"55 Hz", "77 Hz", "110 Hz", "156 Hz", "220 Hz", "311 Hz", "440 Hz", "622 Hz", "880 Hz", "1.2 kHz", "1.8 kHz", "2.5 kHz", "3.5 kHz", "5 kHz", "7 kHz", "10 kHz", "14 kHz", "20 kHz"}; - +const gchar* freqs[18] = {"55 Hz", "77 Hz", "110 Hz", "156 Hz", "220 Hz", "311 Hz", "440 Hz", "622 Hz", "880 Hz", "1.2 kHz", "1.8 kHz", "2.5 kHz", "3.5 kHz", "5 kHz", "7 kHz", "10 kHz", "14 kHz", "20 kHz"}; static gboolean ddb_equalizer_real_configure_event (GtkWidget* base, GdkEventConfigure* event) { DdbEqualizer * self; gboolean result = FALSE; self = (DdbEqualizer*) base; + g_return_val_if_fail (event != NULL, FALSE); gtkui_init_theme_colors (); + + GtkStyle* _tmp0_ = NULL; + const PangoFontDescription* _tmp1_; + gint _tmp2_ = 0; + gdouble _tmp3_ = 0.0; + GdkScreen* _tmp4_ = NULL; + gdouble _tmp5_ = 0.0; + gint _tmp6_; + + _tmp0_ = gtk_widget_get_style ((GtkWidget*) self); + _tmp1_ = _tmp0_->font_desc; + _tmp2_ = pango_font_description_get_size (_tmp1_); + _tmp3_ = pango_units_to_double (_tmp2_); + _tmp4_ = gdk_screen_get_default (); + _tmp5_ = gdk_screen_get_resolution (_tmp4_); + self->priv->eq_margin_bottom = (gint) (((_tmp3_ * _tmp5_) / 72) + 4); + _tmp6_ = self->priv->eq_margin_bottom; + self->priv->eq_margin_left = _tmp6_ * 4; result = FALSE; return result; } @@ -125,317 +144,351 @@ static gpointer _g_object_ref0 (gpointer self) { } +static gboolean ddb_equalizer_real_draw (GtkWidget *widget, cairo_t *cr) { + DdbEqualizer *self = DDB_EQUALIZER (widget); + GdkColor fore_bright_color; + gtkui_get_bar_foreground_color (&fore_bright_color); + GdkColor c1 = fore_bright_color; + GdkColor c2; + gtkui_get_bar_background_color (&c2); + GdkColor fore_dark_color = c2; + + fore_dark_color.red += (c1.red - c2.red) * 0.5; + fore_dark_color.green += (c1.green - c2.green) * 0.5; + fore_dark_color.blue += (c1.blue - c2.blue) * 0.5; + + GtkAllocation alloc; + gtk_widget_get_allocation (widget, &alloc); + + int width = alloc.width; + int height = alloc.height; + + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + cairo_set_line_width (cr, 1.0); + gdk_cairo_set_source_color (cr, &c2); + cairo_rectangle (cr, 0, 0, width, height); + cairo_fill (cr); + + gdk_cairo_set_source_color (cr, &fore_dark_color); + + //drawing grid: + double step = (double)(width - self->priv->eq_margin_left) / (double)(DDB_EQUALIZER_bands+1); + int i; + for (i = 0; i < DDB_EQUALIZER_bands; i++) + { + //does anyone know why this method is static? + cairo_move_to (cr, (int)((i+1)*step)+self->priv->eq_margin_left, 0); + cairo_line_to (cr, (int)((i+1)*step)+self->priv->eq_margin_left, height - self->priv->eq_margin_bottom); + } + + double vstep = (double)(height-self->priv->eq_margin_bottom); + for (double di=0; di < 2; di += 0.25) + { + cairo_move_to (cr, self->priv->eq_margin_left, (int)((di-self->priv->preamp)*vstep)); + cairo_line_to (cr, width, (int)((di-self->priv->preamp)*vstep)); + } + cairo_stroke (cr); + + gdk_cairo_set_source_color (cr, &fore_bright_color); + + //drawing freqs: + + PangoLayout *l = pango_cairo_create_layout (cr); + PangoContext *pctx = pango_layout_get_context (l); + + GtkStyle *st = gtk_widget_get_style (widget); + + PangoFontDescription *fd = pango_font_description_copy (st->font_desc); + + pango_font_description_set_size (fd, (int)(pango_font_description_get_size (st->font_desc) * 0.7)); + pango_context_set_font_description (pctx, fd); + for (i = 0; i < DDB_EQUALIZER_bands; i++) + { + cairo_save (cr); + pango_layout_set_text (l, freqs[i], strlen (freqs[i])); + PangoRectangle ink, log; + pango_layout_get_pixel_extents (l, &ink, &log); + int offs = 2; + if ((i % 2) != 0) { + offs += 2; + } + cairo_move_to (cr, (int)((i+1)*step)+self->priv->eq_margin_left - ink.width/2, height-self->priv->eq_margin_bottom + offs); + pango_cairo_show_layout (cr, l); + cairo_restore (cr); + } + pango_font_description_set_size (fd, (int)(pango_font_description_get_size (st->font_desc))); + pango_context_set_font_description (pctx, fd); + + //drawing db's: + pango_layout_set_width (l, self->priv->eq_margin_left-1); + pango_layout_set_alignment (l, PANGO_ALIGN_RIGHT); + + int fontsize = (int)(pango_units_to_double (pango_font_description_get_size (fd)) * gdk_screen_get_resolution (gdk_screen_get_default ()) / 72); + + char tmp[100]; + + if ((self->priv->mouse_y >= 0) && (self->priv->mouse_y < height - self->priv->eq_margin_bottom)) + { + cairo_save (cr); + double db = ddb_equalizer_scale(self, (double)(self->priv->mouse_y-1) / (double)(height - self->priv->eq_margin_bottom - 2)); + snprintf (tmp, sizeof (tmp), "%s%.1fdB", db > 0 ? "+" : "", db); + pango_layout_set_text (l, tmp, strlen (tmp)); + cairo_move_to (cr, self->priv->eq_margin_left-1, self->priv->mouse_y-3); + pango_cairo_show_layout (cr, l); + cairo_restore (cr); + } + + cairo_save (cr); + double val = ddb_equalizer_scale(self, 1); + snprintf (tmp, sizeof (tmp), "%s%.1fdB", val > 0 ? "+" : "", val); + pango_layout_set_text (l, tmp, strlen(tmp)); + cairo_move_to (cr, self->priv->eq_margin_left-1, height-self->priv->eq_margin_bottom-fontsize); + pango_cairo_show_layout (cr, l); + cairo_restore (cr); + + cairo_save (cr); + val = ddb_equalizer_scale(self, 0); + snprintf (tmp, sizeof (tmp), "%s%.1fdB", val > 0 ? "+" : "", val); + pango_layout_set_text (l, tmp, strlen (tmp)); + cairo_move_to (cr, self->priv->eq_margin_left-1, 1); + pango_cairo_show_layout (cr, l); + cairo_restore (cr); + + cairo_save (cr); + pango_layout_set_text (l, "+0dB", 4); + cairo_move_to (cr, self->priv->eq_margin_left-1, (int)((1-self->priv->preamp)*(height-self->priv->eq_margin_bottom))-fontsize/2); + pango_cairo_show_layout (cr, l); + cairo_restore (cr); + + cairo_save (cr); + pango_layout_set_text (l, "preamp", 6); + pango_layout_set_alignment (l, PANGO_ALIGN_LEFT); + cairo_move_to (cr, 1, height-self->priv->eq_margin_bottom+2); + pango_cairo_show_layout (cr, l); + cairo_restore (cr); + + // frame + cairo_rectangle (cr, self->priv->eq_margin_left, 0, width-self->priv->eq_margin_left, height-self->priv->eq_margin_bottom); + cairo_stroke (cr); + + //draw preamp + cairo_rectangle (cr, 0, (int)(self->priv->preamp * (height-self->priv->eq_margin_bottom)), 11, height); + cairo_clip (cr); + + gdk_cairo_set_source_color (cr, &fore_bright_color); + int count = (int)((height-self->priv->eq_margin_bottom) / 6)+1; + for (int j = 0; j < count; j++) { + cairo_rectangle (cr, 1, height-self->priv->eq_margin_bottom-j*6 - 6, 11, 4); + } + cairo_fill (cr); + cairo_reset_clip (cr); + + //drawing bars: + int bar_w = 11; + if (step < bar_w) + bar_w = (int)step-1; + + + for (i = 0; i < DDB_EQUALIZER_bands; i++) + { + cairo_reset_clip (cr); + cairo_rectangle (cr, (int)((i+1)*step)+self->priv->eq_margin_left - bar_w/2, (int)(self->priv->values[i] * (height-self->priv->eq_margin_bottom)), 11, height); + cairo_clip (cr); + count = (int)((height-self->priv->eq_margin_bottom) * (1-self->priv->values[i]) / 6)+1; + for (int j = 0; j < count; j++) { + cairo_rectangle (cr, (int)((i+1)*step)+self->priv->eq_margin_left - bar_w/2, height-self->priv->eq_margin_bottom-j*6 - 6, bar_w, 4); + } + cairo_fill (cr); + } + + //drawing mouse coordinates: + cairo_reset_clip (cr); + double dash[] = {4, 4}; + cairo_set_dash (cr, dash, 2, 0); + cairo_move_to (cr, self->priv->eq_margin_left+1, self->priv->mouse_y); + cairo_line_to (cr, width, self->priv->mouse_y); + cairo_stroke (cr); + + return FALSE; +} + +#if !GTK_CHECK_VERSION(3,0,0) static gboolean ddb_equalizer_real_expose_event (GtkWidget* base, GdkEventExpose* event) { - DdbEqualizer * self; - gboolean result = FALSE; - GdkColor _tmp0_ = {0}; - GdkColor fore_bright_color; - GdkColor c1; - GdkColor _tmp1_ = {0}; - GdkColor c2; - GdkColor fore_dark_color; - gint width; - gint height; - GdkDrawable* d; - GdkGCValues _tmp3_; - GdkGCValues _tmp2_ = {0}; - GdkGC* gc; - double step; - gint i = 0; - double vstep; - PangoLayout* l; - PangoContext* ctx; - PangoFontDescription* fd; - gint fontsize; - gboolean _tmp7_ = FALSE; - char* tmp; - double val; - const char* _tmp9_; - char* _tmp10_; - const char* _tmp11_; - char* _tmp12_; - GdkRectangle _tmp14_; - GdkRectangle _tmp13_ = {0}; - gint count; - GdkRectangle _tmp17_; - GdkRectangle _tmp16_ = {0}; - gint bar_w; - GdkRectangle _tmp23_; - GdkRectangle _tmp22_ = {0}; - self = (DdbEqualizer*) base; - fore_bright_color = (gtkui_get_bar_foreground_color (&_tmp0_), _tmp0_); - c1 = fore_bright_color; - c2 = (gtkui_get_bar_background_color (&_tmp1_), _tmp1_); - fore_dark_color = c2; - fore_dark_color.red = fore_dark_color.red + ((guint16) ((gint16) ((c1.red - c2.red) * 0.5))); - fore_dark_color.green = fore_dark_color.green + ((guint16) ((gint16) ((c1.green - c2.green) * 0.5))); - fore_dark_color.blue = fore_dark_color.blue + ((guint16) ((gint16) ((c1.blue - c2.blue) * 0.5))); - width = ((GtkWidget*) self)->allocation.width; - height = ((GtkWidget*) self)->allocation.height; - d = _g_object_ref0 ((GdkDrawable*) gtk_widget_get_window ((GtkWidget*) self)); - gc = _g_object_ref0 (GDK_DRAWABLE_GET_CLASS (d)->create_gc (d, (_tmp3_ = (memset (&_tmp2_, 0, sizeof (GdkGCValues)), _tmp2_), &_tmp3_), 0)); - gdk_gc_set_rgb_fg_color (gc, &c2); - gdk_draw_rectangle (d, gc, TRUE, 0, 0, width, height); - gdk_gc_set_rgb_fg_color (gc, &fore_dark_color); - step = ((double) (width - self->priv->margin_left)) / ((double) (DDB_EQUALIZER_bands + 1)); - { - gboolean _tmp4_; - i = 0; - _tmp4_ = TRUE; - while (TRUE) { - if (!_tmp4_) { - i++; - } - _tmp4_ = FALSE; - if (!(i < DDB_EQUALIZER_bands)) { - break; - } - gdk_draw_line (d, gc, ((gint) ((i + 1) * step)) + self->priv->margin_left, 0, ((gint) ((i + 1) * step)) + self->priv->margin_left, height - self->priv->margin_bottom); - } - } - vstep = (double) (height - self->priv->margin_bottom); - { - double di; - di = (double) 0; - { - gboolean _tmp5_; - _tmp5_ = TRUE; - while (TRUE) { - if (!_tmp5_) { - di = di + 0.25; - } - _tmp5_ = FALSE; - if (!(di < 2)) { - break; - } - gdk_draw_line (d, gc, self->priv->margin_left, (gint) ((di - self->priv->preamp) * vstep), width, (gint) ((di - self->priv->preamp) * vstep)); - } - } - } - gdk_gc_set_rgb_fg_color (gc, &fore_bright_color); - l = gtk_widget_create_pango_layout ((GtkWidget*) self, NULL); - ctx = _g_object_ref0 (pango_layout_get_context (l)); - fd = pango_font_description_copy (gtk_widget_get_style ((GtkWidget*) self)->font_desc); - pango_font_description_set_size (fd, (gint) (pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc) * 0.7)); - pango_context_set_font_description (ctx, fd); - { - gboolean _tmp6_; - i = 0; - _tmp6_ = TRUE; - while (TRUE) { - PangoRectangle ink = {0}; - PangoRectangle log = {0}; - gint offs; - if (!_tmp6_) { - i++; - } - _tmp6_ = FALSE; - if (!(i < DDB_EQUALIZER_bands)) { - break; - } - pango_layout_set_text (l, freqs[i], (gint) g_utf8_strlen (freqs[i], -1)); - pango_layout_get_pixel_extents (l, &ink, &log); - offs = 2; - if ((i % 2) != 0) { - offs = offs + 2; - } - gdk_draw_layout (d, gc, (((gint) ((i + 1) * step)) + self->priv->margin_left) - (ink.width / 2), (height - self->priv->margin_bottom) + offs, l); - } - } - pango_font_description_set_size (fd, (gint) pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc)); - pango_context_set_font_description (ctx, fd); - pango_layout_set_width (l, self->priv->margin_left - 1); - pango_layout_set_alignment (l, PANGO_ALIGN_RIGHT); - fontsize = (gint) ((pango_units_to_double (pango_font_description_get_size (fd)) * gdk_screen_get_resolution (gdk_screen_get_default ())) / 72); - if (self->priv->mouse_y >= 0) { - _tmp7_ = self->priv->mouse_y < (height - self->priv->margin_bottom); - } else { - _tmp7_ = FALSE; - } - if (_tmp7_) { - double db; - const char* _tmp8_; - char* tmp; - db = ddb_equalizer_scale (self, ((double) (self->priv->mouse_y - 1)) / ((double) ((height - self->priv->margin_bottom) - 2))); - _tmp8_ = NULL; - if (db > 0) { - _tmp8_ = "+"; - } else { - _tmp8_ = ""; - } - tmp = g_strdup_printf ("%s%.1fdB", _tmp8_, db); - pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1)); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, self->priv->mouse_y - 3, l); - _g_free0 (tmp); - } - tmp = NULL; - val = ddb_equalizer_scale (self, (double) 1); - _tmp9_ = NULL; - if (val > 0) { - _tmp9_ = "+"; - } else { - _tmp9_ = ""; - } - tmp = (_tmp10_ = g_strdup_printf ("%s%.1fdB", _tmp9_, val), _g_free0 (tmp), _tmp10_); - pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1)); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, (height - self->priv->margin_bottom) - fontsize, l); - val = ddb_equalizer_scale (self, (double) 0); - _tmp11_ = NULL; - if (val > 0) { - _tmp11_ = "+"; - } else { - _tmp11_ = ""; - } - tmp = (_tmp12_ = g_strdup_printf ("%s%.1fdB", _tmp11_, val), _g_free0 (tmp), _tmp12_); - pango_layout_set_text (l, tmp, (gint) g_utf8_strlen (tmp, -1)); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, 1, l); - pango_layout_set_text (l, "+0dB", 4); - gdk_draw_layout (d, gc, self->priv->margin_left - 1, ((gint) ((1 - self->priv->preamp) * (height - self->priv->margin_bottom))) - (fontsize / 2), l); - pango_layout_set_text (l, "preamp", 6); - pango_layout_set_alignment (l, PANGO_ALIGN_LEFT); - gdk_draw_layout (d, gc, 1, (height - self->priv->margin_bottom) + 2, l); - gdk_draw_rectangle (d, gc, FALSE, self->priv->margin_left, 0, (width - self->priv->margin_left) - 1, (height - self->priv->margin_bottom) - 1); - gdk_gc_set_line_attributes (gc, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); - gdk_gc_set_clip_rectangle (gc, (_tmp14_ = (_tmp13_.x = 0, _tmp13_.y = (gint) (self->priv->preamp * (height - self->priv->margin_bottom)), _tmp13_.width = 11, _tmp13_.height = height, _tmp13_), &_tmp14_)); - gdk_gc_set_rgb_fg_color (gc, &fore_bright_color); - count = ((gint) ((height - self->priv->margin_bottom) / 6)) + 1; - { - gint j; - j = 0; - { - gboolean _tmp15_; - _tmp15_ = TRUE; - while (TRUE) { - if (!_tmp15_) { - j++; - } - _tmp15_ = FALSE; - if (!(j < count)) { - break; - } - gdk_draw_rectangle (d, gc, TRUE, 1, ((height - self->priv->margin_bottom) - (j * 6)) - 6, 11, 4); - } - } - } - gdk_gc_set_clip_rectangle (gc, (_tmp17_ = (_tmp16_.x = self->priv->margin_left + 1, _tmp16_.y = 1, _tmp16_.width = (width - self->priv->margin_left) - 2, _tmp16_.height = (height - self->priv->margin_bottom) - 2, _tmp16_), &_tmp17_)); - gdk_gc_set_rgb_fg_color (gc, &fore_bright_color); - bar_w = 11; - if (step < bar_w) { - bar_w = ((gint) step) - 1; - } - { - gboolean _tmp18_; - i = 0; - _tmp18_ = TRUE; - while (TRUE) { - GdkRectangle _tmp20_; - GdkRectangle _tmp19_ = {0}; - if (!_tmp18_) { - i++; - } - _tmp18_ = FALSE; - if (!(i < DDB_EQUALIZER_bands)) { - break; - } - gdk_gc_set_clip_rectangle (gc, (_tmp20_ = (_tmp19_.x = (((gint) ((i + 1) * step)) + self->priv->margin_left) - (bar_w / 2), _tmp19_.y = (gint) (self->priv->values[i] * (height - self->priv->margin_bottom)), _tmp19_.width = 11, _tmp19_.height = height, _tmp19_), &_tmp20_)); - count = ((gint) (((height - self->priv->margin_bottom) * (1 - self->priv->values[i])) / 6)) + 1; - { - gint j; - j = 0; - { - gboolean _tmp21_; - _tmp21_ = TRUE; - while (TRUE) { - if (!_tmp21_) { - j++; - } - _tmp21_ = FALSE; - if (!(j < count)) { - break; - } - gdk_draw_rectangle (d, gc, TRUE, (((gint) ((i + 1) * step)) + self->priv->margin_left) - (bar_w / 2), ((height - self->priv->margin_bottom) - (j * 6)) - 6, bar_w, 4); - } - } - } - } - } - gdk_gc_set_clip_rectangle (gc, (_tmp23_ = (_tmp22_.x = 0, _tmp22_.y = 0, _tmp22_.width = width, _tmp22_.height = height, _tmp22_), &_tmp23_)); - gdk_gc_set_line_attributes (gc, 1, GDK_LINE_ON_OFF_DASH, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); - gdk_draw_line (d, gc, self->priv->margin_left + 1, self->priv->mouse_y, width, self->priv->mouse_y); - result = FALSE; - _g_object_unref0 (d); - _g_object_unref0 (gc); - _g_object_unref0 (l); - _g_object_unref0 (ctx); - _pango_font_description_free0 (fd); - _g_free0 (tmp); - return result; + g_return_val_if_fail (event != NULL, FALSE); + cairo_t *cr= gdk_cairo_create ((GdkDrawable*) gtk_widget_get_window (base)); + ddb_equalizer_real_draw (base, cr); + _cairo_destroy0 (cr); + return FALSE; } +#endif -static inline double ddb_equalizer_scale (DdbEqualizer* self, double val) { - double result = 0.0; - double k; - double d; +static inline gdouble ddb_equalizer_scale (DdbEqualizer* self, gdouble val) { + gdouble result = 0.0; + gdouble k; + gdouble d; + gdouble _tmp0_; + gdouble _tmp1_; g_return_val_if_fail (self != NULL, 0.0); - k = (double) (-40); - d = (double) 20; - result = (((val + self->priv->preamp) - 0.5) * k) + d; + k = (gdouble) (-40); + d = (gdouble) 20; + _tmp0_ = val; + _tmp1_ = self->priv->preamp; + result = (((_tmp0_ + _tmp1_) - 0.5) * k) + d; return result; } -static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, double x, double y) { +static gboolean ddb_equalizer_in_curve_area (DdbEqualizer* self, gdouble x, gdouble y) { gboolean result = FALSE; gboolean _tmp0_ = FALSE; gboolean _tmp1_ = FALSE; gboolean _tmp2_ = FALSE; + gdouble _tmp3_; + gint _tmp4_; + gboolean _tmp8_; + gboolean _tmp10_; + gboolean _tmp15_; g_return_val_if_fail (self != NULL, FALSE); - if (x > self->priv->margin_left) { - _tmp2_ = x < (((GtkWidget*) self)->allocation.width - 1); + _tmp3_ = x; + _tmp4_ = self->priv->eq_margin_left; + GtkAllocation _tmp6_; + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp6_); + if (_tmp3_ > ((gdouble) _tmp4_)) { + gdouble _tmp5_; + gint _tmp7_; + _tmp5_ = x; + _tmp7_ = _tmp6_.width; + _tmp2_ = _tmp5_ < ((gdouble) (_tmp7_ - 1)); } else { _tmp2_ = FALSE; } - if (_tmp2_) { - _tmp1_ = y > 1; + _tmp8_ = _tmp2_; + if (_tmp8_) { + gdouble _tmp9_; + _tmp9_ = y; + _tmp1_ = _tmp9_ > ((gdouble) 1); } else { _tmp1_ = FALSE; } - if (_tmp1_) { - _tmp0_ = y < (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom); + _tmp10_ = _tmp1_; + if (_tmp10_) { + gdouble _tmp11_; + GtkAllocation _tmp12_; + gint _tmp13_; + gint _tmp14_; + _tmp11_ = y; + _tmp13_ = _tmp6_.height; + _tmp14_ = self->priv->eq_margin_bottom; + _tmp0_ = _tmp11_ < ((gdouble) (_tmp13_ - _tmp14_)); } else { _tmp0_ = FALSE; } - result = _tmp0_; + _tmp15_ = _tmp0_; + result = _tmp15_; return result; } -static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, double x, double y) { - double band_width; +static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, gdouble x, gdouble y) { + GtkAllocation _tmp0_; + gint _tmp1_; + gint _tmp2_; + gdouble band_width; + gdouble _tmp3_; + gint _tmp4_; + gdouble _tmp5_; + gdouble _tmp6_ = 0.0; gint band; - gboolean _tmp0_ = FALSE; + gint _tmp7_; + gint _tmp8_; + gboolean _tmp10_ = FALSE; + gint _tmp11_; + gboolean _tmp13_; g_return_if_fail (self != NULL); - band_width = ((double) (((GtkWidget*) self)->allocation.width - self->priv->margin_left)) / ((double) (DDB_EQUALIZER_bands + 1)); - band = (gint) floor (((x - self->priv->margin_left) / band_width) - 0.5); - if (band < 0) { + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp0_); + _tmp1_ = _tmp0_.width; + _tmp2_ = self->priv->eq_margin_left; + band_width = ((gdouble) (_tmp1_ - _tmp2_)) / ((gdouble) (DDB_EQUALIZER_bands + 1)); + _tmp3_ = x; + _tmp4_ = self->priv->eq_margin_left; + _tmp5_ = band_width; + _tmp6_ = floor (((_tmp3_ - _tmp4_) / _tmp5_) - 0.5); + band = (gint) _tmp6_; + _tmp7_ = band; + if (_tmp7_ < 0) { band = 0; } - if (band >= DDB_EQUALIZER_bands) { - band = band - 1; + _tmp8_ = band; + if (_tmp8_ >= DDB_EQUALIZER_bands) { + gint _tmp9_; + _tmp9_ = band; + band = _tmp9_ - 1; } - if (band >= 0) { - _tmp0_ = band < DDB_EQUALIZER_bands; + _tmp11_ = band; + if (_tmp11_ >= 0) { + gint _tmp12_; + _tmp12_ = band; + _tmp10_ = _tmp12_ < DDB_EQUALIZER_bands; } else { - _tmp0_ = FALSE; + _tmp10_ = FALSE; } - if (_tmp0_) { - self->priv->values[band] = y / ((double) (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom)); - if (self->priv->values[band] > 1) { - self->priv->values[band] = (double) 1; + _tmp13_ = _tmp10_; + if (_tmp13_) { + gdouble* _tmp14_; + gint _tmp14__length1; + gint _tmp15_; + gdouble _tmp16_; + GtkAllocation _tmp17_; + gint _tmp18_; + gint _tmp19_; + gdouble _tmp20_; + gdouble* _tmp21_; + gint _tmp21__length1; + gint _tmp22_; + gdouble _tmp23_; + _tmp14_ = self->priv->values; + _tmp14__length1 = self->priv->values_length1; + _tmp15_ = band; + _tmp16_ = y; + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp17_); + _tmp18_ = _tmp17_.height; + _tmp19_ = self->priv->eq_margin_bottom; + _tmp14_[_tmp15_] = _tmp16_ / ((gdouble) (_tmp18_ - _tmp19_)); + _tmp20_ = _tmp14_[_tmp15_]; + _tmp21_ = self->priv->values; + _tmp21__length1 = self->priv->values_length1; + _tmp22_ = band; + _tmp23_ = _tmp21_[_tmp22_]; + if (_tmp23_ > ((gdouble) 1)) { + gdouble* _tmp24_; + gint _tmp24__length1; + gint _tmp25_; + gdouble _tmp26_; + _tmp24_ = self->priv->values; + _tmp24__length1 = self->priv->values_length1; + _tmp25_ = band; + _tmp24_[_tmp25_] = (gdouble) 1; + _tmp26_ = _tmp24_[_tmp25_]; } else { - if (self->priv->values[band] < 0) { - self->priv->values[band] = (double) 0; + gdouble* _tmp27_; + gint _tmp27__length1; + gint _tmp28_; + gdouble _tmp29_; + _tmp27_ = self->priv->values; + _tmp27__length1 = self->priv->values_length1; + _tmp28_ = band; + _tmp29_ = _tmp27_[_tmp28_]; + if (_tmp29_ < ((gdouble) 0)) { + gdouble* _tmp30_; + gint _tmp30__length1; + gint _tmp31_; + gdouble _tmp32_; + _tmp30_ = self->priv->values; + _tmp30__length1 = self->priv->values_length1; + _tmp31_ = band; + _tmp30_[_tmp31_] = (gdouble) 0; + _tmp32_ = _tmp30_[_tmp31_]; } } g_signal_emit_by_name (self, "on-changed"); @@ -446,38 +499,103 @@ static void ddb_equalizer_update_eq_drag (DdbEqualizer* self, double x, double y static gboolean ddb_equalizer_real_button_press_event (GtkWidget* base, GdkEventButton* event) { DdbEqualizer * self; gboolean result = FALSE; - gboolean _tmp0_ = FALSE; - gboolean _tmp1_ = FALSE; - gboolean _tmp2_ = FALSE; + GdkEventButton _tmp0_; + gdouble _tmp1_; + GdkEventButton _tmp2_; + gdouble _tmp3_; + gboolean _tmp4_ = FALSE; + gboolean _tmp11_ = FALSE; + gboolean _tmp12_ = FALSE; + gboolean _tmp13_ = FALSE; + GdkEventButton _tmp14_; + gdouble _tmp15_; + gboolean _tmp18_; + gboolean _tmp24_; + gboolean _tmp27_; self = (DdbEqualizer*) base; - if (ddb_equalizer_in_curve_area (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y))) { + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = _tmp0_.x; + _tmp2_ = *event; + _tmp3_ = _tmp2_.y; + _tmp4_ = ddb_equalizer_in_curve_area (self, (gdouble) ((gint) _tmp1_), (gdouble) ((gint) _tmp3_)); + if (_tmp4_) { + GdkEventButton _tmp5_; + gdouble _tmp6_; + GdkEventButton _tmp7_; + gdouble _tmp8_; + GdkEventButton _tmp9_; + gdouble _tmp10_; self->priv->curve_hook = TRUE; - ddb_equalizer_update_eq_drag (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y)); - self->priv->mouse_y = (gint) (*event).y; + _tmp5_ = *event; + _tmp6_ = _tmp5_.x; + _tmp7_ = *event; + _tmp8_ = _tmp7_.y; + ddb_equalizer_update_eq_drag (self, (gdouble) ((gint) _tmp6_), (gdouble) ((gint) _tmp8_)); + _tmp9_ = *event; + _tmp10_ = _tmp9_.y; + self->priv->mouse_y = (gint) _tmp10_; gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; return result; } - if ((*event).x <= 11) { - _tmp2_ = (*event).y > 1; + _tmp14_ = *event; + _tmp15_ = _tmp14_.x; + if (_tmp15_ <= ((gdouble) 11)) { + GdkEventButton _tmp16_; + gdouble _tmp17_; + _tmp16_ = *event; + _tmp17_ = _tmp16_.y; + _tmp13_ = _tmp17_ > ((gdouble) 1); } else { - _tmp2_ = FALSE; + _tmp13_ = FALSE; } - if (_tmp2_) { - _tmp1_ = (*event).y <= (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom); + _tmp18_ = _tmp13_; + if (_tmp18_) { + GdkEventButton _tmp19_; + gdouble _tmp20_; + GtkAllocation _tmp21_; + gint _tmp22_; + gint _tmp23_; + _tmp19_ = *event; + _tmp20_ = _tmp19_.y; + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp21_); + _tmp22_ = _tmp21_.height; + _tmp23_ = self->priv->eq_margin_bottom; + _tmp12_ = _tmp20_ <= ((gdouble) (_tmp22_ - _tmp23_)); } else { - _tmp1_ = FALSE; + _tmp12_ = FALSE; } - if (_tmp1_) { - _tmp0_ = (*event).button == 1; + _tmp24_ = _tmp12_; + if (_tmp24_) { + GdkEventButton _tmp25_; + guint _tmp26_; + _tmp25_ = *event; + _tmp26_ = _tmp25_.button; + _tmp11_ = _tmp26_ == ((guint) 1); } else { - _tmp0_ = FALSE; + _tmp11_ = FALSE; } - if (_tmp0_) { - self->priv->preamp = (*event).y / ((double) (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom)); + _tmp27_ = _tmp11_; + if (_tmp27_) { + GdkEventButton _tmp28_; + gdouble _tmp29_; + GtkAllocation _tmp30_; + gint _tmp31_; + gint _tmp32_; + GdkEventButton _tmp33_; + gdouble _tmp34_; + _tmp28_ = *event; + _tmp29_ = _tmp28_.y; + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp30_); + _tmp31_ = _tmp30_.height; + _tmp32_ = self->priv->eq_margin_bottom; + self->priv->preamp = _tmp29_ / ((gdouble) (_tmp31_ - _tmp32_)); g_signal_emit_by_name (self, "on-changed"); self->priv->preamp_hook = TRUE; - self->priv->mouse_y = (gint) (*event).y; + _tmp33_ = *event; + _tmp34_ = _tmp33_.y; + self->priv->mouse_y = (gint) _tmp34_; gtk_widget_queue_draw ((GtkWidget*) self); } result = FALSE; @@ -488,10 +606,15 @@ static gboolean ddb_equalizer_real_button_press_event (GtkWidget* base, GdkEvent static gboolean ddb_equalizer_real_button_release_event (GtkWidget* base, GdkEventButton* event) { DdbEqualizer * self; gboolean result = FALSE; + GdkWindow* _tmp0_ = NULL; + GdkCursor* _tmp1_; self = (DdbEqualizer*) base; + g_return_val_if_fail (event != NULL, FALSE); self->priv->curve_hook = FALSE; self->priv->preamp_hook = FALSE; - gdk_window_set_cursor (gtk_widget_get_window ((GtkWidget*) self), self->priv->pointer_cursor); + _tmp0_ = gtk_widget_get_window ((GtkWidget*) self); + _tmp1_ = self->priv->pointer_cursor; + gdk_window_set_cursor (_tmp0_, _tmp1_); result = FALSE; return result; } @@ -501,6 +624,7 @@ static gboolean ddb_equalizer_real_leave_notify_event (GtkWidget* base, GdkEvent DdbEqualizer * self; gboolean result = FALSE; self = (DdbEqualizer*) base; + g_return_val_if_fail (event != NULL, FALSE); self->priv->mouse_y = -1; gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; @@ -511,30 +635,77 @@ static gboolean ddb_equalizer_real_leave_notify_event (GtkWidget* base, GdkEvent static gboolean ddb_equalizer_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event) { DdbEqualizer * self; gboolean result = FALSE; - double y; + GdkEventMotion _tmp0_; + gdouble _tmp1_; + GtkAllocation _tmp2_; + gint _tmp3_; + gint _tmp4_; + gdouble y; + gdouble _tmp5_; + gdouble _tmp6_; + gboolean _tmp7_; + GdkEventMotion _tmp9_; + gdouble _tmp10_; + GdkEventMotion _tmp11_; + gdouble _tmp12_; + gboolean _tmp13_ = FALSE; + gboolean _tmp16_; self = (DdbEqualizer*) base; - y = (*event).y / ((double) (((GtkWidget*) self)->allocation.height - self->priv->margin_bottom)); - if (y < 0) { - y = (double) 0; + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = _tmp0_.y; + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp2_); + _tmp3_ = _tmp2_.height; + _tmp4_ = self->priv->eq_margin_bottom; + y = _tmp1_ / ((gdouble) (_tmp3_ - _tmp4_)); + _tmp5_ = y; + if (_tmp5_ < ((gdouble) 0)) { + y = (gdouble) 0; } - if (y > 1) { - y = (double) 1; + _tmp6_ = y; + if (_tmp6_ > ((gdouble) 1)) { + y = (gdouble) 1; } - if (self->priv->preamp_hook) { - self->priv->preamp = y; + _tmp7_ = self->priv->preamp_hook; + if (_tmp7_) { + gdouble _tmp8_; + _tmp8_ = y; + self->priv->preamp = _tmp8_; g_signal_emit_by_name (self, "on-changed"); gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; return result; } - if (!ddb_equalizer_in_curve_area (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y))) { + _tmp9_ = *event; + _tmp10_ = _tmp9_.x; + _tmp11_ = *event; + _tmp12_ = _tmp11_.y; + _tmp13_ = ddb_equalizer_in_curve_area (self, (gdouble) ((gint) _tmp10_), (gdouble) ((gint) _tmp12_)); + if (!_tmp13_) { self->priv->mouse_y = -1; } else { - self->priv->mouse_y = (gint) (*event).y; + GdkEventMotion _tmp14_; + gdouble _tmp15_; + _tmp14_ = *event; + _tmp15_ = _tmp14_.y; + self->priv->mouse_y = (gint) _tmp15_; } - if (self->priv->curve_hook) { - ddb_equalizer_update_eq_drag (self, (double) ((gint) (*event).x), (double) ((gint) (*event).y)); - self->priv->mouse_y = (gint) (*event).y; + _tmp16_ = self->priv->curve_hook; + if (_tmp16_) { + GdkEventMotion _tmp17_; + gdouble _tmp18_; + GdkEventMotion _tmp19_; + gdouble _tmp20_; + GdkEventMotion _tmp21_; + gdouble _tmp22_; + _tmp17_ = *event; + _tmp18_ = _tmp17_.x; + _tmp19_ = *event; + _tmp20_ = _tmp19_.y; + ddb_equalizer_update_eq_drag (self, (gdouble) ((gint) _tmp18_), (gdouble) ((gint) _tmp20_)); + _tmp21_ = *event; + _tmp22_ = _tmp21_.y; + self->priv->mouse_y = (gint) _tmp22_; } gtk_widget_queue_draw ((GtkWidget*) self); result = FALSE; @@ -542,37 +713,59 @@ static gboolean ddb_equalizer_real_motion_notify_event (GtkWidget* base, GdkEven } -void ddb_equalizer_set_band (DdbEqualizer* self, gint band, double v) { +void ddb_equalizer_set_band (DdbEqualizer* self, gint band, gdouble v) { + gdouble* _tmp0_; + gint _tmp0__length1; + gint _tmp1_; + gdouble _tmp2_; + gdouble _tmp3_; g_return_if_fail (self != NULL); - self->priv->values[band] = 1 - ((v + 20.0) / 40.0); + _tmp0_ = self->priv->values; + _tmp0__length1 = self->priv->values_length1; + _tmp1_ = band; + _tmp2_ = v; + _tmp0_[_tmp1_] = 1 - ((_tmp2_ + 20.0) / 40.0); + _tmp3_ = _tmp0_[_tmp1_]; } -double ddb_equalizer_get_band (DdbEqualizer* self, gint band) { - double result = 0.0; +gdouble ddb_equalizer_get_band (DdbEqualizer* self, gint band) { + gdouble result = 0.0; + gdouble* _tmp0_; + gint _tmp0__length1; + gint _tmp1_; + gdouble _tmp2_; g_return_val_if_fail (self != NULL, 0.0); - result = ((1 - self->priv->values[band]) * 40.0) - 20.0; + _tmp0_ = self->priv->values; + _tmp0__length1 = self->priv->values_length1; + _tmp1_ = band; + _tmp2_ = _tmp0_[_tmp1_]; + result = ((1 - _tmp2_) * 40.0) - 20.0; return result; } -void ddb_equalizer_set_preamp (DdbEqualizer* self, double v) { +void ddb_equalizer_set_preamp (DdbEqualizer* self, gdouble v) { + gdouble _tmp0_; g_return_if_fail (self != NULL); - self->priv->preamp = 1 - ((v + 20.0) / 40.0); + _tmp0_ = v; + self->priv->preamp = 1 - ((_tmp0_ + 20.0) / 40.0); } -double ddb_equalizer_get_preamp (DdbEqualizer* self) { - double result = 0.0; +gdouble ddb_equalizer_get_preamp (DdbEqualizer* self) { + gdouble result = 0.0; + gdouble _tmp0_; g_return_val_if_fail (self != NULL, 0.0); - result = ((1 - self->priv->preamp) * 40.0) - 20.0; + _tmp0_ = self->priv->preamp; + result = ((1 - _tmp0_) * 40.0) - 20.0; return result; } DdbEqualizer* ddb_equalizer_construct (GType object_type) { - DdbEqualizer * self; - self = g_object_newv (object_type, 0, NULL); + DdbEqualizer * self = NULL; + self = (DdbEqualizer*) g_object_new (object_type, NULL); return self; } @@ -589,10 +782,6 @@ static GObject * ddb_equalizer_constructor (GType type, guint n_construct_proper parent_class = G_OBJECT_CLASS (ddb_equalizer_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = DDB_EQUALIZER (obj); - { - self->priv->margin_bottom = (gint) (((pango_units_to_double (pango_font_description_get_size (gtk_widget_get_style ((GtkWidget*) self)->font_desc)) * gdk_screen_get_resolution (gdk_screen_get_default ())) / 72) + 4); - self->priv->margin_left = self->priv->margin_bottom * 4; - } return obj; } @@ -602,7 +791,11 @@ static void ddb_equalizer_class_init (DdbEqualizerClass * klass) { g_type_class_add_private (klass, sizeof (DdbEqualizerPrivate)); GTK_WIDGET_CLASS (klass)->configure_event = ddb_equalizer_real_configure_event; GTK_WIDGET_CLASS (klass)->realize = ddb_equalizer_real_realize; +#if GTK_CHECK_VERSION(3,0,0) + GTK_WIDGET_CLASS (klass)->draw = ddb_equalizer_real_draw; +#else GTK_WIDGET_CLASS (klass)->expose_event = ddb_equalizer_real_expose_event; +#endif GTK_WIDGET_CLASS (klass)->button_press_event = ddb_equalizer_real_button_press_event; GTK_WIDGET_CLASS (klass)->button_release_event = ddb_equalizer_real_button_release_event; GTK_WIDGET_CLASS (klass)->leave_notify_event = ddb_equalizer_real_leave_notify_event; @@ -614,17 +807,21 @@ static void ddb_equalizer_class_init (DdbEqualizerClass * klass) { static void ddb_equalizer_instance_init (DdbEqualizer * self) { + gdouble* _tmp0_ = NULL; + GdkCursor* _tmp1_; self->priv = DDB_EQUALIZER_GET_PRIVATE (self); - self->priv->values = g_new0 (double, DDB_EQUALIZER_bands); + _tmp0_ = g_new0 (gdouble, DDB_EQUALIZER_bands); + self->priv->values = _tmp0_; self->priv->values_length1 = DDB_EQUALIZER_bands; self->priv->_values_size_ = self->priv->values_length1; self->priv->preamp = 0.5; self->priv->mouse_y = -1; self->priv->curve_hook = FALSE; self->priv->preamp_hook = FALSE; - self->priv->margin_bottom = -1; - self->priv->margin_left = -1; - self->priv->pointer_cursor = gdk_cursor_new (GDK_LEFT_PTR); + self->priv->eq_margin_bottom = -1; + self->priv->eq_margin_left = -1; + _tmp1_ = gdk_cursor_new (GDK_LEFT_PTR); + self->priv->pointer_cursor = _tmp1_; } @@ -650,4 +847,3 @@ GType ddb_equalizer_get_type (void) { - diff --git a/plugins/gtkui/ddbequalizer.h b/plugins/gtkui/ddbequalizer.h index b0493d52..02df70af 100644 --- a/plugins/gtkui/ddbequalizer.h +++ b/plugins/gtkui/ddbequalizer.h @@ -1,6 +1,3 @@ -/* ddbequalizer.h generated by valac, the Vala compiler, do not modify */ - - #ifndef __DDBEQUALIZER_H__ #define __DDBEQUALIZER_H__ @@ -33,11 +30,11 @@ struct _DdbEqualizerClass { }; -GType ddb_equalizer_get_type (void); -void ddb_equalizer_set_band (DdbEqualizer* self, gint band, double v); -double ddb_equalizer_get_band (DdbEqualizer* self, gint band); -void ddb_equalizer_set_preamp (DdbEqualizer* self, double v); -double ddb_equalizer_get_preamp (DdbEqualizer* self); +GType ddb_equalizer_get_type (void) G_GNUC_CONST; +void ddb_equalizer_set_band (DdbEqualizer* self, gint band, gdouble v); +gdouble ddb_equalizer_get_band (DdbEqualizer* self, gint band); +void ddb_equalizer_set_preamp (DdbEqualizer* self, gdouble v); +gdouble ddb_equalizer_get_preamp (DdbEqualizer* self); DdbEqualizer* ddb_equalizer_new (void); DdbEqualizer* ddb_equalizer_construct (GType object_type); diff --git a/plugins/gtkui/ddbequalizer.vala b/plugins/gtkui/ddbequalizer.vala index 4b82671c..82a1f060 100644 --- a/plugins/gtkui/ddbequalizer.vala +++ b/plugins/gtkui/ddbequalizer.vala @@ -18,6 +18,9 @@ // sripped down and polished by Alexey Yakovenko <waker@users.sourceforge.net> +using Gtk; +using Gdk; + const string[] freqs = { "55 Hz","77 Hz","110 Hz","156 Hz","220 Hz","311 Hz","440 Hz","622 Hz","880 Hz", "1.2 kHz","1.8 kHz","2.5 kHz","3.5 kHz","5 kHz","7 kHz","10 kHz","14 kHz","20 kHz" @@ -36,8 +39,8 @@ namespace Ddb { private bool curve_hook = false; private bool preamp_hook = false; - private int margin_bottom = -1; - private int margin_left = -1; + private int eq_margin_bottom = -1; + private int eq_margin_left = -1; static const int spot_size = 3; static const int bands = 18; @@ -47,8 +50,8 @@ namespace Ddb { construct { - margin_bottom = (int)(Pango.units_to_double (get_style ().font_desc.get_size ()) * Gdk.Screen.get_default ().get_resolution () / 72 + 4); - margin_left = margin_bottom * 4; + eq_margin_bottom = (int)(Pango.units_to_double (get_style ().font_desc.get_size ()) * Gdk.Screen.get_default ().get_resolution () / 72 + 4); + eq_margin_left = eq_margin_bottom * 4; //color_changed (); } @@ -75,121 +78,131 @@ namespace Ddb { fore_dark_color.green += (int16)((c1.green - c2.green) * 0.5); fore_dark_color.blue += (int16)((c1.blue - c2.blue) * 0.5); - int width = allocation.width; - int height = allocation.height; + Allocation alloc; + get_allocation (out alloc); - Gdk.Drawable d = get_window(); - var gc = d.create_gc (Gdk.GCValues(), 0); - //Gdk.Rectangle rc = {0, 0, allocation.width, allocation.height}; - //gc.set_clip_rectangle (rc); + int width = alloc.width; + int height = alloc.height; - gc.set_rgb_fg_color (c2); + var ctx = Gdk.cairo_create (get_window ()); + ctx.set_antialias (Cairo.Antialias.NONE); + ctx.set_line_width (1.0); + ctx.set_source_rgba (c2.red/65535.0, c2.green/65535.0, c2.blue/65535.0, 1); + ctx.rectangle (0, 0, width, height); + ctx.fill (); - d.draw_rectangle (gc, true, 0, 0, width, height); + ctx.set_source_rgba (fore_dark_color.red/65535.0, fore_dark_color.green/65535.0, fore_dark_color.blue/65535.0, 1); - gc.set_rgb_fg_color (fore_dark_color); //drawing grid: - double step = (double)(width - margin_left) / (double)(bands+1); + double step = (double)(width - eq_margin_left) / (double)(bands+1); int i; for (i = 0; i < bands; i++) { //does anyone know why this method is static? - Gdk.draw_line (d, gc, - (int)((i+1)*step)+margin_left, - 0, - (int)((i+1)*step)+margin_left, - height - margin_bottom); + ctx.move_to ((int)((i+1)*step)+eq_margin_left, 0); + ctx.line_to ((int)((i+1)*step)+eq_margin_left, height - eq_margin_bottom); } - double vstep = (double)(height-margin_bottom); + double vstep = (double)(height-eq_margin_bottom); for (double di=0; di < 2; di += 0.25) { - Gdk.draw_line (d, gc, - margin_left, - (int)((di-preamp)*vstep), - width, - (int)((di-preamp)*vstep)); + ctx.move_to (eq_margin_left, (int)((di-preamp)*vstep)); + ctx.line_to (width, (int)((di-preamp)*vstep)); } + ctx.stroke (); - gc.set_rgb_fg_color (fore_bright_color); + ctx.set_source_rgba (fore_bright_color.red/65535.0, fore_bright_color.green/65535.0, fore_bright_color.blue/65535.0, 1); //drawing freqs: - Pango.Layout l = create_pango_layout (null); - var ctx = l.get_context (); + + Pango.Layout l = Pango.cairo_create_layout (ctx); + var pctx = l.get_context (); var fd = get_style ().font_desc.copy (); -// var fd = ctx.get_font_description (); fd.set_size ((int)(get_style ().font_desc.get_size () * 0.7)); - ctx.set_font_description (fd); + pctx.set_font_description (fd); for (i = 0; i < bands; i++) { - l.set_text (freqs[i], (int)freqs[i].len()); + ctx.save (); + l.set_text (freqs[i], (int)freqs[i].length); Pango.Rectangle ink, log; l.get_pixel_extents (out ink, out log); int offs = 2; if ((i % 2) != 0) { offs += 2; } - Gdk.draw_layout (d, gc, (int)((i+1)*step)+margin_left - ink.width/2, height-margin_bottom + offs, l); + ctx.move_to ( (int)((i+1)*step)+eq_margin_left - ink.width/2, height-eq_margin_bottom + offs); + Pango.cairo_show_layout (ctx, l); + ctx.restore (); } fd.set_size ((int)(get_style ().font_desc.get_size ())); - ctx.set_font_description (fd); + pctx.set_font_description (fd); //drawing db's: - l.set_width (margin_left-1); + l.set_width (eq_margin_left-1); l.set_alignment (Pango.Alignment.RIGHT); int fontsize = (int)(Pango.units_to_double (fd.get_size ()) * Gdk.Screen.get_default ().get_resolution () / 72); - if ((mouse_y >= 0) && (mouse_y < height - margin_bottom)) + if ((mouse_y >= 0) && (mouse_y < height - eq_margin_bottom)) { - double db = scale((double)(mouse_y-1) / (double)(height - margin_bottom - 2)); + ctx.save (); + double db = scale((double)(mouse_y-1) / (double)(height - eq_margin_bottom - 2)); string tmp = "%s%.1fdB".printf (db > 0 ? "+" : "", db); - l.set_text (tmp, (int)tmp.len()); - Gdk.draw_layout (d, gc, margin_left-1, mouse_y-3, l); + l.set_text (tmp, (int)tmp.length); + ctx.move_to (eq_margin_left-1, mouse_y-3); + Pango.cairo_show_layout (ctx, l); + ctx.restore (); } + ctx.save (); string tmp; double val = scale(1); tmp = "%s%.1fdB".printf (val > 0 ? "+" : "", val); - l.set_text (tmp, (int)tmp.len()); - Gdk.draw_layout (d, gc, margin_left-1, height-margin_bottom-fontsize, l); + l.set_text (tmp, (int)tmp.length); + ctx.move_to (eq_margin_left-1, height-eq_margin_bottom-fontsize); + Pango.cairo_show_layout (ctx, l); + ctx.restore (); + ctx.save (); val = scale(0); tmp = "%s%.1fdB".printf (val > 0 ? "+" : "", val); - l.set_text (tmp, (int)tmp.len()); - Gdk.draw_layout (d, gc, margin_left-1, 1, l); + l.set_text (tmp, (int)tmp.length); + ctx.move_to (eq_margin_left-1, 1); + Pango.cairo_show_layout (ctx, l); + ctx.restore (); + ctx.save (); l.set_text ("+0dB", 4); - Gdk.draw_layout (d, gc, margin_left-1, (int)((1-preamp)*(height-margin_bottom))-fontsize/2, l); + ctx.move_to (eq_margin_left-1, (int)((1-preamp)*(height-eq_margin_bottom))-fontsize/2); + Pango.cairo_show_layout (ctx, l); + ctx.restore (); + ctx.save (); l.set_text ("preamp", 6); l.set_alignment (Pango.Alignment.LEFT); - Gdk.draw_layout (d, gc, 1, height-margin_bottom+2, l); + ctx.move_to (1, height-eq_margin_bottom+2); + Pango.cairo_show_layout (ctx, l); + ctx.restore (); - d.draw_rectangle (gc, false, margin_left, 0, width-margin_left-1, height-margin_bottom-1); - gc.set_line_attributes (2, Gdk.LineStyle.SOLID, Gdk.CapStyle.NOT_LAST, Gdk.JoinStyle.MITER); - - //draw preamp - gc.set_clip_rectangle ({0, (int)(preamp * (height-margin_bottom)), 11, height}); + // frame + ctx.rectangle (eq_margin_left, 0, width-eq_margin_left-1, height-eq_margin_bottom-1); + ctx.stroke (); - gc.set_rgb_fg_color (fore_bright_color); - int count = (int)((height-margin_bottom) / 6)+1; - for (int j = 0; j < count; j++) - d.draw_rectangle ( - gc, - true, - 1, - height-margin_bottom-j*6 - 6, - 11, - 4); + //draw preamp + ctx.rectangle (0, (int)(preamp * (height-eq_margin_bottom)), 11, height); + ctx.clip (); - gc.set_clip_rectangle ({margin_left+1, 1, width-margin_left-2, height-margin_bottom-2}); + ctx.set_source_rgba (fore_bright_color.red/65535.0, fore_bright_color.green/65535.0, fore_bright_color.blue/65535.0, 1.0); + int count = (int)((height-eq_margin_bottom) / 6)+1; + for (int j = 0; j < count; j++) { + ctx.rectangle (1, height-eq_margin_bottom-j*6 - 6, 11, 4); + } + ctx.fill (); + ctx.reset_clip (); //drawing bars: - gc.set_rgb_fg_color (fore_bright_color); - int bar_w = 11; if (step < bar_w) bar_w = (int)step-1; @@ -197,26 +210,22 @@ namespace Ddb { for (i = 0; i < bands; i++) { - gc.set_clip_rectangle ({ - (int)((i+1)*step)+margin_left - bar_w/2, - (int)(values[i] * (height-margin_bottom)), - 11, - height}); - count = (int)((height-margin_bottom) * (1-values[i]) / 6)+1; - for (int j = 0; j < count; j++) - d.draw_rectangle ( - gc, - true, - (int)((i+1)*step)+margin_left - bar_w/2, - height-margin_bottom-j*6 - 6, - bar_w, - 4); + ctx.reset_clip (); + ctx.rectangle ((int)((i+1)*step)+eq_margin_left - bar_w/2, (int)(values[i] * (height-eq_margin_bottom)), 11, height); + ctx.clip (); + count = (int)((height-eq_margin_bottom) * (1-values[i]) / 6)+1; + for (int j = 0; j < count; j++) { + ctx.rectangle ( (int)((i+1)*step)+eq_margin_left - bar_w/2, height-eq_margin_bottom-j*6 - 6, bar_w, 4); + } + ctx.fill (); } - gc.set_clip_rectangle ({0, 0, width, height}); //drawing mouse coordinates: - gc.set_line_attributes (1, Gdk.LineStyle.ON_OFF_DASH, Gdk.CapStyle.NOT_LAST, Gdk.JoinStyle.MITER); - Gdk.draw_line (d, gc, margin_left+1, mouse_y, width, mouse_y); + ctx.reset_clip (); + ctx.set_dash (new double[] {4, 4}, 0); + ctx.move_to (eq_margin_left+1, mouse_y); + ctx.line_to (width, mouse_y); + ctx.stroke (); return false; } @@ -233,16 +242,16 @@ namespace Ddb { in_curve_area (double x, double y) { return - x > margin_left && + x > eq_margin_left && x < allocation.width-1 && y > 1 && - y < allocation.height-margin_bottom; + y < allocation.height-eq_margin_bottom; } private void update_eq_drag (double x, double y) { - double band_width = (double)(allocation.width - margin_left) / (double)(bands+1); - int band = (int)GLib.Math.floor ((x - margin_left) / band_width - 0.5); + double band_width = (double)(allocation.width - eq_margin_left) / (double)(bands+1); + int band = (int)GLib.Math.floor ((x - eq_margin_left) / band_width - 0.5); if (band < 0) { band = 0; } @@ -250,7 +259,7 @@ namespace Ddb { band = band-1; } if (band >= 0 && band < bands) { - values[band] = y / (double)(allocation.height - margin_bottom); + values[band] = y / (double)(allocation.height - eq_margin_bottom); if (values[band] > 1) { values[band] = 1; } @@ -276,11 +285,11 @@ namespace Ddb { if (event.x <= 11 && event.y > 1 && - event.y <= allocation.height-margin_bottom && + event.y <= allocation.height-eq_margin_bottom && event.button == 1 ) { - preamp = event.y / (double)(allocation.height - margin_bottom); + preamp = event.y / (double)(allocation.height - eq_margin_bottom); on_changed (); preamp_hook = true; mouse_y = (int)event.y; @@ -311,7 +320,7 @@ namespace Ddb { /* Mouse pointer moved over widget */ public override bool motion_notify_event (Gdk.EventMotion event) { - double y = event.y / (double)(allocation.height - margin_bottom); + double y = event.y / (double)(allocation.height - eq_margin_bottom); if (y < 0) y = 0; if (y > 1) y = 1; diff --git a/plugins/gtkui/ddblistview.c b/plugins/gtkui/ddblistview.c index bc2ded0a..ba2b0080 100644 --- a/plugins/gtkui/ddblistview.c +++ b/plugins/gtkui/ddblistview.c @@ -20,7 +20,6 @@ #endif #include <gtk/gtk.h> -#include <gdk/gdkkeysyms.h> #include <math.h> #include <stdlib.h> #include <time.h> @@ -32,6 +31,7 @@ #include "ddblistview.h" #include "drawing.h" #include "gtkui.h" +#include "support.h" #define min(x,y) ((x)<(y)?(x):(y)) #define max(x,y) ((x)>(y)?(x):(y)) @@ -57,7 +57,7 @@ G_DEFINE_TYPE (DdbListview, ddb_listview, GTK_TYPE_TABLE); struct _DdbListviewColumn { char *title; - int width; + float width; int minheight; struct _DdbListviewColumn *next; void *user_data; @@ -80,7 +80,7 @@ static void ddb_listview_init(DdbListview *listview); //static void ddb_listview_size_allocate(GtkWidget *widget, GtkAllocation *allocation); //static void ddb_listview_realize(GtkWidget *widget); //static void ddb_listview_paint(GtkWidget *widget); -static void ddb_listview_destroy(GtkObject *object); +static void ddb_listview_destroy(GObject *object); static void ddb_listview_build_groups (DdbListview *listview); @@ -94,13 +94,11 @@ ddb_listview_free_groups (DdbListview *listview); ////// list functions //// void -ddb_listview_list_render (DdbListview *ps, int x, int y, int w, int h); +ddb_listview_list_render (DdbListview *ps, cairo_t *cr, int x, int y, int w, int h); void -ddb_listview_list_render_row_background (DdbListview *ps, DdbListviewIter it, int even, int cursor, int x, int y, int w, int h); +ddb_listview_list_render_row_background (DdbListview *ps, cairo_t *cr, DdbListviewIter it, int even, int cursor, int x, int y, int w, int h); void -ddb_listview_list_render_row_foreground (DdbListview *ps, DdbListviewIter it, DdbListviewIter group_it, int even, int cursor, int group_y, int x, int y, int w, int h); -//void -//ddb_listview_list_render_row (DdbListview *ps, int row, DdbListviewIter it); +ddb_listview_list_render_row_foreground (DdbListview *ps, cairo_t *cr, DdbListviewIter it, DdbListviewIter group_it, int even, int cursor, int group_y, int x, int y, int w, int h); void ddb_listview_list_track_dragdrop (DdbListview *ps, int y); int @@ -120,7 +118,7 @@ ddb_listview_get_row_pos (DdbListview *listview, int pos); ////// header functions //// void -ddb_listview_header_render (DdbListview *ps); +ddb_listview_header_render (DdbListview *ps, cairo_t *cr); ////// column management functions //// void @@ -148,9 +146,16 @@ ddb_listview_list_drag_data_received (GtkWidget *widget, gpointer user_data); gboolean +ddb_listview_header_draw (GtkWidget *widget, + cairo_t *cr, + gpointer user_data); +#if !GTK_CHECK_VERSION(3,0,0) + +gboolean ddb_listview_header_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data); +#endif gboolean ddb_listview_header_configure_event (GtkWidget *widget, @@ -186,6 +191,11 @@ ddb_listview_list_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data); +gboolean +ddb_listview_list_draw (GtkWidget *widget, + cairo_t *cr, + gpointer user_data); + void ddb_listview_list_realize (GtkWidget *widget, gpointer user_data); @@ -278,16 +288,15 @@ static void ddb_listview_class_init(DdbListviewClass *class) { GtkTableClass *widget_class = (GtkTableClass *) class; - GtkObjectClass *object_class = (GtkObjectClass *) class; - // FIXME!!! - object_class->destroy = ddb_listview_destroy; + GObjectClass *object_class = (GObjectClass *) class; + object_class->finalize = ddb_listview_destroy; } static void ddb_listview_init(DdbListview *listview) { // init instance - create all subwidgets, and insert into table - draw_init_font (GTK_WIDGET(listview)->style); + draw_init_font (gtk_widget_get_style (GTK_WIDGET(listview))); listview->rowheight = draw_get_listview_rowheight (); @@ -317,6 +326,7 @@ ddb_listview_init(DdbListview *listview) listview->last_header_motion_ev = -1; //is it subject to remove? listview->prev_header_x = -1; listview->header_prepare = 0; + listview->header_width = 0; listview->columns = NULL; listview->groups = NULL; @@ -382,9 +392,15 @@ ddb_listview_init(DdbListview *listview) g_signal_connect ((gpointer) listview->scrollbar, "value_changed", G_CALLBACK (ddb_listview_vscroll_value_changed), NULL); +#if !GTK_CHECK_VERSION(3,0,0) g_signal_connect ((gpointer) listview->header, "expose_event", G_CALLBACK (ddb_listview_header_expose_event), NULL); +#else + g_signal_connect ((gpointer) listview->header, "draw", + G_CALLBACK (ddb_listview_header_draw), + NULL); +#endif g_signal_connect ((gpointer) listview->header, "configure_event", G_CALLBACK (ddb_listview_header_configure_event), NULL); @@ -400,9 +416,15 @@ ddb_listview_init(DdbListview *listview) g_signal_connect ((gpointer) listview->header, "button_release_event", G_CALLBACK (ddb_listview_header_button_release_event), NULL); +#if !GTK_CHECK_VERSION(3,0,0) g_signal_connect ((gpointer) listview->list, "expose_event", G_CALLBACK (ddb_listview_list_expose_event), NULL); +#else + g_signal_connect ((gpointer) listview->list, "draw", + G_CALLBACK (ddb_listview_list_draw), + NULL); +#endif g_signal_connect ((gpointer) listview->list, "realize", G_CALLBACK (ddb_listview_list_realize), NULL); @@ -457,7 +479,7 @@ GtkWidget * ddb_listview_new() } static void -ddb_listview_destroy(GtkObject *object) +ddb_listview_destroy(GObject *object) { DdbListview *listview; @@ -525,7 +547,7 @@ ddb_listview_list_configure_event (GtkWidget *widget, { DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); - draw_init_font (widget->style); + draw_init_font (gtk_widget_get_style (widget)); int height = draw_get_listview_rowheight (); if (height != ps->rowheight) { ps->rowheight = height; @@ -610,11 +632,17 @@ ddb_listview_list_pickpoint_y (DdbListview *listview, int y, DdbListviewGroup ** } void -ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) { +ddb_listview_list_render (DdbListview *listview, cairo_t *cr, int x, int y, int w, int h) { + cairo_set_line_width (cr, 1); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); GtkWidget *treeview = theme_treeview; - if (treeview->style->depth == -1) { + +#if !GTK_CHECK_VERSION(3,0,0) +// FIXME? + if (gtk_widget_get_style (treeview)->depth == -1) { return; // drawing was called too early } +#endif int idx = 0; int abs_idx = 0; deadbeef->pl_lock (); @@ -628,7 +656,8 @@ ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) { abs_idx += grp->num_items; grp = grp->next; } - draw_begin ((uintptr_t)listview->list->window); + + draw_begin (cr); int ii = 0; while (grp && grp_y < y + h + listview->scrollpos) { @@ -640,9 +669,9 @@ ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) { } listview->binding->ref (it); if (grp_y + listview->grouptitle_height >= y + listview->scrollpos && grp_y < y + h + listview->scrollpos) { - ddb_listview_list_render_row_background (listview, NULL, idx & 1, 0, -listview->hscrollpos, grp_y - listview->scrollpos, listview->totalwidth, listview->grouptitle_height); + ddb_listview_list_render_row_background (listview, cr, NULL, idx & 1, 0, -listview->hscrollpos, grp_y - listview->scrollpos, listview->totalwidth, listview->grouptitle_height); if (listview->binding->draw_group_title && listview->grouptitle_height > 0) { - listview->binding->draw_group_title (listview, listview->list->window, it, -listview->hscrollpos, grp_y - listview->scrollpos, listview->totalwidth, listview->grouptitle_height); + listview->binding->draw_group_title (listview, cr, it, -listview->hscrollpos, grp_y - listview->scrollpos, listview->totalwidth, listview->grouptitle_height); } } for (int i = 0; i < grp->num_items; i++) { @@ -655,9 +684,12 @@ ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) { } if (grp_y + listview->grouptitle_height + (i+1) * listview->rowheight >= y + listview->scrollpos && grp_y + listview->grouptitle_height + i * listview->rowheight < y + h + listview->scrollpos) { - gdk_draw_rectangle (listview->list->window, listview->list->style->bg_gc[GTK_STATE_NORMAL], TRUE, -listview->hscrollpos, grp_y + listview->grouptitle_height + i * listview->rowheight - listview->scrollpos, listview->totalwidth, listview->rowheight); - ddb_listview_list_render_row_background (listview, it, (idx + 1 + i) & 1, (abs_idx+i) == listview->binding->cursor () ? 1 : 0, -listview->hscrollpos, grp_y + listview->grouptitle_height + i * listview->rowheight - listview->scrollpos, listview->totalwidth, listview->rowheight); - ddb_listview_list_render_row_foreground (listview, it, grp->head, (idx + 1 + i) & 1, (idx+i) == listview->binding->cursor () ? 1 : 0, i * listview->rowheight, -listview->hscrollpos, grp_y + listview->grouptitle_height + i * listview->rowheight - listview->scrollpos, listview->totalwidth, listview->rowheight); + GtkStyle *st = gtk_widget_get_style (listview->list); + gdk_cairo_set_source_color (cr, &st->bg[GTK_STATE_NORMAL]); + cairo_rectangle (cr, -listview->hscrollpos, grp_y + listview->grouptitle_height + i * listview->rowheight - listview->scrollpos, listview->totalwidth, listview->rowheight); + cairo_fill (cr); + ddb_listview_list_render_row_background (listview, cr, it, (idx + 1 + i) & 1, (abs_idx+i) == listview->binding->cursor () ? 1 : 0, -listview->hscrollpos, grp_y + listview->grouptitle_height + i * listview->rowheight - listview->scrollpos, listview->totalwidth, listview->rowheight); + ddb_listview_list_render_row_foreground (listview, cr, it, grp->head, (idx + 1 + i) & 1, (idx+i) == listview->binding->cursor () ? 1 : 0, i * listview->rowheight, -listview->hscrollpos, grp_y + listview->grouptitle_height + i * listview->rowheight - listview->scrollpos, listview->totalwidth, listview->rowheight); } DdbListviewIter next = listview->binding->next (it); listview->binding->unref (it); @@ -676,18 +708,22 @@ ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) { if (filler > 0) { int theming = !gtkui_override_listview_colors (); if (theming) { - gtk_paint_flat_box (treeview->style, listview->list->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, "cell_even_ruled", x, grp_y - listview->scrollpos + listview->grouptitle_height + listview->rowheight * grp->num_items, w, filler); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_flat_box (gtk_widget_get_style (treeview), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, treeview, "even_row_color", x, grp_y - listview->scrollpos + listview->grouptitle_height + listview->rowheight * grp->num_items, w, filler); +#else + gtk_paint_flat_box (gtk_widget_get_style (treeview), gtk_widget_get_window (listview->list), GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, "cell_even_ruled", x, grp_y - listview->scrollpos + listview->grouptitle_height + listview->rowheight * grp->num_items, w, filler); +#endif } else { GdkColor clr; - GdkGC *gc = gdk_gc_new (listview->list->window); - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_listview_even_row_color (&clr), &clr)); - gdk_draw_rectangle (listview->list->window, gc, TRUE, x, grp_y - listview->scrollpos + listview->grouptitle_height + listview->rowheight * grp->num_items, w, filler); - g_object_unref (gc); + gtkui_get_listview_even_row_color (&clr); + gdk_cairo_set_source_color (cr, &clr); + cairo_rectangle (cr, x, grp_y - listview->scrollpos + listview->grouptitle_height + listview->rowheight * grp->num_items, w, filler); + cairo_fill (cr); } - ddb_listview_list_render_row_foreground (listview, NULL, grp->head, 0, 0, grp->num_items * listview->rowheight, -listview->hscrollpos, grp_y - listview->scrollpos + listview->grouptitle_height + listview->rowheight * grp->num_items, listview->totalwidth, filler); + ddb_listview_list_render_row_foreground (listview, cr, NULL, grp->head, 0, 0, grp->num_items * listview->rowheight, -listview->hscrollpos, grp_y - listview->scrollpos + listview->grouptitle_height + listview->rowheight * grp->num_items, listview->totalwidth, filler); } grp_y += grpheight; @@ -698,14 +734,18 @@ ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) { // gdk_draw_rectangle (listview->list->window, listview->list->style->bg_gc[GTK_STATE_NORMAL], TRUE, x, grp_y - listview->scrollpos, w, hh); int theming = !gtkui_override_listview_colors (); if (theming) { - gtk_paint_flat_box (treeview->style, listview->list->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, "cell_even_ruled", x, grp_y - listview->scrollpos, w, hh); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_flat_box (gtk_widget_get_style (treeview), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, treeview, "even_row_color", x, grp_y - listview->scrollpos, w, hh); +#else + gtk_paint_flat_box (gtk_widget_get_style (treeview), listview->list->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, "cell_even_ruled", x, grp_y - listview->scrollpos, w, hh); +#endif } else { GdkColor clr; - GdkGC *gc = gdk_gc_new (listview->list->window); - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_listview_even_row_color (&clr), &clr)); - gdk_draw_rectangle (listview->list->window, gc, TRUE, x, grp_y - listview->scrollpos, w, hh); - g_object_unref (gc); + gtkui_get_listview_even_row_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_rectangle (cr, x, grp_y - listview->scrollpos, w, hh); + cairo_fill (cr); } } deadbeef->pl_unlock (); @@ -713,24 +753,43 @@ ddb_listview_list_render (DdbListview *listview, int x, int y, int w, int h) { } static void -ddb_listview_draw_dnd_marker (DdbListview *ps) { +ddb_listview_draw_dnd_marker (DdbListview *ps, cairo_t *cr) { if (ps->drag_motion_y < 0) { return; } int drag_motion_y = ps->drag_motion_y - ps->scrollpos; GtkWidget *widget = ps->list; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); GdkColor clr; gtkui_get_listview_cursor_color (&clr); - GdkGC *gc = gdk_gc_new (widget->window); - gdk_gc_set_rgb_fg_color (gc, &clr); - gdk_draw_rectangle (widget->window, gc, TRUE, 0, drag_motion_y-1, widget->allocation.width, 3); - gdk_draw_rectangle (widget->window, gc, TRUE, 0, drag_motion_y-3, 3, 7); - gdk_draw_rectangle (widget->window, gc, TRUE, widget->allocation.width-3, drag_motion_y-3, 3, 7); - g_object_unref (gc); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.0); + cairo_rectangle (cr, 0, drag_motion_y-1, a.width, 3); + cairo_fill (cr); + cairo_rectangle (cr, 0, drag_motion_y-3, 3, 7); + cairo_fill (cr); + cairo_rectangle (cr, a.width-3, drag_motion_y-3, 3, 7); + cairo_fill (cr); } +#if GTK_CHECK_VERSION(3,0,0) +gboolean +ddb_listview_list_draw (GtkWidget *widget, + cairo_t *cr, + gpointer user_data) +{ + DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); + widget = ps->list; + // FIXME: clip region + ddb_listview_list_render (ps, cr, 0, 0, gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget)); + if (ps->drag_motion_y >= 0/* && ps->drag_motion_y-ps->scrollpos-3 < event->area.y+event->area.height && ps->drag_motion_y-ps->scrollpos+3 >= event->area.y*/) { + ddb_listview_draw_dnd_marker (ps, cr); + } + return FALSE; +} +#else gboolean ddb_listview_list_expose_event (GtkWidget *widget, GdkEventExpose *event, @@ -738,14 +797,15 @@ ddb_listview_list_expose_event (GtkWidget *widget, { DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); widget = ps->list; - if (widget->window) { - ddb_listview_list_render (ps, event->area.x, event->area.y, event->area.width, event->area.height); - } + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); + ddb_listview_list_render (ps, cr, event->area.x, event->area.y, event->area.width, event->area.height); if (ps->drag_motion_y >= 0 && ps->drag_motion_y-ps->scrollpos-3 < event->area.y+event->area.height && ps->drag_motion_y-ps->scrollpos+3 >= event->area.y) { - ddb_listview_draw_dnd_marker (ps); + ddb_listview_draw_dnd_marker (ps, cr); } + cairo_destroy (cr); return FALSE; } +#endif gboolean ddb_listview_vscroll_event (GtkWidget *widget, @@ -783,40 +843,8 @@ ddb_listview_vscroll_value_changed (GtkRange *widget, return; } if (newscroll != ps->scrollpos) { - GtkWidget *widget = ps->list; - int di = newscroll - ps->scrollpos; - int d = abs (di); - int height = ps->list->allocation.height; - if (d < height) { - if (di > 0) { - // scroll down - // copy scrolled part of buffer - gdk_draw_drawable (ps->list->window, widget->style->black_gc, ps->list->window, 0, d, 0, 0, widget->allocation.width, widget->allocation.height-d); -// draw_drawable (ps->list->window, widget->style->black_gc, ps->list->window, 0, d, 0, 0, widget->allocation.width, widget->allocation.height-d); - // redraw other part - int start = height-d-1; - ps->scrollpos = newscroll; - gtk_widget_queue_draw_area (ps->list, 0, start, ps->list->allocation.width, widget->allocation.height-start); -// ddb_listview_list_render (ps, 0, start, ps->list->allocation.width, widget->allocation.height-start); - } - else { - // scroll up - // copy scrolled part of buffer - gdk_draw_drawable (ps->list->window, widget->style->black_gc, ps->list->window, 0, 0, 0, d, widget->allocation.width, widget->allocation.height-d); - //draw_drawable (ps->list->window, widget->style->black_gc, ps->list->window, 0, 0, 0, d, widget->allocation.width, widget->allocation.height-d); - // redraw other part - ps->scrollpos = newscroll; - gtk_widget_queue_draw_area (ps->list, 0, 0, ps->list->allocation.width, d+1); - //ddb_listview_list_render (ps, 0, 0, ps->list->allocation.width, d+1); - } - } - else { - // scrolled more than view height, redraw everything - ps->scrollpos = newscroll; - ddb_listview_list_render (ps, 0, 0, widget->allocation.width, widget->allocation.height); - } + ps->scrollpos = newscroll; gtk_widget_queue_draw (ps->list); -// draw_drawable (widget->window, widget->style->black_gc, ps->list->window, 0, 0, 0, 0, widget->allocation.width, widget->allocation.height); } } @@ -839,10 +867,11 @@ ddb_listview_list_drag_motion (GtkWidget *widget, { DdbListview *pl = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); ddb_listview_list_track_dragdrop (pl, y); - int cnt = g_list_length (drag_context->targets); + GList *targets = gdk_drag_context_list_targets (drag_context); + int cnt = g_list_length (targets); int i; for (i = 0; i < cnt; i++) { - GdkAtom a = GDK_POINTER_TO_ATOM (g_list_nth_data (drag_context->targets, i)); + GdkAtom a = GDK_POINTER_TO_ATOM (g_list_nth_data (targets, i)); gchar *nm = gdk_atom_name (a); if (!strcmp (nm, "text/uri-list")) { g_free (nm); @@ -912,7 +941,8 @@ ddb_listview_list_drag_data_get (GtkWidget *widget, ps->binding->unref (it); it = next; } - gtk_selection_data_set (selection_data, selection_data->target, sizeof (uint32_t) * 8, (gchar *)ptr, (nsel+1) * sizeof (uint32_t)); + GdkAtom target = gtk_selection_data_get_target (selection_data); + gtk_selection_data_set (selection_data, target, sizeof (uint32_t) * 8, (gchar *)ptr, (nsel+1) * sizeof (uint32_t)); free (ptr); } break; @@ -950,23 +980,24 @@ ddb_listview_list_drag_data_received (GtkWidget *widget, if (sel != -1) { it = ps->binding->get_for_idx (sel); } - gchar *ptr=(char*)data->data; + gchar *ptr=(char*)gtk_selection_data_get_data (data); + gint len = gtk_selection_data_get_length (data); if (target_type == 0) { // uris // this happens when dropped from file manager - char *mem = malloc (data->length+1); - memcpy (mem, ptr, data->length); - mem[data->length] = 0; + char *mem = malloc (len+1); + memcpy (mem, ptr, len); + mem[len] = 0; // we don't pass control structure, but there's only one drag-drop view currently - ps->binding->external_drag_n_drop (it, mem, data->length); + ps->binding->external_drag_n_drop (it, mem, len); if (it) { UNREF (it); } } - else if (target_type == 1 && data->format == 32) { // list of 32bit ints, DDB_URI_LIST target + else if (target_type == 1 && gtk_selection_data_get_format(data) == 32) { // list of 32bit ints, DDB_URI_LIST target uint32_t *d= (uint32_t *)ptr; int plt = *d; d++; - int length = (data->length/4)-1; + int length = (len/4)-1; DdbListviewIter drop_before = it; // find last selected while (drop_before && ps->binding->is_selected (drop_before)) { @@ -976,7 +1007,8 @@ ddb_listview_list_drag_data_received (GtkWidget *widget, } ddb_playlist_t *p = deadbeef->plt_get_for_idx (plt); if (p) { - ps->binding->drag_n_drop (drop_before, p, d, length, drag_context->action == GDK_ACTION_COPY ? 1 : 0); + // FIXME + ps->binding->drag_n_drop (drop_before, p, d, length, gdk_drag_context_get_selected_action (drag_context) == GDK_ACTION_COPY ? 1 : 0); deadbeef->plt_unref (p); } if (drop_before) { @@ -1109,7 +1141,9 @@ ddb_listview_list_setup_vscroll (DdbListview *ps) { GtkWidget *list = ps->list; GtkWidget *scroll = ps->scrollbar; int vheight = ps->fullheight; - if (ps->fullheight <= ps->list->allocation.height) { + GtkAllocation a; + gtk_widget_get_allocation (ps->list, &a); + if (ps->fullheight <= a.height) { gtk_widget_hide (scroll); ps->scrollpos = 0; gtk_widget_queue_draw (ps->list); @@ -1120,7 +1154,7 @@ ddb_listview_list_setup_vscroll (DdbListview *ps) { ps->scrollpos = vheight-1; } } - int h = list->allocation.height; + int h = a.height; GtkAdjustment *adj = (GtkAdjustment*)gtk_adjustment_new (gtk_range_get_value (GTK_RANGE (scroll)), 0, vheight, SCROLL_STEP, h/2, h); gtk_range_set_adjustment (GTK_RANGE (scroll), adj); gtk_range_set_value (GTK_RANGE (scroll), ps->scrollpos); @@ -1129,15 +1163,17 @@ ddb_listview_list_setup_vscroll (DdbListview *ps) { void ddb_listview_list_setup_hscroll (DdbListview *ps) { GtkWidget *list = ps->list; - int w = list->allocation.width; + GtkAllocation a; + gtk_widget_get_allocation (ps->list, &a); + int w = a.width; int size = 0; DdbListviewColumn *c; for (c = ps->columns; c; c = c->next) { size += c->width; } ps->totalwidth = size; - if (ps->totalwidth < ps->list->allocation.width) { - ps->totalwidth = ps->list->allocation.width; + if (ps->totalwidth < a.width) { + ps->totalwidth = a.width; } if (w >= size) { size = 0; @@ -1192,35 +1228,6 @@ ddb_listview_list_get_drawinfo (DdbListview *listview, int row, DdbListviewGroup return -1; } -#if 0 -void -ddb_listview_list_render_row (DdbListview *listview, int row, DdbListviewIter it) { - DdbListviewGroup *grp; - int even; - int cursor; - int x, y, w, h; - int group_y; - if (ddb_listview_list_get_drawinfo (listview, row, &grp, &even, &cursor, &group_y, &x, &y, &w, &h) == -1) { - return; - } - - if (y + h <= 0) { - return; - } - - if (y > GTK_WIDGET (listview)->allocation.height) { - return; - } - - draw_begin ((uintptr_t)listview->list->window); - ddb_listview_list_render_row_background (listview, it, even, cursor, x, y, w, h); - if (it) { - ddb_listview_list_render_row_foreground (listview, it, grp->head, even, cursor, group_y, x, y, w, h); - } - draw_end (); -} -#endif - void ddb_listview_draw_row (DdbListview *listview, int row, DdbListviewIter it) { DdbListviewGroup *grp; @@ -1236,51 +1243,63 @@ ddb_listview_draw_row (DdbListview *listview, int row, DdbListviewIter it) { return; } - if (y > GTK_WIDGET (listview)->allocation.height) { + GtkAllocation a; + gtk_widget_get_allocation (GTK_WIDGET (listview->list), &a); + + if (y > a.height) { return; } - gtk_widget_queue_draw_area (listview->list, 0, y, listview->list->allocation.width, h); + gtk_widget_queue_draw_area (listview->list, 0, y, a.width, h); } // coords passed are window-relative void -ddb_listview_list_render_row_background (DdbListview *ps, DdbListviewIter it, int even, int cursor, int x, int y, int w, int h) { +ddb_listview_list_render_row_background (DdbListview *ps, cairo_t *cr, DdbListviewIter it, int even, int cursor, int x, int y, int w, int h) { // draw background GtkWidget *treeview = theme_treeview; int theming = !gtkui_override_listview_colors (); if (theming) { - if (treeview->style->depth == -1) { +#if !GTK_CHECK_VERSION(3,0,0) + if (gtk_widget_get_style (treeview)->depth == -1) { return; // drawing was called too early } GTK_WIDGET_SET_FLAGS (GTK_WIDGET (treeview), GTK_HAS_FOCUS); - //G_OBJECT_FLAGS (treeview) |= GTK_HAS_FOCUS; +#endif } int sel = it && ps->binding->is_selected (it); if (theming || !sel) { if (theming) { // draw background for selection -- workaround for New Wave theme (translucency) - gtk_paint_flat_box (treeview->style, ps->list->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, even ? "cell_even_ruled" : "cell_odd_ruled", x, y, w, h); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_flat_box (gtk_widget_get_style (treeview), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, treeview, even ? "even_row_color" : "odd_row_color", x, y, w, h); +#else + gtk_paint_flat_box (gtk_widget_get_style (treeview), ps->list->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, even ? "cell_even_ruled" : "cell_odd_ruled", x, y, w, h); +#endif } else { GdkColor clr; - GdkGC *gc = gdk_gc_new (ps->list->window); - gdk_gc_set_rgb_fg_color (gc, even ? (gtkui_get_listview_even_row_color (&clr), &clr) : (gtkui_get_listview_odd_row_color (&clr), &clr)); - gdk_draw_rectangle (ps->list->window, gc, TRUE, x, y, w, h); - g_object_unref (gc); + even ? gtkui_get_listview_even_row_color (&clr) : gtkui_get_listview_odd_row_color (&clr); + gdk_cairo_set_source_color (cr, &clr); + cairo_rectangle (cr, x, y, w, h); + cairo_fill (cr); } } if (sel) { if (theming) { - gtk_paint_flat_box (treeview->style, ps->list->window, GTK_STATE_SELECTED, GTK_SHADOW_NONE, NULL, treeview, even ? "cell_even_ruled" : "cell_odd_ruled", x, y, w, h); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_flat_box (gtk_widget_get_style (treeview), cr, GTK_STATE_SELECTED, GTK_SHADOW_NONE, treeview, even ? "even_row_color" : "odd_row_color", x, y, w, h); +#else + gtk_paint_flat_box (gtk_widget_get_style (treeview), ps->list->window, GTK_STATE_SELECTED, GTK_SHADOW_NONE, NULL, treeview, even ? "cell_even_ruled" : "cell_odd_ruled", x, y, w, h); +#endif } else { GdkColor clr; - GdkGC *gc = gdk_gc_new (ps->list->window); - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_listview_selection_color (&clr), &clr)); - gdk_draw_rectangle (ps->list->window, gc, TRUE, x, y, w, h); - g_object_unref (gc); + gtkui_get_listview_selection_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_rectangle (cr, x, y, w, h); + cairo_fill (cr); } } if (cursor) { @@ -1288,24 +1307,27 @@ ddb_listview_list_render_row_background (DdbListview *ps, DdbListviewIter it, in // but we want it anyway //treeview->style->fg_gc[GTK_STATE_NORMAL] GdkColor clr; - GdkGC *gc = gdk_gc_new (ps->list->window); - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_listview_cursor_color (&clr), &clr)); - gdk_draw_rectangle (ps->list->window, gc, FALSE, x, y, w-1, h-1); - g_object_unref (gc); + gtkui_get_listview_cursor_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_rectangle (cr, x+1, y+1, w-1, h-1); + cairo_stroke (cr); } } void -ddb_listview_list_render_row_foreground (DdbListview *ps, DdbListviewIter it, DdbListviewIter group_it, int even, int cursor, int group_y, int x, int y, int w, int h) { +ddb_listview_list_render_row_foreground (DdbListview *ps, cairo_t *cr, DdbListviewIter it, DdbListviewIter group_it, int even, int cursor, int group_y, int x, int y, int w, int h) { int width, height; - draw_get_canvas_size ((uintptr_t)ps->list->window, &width, &height); + GtkAllocation a; + gtk_widget_get_allocation (ps->list, &a); + width = a.width; + height = a.height; if (it && ps->binding->is_selected (it)) { - GdkColor *clr = &theme_treeview->style->fg[GTK_STATE_SELECTED]; + GdkColor *clr = >k_widget_get_style (theme_treeview)->fg[GTK_STATE_SELECTED]; float rgb[3] = { clr->red/65535.f, clr->green/65535.f, clr->blue/65535.f }; draw_set_fg_color (rgb); } else { - GdkColor *clr = &theme_treeview->style->fg[GTK_STATE_NORMAL]; + GdkColor *clr = >k_widget_get_style (theme_treeview)->fg[GTK_STATE_NORMAL]; float rgb[3] = { clr->red/65535.f, clr->green/65535.f, clr->blue/65535.f }; draw_set_fg_color (rgb); } @@ -1313,15 +1335,15 @@ ddb_listview_list_render_row_foreground (DdbListview *ps, DdbListviewIter it, Dd int cidx = 0; for (c = ps->columns; c; c = c->next, cidx++) { int cw = c->width; - ps->binding->draw_column_data (ps, ps->list->window, it, ps->grouptitle_height > 0 ? group_it : NULL, cidx, group_y, x, y, cw, h); + ps->binding->draw_column_data (ps, cr, it, ps->grouptitle_height > 0 ? group_it : NULL, cidx, group_y, x, y, cw, h); x += cw; } } void -ddb_listview_header_expose (DdbListview *ps, int x, int y, int w, int h) { - ddb_listview_header_render (ps); +ddb_listview_header_expose (DdbListview *ps, cairo_t *cr, int x, int y, int w, int h) { + ddb_listview_header_render (ps, cr); } void @@ -1819,6 +1841,9 @@ ddb_listview_list_mousemove (DdbListview *ps, GdkEventMotion *ev, int ex, int ey } } + GtkAllocation a; + gtk_widget_get_allocation (ps->list, &a); + if (ey < 10) { ps->scroll_mode = 0; ps->scroll_pointer_y = ey; @@ -1830,7 +1855,7 @@ ddb_listview_list_mousemove (DdbListview *ps, GdkEventMotion *ev, int ex, int ey g_idle_add (ddb_listview_list_scroll_cb, ps); } } - else if (ey > ps->list->allocation.height-10) { + else if (ey > a.height-10) { ps->scroll_mode = 0; ps->scroll_pointer_y = ey; // start scrolling down @@ -1885,7 +1910,7 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) { cursor++; } else { - gtk_range_set_value (GTK_RANGE (range), adj->upper); + gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_upper (adj)); } } else if (keyval == GDK_Up) { @@ -1893,7 +1918,7 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) { cursor--; } else { - gtk_range_set_value (GTK_RANGE (range), adj->lower); + gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_lower (adj)); if (cursor < 0 && ps->binding->count () > 0) { cursor = 0; } @@ -1907,14 +1932,14 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) { } } else { - gtk_range_set_value (GTK_RANGE (range), adj->upper); + gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_upper (adj)); } } else if (keyval == GDK_Page_Up) { if (cursor > 0) { cursor -= 10; if (cursor < 0) { - gtk_range_set_value (GTK_RANGE (range), adj->lower); + gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_upper (adj)); cursor = 0; } } @@ -1922,16 +1947,16 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) { if (cursor < 0 && ps->binding->count () > 0) { cursor = 0; } - gtk_range_set_value (GTK_RANGE (range), adj->lower); + gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_lower (adj)); } } else if (keyval == GDK_End) { cursor = ps->binding->count () - 1; - gtk_range_set_value (GTK_RANGE (range), adj->upper); + gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_upper (adj)); } else if (keyval == GDK_Home) { cursor = 0; - gtk_range_set_value (GTK_RANGE (range), adj->lower); + gtk_range_set_value (GTK_RANGE (range), gtk_adjustment_get_lower (adj)); } else if (keyval == GDK_Delete) { ps->binding->delete_selected (); @@ -1942,14 +1967,16 @@ ddb_listview_handle_keypress (DdbListview *ps, int keyval, int state) { } if (state & GDK_SHIFT_MASK) { + GtkAllocation a; + gtk_widget_get_allocation (ps->list, &a); if (cursor != prev) { int newscroll = ps->scrollpos; int cursor_scroll = ddb_listview_get_row_pos (ps, cursor); if (cursor_scroll < ps->scrollpos) { newscroll = cursor_scroll; } - else if (cursor_scroll >= ps->scrollpos + ps->list->allocation.height) { - newscroll = cursor_scroll - ps->list->allocation.height + 1; + else if (cursor_scroll >= ps->scrollpos + a.height) { + newscroll = cursor_scroll - a.height + 1; if (newscroll < 0) { newscroll = 0; } @@ -2035,9 +2062,11 @@ ddb_listview_dragdrop_get_row_from_coord (DdbListview *listview, int y) { void ddb_listview_list_track_dragdrop (DdbListview *ps, int y) { GtkWidget *widget = ps->list; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); if (ps->drag_motion_y != -1) { // erase previous track - gtk_widget_queue_draw_area (ps->list, 0, ps->drag_motion_y-ps->scrollpos-3, widget->allocation.width, 7); + gtk_widget_queue_draw_area (ps->list, 0, ps->drag_motion_y-ps->scrollpos-3, a.width, 7); } if (y == -1) { @@ -2060,7 +2089,10 @@ ddb_listview_list_track_dragdrop (DdbListview *ps, int y) { ps->drag_motion_y = ddb_listview_get_row_pos (ps, sel); } - ddb_listview_draw_dnd_marker (ps); +#if !GTK_CHECK_VERSION(3,0,0) + // FIXME +// ddb_listview_draw_dnd_marker (ps, cr); +#endif if (y < 10) { ps->scroll_pointer_y = y; @@ -2073,7 +2105,7 @@ ddb_listview_list_track_dragdrop (DdbListview *ps, int y) { g_idle_add (ddb_listview_list_scroll_cb, ps); } } - else if (y > ps->list->allocation.height-10) { + else if (y > a.height-10) { ps->scroll_mode = 1; ps->scroll_pointer_y = y; // start scrolling up @@ -2104,26 +2136,42 @@ ddb_listview_list_drag_end (GtkWidget *widget, // #define HEADERS_GTKTHEME void -ddb_listview_header_render (DdbListview *ps) { +ddb_listview_header_render (DdbListview *ps, cairo_t *cr) { + cairo_set_line_width (cr, 1); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); GtkWidget *widget = ps->header; int x = -ps->hscrollpos; int w = 100; - int h = widget->allocation.height; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + int h = a.height; const char *detail = "button"; // fill background and draw bottom line #if !HEADERS_GTKTHEME - GdkGC *gc = gdk_gc_new (ps->header->window); GdkColor clr; - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_tabstrip_base_color (&clr), &clr)); - gdk_draw_rectangle (ps->header->window, gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height); - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_tabstrip_dark_color (&clr), &clr)); - gdk_draw_line (ps->header->window, gc, 0, widget->allocation.height-1, widget->allocation.width, widget->allocation.height-1); + gtkui_get_tabstrip_base_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_rectangle (cr, 0, 0, a.width, a.height); + cairo_fill (cr); + gtkui_get_tabstrip_dark_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_move_to (cr, 0, a.height); + cairo_line_to (cr, a.width, a.height); + cairo_stroke (cr); #else - gtk_paint_box (theme_button->style, ps->header->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, widget, detail, -10, -10, widget->allocation.width+20, widget->allocation.height+20); - gdk_draw_line (ps->header->window, widget->style->mid_gc[GTK_STATE_NORMAL], 0, widget->allocation.height-1, widget->allocation.width, widget->allocation.height-1); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_box (gtk_widget_get_style (theme_button), cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, widget, detail, -10, -10, a.width+20, a.height+20); +#else + gtk_paint_box (theme_button->style, ps->header->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, widget, detail, -10, -10, a.width+20, a.height+20); +#endif + clr = gtk_widget_get_style (widget)->mid[GTK_STATE_NORMAL] + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_move_to (cr, 0, a.height-1); + cairo_line_to (cr, a.width, a.height-1); + cairo_stroke (cr); #endif - draw_begin ((uintptr_t)ps->header->window); + draw_begin (cr); x = -ps->hscrollpos; DdbListviewColumn *c; int need_draw_moving = 0; @@ -2142,21 +2190,33 @@ ddb_listview_header_render (DdbListview *ps) { } #endif if (ps->header_dragging < 0 || idx != ps->header_dragging) { - if (xx >= widget->allocation.width) { + if (xx >= a.width) { continue; } int arrow_sz = 10; int sort = c->sort_order; if (w > 0) { #if !HEADERS_GTKTHEME - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_tabstrip_dark_color (&clr), &clr)); - gdk_draw_line (ps->header->window, gc, xx+w - 2, 2, xx+w - 2, h-4); - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_tabstrip_light_color (&clr), &clr)); - gdk_draw_line (ps->header->window, gc, xx+w - 1, 2, xx+w - 1, h-4); + gtkui_get_tabstrip_dark_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_move_to (cr, xx+w - 2, 2); + cairo_line_to (cr, xx+w - 2, h-4); + cairo_stroke (cr); + + gtkui_get_tabstrip_light_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + + cairo_move_to (cr, xx+w - 1, 2); + cairo_line_to (cr, xx+w - 1, h-4); + cairo_stroke (cr); +#else +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_vline (gtk_widget_get_style (widget), cr, GTK_STATE_NORMAL, widget, NULL, 2, h-4, xx+w - 2); #else gtk_paint_vline (widget->style, ps->header->window, GTK_STATE_NORMAL, NULL, widget, NULL, 2, h-4, xx+w - 2); #endif - GdkColor *gdkfg = &theme_button->style->fg[0]; +#endif + GdkColor *gdkfg = >k_widget_get_style (theme_button)->fg[0]; float fg[3] = {(float)gdkfg->red/0xffff, (float)gdkfg->green/0xffff, (float)gdkfg->blue/0xffff}; draw_set_fg_color (fg); int ww = w-10; @@ -2170,7 +2230,11 @@ ddb_listview_header_render (DdbListview *ps) { } if (sort) { int dir = sort == 1 ? GTK_ARROW_DOWN : GTK_ARROW_UP; - gtk_paint_arrow (widget->style, ps->header->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, NULL, dir, TRUE, xx + w-arrow_sz-5, widget->allocation.height/2-arrow_sz/2, arrow_sz, arrow_sz); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_arrow (gtk_widget_get_style (widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, widget, NULL, dir, TRUE, xx + w-arrow_sz-5, a.height/2-arrow_sz/2, arrow_sz, arrow_sz); +#else + gtk_paint_arrow (widget->style, ps->header->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, NULL, dir, TRUE, xx + w-arrow_sz-5, a.height/2-arrow_sz/2, arrow_sz, arrow_sz); +#endif } } else { @@ -2195,16 +2259,24 @@ ddb_listview_header_render (DdbListview *ps) { } #endif // draw empty slot - if (x < widget->allocation.width) { + if (x < a.width) { +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_box (gtk_widget_get_style (theme_button), cr, GTK_STATE_ACTIVE, GTK_SHADOW_ETCHED_IN, widget, "button", x, 0, w, h); +#else gtk_paint_box (theme_button->style, ps->header->window, GTK_STATE_ACTIVE, GTK_SHADOW_ETCHED_IN, NULL, widget, "button", x, 0, w, h); +#endif } x = ps->col_movepos - ps->hscrollpos; - if (x >= widget->allocation.width) { + if (x >= a.width) { break; } if (w > 0) { +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_box (gtk_widget_get_style (theme_button), cr, GTK_STATE_SELECTED, GTK_SHADOW_OUT, widget, "button", x, 0, w, h); +#else gtk_paint_box (theme_button->style, ps->header->window, GTK_STATE_SELECTED, GTK_SHADOW_OUT, NULL, widget, "button", x, 0, w, h); - GdkColor *gdkfg = &theme_button->style->fg[GTK_STATE_SELECTED]; +#endif + GdkColor *gdkfg = >k_widget_get_style (theme_button)->fg[GTK_STATE_SELECTED]; float fg[3] = {(float)gdkfg->red/0xffff, (float)gdkfg->green/0xffff, (float)gdkfg->blue/0xffff}; draw_set_fg_color (fg); draw_text (x + 5, 3, c->width-10, 0, c->title); @@ -2215,21 +2287,36 @@ ddb_listview_header_render (DdbListview *ps) { } } draw_end (); +} -#if !HEADERS_GTKTHEME - g_object_unref (gc); -#endif +gboolean +ddb_listview_header_draw (GtkWidget *widget, + cairo_t *cr, + gpointer user_data) { + DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); + // FIXME: clip region + cairo_set_line_width (cr, 1); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + ddb_listview_header_expose (ps, cr, 0, 0, a.width, a.height); + return FALSE; } + +#if !GTK_CHECK_VERSION(3,0,0) gboolean ddb_listview_header_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); - ddb_listview_header_expose (ps, event->area.x, event->area.y, event->area.width, event->area.height); + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); + ddb_listview_header_expose (ps, cr, event->area.x, event->area.y, event->area.width, event->area.height); + cairo_destroy (cr); return FALSE; } +#endif gboolean @@ -2238,11 +2325,26 @@ ddb_listview_header_configure_event (GtkWidget *widget, gpointer user_data) { DdbListview *ps = DDB_LISTVIEW (g_object_get_data (G_OBJECT (widget), "owner")); - draw_init_font (widget->style); + draw_init_font (gtk_widget_get_style (widget)); int height = draw_get_listview_rowheight (); - if (height != widget->allocation.height) { + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + if (height != a.height) { gtk_widget_set_size_request (widget, -1, height); } + + if (ps->header_width == 0) { + ps->header_width = a.width; + } + else if (ps->header_width != a.width && deadbeef->conf_get_int ("gtkui.autoresize_columns", 0)) { + float ratio = (float)a.width / ps->header_width; + ps->header_width = a.width; + struct _DdbListviewColumn *c; + for (c = ps->columns; c; c = c->next) { + c->width *= ratio; + } + } + return FALSE; } @@ -2291,7 +2393,7 @@ ddb_listview_header_motion_notify_event (GtkWidget *widget, } } if (!ps->header_prepare && ps->header_dragging >= 0) { - gdk_window_set_cursor (widget->window, ps->cursor_drag); + gdk_window_set_cursor (gtk_widget_get_window (widget), ps->cursor_drag); DdbListviewColumn *c; int i; for (i = 0, c = ps->columns; i < ps->header_dragging && c; c = c->next, i++); @@ -2329,7 +2431,7 @@ ddb_listview_header_motion_notify_event (GtkWidget *widget, else if (ps->header_sizing >= 0) { ps->last_header_motion_ev = event->time; ps->prev_header_x = ev_x; - gdk_window_set_cursor (widget->window, ps->cursor_sz); + gdk_window_set_cursor (gtk_widget_get_window (widget), ps->cursor_sz); // get column start pos int x = -ps->hscrollpos; int i = 0; @@ -2358,15 +2460,15 @@ ddb_listview_header_motion_notify_event (GtkWidget *widget, int w = c->width; if (w > 0) { // ignore collapsed columns (hack for search window) if (ev_x >= x + w - 2 && ev_x <= x + w) { - gdk_window_set_cursor (widget->window, ps->cursor_sz); + gdk_window_set_cursor (gtk_widget_get_window (widget), ps->cursor_sz); break; } else { - gdk_window_set_cursor (widget->window, NULL); + gdk_window_set_cursor (gtk_widget_get_window (widget), NULL); } } else { - gdk_window_set_cursor (widget->window, NULL); + gdk_window_set_cursor (gtk_widget_get_window (widget), NULL); } x += w; } @@ -2479,11 +2581,11 @@ ddb_listview_header_button_release_event (GtkWidget *widget, for (c = ps->columns; c; c = c->next) { int w = c->width; if (event->x >= x + w - 2 && event->x <= x + w) { - gdk_window_set_cursor (widget->window, ps->cursor_sz); + gdk_window_set_cursor (gtk_widget_get_window (widget), ps->cursor_sz); break; } else { - gdk_window_set_cursor (widget->window, NULL); + gdk_window_set_cursor (gtk_widget_get_window (widget), NULL); } x += w; } @@ -2532,11 +2634,13 @@ ddb_listview_set_cursor_cb (gpointer data) { int cursor_scroll = ddb_listview_get_row_pos (sc->pl, sc->cursor); int newscroll = sc->pl->scrollpos; + GtkAllocation a; + gtk_widget_get_allocation (sc->pl->list, &a); if (cursor_scroll < sc->pl->scrollpos) { newscroll = cursor_scroll; } - else if (cursor_scroll + sc->pl->rowheight >= sc->pl->scrollpos + sc->pl->list->allocation.height) { - newscroll = cursor_scroll + sc->pl->rowheight - sc->pl->list->allocation.height + 1; + else if (cursor_scroll + sc->pl->rowheight >= sc->pl->scrollpos + a.height) { + newscroll = cursor_scroll + sc->pl->rowheight - a.height + 1; if (newscroll < 0) { newscroll = 0; } @@ -2673,8 +2777,10 @@ ddb_listview_get_iter_from_coord (DdbListview *listview, int x, int y) { void ddb_listview_scroll_to (DdbListview *listview, int pos) { pos = ddb_listview_get_row_pos (listview, pos); - if (pos < listview->scrollpos || pos >= listview->scrollpos + listview->list->allocation.height) { - gtk_range_set_value (GTK_RANGE (listview->scrollbar), pos - listview->list->allocation.height/2); + GtkAllocation a; + gtk_widget_get_allocation (listview->list, &a); + if (pos < listview->scrollpos || pos >= listview->scrollpos + a.height) { + gtk_range_set_value (GTK_RANGE (listview->scrollbar), pos - a.height/2); } } int diff --git a/plugins/gtkui/ddblistview.h b/plugins/gtkui/ddblistview.h index b22469ed..a43dbcc3 100644 --- a/plugins/gtkui/ddblistview.h +++ b/plugins/gtkui/ddblistview.h @@ -73,8 +73,8 @@ typedef struct { void (*external_drag_n_drop) (DdbListviewIter before, char *mem, int length); // callbacks - void (*draw_group_title) (DdbListview *listview, GdkDrawable *drawable, DdbListviewIter iter, int x, int y, int width, int height); - void (*draw_column_data) (DdbListview *listview, GdkDrawable *drawable, DdbListviewIter iter, DdbListviewIter group_iter, int column, int group_y, int x, int y, int width, int height); + void (*draw_group_title) (DdbListview *listview, cairo_t *drawable, DdbListviewIter iter, int x, int y, int width, int height); + void (*draw_column_data) (DdbListview *listview, cairo_t *drawable, DdbListviewIter iter, DdbListviewIter group_iter, int column, int group_y, int x, int y, int width, int height); void (*list_context_menu) (DdbListview *listview, DdbListviewIter iter, int idx); void (*header_context_menu) (DdbListview *listview, int col); void (*handle_doubleclick) (DdbListview *listview, DdbListviewIter iter, int idx); @@ -138,6 +138,7 @@ struct _DdbListview { float last_header_motion_ev; //is it subject to remove? int prev_header_x; int header_prepare; + int header_width; // previous width before resize struct _DdbListviewColumn *columns; struct _DdbListviewGroup *groups; diff --git a/plugins/gtkui/ddbseekbar.c b/plugins/gtkui/ddbseekbar.c index d70ebc05..f1b3a836 100644 --- a/plugins/gtkui/ddbseekbar.c +++ b/plugins/gtkui/ddbseekbar.c @@ -1,6 +1,3 @@ -/* ddbseekbar.c generated by valac, the Vala compiler - * generated from ddbseekbar.vala, do not modify */ - /* DeaDBeeF - ultimate music player for GNU/Linux systems with X11 Copyright (C) 2009-2010 Alexey Yakovenko <waker@users.sourceforge.net> @@ -24,8 +21,8 @@ #include <glib-object.h> #include <gtk/gtk.h> #include <gdk/gdk.h> -#include <gtkui.h> #include <drawing.h> +#include <gtkui.h> #define DDB_TYPE_SEEKBAR (ddb_seekbar_get_type ()) @@ -55,10 +52,14 @@ GType ddb_seekbar_get_type (void); enum { DDB_SEEKBAR_DUMMY_PROPERTY }; -static void ddb_seekbar_real_realize (GtkWidget* base); -static void ddb_seekbar_real_unrealize (GtkWidget* base); -static void ddb_seekbar_real_size_request (GtkWidget* base, GtkRequisition* requisition); +#if GTK_CHECK_VERSION(3,0,0) +static void ddb_seekbar_get_preferred_width (GtkWidget* base, gint *minimal_width, gint *natural_width); +static void ddb_seekbar_get_preferred_height (GtkWidget* base, gint *minimal_height, gint *natural_height); +#else static gboolean ddb_seekbar_real_expose_event (GtkWidget* base, GdkEventExpose* event); +#endif +static void ddb_seekbar_real_size_request (GtkWidget* base, GtkRequisition* requisition); +static gboolean ddb_seekbar_real_draw (GtkWidget* base, cairo_t *cr); static gboolean ddb_seekbar_real_button_press_event (GtkWidget* base, GdkEventButton* event); static gboolean ddb_seekbar_real_button_release_event (GtkWidget* base, GdkEventButton* event); static gboolean ddb_seekbar_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event); @@ -68,43 +69,57 @@ DdbSeekbar* ddb_seekbar_construct (GType object_type); static GObject * ddb_seekbar_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +#if GTK_CHECK_VERSION(3,0,0) +static void ddb_seekbar_get_preferred_width (GtkWidget* widget, gint *minimal_width, gint *natural_width) { + GtkRequisition requisition; -static void ddb_seekbar_real_realize (GtkWidget* base) { - DdbSeekbar * self; - self = (DdbSeekbar*) base; - gtk_widget_set_has_window ((GtkWidget*) self, FALSE); - GTK_WIDGET_CLASS (ddb_seekbar_parent_class)->realize (GTK_WIDGET (self)); + ddb_seekbar_real_size_request (widget, &requisition); + + *minimal_width = *natural_width = requisition.width; } +static void ddb_seekbar_get_preferred_height (GtkWidget* widget, gint *minimal_height, gint *natural_height) { + GtkRequisition requisition; -static void ddb_seekbar_real_unrealize (GtkWidget* base) { - DdbSeekbar * self; - self = (DdbSeekbar*) base; - GTK_WIDGET_CLASS (ddb_seekbar_parent_class)->unrealize (GTK_WIDGET (self)); -} + ddb_seekbar_real_size_request (widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} +#endif static void ddb_seekbar_real_size_request (GtkWidget* base, GtkRequisition* requisition) { DdbSeekbar * self; + GtkRequisition _vala_requisition = {0}; self = (DdbSeekbar*) base; + if (requisition) { + *requisition = _vala_requisition; + } } +static gboolean ddb_seekbar_real_draw (GtkWidget* base, cairo_t *cr) { + seekbar_draw (base, cr); + return FALSE; +} +#if !GTK_CHECK_VERSION(3,0,0) static gboolean ddb_seekbar_real_expose_event (GtkWidget* base, GdkEventExpose* event) { - DdbSeekbar * self; - gboolean result = FALSE; - self = (DdbSeekbar*) base; - seekbar_draw (GTK_WIDGET (self)); - result = TRUE; - return result; + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (base)); + ddb_seekbar_real_draw (base, cr); + cairo_destroy (cr); + return FALSE; } - +#endif static gboolean ddb_seekbar_real_button_press_event (GtkWidget* base, GdkEventButton* event) { DdbSeekbar * self; gboolean result = FALSE; + GdkEventButton _tmp0_; + gboolean _tmp1_ = FALSE; self = (DdbSeekbar*) base; - result = on_seekbar_button_press_event ((GtkWidget*) self, event); + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = on_seekbar_button_press_event ((GtkWidget*) self, &_tmp0_); + result = _tmp1_; return result; } @@ -112,8 +127,13 @@ static gboolean ddb_seekbar_real_button_press_event (GtkWidget* base, GdkEventBu static gboolean ddb_seekbar_real_button_release_event (GtkWidget* base, GdkEventButton* event) { DdbSeekbar * self; gboolean result = FALSE; + GdkEventButton _tmp0_; + gboolean _tmp1_ = FALSE; self = (DdbSeekbar*) base; - result = on_seekbar_button_release_event ((GtkWidget*) self, event); + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = on_seekbar_button_release_event ((GtkWidget*) self, &_tmp0_); + result = _tmp1_; return result; } @@ -121,8 +141,13 @@ static gboolean ddb_seekbar_real_button_release_event (GtkWidget* base, GdkEvent static gboolean ddb_seekbar_real_motion_notify_event (GtkWidget* base, GdkEventMotion* event) { DdbSeekbar * self; gboolean result = FALSE; + GdkEventMotion _tmp0_; + gboolean _tmp1_ = FALSE; self = (DdbSeekbar*) base; - result = on_seekbar_motion_notify_event ((GtkWidget*) self, event); + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = on_seekbar_motion_notify_event ((GtkWidget*) self, &_tmp0_); + result = _tmp1_; return result; } @@ -131,6 +156,7 @@ static gboolean ddb_seekbar_real_configure_event (GtkWidget* base, GdkEventConfi DdbSeekbar * self; gboolean result = FALSE; self = (DdbSeekbar*) base; + g_return_val_if_fail (event != NULL, FALSE); gtkui_init_theme_colors (); result = FALSE; return result; @@ -156,18 +182,20 @@ static GObject * ddb_seekbar_constructor (GType type, guint n_construct_properti parent_class = G_OBJECT_CLASS (ddb_seekbar_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = DDB_SEEKBAR (obj); - { - } return obj; } static void ddb_seekbar_class_init (DdbSeekbarClass * klass) { ddb_seekbar_parent_class = g_type_class_peek_parent (klass); - GTK_WIDGET_CLASS (klass)->realize = ddb_seekbar_real_realize; - GTK_WIDGET_CLASS (klass)->unrealize = ddb_seekbar_real_unrealize; +#if GTK_CHECK_VERSION(3,0,0) + GTK_WIDGET_CLASS (klass)->get_preferred_width = ddb_seekbar_get_preferred_width; + GTK_WIDGET_CLASS (klass)->get_preferred_height = ddb_seekbar_get_preferred_height; + GTK_WIDGET_CLASS (klass)->draw = ddb_seekbar_real_draw; +#else GTK_WIDGET_CLASS (klass)->size_request = ddb_seekbar_real_size_request; GTK_WIDGET_CLASS (klass)->expose_event = ddb_seekbar_real_expose_event; +#endif GTK_WIDGET_CLASS (klass)->button_press_event = ddb_seekbar_real_button_press_event; GTK_WIDGET_CLASS (klass)->button_release_event = ddb_seekbar_real_button_release_event; GTK_WIDGET_CLASS (klass)->motion_notify_event = ddb_seekbar_real_motion_notify_event; @@ -177,6 +205,7 @@ static void ddb_seekbar_class_init (DdbSeekbarClass * klass) { static void ddb_seekbar_instance_init (DdbSeekbar * self) { + gtk_widget_set_has_window ((GtkWidget*) self, FALSE); } @@ -193,4 +222,3 @@ GType ddb_seekbar_get_type (void) { - diff --git a/plugins/gtkui/ddbseekbar.h b/plugins/gtkui/ddbseekbar.h index 28c69cd3..ee455087 100644 --- a/plugins/gtkui/ddbseekbar.h +++ b/plugins/gtkui/ddbseekbar.h @@ -1,6 +1,3 @@ -/* ddbseekbar.h generated by valac, the Vala compiler, do not modify */ - - #ifndef __DDBSEEKBAR_H__ #define __DDBSEEKBAR_H__ diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c index e1882d1e..8b260cf8 100644 --- a/plugins/gtkui/ddbtabstrip.c +++ b/plugins/gtkui/ddbtabstrip.c @@ -64,12 +64,15 @@ ddb_tabstrip_send_configure (DdbTabStrip *darea) widget = GTK_WIDGET (darea); - event->configure.window = g_object_ref (widget->window); + event->configure.window = g_object_ref (gtk_widget_get_window(widget)); event->configure.send_event = TRUE; - event->configure.x = widget->allocation.x; - event->configure.y = widget->allocation.y; - event->configure.width = widget->allocation.width; - event->configure.height = widget->allocation.height; + + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + event->configure.x = a.x; + event->configure.y = a.y; + event->configure.width = a.width; + event->configure.height = a.height; gtk_widget_event (widget, event); gdk_event_free (event); @@ -81,33 +84,39 @@ ddb_tabstrip_realize (GtkWidget *widget) { GdkWindowAttr attributes; gint attributes_mask; - if (GTK_WIDGET_FLAGS (widget)>K_NO_WINDOW/*GTK_WIDGET_NO_WINDOW (widget)*/) + if (!gtk_widget_get_has_window (widget)) { GTK_WIDGET_CLASS (ddb_tabstrip_parent_class)->realize (widget); } else { - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + attributes.x = a.x; + attributes.y = a.y; + attributes.width = a.width; + attributes.height = a.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); +#if !GTK_CHECK_VERSION(3,0,0) attributes.colormap = gtk_widget_get_colormap (widget); +#endif attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; +#if !GTK_CHECK_VERSION(3,0,0) + attributes_mask |= GDK_WA_COLORMAP; +#endif - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, darea); + gtk_widget_set_window(widget, gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask)); + gdk_window_set_user_data (gtk_widget_get_window(widget), darea); - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); + gtk_widget_set_style (widget, gtk_style_attach (gtk_widget_get_style (widget), gtk_widget_get_window(widget))); + gtk_style_set_background (gtk_widget_get_style (widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL); } ddb_tabstrip_send_configure (DDB_TABSTRIP (widget)); @@ -128,12 +137,12 @@ ddb_tabstrip_size_allocate (GtkWidget *widget, g_return_if_fail (DDB_IS_TABSTRIP (widget)); g_return_if_fail (allocation != NULL); - widget->allocation = *allocation; + gtk_widget_set_allocation (widget, allocation); - if (GTK_WIDGET_FLAGS(widget)>K_REALIZED/*GTK_WIDGET_REALIZED (widget)*/) + if (gtk_widget_get_realized (widget)) { - if (!(GTK_WIDGET_FLAGS (widget)>K_NO_WINDOW)/*GTK_WIDGET_NO_WINDOW (widget)*/) - gdk_window_move_resize (widget->window, + if (gtk_widget_get_has_window (widget)) + gdk_window_move_resize (gtk_widget_get_window(widget), allocation->x, allocation->y, allocation->width, allocation->height); @@ -159,6 +168,11 @@ on_tabstrip_configure_event (GtkWidget *widget, GdkEventConfigure *event); gboolean +on_tabstrip_draw (GtkWidget *widget, + cairo_t *cr); + + +gboolean on_tabstrip_expose_event (GtkWidget *widget, GdkEventExpose *event); @@ -202,7 +216,7 @@ static int get_tab_under_cursor (DdbTabStrip *ts, int x); static void -ddb_tabstrip_destroy(GtkObject *object) +ddb_tabstrip_destroy(GObject *object) { DdbTabStrip *tabstrip; @@ -216,10 +230,14 @@ static void ddb_tabstrip_class_init(DdbTabStripClass *class) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - GtkObjectClass *object_class = (GtkObjectClass *) class; +#if !GTK_CHECK_VERSION(3,0,0) + widget_class->expose_event = on_tabstrip_expose_event; +#else + widget_class->draw = on_tabstrip_draw; +#endif widget_class->realize = ddb_tabstrip_realize; widget_class->size_allocate = ddb_tabstrip_size_allocate; - widget_class->expose_event = on_tabstrip_expose_event; + widget_class->button_press_event = on_tabstrip_button_press_event; widget_class->button_release_event = on_tabstrip_button_release_event; widget_class->configure_event = on_tabstrip_configure_event; widget_class->motion_notify_event = on_tabstrip_motion_notify_event; @@ -229,8 +247,6 @@ ddb_tabstrip_class_init(DdbTabStripClass *class) widget_class->drag_end = on_tabstrip_drag_end; widget_class->drag_data_received = on_tabstrip_drag_data_received; widget_class->drag_leave = on_tabstrip_drag_leave; - - object_class->destroy = ddb_tabstrip_destroy; } gboolean @@ -252,24 +268,26 @@ on_tabstrip_drag_data_received (GtkWidget *widget, guint target_type, guint time) { - gchar *ptr=(char*)data->data; + DdbListview *ps = DDB_LISTVIEW (lookup_widget (mainwin, "playlist")); + + gchar *ptr=(char*)gtk_selection_data_get_data (data); + int len = gtk_selection_data_get_length (data); if (target_type == 0) { // uris // this happens when dropped from file manager - char *mem = malloc (data->length+1); - memcpy (mem, ptr, data->length); - mem[data->length] = 0; + char *mem = malloc (len+1); + memcpy (mem, ptr, len); + mem[len] = 0; // we don't pass control structure, but there's only one drag-drop view currently - gtkui_receive_fm_drop (NULL, mem, data->length); + gtkui_receive_fm_drop (NULL, mem, len); } else if (target_type == 1) { uint32_t *d= (uint32_t *)ptr; int plt = *d; d++; - int length = (data->length/4)-1; + int length = (len/4)-1; ddb_playlist_t *p = deadbeef->plt_get_for_idx (plt); if (p) { - //ps->binding->drag_n_drop (NULL, p, d, length, drag_context->action == GDK_ACTION_COPY ? 1 : 0); - main_drag_n_drop (NULL, p, d, length, drag_context->action == GDK_ACTION_COPY ? 1 : 0); + main_drag_n_drop (NULL, p, d, length, gdk_drag_context_get_selected_action (drag_context) == GDK_ACTION_COPY ? 1 : 0); deadbeef->plt_unref (p); } } @@ -307,9 +325,6 @@ ddb_tabstrip_init(DdbTabStrip *tabstrip) tabstrip->dragpt[1] = 0; tabstrip->prev_x = 0; tabstrip->movepos = 0; - g_signal_connect_after ((gpointer) tabstrip, "button_press_event", - G_CALLBACK (on_tabstrip_button_press_event), - NULL); } static int tab_clicked = -1; @@ -322,8 +337,26 @@ static int min_tab_size = 80; static int tab_moved = 0; +static void +cairo_draw_lines (cairo_t *cr, GdkPoint *pts, int cnt) { + for (int i = 1; i < cnt; i++) { + cairo_move_to (cr, pts[i-1].x+1, pts[i-1].y+1); + cairo_line_to (cr, pts[i].x+1, pts[i].y+1); + } +} + +static void +cairo_draw_poly (cairo_t *cr, GdkPoint *pts, int cnt) { + cairo_move_to (cr, pts[0].x, pts[0].y); + for (int i = 1; i < cnt; i++) { + cairo_line_to (cr, pts[i].x, pts[i].y); + } +} + + + void -ddb_tabstrip_draw_tab (GtkWidget *widget, GdkDrawable *drawable, int idx, int selected, int x, int y, int w, int h) { +ddb_tabstrip_draw_tab (GtkWidget *widget, cairo_t *cr, int idx, int selected, int x, int y, int w, int h) { GdkPoint points_filled[] = { { x+2, y + h }, { x+2, y + 2 }, @@ -332,7 +365,7 @@ ddb_tabstrip_draw_tab (GtkWidget *widget, GdkDrawable *drawable, int idx, int se }; GdkPoint points_frame1[] = { { x, y + h-2 }, - { x, y + 1 }, + { x, y + 0 }, { x + 1, y + 0 }, { x + w - h - 1, y + 0 }, { x + w - h, y + 1 }, @@ -343,18 +376,16 @@ ddb_tabstrip_draw_tab (GtkWidget *widget, GdkDrawable *drawable, int idx, int se }; GdkPoint points_frame2[] = { { x + 1, y + h + 1 }, - { x + 1, y + 1 }, + { x + 1, y + 0 }, { x + w - h - 1, y + 1 }, { x + w - h, y + 2 }, { x + w - h + 1, y + 2 }, { x + w-3, y + h - 2 }, { x + w-2, y + h - 2 }, }; - //gdk_draw_rectangle (widget->window, widget->style->black_gc, FALSE, x-1, y-1, w+2, h+2); - GdkGC *bg = gdk_gc_new (drawable); - GdkGC *outer_frame = gdk_gc_new (drawable); - GdkGC *inner_frame = gdk_gc_new (drawable); - GdkColor clr; + GdkColor clr_bg; + GdkColor clr_outer_frame; + GdkColor clr_inner_frame; int fallback = 1; deadbeef->pl_lock (); ddb_playlist_t *plt = deadbeef->plt_get_for_idx (idx); @@ -364,35 +395,38 @@ ddb_tabstrip_draw_tab (GtkWidget *widget, GdkDrawable *drawable, int idx, int se int r, g, b; if (3 == sscanf (bgclr, "%02x%02x%02x", &r, &g, &b)) { fallback = 0; - clr.red = r * 0x101; - clr.green = g * 0x101; - clr.blue = b * 0x101; + clr_bg.red = r * 0x101; + clr_bg.green = g * 0x101; + clr_bg.blue = b * 0x101; } } deadbeef->pl_unlock (); if (selected) { if (fallback) { - gtkui_get_tabstrip_base_color (&clr); + gtkui_get_tabstrip_base_color (&clr_bg); } - gdk_gc_set_rgb_fg_color (bg, &clr); - gdk_gc_set_rgb_fg_color (outer_frame, (gtkui_get_tabstrip_dark_color (&clr), &clr)); - gdk_gc_set_rgb_fg_color (inner_frame, (gtkui_get_tabstrip_light_color (&clr), &clr)); + gtkui_get_tabstrip_dark_color (&clr_outer_frame); + gtkui_get_tabstrip_light_color (&clr_inner_frame); } else { if (fallback) { - gtkui_get_tabstrip_mid_color (&clr); + gtkui_get_tabstrip_mid_color (&clr_bg); } - gdk_gc_set_rgb_fg_color (bg, &clr); - gdk_gc_set_rgb_fg_color (outer_frame, (gtkui_get_tabstrip_dark_color (&clr), &clr)); - gdk_gc_set_rgb_fg_color (inner_frame, (gtkui_get_tabstrip_mid_color (&clr), &clr)); + gtkui_get_tabstrip_dark_color (&clr_outer_frame); + gtkui_get_tabstrip_mid_color (&clr_inner_frame); } - gdk_draw_polygon (drawable, bg, TRUE, points_filled, 4); - gdk_draw_lines (drawable, outer_frame, points_frame1, 9); - gdk_draw_lines (drawable, inner_frame, points_frame2, 7); - g_object_unref (bg); - g_object_unref (outer_frame); - g_object_unref (inner_frame); + cairo_set_source_rgb (cr, clr_bg.red/65535.f, clr_bg.green/65535.f, clr_bg.blue/65535.0); + cairo_new_path (cr); + cairo_draw_poly (cr, points_filled, 4); + cairo_close_path (cr); + cairo_fill (cr); + cairo_set_source_rgb (cr, clr_outer_frame.red/65535.f, clr_outer_frame.green/65535.f, clr_outer_frame.blue/65535.0); + cairo_draw_lines (cr, points_frame1, 9); + cairo_stroke (cr); + cairo_set_source_rgb (cr, clr_inner_frame.red/65535.f, clr_inner_frame.green/65535.f, clr_inner_frame.blue/65535.0); + cairo_draw_lines (cr, points_frame2, 7); + cairo_stroke (cr); } int @@ -414,14 +448,16 @@ tabstrip_need_arrows (DdbTabStrip *ts) { GtkWidget *widget = GTK_WIDGET (ts); int cnt = deadbeef->plt_get_count (); int w = 0; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); for (int idx = 0; idx < cnt; idx++) { w += ddb_tabstrip_get_tab_width (ts, idx) - tab_overlap_size; - if (w >= widget->allocation.width) { + if (w >= a.width) { return 1; } } w += tab_overlap_size + 3; - if (w >= widget->allocation.width) { + if (w >= a.width) { return 1; } return 0; @@ -432,7 +468,9 @@ tabstrip_scroll_to_tab_int (DdbTabStrip *ts, int tab, int redraw) { GtkWidget *widget = GTK_WIDGET (ts); int w = 0; int cnt = deadbeef->plt_get_count (); - int boundary = widget->allocation.width - arrow_widget_width*2 + ts->hscrollpos; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + int boundary = a.width - arrow_widget_width*2 + ts->hscrollpos; for (int idx = 0; idx < cnt; idx++) { int tab_w = ddb_tabstrip_get_tab_width (ts, idx); if (idx == cnt-1) { @@ -471,14 +509,16 @@ tabstrip_adjust_hscroll (DdbTabStrip *ts) { if (deadbeef->plt_get_count () > 0) { int need_arrows = tabstrip_need_arrows (ts); if (need_arrows) { + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); int w = 0; int cnt = deadbeef->plt_get_count (); for (int idx = 0; idx < cnt; idx++) { w += ddb_tabstrip_get_tab_width (ts, idx) - tab_overlap_size; } w += tab_overlap_size + 3; - if (ts->hscrollpos > w - (widget->allocation.width - arrow_widget_width*2)) { - ts->hscrollpos = w - (widget->allocation.width - arrow_widget_width*2); + if (ts->hscrollpos > w - (a.width - arrow_widget_width*2)) { + ts->hscrollpos = w - (a.width - arrow_widget_width*2); deadbeef->conf_set_int ("gtkui.tabscroll", ts->hscrollpos); } tabstrip_scroll_to_tab_int (ts, deadbeef->plt_get_curr_idx (), 0); @@ -518,11 +558,14 @@ set_tab_text_color (int idx, int selected) { } void -tabstrip_render (DdbTabStrip *ts) { +tabstrip_render (DdbTabStrip *ts, cairo_t *cr) { GtkWidget *widget = GTK_WIDGET (ts); - GdkDrawable *backbuf = gtk_widget_get_window (widget); + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); tabstrip_adjust_hscroll (ts); + cairo_set_line_width (cr, 1); + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); int cnt = deadbeef->plt_get_count (); int hscroll = ts->hscrollpos; @@ -535,7 +578,7 @@ tabstrip_render (DdbTabStrip *ts) { int x = -hscroll; int w = 0; int h = draw_get_font_size (); - h = widget->allocation.height; + h = a.height; tab_overlap_size = (h-4)/2; text_right_padding = h - 3; @@ -545,17 +588,22 @@ tabstrip_render (DdbTabStrip *ts) { return; } - GdkGC *gc = gdk_gc_new (backbuf); - // fill background GdkColor clr; - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_tabstrip_mid_color (&clr), &clr)); - gdk_draw_rectangle (backbuf, gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height); - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_tabstrip_dark_color (&clr), &clr)); - gdk_draw_line (backbuf, gc, 0, 0, widget->allocation.width, 0); + gtkui_get_tabstrip_mid_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.0); + cairo_rectangle (cr, 0, 0, a.width, a.height); + cairo_fill (cr); + + gtkui_get_tabstrip_dark_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.0); + cairo_move_to (cr, 0, 1); + cairo_line_to (cr, a.width, 1); + cairo_stroke (cr); + int y = 4; - h = widget->allocation.height - 4; - draw_begin ((uintptr_t)backbuf); + h = a.height - 4; + draw_begin (cr); int need_draw_moving = 0; int idx; int widths[cnt]; @@ -580,7 +628,7 @@ tabstrip_render (DdbTabStrip *ts) { area.width = w; area.height = 24; if (idx != tab_selected) { - ddb_tabstrip_draw_tab (widget, backbuf, idx, idx == tab_selected, x, y, w, h); + ddb_tabstrip_draw_tab (widget, cr, idx, idx == tab_selected, x, y, w, h); char tab_title[100]; plt_get_title_wrapper (idx, tab_title, sizeof (tab_title)); @@ -589,8 +637,16 @@ tabstrip_render (DdbTabStrip *ts) { } x += w - tab_overlap_size; } - gdk_draw_line (backbuf, widget->style->dark_gc[GTK_STATE_NORMAL], 0, widget->allocation.height-2, widget->allocation.width, widget->allocation.height-2); - gdk_draw_line (backbuf, widget->style->light_gc[GTK_STATE_NORMAL], 0, widget->allocation.height-1, widget->allocation.width, widget->allocation.height-1); + GdkColor *pclr = >k_widget_get_style (widget)->dark[GTK_STATE_NORMAL]; + cairo_set_source_rgb (cr, pclr->red/65535.f, pclr->green/65535.f, pclr->blue/65535.0); + cairo_move_to (cr, 0, a.height-1); + cairo_line_to (cr, a.width, a.height-1); + cairo_stroke (cr); + pclr = >k_widget_get_style (widget)->light[GTK_STATE_NORMAL]; + cairo_set_source_rgb (cr, pclr->red/65535.f, pclr->green/65535.f, pclr->blue/65535.0); + cairo_move_to (cr, 0, a.height); + cairo_line_to (cr, a.width, a.height); + cairo_stroke (cr); // calc position for drawin selected tab x = -hscroll; for (idx = 0; idx < tab_selected; idx++) { @@ -606,7 +662,7 @@ tabstrip_render (DdbTabStrip *ts) { area.y = 0; area.width = w; area.height = 24; - ddb_tabstrip_draw_tab (widget, backbuf, idx, 1, x, y, w, h); + ddb_tabstrip_draw_tab (widget, cr, idx, 1, x, y, w, h); char tab_title[100]; plt_get_title_wrapper (idx, tab_title, sizeof (tab_title)); set_tab_text_color (idx, tab_selected); @@ -621,11 +677,11 @@ tabstrip_render (DdbTabStrip *ts) { w = widths[idx]; if (idx == ts->dragging) { x = ts->movepos; - if (x >= widget->allocation.width) { + if (x >= a.width) { break; } if (w > 0) { - ddb_tabstrip_draw_tab (widget, backbuf, idx, 1, x, y, w, h); + ddb_tabstrip_draw_tab (widget, cr, idx, 1, x, y, w, h); char tab_title[100]; plt_get_title_wrapper (idx, tab_title, sizeof (tab_title)); set_tab_text_color (idx, tab_selected); @@ -636,19 +692,28 @@ tabstrip_render (DdbTabStrip *ts) { x += w - tab_overlap_size; } } - if (need_arrows) { - int sz = widget->allocation.height-3; - GdkColor clr; - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_tabstrip_mid_color (&clr), &clr)); - gdk_draw_rectangle (backbuf, gc, TRUE, 0, 1, arrow_widget_width, sz); - gtk_paint_arrow (widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, NULL, GTK_ARROW_LEFT, TRUE, 2, sz/2-arrow_sz/2, arrow_sz, arrow_sz); - gdk_draw_rectangle (backbuf, gc, TRUE, widget->allocation.width-arrow_widget_width, 1, arrow_widget_width, sz); - gtk_paint_arrow (widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, NULL, GTK_ARROW_RIGHT, TRUE, widget->allocation.width-arrow_sz-2, 1+sz/2-arrow_sz/2, arrow_sz, arrow_sz); + int sz = a.height-3; + gtkui_get_tabstrip_mid_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.0); + cairo_rectangle (cr, 0, 1, arrow_widget_width, sz); + cairo_fill (cr); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_arrow (gtk_widget_get_style (widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, widget, NULL, GTK_ARROW_LEFT, TRUE, 2, sz/2-arrow_sz/2, arrow_sz, arrow_sz); +#else + gtk_paint_arrow (gtk_widget_get_style (widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, NULL, GTK_ARROW_LEFT, TRUE, 2, sz/2-arrow_sz/2, arrow_sz, arrow_sz); +#endif + + cairo_rectangle (cr, a.width-arrow_widget_width, 1, arrow_widget_width, sz); + cairo_fill (cr); +#if GTK_CHECK_VERSION(3,0,0) + gtk_paint_arrow (gtk_widget_get_style (widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, widget, NULL, GTK_ARROW_RIGHT, TRUE, a.width-arrow_sz-2, 1+sz/2-arrow_sz/2, arrow_sz, arrow_sz); +#else + gtk_paint_arrow (gtk_widget_get_style (widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, NULL, GTK_ARROW_RIGHT, TRUE, a.width-arrow_sz-2, 1+sz/2-arrow_sz/2, arrow_sz, arrow_sz); +#endif } draw_end (); - g_object_unref (gc); } static int @@ -745,10 +810,16 @@ create_plmenu (void) plmenu = gtk_menu_new (); rename_playlist1 = gtk_menu_item_new_with_mnemonic (_("Rename Playlist")); + if (tab_clicked == -1) { + gtk_widget_set_sensitive (rename_playlist1, FALSE); + } gtk_widget_show (rename_playlist1); gtk_container_add (GTK_CONTAINER (plmenu), rename_playlist1); remove_playlist1 = gtk_menu_item_new_with_mnemonic (_("Remove Playlist")); + if (tab_clicked == -1) { + gtk_widget_set_sensitive (remove_playlist1, FALSE); + } gtk_widget_show (remove_playlist1); gtk_container_add (GTK_CONTAINER (plmenu), remove_playlist1); @@ -838,6 +909,8 @@ on_tabstrip_button_press_event(GtkWidget *widget, { int need_arrows = tabstrip_need_arrows (ts); if (need_arrows) { + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); if (event->x < arrow_widget_width) { if (event->type == GDK_BUTTON_PRESS) { tabstrip_scroll_left (ts); @@ -846,7 +919,7 @@ on_tabstrip_button_press_event(GtkWidget *widget, } return TRUE; } - else if (event->x >= widget->allocation.width - arrow_widget_width) { + else if (event->x >= a.width - arrow_widget_width) { if (event->type == GDK_BUTTON_PRESS) { tabstrip_scroll_right (ts); ts->scroll_direction = 1; @@ -942,22 +1015,31 @@ gboolean on_tabstrip_configure_event (GtkWidget *widget, GdkEventConfigure *event) { - draw_init_font (widget->style); + draw_init_font (gtk_widget_get_style (widget)); DdbTabStrip *ts = DDB_TABSTRIP (widget); tabstrip_adjust_hscroll (ts); int height = draw_get_listview_rowheight () + 4; - if (height != widget->allocation.height) { + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + if (height != a.height) { gtk_widget_set_size_request (widget, -1, height); } return FALSE; } +gboolean +on_tabstrip_draw (GtkWidget *widget, cairo_t *cr) { + tabstrip_render (DDB_TABSTRIP (widget), cr); + return FALSE; +} gboolean on_tabstrip_expose_event (GtkWidget *widget, GdkEventExpose *event) { - tabstrip_render (DDB_TABSTRIP (widget)); + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); + on_tabstrip_draw (widget, cr); + cairo_destroy (cr); return FALSE; } @@ -980,7 +1062,7 @@ on_tabstrip_motion_notify_event (GtkWidget *widget, } } if (!ts->prepare && ts->dragging >= 0) { -// gdk_window_set_cursor (widget->window, cursor_drag); +// gdk_window_set_cursor (gtk_widget_get_window(widget), cursor_drag); ts->movepos = ev_x - ts->dragpt[0]; // find closest tab to the left @@ -1048,11 +1130,11 @@ on_tabstrip_drag_motion_event (GtkWidget *widget, } GtkWidget *pl = lookup_widget (mainwin, "playlist"); - - int cnt = g_list_length (drag_context->targets); + GList *targets = gdk_drag_context_list_targets (drag_context); + int cnt = g_list_length (targets); int i; for (i = 0; i < cnt; i++) { - GdkAtom a = GDK_POINTER_TO_ATOM (g_list_nth_data (drag_context->targets, i)); + GdkAtom a = GDK_POINTER_TO_ATOM (g_list_nth_data (targets, i)); gchar *nm = gdk_atom_name (a); if (!strcmp (nm, "text/uri-list")) { g_free (nm); diff --git a/plugins/gtkui/ddbvolumebar.c b/plugins/gtkui/ddbvolumebar.c index b0df2c9a..732210f3 100644 --- a/plugins/gtkui/ddbvolumebar.c +++ b/plugins/gtkui/ddbvolumebar.c @@ -35,73 +35,32 @@ ddb_volumebar_send_configure (DdbVolumeBar *darea) widget = GTK_WIDGET (darea); - event->configure.window = g_object_ref (widget->window); + event->configure.window = g_object_ref (gtk_widget_get_window(widget)); event->configure.send_event = TRUE; - event->configure.x = widget->allocation.x; - event->configure.y = widget->allocation.y; - event->configure.width = widget->allocation.width; - event->configure.height = widget->allocation.height; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + event->configure.x = a.x; + event->configure.y = a.y; + event->configure.width = a.width; + event->configure.height = a.height; gtk_widget_event (widget, event); gdk_event_free (event); } static void -ddb_volumebar_realize (GtkWidget *widget) { - DdbVolumeBar *darea = DDB_VOLUMEBAR (widget); - - gtk_widget_set_has_window (widget, FALSE); - GTK_WIDGET_CLASS (ddb_volumebar_parent_class)->realize (widget); - -#if 0 - if (GTK_WIDGET_NO_WINDOW (widget)) - { - GTK_WIDGET_CLASS (ddb_volumebar_parent_class)->realize (widget); - } - else - { - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); - gint attributes_mask; - GdkWindowAttr attributes; - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); - attributes.event_mask = gtk_widget_get_events (widget); - attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK; - - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, darea); - - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); - } - - ddb_volumebar_send_configure (DDB_VOLUMEBAR (widget)); -#endif -} - -static void ddb_volumebar_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { g_return_if_fail (DDB_IS_VOLUMEBAR (widget)); g_return_if_fail (allocation != NULL); - widget->allocation = *allocation; + gtk_widget_set_allocation (widget, allocation); if (gtk_widget_get_realized (widget)) { if (gtk_widget_get_has_window (widget)) - gdk_window_move_resize (widget->window, + gdk_window_move_resize (gtk_widget_get_window(widget), allocation->x, allocation->y, allocation->width, allocation->height); @@ -110,6 +69,9 @@ ddb_volumebar_size_allocate (GtkWidget *widget, } gboolean +on_volumebar_draw (GtkWidget *widget, cairo_t *cr); + +gboolean on_volumebar_expose_event (GtkWidget *widget, GdkEventExpose *event); @@ -136,9 +98,12 @@ static void ddb_volumebar_class_init(DdbVolumeBarClass *class) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - widget_class->realize = ddb_volumebar_realize; widget_class->size_allocate = ddb_volumebar_size_allocate; +#if GTK_CHECK_VERSION(3,0,0) + widget_class->draw = on_volumebar_draw; +#else widget_class->expose_event = on_volumebar_expose_event; +#endif widget_class->button_press_event = on_volumebar_button_press_event; widget_class->button_release_event = on_volumebar_button_release_event; widget_class->motion_notify_event = on_volumebar_motion_notify_event; @@ -157,43 +122,54 @@ ddb_volumebar_init(DdbVolumeBar *volumebar) int db = deadbeef->volume_get_db (); snprintf (s, sizeof (s), "%s%ddB", db < 0 ? "" : "+", db); gtk_widget_set_tooltip_text (GTK_WIDGET (volumebar), s); + gtk_widget_set_has_window (GTK_WIDGET (volumebar), FALSE); } void -volumebar_draw (GtkWidget *widget) { +volumebar_draw (GtkWidget *widget, cairo_t *cr) { if (!widget) { return; } - GdkDrawable *volumebar_backbuf = GDK_DRAWABLE (widget->window); + +#if GTK_CHECK_VERSION(3,0,0) + GtkAllocation allocation; + gtk_widget_get_allocation (widget, &allocation); + cairo_translate (cr, -allocation.x, -allocation.y); +#endif + float range = -deadbeef->volume_get_min_db (); - int n = widget->allocation.width / 4; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + int n = a.width / 4; float vol = (range + deadbeef->volume_get_db ()) / range * n; float h = 17; - GdkGC *back_gc = gdk_gc_new (widget->window); - GdkColor clr; - gdk_gc_set_rgb_fg_color (back_gc, (gtkui_get_bar_background_color (&clr), &clr)); - - GdkGC *front_gc = gdk_gc_new (widget->window); - gdk_gc_set_rgb_fg_color (front_gc, (gtkui_get_bar_foreground_color (&clr), &clr)); + GdkColor clr_fg; + GdkColor clr_bg; + gtkui_get_bar_foreground_color (&clr_fg); + gtkui_get_bar_background_color (&clr_bg); for (int i = 0; i < n; i++) { float iy = (float)i + 3; int _x = i * 4; int _h = h * iy / n; - int _y = widget->allocation.height/2-h/2; + int _y = a.height/2-h/2; _y += (h - _h); int _w = 3; if (i < vol) { - gdk_draw_rectangle (volumebar_backbuf, front_gc, TRUE, _x + widget->allocation.x, _y + widget->allocation.y, _w, _h); + cairo_set_source_rgb (cr, clr_fg.red/65535.f, clr_fg.green/65535.f, clr_fg.blue/65535.f); + cairo_rectangle (cr, _x + a.x, _y + a.y, _w, _h); + cairo_fill (cr); } else { - gdk_draw_rectangle (volumebar_backbuf, back_gc, TRUE, _x + widget->allocation.x, _y + widget->allocation.y, _w, _h); + cairo_set_source_rgb (cr, clr_bg.red/65535.f, clr_bg.green/65535.f, clr_bg.blue/65535.f); + cairo_rectangle (cr, _x + a.x, _y + a.y, _w, _h); + cairo_fill (cr); } } #if 0 if (DDB_VOLUMEBAR (widget)->show_dbs) { - draw_begin ((uintptr_t)widget->window); + draw_begin ((uintptr_t)gtk_widget_get_window(widget)); draw_init_font (widget->style); char s[100]; int db = deadbeef->volume_get_db (); @@ -204,25 +180,34 @@ volumebar_draw (GtkWidget *widget) { draw_end (); } #endif - g_object_unref (back_gc); - g_object_unref (front_gc); } gboolean +on_volumebar_draw (GtkWidget *widget, cairo_t *cr) { + volumebar_draw (widget, cr); +} + +#if !GTK_CHECK_VERSION(3,0,0) +gboolean on_volumebar_expose_event (GtkWidget *widget, GdkEventExpose *event) { - volumebar_draw (widget); + cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); + on_volumebar_draw (widget, cr); + cairo_destroy (cr); return FALSE; } +#endif gboolean on_volumebar_motion_notify_event (GtkWidget *widget, GdkEventMotion *event) { + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); if (event->state & GDK_BUTTON1_MASK) { float range = -deadbeef->volume_get_min_db (); - float volume = (event->x - widget->allocation.x) / widget->allocation.width * range - range; + float volume = (event->x - a.x) / a.width * range - range; if (volume > 0) { volume = 0; } @@ -244,9 +229,11 @@ gboolean on_volumebar_button_press_event (GtkWidget *widget, GdkEventButton *event) { + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); if (event->button == 1) { float range = -deadbeef->volume_get_min_db (); - float volume = (event->x - widget->allocation.x)/ widget->allocation.width * range - range; + float volume = (event->x - a.x)/ a.width * range - range; if (volume < -range) { volume = -range; } diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 926fa6ab..b0659ff5 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -2643,10 +2643,96 @@ Album</property> </child> <child> - <widget class="GtkHBox" id="hbox100"> + <widget class="GtkTable" id="table1"> <property name="visible">True</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> <property name="homogeneous">False</property> - <property name="spacing">8</property> + <property name="row_spacing">0</property> + <property name="column_spacing">8</property> + + <child> + <widget class="GtkHBox" id="hbox100"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkLabel" id="label125"> + <property name="visible">True</property> + <property name="label" translatable="yes">-12 dB</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHScale" id="replaygain_preamp"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="draw_value">True</property> + <property name="value_pos">GTK_POS_BOTTOM</property> + <property name="digits">0</property> + <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> + <property name="inverted">False</property> + <property name="adjustment">0 -12 12 0 0 0</property> + <signal name="value_changed" handler="on_replaygain_preamp_value_changed" last_modification_time="Sat, 12 Mar 2011 14:20:29 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label126"> + <property name="visible">True</property> + <property name="label" translatable="yes">+12 dB</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + </packing> + </child> <child> <widget class="GtkLabel" id="label124"> @@ -2657,7 +2743,7 @@ Album</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> - <property name="xalign">0.5</property> + <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> @@ -2667,22 +2753,25 @@ Album</property> <property name="angle">0</property> </widget> <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkLabel" id="label125"> + <widget class="GtkLabel" id="label124a"> <property name="visible">True</property> - <property name="label" translatable="yes">-12 dB</property> + <property name="label" translatable="yes">Global preamp:</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> - <property name="xalign">0.5</property> + <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> @@ -2692,53 +2781,97 @@ Album</property> <property name="angle">0</property> </widget> <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkHScale" id="replaygain_preamp"> + <widget class="GtkHBox" id="hbox100a"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="draw_value">True</property> - <property name="value_pos">GTK_POS_BOTTOM</property> - <property name="digits">0</property> - <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> - <property name="inverted">False</property> - <property name="adjustment">0 -12 12 0 0 0</property> - <signal name="value_changed" handler="on_replaygain_preamp_value_changed" last_modification_time="Sat, 12 Mar 2011 14:20:29 GMT"/> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> + <property name="homogeneous">False</property> + <property name="spacing">8</property> - <child> - <widget class="GtkLabel" id="label126"> - <property name="visible">True</property> - <property name="label" translatable="yes">+12 dB</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> + <child> + <widget class="GtkLabel" id="label125a"> + <property name="visible">True</property> + <property name="label" translatable="yes">-12 dB</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHScale" id="global_preamp"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="draw_value">True</property> + <property name="value_pos">GTK_POS_BOTTOM</property> + <property name="digits">0</property> + <property name="update_policy">GTK_UPDATE_CONTINUOUS</property> + <property name="inverted">False</property> + <property name="adjustment">0 -12 12 0 0 0</property> + <signal name="value_changed" handler="on_global_preamp_value_changed" last_modification_time="Thu, 01 Sep 2011 11:40:00 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label126a"> + <property name="visible">True</property> + <property name="label" translatable="yes">+12 dB</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> </widget> <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> </packing> </child> </widget> diff --git a/plugins/gtkui/drawing.h b/plugins/gtkui/drawing.h index b73c9f97..3556ec62 100644 --- a/plugins/gtkui/drawing.h +++ b/plugins/gtkui/drawing.h @@ -30,27 +30,15 @@ void draw_free (void); void -draw_begin (uintptr_t canvas); +draw_begin (cairo_t *cr); void draw_end (void); void -draw_get_canvas_size (uintptr_t canvas, int *w, int *h); - -void -draw_copy (uintptr_t dest_canvas, uintptr_t src_canvas, int dx, int dy, int sx, int sy, int w, int h); - -void -draw_pixbuf (uintptr_t dest_canvas, uintptr_t pixbuf, int dx, int dy, int sx, int sy, int w, int h); - -void draw_set_fg_color (float *rgb); void -draw_set_bg_color (float *rgb); - -void draw_line (float x1, float y1, float x2, float y2); void diff --git a/plugins/gtkui/eq.c b/plugins/gtkui/eq.c index f2012bba..c534dfb6 100644 --- a/plugins/gtkui/eq.c +++ b/plugins/gtkui/eq.c @@ -97,7 +97,7 @@ on_zero_all_clicked (GtkButton *button, // set dsp set_param (eq, i+1, 0); } - gdk_window_invalidate_rect (eqwin->window, NULL, FALSE); + gtk_widget_queue_draw (eqwin); } } } @@ -110,7 +110,7 @@ on_zero_preamp_clicked (GtkButton *button, if (eq) { set_param (eq, 0, 0); ddb_equalizer_set_preamp (DDB_EQUALIZER (eqwin), 0); - gdk_window_invalidate_rect (eqwin->window, NULL, FALSE); + gtk_widget_queue_draw (eqwin); } } } @@ -125,7 +125,7 @@ on_zero_bands_clicked (GtkButton *button, ddb_equalizer_set_band (DDB_EQUALIZER (eqwin), i, 0); set_param (eq, i+1, 0); } - gdk_window_invalidate_rect (eqwin->window, NULL, FALSE); + gtk_widget_queue_draw (eqwin); } } } @@ -227,7 +227,7 @@ on_load_preset_clicked (GtkMenuItem *menuitem, ddb_equalizer_set_band (DDB_EQUALIZER (eqwin), i, vals[i]); set_param (eq, i+1, vals[i]); } - gdk_window_invalidate_rect (eqwin->window, NULL, FALSE); + gtk_widget_queue_draw (eqwin); deadbeef->conf_save (); } } @@ -293,7 +293,7 @@ on_import_fb2k_preset_clicked (GtkButton *button, ddb_equalizer_set_band (DDB_EQUALIZER (eqwin), i, vals[i]); set_param (eq, i+1, vals[i]); } - gdk_window_invalidate_rect (eqwin->window, NULL, FALSE); + gtk_widget_queue_draw (eqwin); deadbeef->conf_save (); } } diff --git a/plugins/gtkui/fileman.c b/plugins/gtkui/fileman.c index 4b1b6949..0a366990 100644 --- a/plugins/gtkui/fileman.c +++ b/plugins/gtkui/fileman.c @@ -74,12 +74,16 @@ gtkpl_add_files (GSList *lst) { g_slist_free (lst); deadbeef->pl_add_files_end (); deadbeef->plt_unref (plt); + deadbeef->pl_save_all (); + deadbeef->conf_save (); } static void add_dirs_worker (void *data) { GSList *lst = (GSList *)data; gtkpl_add_dirs (lst); + deadbeef->pl_save_all (); + deadbeef->conf_save (); } void @@ -104,6 +108,8 @@ static void open_files_worker (void *data) { GSList *lst = (GSList *)data; gtkpl_add_files (lst); + deadbeef->pl_save_all (); + deadbeef->conf_save (); deadbeef->pl_set_cursor (PL_MAIN, 0); deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); deadbeef->sendmessage (DB_EV_PLAY_CURRENT, 0, 1, 0); @@ -230,6 +236,7 @@ gtkpl_add_fm_dropped_files (DB_playItem_t *drop_before, char *ptr, int length) { deadbeef->pl_add_files_end (); deadbeef->plt_unref (plt); + deadbeef->pl_save_all (); g_idle_add (set_dnd_cursor_idle, first); } diff --git a/plugins/gtkui/gdkdrawing.c b/plugins/gtkui/gdkdrawing.c index cb795ccb..41967bb8 100644 --- a/plugins/gtkui/gdkdrawing.c +++ b/plugins/gtkui/gdkdrawing.c @@ -27,8 +27,8 @@ #include "support.h" #include "gtkui.h" -static GdkDrawable *drawable; -static GdkGC *gc; +static cairo_t *drawable; +//static GdkGC *gc; static GdkColor clrfg; static GdkColor clrbg; static int pango_ready; @@ -36,59 +36,31 @@ static PangoContext *pangoctx; static PangoLayout *pangolayout; void -draw_begin (uintptr_t canvas) { - drawable = GDK_DRAWABLE (canvas); - gc = gdk_gc_new (drawable); +draw_begin (cairo_t *cr) { + drawable = cr; } void draw_end (void) { drawable = NULL; - if (gc) { - g_object_unref (gc); - gc = NULL; - } -} - -void -draw_copy (uintptr_t dest_canvas, uintptr_t src_canvas, int dx, int dy, int sx, int sy, int w, int h) { - gdk_draw_drawable (GDK_DRAWABLE (dest_canvas), gc, GDK_DRAWABLE (src_canvas), dx, dy, sx, sy, w, h); -} - -void -draw_pixbuf (uintptr_t dest_canvas, uintptr_t pixbuf, int dx, int dy, int sx, int sy, int w, int h) { - gdk_draw_pixbuf (GDK_DRAWABLE (dest_canvas), gc, GDK_PIXBUF (pixbuf), sx, sy, dx, dy, w, h, GDK_RGB_DITHER_NONE, 0, 0); -} - -void -draw_get_canvas_size (uintptr_t canvas, int *w, int *h) { - gdk_drawable_get_size (GDK_DRAWABLE (canvas), w, h); } void draw_set_fg_color (float *rgb) { - clrfg.red = rgb[0] * 0xffff; - clrfg.green = rgb[1] * 0xffff; - clrfg.blue = rgb[2] * 0xffff; - gdk_gc_set_rgb_fg_color (gc, &clrfg); -} - -void -draw_set_bg_color (float *rgb) { - clrbg.red = rgb[0] * 0xffff; - clrbg.green = rgb[1] * 0xffff; - clrbg.blue = rgb[2] * 0xffff; - gdk_gc_set_rgb_bg_color (gc, &clrbg); + cairo_set_source_rgb (drawable, rgb[0], rgb[1], rgb[2]); } void draw_line (float x1, float y1, float x2, float y2) { - gdk_draw_line (drawable, gc, x1, y1, x2, y2); + cairo_move_to (drawable, x1, y1); + cairo_line_to (drawable, x2, y2); + cairo_stroke (drawable); } void draw_rect (float x, float y, float w, float h, int fill) { - gdk_draw_rectangle (drawable, gc, fill, x, y, w, h); + cairo_rectangle (drawable, x, y, w, h); + fill ? cairo_fill (drawable) : cairo_stroke (drawable); } static GtkStyle *font_style = NULL; @@ -165,7 +137,8 @@ draw_text (float x, float y, int width, int align, const char *text) { pango_layout_set_width (pangolayout, width*PANGO_SCALE); pango_layout_set_alignment (pangolayout, align ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT); pango_layout_set_text (pangolayout, text, -1); - gdk_draw_layout (drawable, gc, x, y, pangolayout); + cairo_move_to (drawable, x, y); + pango_cairo_show_layout (drawable, pangolayout); } void @@ -174,7 +147,10 @@ draw_text_with_colors (float x, float y, int width, int align, const char *text) pango_layout_set_width (pangolayout, width*PANGO_SCALE); pango_layout_set_alignment (pangolayout, align ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT); pango_layout_set_text (pangolayout, text, -1); - gdk_draw_layout_with_colors (drawable, gc, x, y, pangolayout, &clrfg, &clrbg); +// gdk_draw_layout_with_colors (drawable, gc, x, y, pangolayout, &clrfg, &clrbg); + cairo_move_to (drawable, x, y); + pango_cairo_show_layout (drawable, pangolayout); + } void @@ -233,7 +209,7 @@ gtkui_init_theme_colors (void) { override_tabstrip_colors = deadbeef->conf_get_int ("gtkui.override_tabstrip_colors", 0); extern GtkWidget *mainwin; - GtkStyle *style = mainwin->style; + GtkStyle *style = gtk_widget_get_style (mainwin); char color_text[100]; const char *clr; diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index a7378953..e3081188 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -77,7 +77,7 @@ int gtkui_embolden_current_track; void gtkpl_init (void) { theme_treeview = gtk_tree_view_new (); - GTK_WIDGET_UNSET_FLAGS (theme_treeview, GTK_CAN_FOCUS); + gtk_widget_set_can_focus (theme_treeview, FALSE); gtk_widget_show (theme_treeview); GtkWidget *vbox1 = lookup_widget (mainwin, "vbox1"); gtk_box_pack_start (GTK_BOX (vbox1), theme_treeview, FALSE, FALSE, 0); @@ -115,7 +115,7 @@ static struct timeval last_br_update; static gboolean update_songinfo (gpointer ctx) { - int iconified = gdk_window_get_state(mainwin->window) & GDK_WINDOW_STATE_ICONIFIED; + int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED; if (!gtk_widget_get_visible (mainwin) || iconified) { return FALSE; } @@ -216,7 +216,9 @@ update_songinfo (gpointer ctx) { GtkWidget *widget = lookup_widget (mainwin, "seekbar"); // translate volume to seekbar pixels songpos /= duration; - songpos *= widget->allocation.width; + GtkAllocation a; + gtk_widget_get_allocation (widget, &a); + songpos *= a.width; if (fabs (songpos - last_songpos) > 0.01) { gtk_widget_queue_draw (widget); last_songpos = songpos; @@ -261,6 +263,16 @@ on_trayicon_scroll_event (GtkWidget *widget, deadbeef->volume_set_db (vol); volumebar_redraw (); + //Update volume bar tooltip + if (mainwin) { + GtkWidget *volumebar = lookup_widget (mainwin, "volumebar"); + char s[100]; + int db = vol; + snprintf (s, sizeof (s), "%s%ddB", db < 0 ? "" : "+", db); + gtk_widget_set_tooltip_text (volumebar, s); + gtk_widget_trigger_tooltip_query (volumebar); + } + #if 0 char str[100]; if (deadbeef->conf_get_int ("gtkui.show_gain_in_db", 1)) { @@ -277,7 +289,7 @@ on_trayicon_scroll_event (GtkWidget *widget, void mainwin_toggle_visible (void) { - int iconified = gdk_window_get_state(mainwin->window) & GDK_WINDOW_STATE_ICONIFIED; + int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED; if (gtk_widget_get_visible (mainwin) && !iconified) { gtk_widget_hide (mainwin); } @@ -355,6 +367,10 @@ redraw_queued_tracks (DdbListview *pl) { gboolean redraw_queued_tracks_cb (gpointer plt) { DdbListview *list = plt; + int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED; + if (!gtk_widget_get_visible (mainwin) || iconified) { + return FALSE; + } redraw_queued_tracks (list); return FALSE; } @@ -476,7 +492,7 @@ gtkui_on_frameupdate (gpointer data) { static gboolean gtkui_volumechanged_cb (gpointer ctx) { GtkWidget *volumebar = lookup_widget (mainwin, "volumebar"); - gdk_window_invalidate_rect (volumebar->window, NULL, FALSE); + gdk_window_invalidate_rect (gtk_widget_get_window (volumebar), NULL, FALSE); return FALSE; } @@ -828,7 +844,7 @@ update_win_title_idle (gpointer data) { static gboolean redraw_seekbar_cb (gpointer nothing) { - int iconified = gdk_window_get_state(mainwin->window) & GDK_WINDOW_STATE_ICONIFIED; + int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED; if (!gtk_widget_get_visible (mainwin) || iconified) { return FALSE; } @@ -871,7 +887,7 @@ gtkui_add_new_playlist (void) { void volumebar_redraw (void) { GtkWidget *volumebar = lookup_widget (mainwin, "volumebar"); - gdk_window_invalidate_rect (volumebar->window, NULL, FALSE); + gdk_window_invalidate_rect (gtk_widget_get_window (volumebar), NULL, FALSE); } //void @@ -1304,11 +1320,19 @@ gtkui_get_mainwin (void) { return mainwin; } +#if !GTK_CHECK_VERSION(3,0,0) DB_plugin_t * ddb_gui_GTK2_load (DB_functions_t *api) { deadbeef = api; return DB_PLUGIN (&plugin); } +#else +DB_plugin_t * +ddb_gui_GTK3_load (DB_functions_t *api) { + deadbeef = api; + return DB_PLUGIN (&plugin); +} +#endif static const char settings_dlg[] = "property \"Ask confirmation to delete files from disk\" checkbox gtkui.delete_files_ask 1;\n" @@ -1317,6 +1341,7 @@ static const char settings_dlg[] = "property \"Custom status icon\" entry gtkui.custom_tray_icon \"" TRAY_ICON "\" ;\n" "property \"Run gtk_init with --sync (debug mode)\" checkbox gtkui.sync 0;\n" "property \"Add separators between plugin context menu items\" checkbox gtkui.action_separators 0;\n" + "property \"Auto-resize columns to fit the main window\" checkbox gtkui.autoresize_columns 0;\n" ; // define plugin interface @@ -1326,7 +1351,11 @@ static ddb_gtkui_t plugin = { .gui.plugin.version_major = 1, .gui.plugin.version_minor = 0, .gui.plugin.type = DB_PLUGIN_MISC, +#if GTK_CHECK_VERSION(3,0,0) + .gui.plugin.id = "gtkui3", +#else .gui.plugin.id = "gtkui", +#endif .gui.plugin.name = "Standard GTK2 user interface", .gui.plugin.descr = "Default DeaDBeeF GUI", .gui.plugin.copyright = diff --git a/plugins/gtkui/gtkui.h b/plugins/gtkui/gtkui.h index f3b075d3..6aa81529 100644 --- a/plugins/gtkui/gtkui.h +++ b/plugins/gtkui/gtkui.h @@ -116,7 +116,7 @@ void seekbar_redraw (void); void -seekbar_draw (GtkWidget *widget); +seekbar_draw (GtkWidget *widget, cairo_t *cr); gboolean on_seekbar_button_press_event (GtkWidget *widget, diff --git a/plugins/gtkui/gtkui.vapi b/plugins/gtkui/gtkui.vapi index 59886a55..d18e90bb 100644 --- a/plugins/gtkui/gtkui.vapi +++ b/plugins/gtkui/gtkui.vapi @@ -1,5 +1,4 @@ -[CCode (cheader_filename = "gtkui.h")] -[CCode (cheader_filename = "drawing.h")] +[CCode (cheader_filename = "drawing.h,gtkui.h")] [CCode (cprefix = "Gtkui", lower_case_cprefix = "gtkui_")] namespace Gtkui { public static unowned Gdk.Color get_bar_foreground_color (); diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index d09e9dc7..4ae9d5a7 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -21,7 +21,7 @@ #define GLADE_HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ - gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + g_object_ref(G_OBJECT(widget)), (GDestroyNotify) g_object_unref) #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ g_object_set_data (G_OBJECT (component), name, widget) @@ -505,7 +505,7 @@ create_mainwin (void) stopbtn = gtk_button_new (); gtk_widget_show (stopbtn); gtk_box_pack_start (GTK_BOX (hbox3), stopbtn, FALSE, FALSE, 0); - GTK_WIDGET_UNSET_FLAGS (stopbtn, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(stopbtn, FALSE); gtk_widget_add_accelerator (stopbtn, "activate", accel_group, GDK_v, (GdkModifierType) 0, GTK_ACCEL_VISIBLE); @@ -518,7 +518,7 @@ create_mainwin (void) playbtn = gtk_button_new (); gtk_widget_show (playbtn); gtk_box_pack_start (GTK_BOX (hbox3), playbtn, FALSE, FALSE, 0); - GTK_WIDGET_UNSET_FLAGS (playbtn, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(playbtn, FALSE); gtk_widget_add_accelerator (playbtn, "activate", accel_group, GDK_x, (GdkModifierType) 0, GTK_ACCEL_VISIBLE); @@ -534,7 +534,7 @@ create_mainwin (void) pausebtn = gtk_button_new (); gtk_widget_show (pausebtn); gtk_box_pack_start (GTK_BOX (hbox3), pausebtn, FALSE, FALSE, 0); - GTK_WIDGET_UNSET_FLAGS (pausebtn, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(pausebtn, FALSE); gtk_widget_add_accelerator (pausebtn, "activate", accel_group, GDK_c, (GdkModifierType) 0, GTK_ACCEL_VISIBLE); @@ -550,7 +550,7 @@ create_mainwin (void) prevbtn = gtk_button_new (); gtk_widget_show (prevbtn); gtk_box_pack_start (GTK_BOX (hbox3), prevbtn, FALSE, FALSE, 0); - GTK_WIDGET_UNSET_FLAGS (prevbtn, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(prevbtn, FALSE); gtk_widget_add_accelerator (prevbtn, "activate", accel_group, GDK_z, (GdkModifierType) 0, GTK_ACCEL_VISIBLE); @@ -563,7 +563,7 @@ create_mainwin (void) nextbtn = gtk_button_new (); gtk_widget_show (nextbtn); gtk_box_pack_start (GTK_BOX (hbox3), nextbtn, FALSE, FALSE, 0); - GTK_WIDGET_UNSET_FLAGS (nextbtn, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(nextbtn, FALSE); gtk_widget_add_accelerator (nextbtn, "activate", accel_group, GDK_b, (GdkModifierType) 0, GTK_ACCEL_VISIBLE); @@ -577,15 +577,15 @@ create_mainwin (void) gtk_widget_show (seekbar); gtk_box_pack_start (GTK_BOX (hbox2), seekbar, TRUE, TRUE, 2); gtk_widget_set_size_request (seekbar, 20, -1); - GTK_WIDGET_UNSET_FLAGS (seekbar, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (seekbar, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(seekbar, FALSE); + gtk_widget_set_can_default(seekbar, FALSE); volumebar = create_volumebar_widget ("volumebar", "", "", 0, 0); gtk_widget_show (volumebar); gtk_box_pack_start (GTK_BOX (hbox2), volumebar, FALSE, TRUE, 2); gtk_widget_set_size_request (volumebar, 70, -1); - GTK_WIDGET_UNSET_FLAGS (volumebar, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (volumebar, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(volumebar, FALSE); + gtk_widget_set_can_default(volumebar, FALSE); plugins_bottom_vbox = gtk_vbox_new (FALSE, 0); gtk_widget_show (plugins_bottom_vbox); @@ -907,8 +907,8 @@ create_searchwin (void) searchlist = create_ddb_listview_widget ("searchlist", "", "", 0, 0); gtk_widget_show (searchlist); gtk_container_add (GTK_CONTAINER (frame2), searchlist); - GTK_WIDGET_UNSET_FLAGS (searchlist, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (searchlist, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(searchlist, FALSE); + gtk_widget_set_can_default(searchlist, FALSE); g_signal_connect ((gpointer) searchwin, "key_press_event", G_CALLBACK (on_searchwin_key_press_event), @@ -1105,7 +1105,7 @@ create_progressdlg (void) gtk_widget_show (progresstitle); gtk_box_pack_start (GTK_BOX (vbox6), progresstitle, TRUE, FALSE, 0); gtk_widget_set_size_request (progresstitle, 500, -1); - GTK_WIDGET_UNSET_FLAGS (progresstitle, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(progresstitle, FALSE); gtk_editable_set_editable (GTK_EDITABLE (progresstitle), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (progresstitle), 8226); @@ -1269,7 +1269,7 @@ create_trackproperties (void) write_tags = gtk_button_new (); gtk_widget_show (write_tags); gtk_container_add (GTK_CONTAINER (hbuttonbox1), write_tags); - GTK_WIDGET_SET_FLAGS (write_tags, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(write_tags, TRUE); alignment11 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment11); @@ -1290,7 +1290,7 @@ create_trackproperties (void) closebtn = gtk_button_new (); gtk_widget_show (closebtn); gtk_container_add (GTK_CONTAINER (hbuttonbox1), closebtn); - GTK_WIDGET_SET_FLAGS (closebtn, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(closebtn, TRUE); alignment12 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment12); @@ -1336,7 +1336,7 @@ create_trackproperties (void) button2 = gtk_button_new (); gtk_widget_show (button2); gtk_container_add (GTK_CONTAINER (hbuttonbox2), button2); - GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(button2, TRUE); alignment13 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment13); @@ -1462,7 +1462,7 @@ create_editcolumndlg (void) gtk_window_set_modal (GTK_WINDOW (editcolumndlg), TRUE); gtk_window_set_type_hint (GTK_WINDOW (editcolumndlg), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox1 = GTK_DIALOG (editcolumndlg)->vbox; + dialog_vbox1 = gtk_dialog_get_content_area (GTK_DIALOG (editcolumndlg)); gtk_widget_show (dialog_vbox1); vbox14 = gtk_vbox_new (FALSE, 8); @@ -1494,20 +1494,20 @@ create_editcolumndlg (void) gtk_box_pack_start (GTK_BOX (hbox30), label37, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label37), 0, 0.5); - id = gtk_combo_box_new_text (); + id = gtk_combo_box_text_new (); gtk_widget_show (id); gtk_box_pack_start (GTK_BOX (hbox30), id, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Item Index")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Playing")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Album Art")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Artist - Album")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Artist")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Album")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Title")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Duration")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Track Number")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Band / Album Artist")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id), _("Custom")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Item Index")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Playing")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Album Art")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Artist - Album")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Artist")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Album")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Title")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Duration")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Track Number")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Band / Album Artist")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id), _("Custom")); hbox31 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox31); @@ -1531,8 +1531,8 @@ create_editcolumndlg (void) title_formatting_help_link = title_formatting_help_link_create ("title_formatting_help_link", "", "", 0, 0); gtk_widget_show (title_formatting_help_link); gtk_box_pack_start (GTK_BOX (hbox74), title_formatting_help_link, TRUE, TRUE, 0); - GTK_WIDGET_UNSET_FLAGS (title_formatting_help_link, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (title_formatting_help_link, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(title_formatting_help_link, FALSE); + gtk_widget_set_can_default(title_formatting_help_link, FALSE); hbox32 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox32); @@ -1543,20 +1543,20 @@ create_editcolumndlg (void) gtk_box_pack_start (GTK_BOX (hbox32), label38, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label38), 0, 0.5); - align = gtk_combo_box_new_text (); + align = gtk_combo_box_text_new (); gtk_widget_show (align); gtk_box_pack_start (GTK_BOX (hbox32), align, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (align), _("Left")); - gtk_combo_box_append_text (GTK_COMBO_BOX (align), _("Right")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (align), _("Left")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (align), _("Right")); - dialog_action_area1 = GTK_DIALOG (editcolumndlg)->action_area; + dialog_action_area1 = gtk_dialog_get_action_area (GTK_DIALOG (editcolumndlg)); gtk_widget_show (dialog_action_area1); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); cancelbutton1 = gtk_button_new (); gtk_widget_show (cancelbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (editcolumndlg), cancelbutton1, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton1, TRUE); alignment9 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment9); @@ -1577,7 +1577,7 @@ create_editcolumndlg (void) okbutton1 = gtk_button_new (); gtk_widget_show (okbutton1); gtk_dialog_add_action_widget (GTK_DIALOG (editcolumndlg), okbutton1, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton1, TRUE); alignment8 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment8); @@ -1652,11 +1652,17 @@ create_prefwin (void) GtkWidget *label8; GtkWidget *pref_replaygain_mode; GtkWidget *pref_replaygain_scale; + GtkWidget *table1; GtkWidget *hbox100; - GtkWidget *label124; GtkWidget *label125; GtkWidget *replaygain_preamp; GtkWidget *label126; + GtkWidget *label124; + GtkWidget *label124a; + GtkWidget *hbox100a; + GtkWidget *label125a; + GtkWidget *global_preamp; + GtkWidget *label126a; GtkWidget *hbox66; GtkWidget *cli_add_to_playlist; GtkWidget *cli_playlist_name; @@ -1789,7 +1795,7 @@ create_prefwin (void) gtk_window_set_position (GTK_WINDOW (prefwin), GTK_WIN_POS_CENTER); gtk_window_set_type_hint (GTK_WINDOW (prefwin), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox2 = GTK_DIALOG (prefwin)->vbox; + dialog_vbox2 = gtk_dialog_get_content_area (GTK_DIALOG (prefwin)); gtk_widget_show (dialog_vbox2); notebook = gtk_notebook_new (); @@ -1811,7 +1817,7 @@ create_prefwin (void) gtk_box_pack_start (GTK_BOX (hbox11), label23, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label23), 0, 0.5); - pref_output_plugin = gtk_combo_box_new_text (); + pref_output_plugin = gtk_combo_box_text_new (); gtk_widget_show (pref_output_plugin); gtk_box_pack_start (GTK_BOX (hbox11), pref_output_plugin, TRUE, TRUE, 0); @@ -1824,7 +1830,7 @@ create_prefwin (void) gtk_box_pack_start (GTK_BOX (hbox12), label4, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5); - pref_soundcard = gtk_combo_box_new_text (); + pref_soundcard = gtk_combo_box_text_new (); gtk_widget_show (pref_soundcard); gtk_box_pack_start (GTK_BOX (hbox12), pref_soundcard, TRUE, TRUE, 0); @@ -1850,25 +1856,28 @@ create_prefwin (void) gtk_box_pack_start (GTK_BOX (hbox10), label8, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5); - pref_replaygain_mode = gtk_combo_box_new_text (); + pref_replaygain_mode = gtk_combo_box_text_new (); gtk_widget_show (pref_replaygain_mode); gtk_box_pack_start (GTK_BOX (hbox10), pref_replaygain_mode, TRUE, TRUE, 0); gtk_widget_set_size_request (pref_replaygain_mode, 337, -1); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_replaygain_mode), _("Disable")); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_replaygain_mode), _("Track")); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_replaygain_mode), _("Album")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_replaygain_mode), _("Disable")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_replaygain_mode), _("Track")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_replaygain_mode), _("Album")); pref_replaygain_scale = gtk_check_button_new_with_mnemonic (_("Replaygain peak scale")); gtk_widget_show (pref_replaygain_scale); gtk_box_pack_start (GTK_BOX (vbox8), pref_replaygain_scale, FALSE, FALSE, 0); + table1 = gtk_table_new (2, 2, FALSE); + gtk_widget_show (table1); + gtk_box_pack_start (GTK_BOX (vbox8), table1, FALSE, FALSE, 0); + gtk_table_set_col_spacings (GTK_TABLE (table1), 8); + hbox100 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox100); - gtk_box_pack_start (GTK_BOX (vbox8), hbox100, FALSE, FALSE, 0); - - label124 = gtk_label_new (_("Replaygain preamp:")); - gtk_widget_show (label124); - gtk_box_pack_start (GTK_BOX (hbox100), label124, FALSE, FALSE, 0); + gtk_table_attach (GTK_TABLE (table1), hbox100, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0); label125 = gtk_label_new (_("-12 dB")); gtk_widget_show (label125); @@ -1884,6 +1893,40 @@ create_prefwin (void) gtk_widget_show (label126); gtk_box_pack_start (GTK_BOX (hbox100), label126, FALSE, FALSE, 0); + label124 = gtk_label_new (_("Replaygain preamp:")); + gtk_widget_show (label124); + gtk_table_attach (GTK_TABLE (table1), label124, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label124), 0, 0.5); + + label124a = gtk_label_new (_("Global preamp:")); + gtk_widget_show (label124a); + gtk_table_attach (GTK_TABLE (table1), label124a, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label124a), 0, 0.5); + + hbox100a = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox100a); + gtk_table_attach (GTK_TABLE (table1), hbox100a, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + + label125a = gtk_label_new (_("-12 dB")); + gtk_widget_show (label125a); + gtk_box_pack_start (GTK_BOX (hbox100a), label125a, FALSE, FALSE, 0); + + global_preamp = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, -12, 12, 0, 0, 0))); + gtk_widget_show (global_preamp); + gtk_box_pack_start (GTK_BOX (hbox100a), global_preamp, TRUE, TRUE, 0); + gtk_scale_set_value_pos (GTK_SCALE (global_preamp), GTK_POS_BOTTOM); + gtk_scale_set_digits (GTK_SCALE (global_preamp), 0); + + label126a = gtk_label_new (_("+12 dB")); + gtk_widget_show (label126a); + gtk_box_pack_start (GTK_BOX (hbox100a), label126a, FALSE, FALSE, 0); + hbox66 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox66); gtk_box_pack_start (GTK_BOX (vbox8), hbox66, FALSE, FALSE, 0); @@ -2060,7 +2103,7 @@ create_prefwin (void) gtk_widget_show (label128); gtk_box_pack_start (GTK_BOX (hbox101), label128, FALSE, FALSE, 0); - gui_plugin = gtk_combo_box_new_text (); + gui_plugin = gtk_combo_box_text_new (); gtk_widget_show (gui_plugin); gtk_box_pack_start (GTK_BOX (hbox101), gui_plugin, TRUE, TRUE, 0); @@ -2347,15 +2390,15 @@ create_prefwin (void) gtk_box_pack_start (GTK_BOX (hbox15), label20, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label20), 0, 0.5); - pref_network_proxytype = gtk_combo_box_new_text (); + pref_network_proxytype = gtk_combo_box_text_new (); gtk_widget_show (pref_network_proxytype); gtk_box_pack_start (GTK_BOX (hbox15), pref_network_proxytype, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_network_proxytype), "HTTP"); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_network_proxytype), "HTTP_1_0"); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_network_proxytype), "SOCKS4"); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_network_proxytype), "SOCKS5"); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_network_proxytype), "SOCKS4A"); - gtk_combo_box_append_text (GTK_COMBO_BOX (pref_network_proxytype), "SOCKS5_HOSTNAME"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_network_proxytype), "HTTP"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_network_proxytype), "HTTP_1_0"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_network_proxytype), "SOCKS4"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_network_proxytype), "SOCKS5"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_network_proxytype), "SOCKS4A"); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (pref_network_proxytype), "SOCKS5_HOSTNAME"); hbox61 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox61); @@ -2486,22 +2529,22 @@ create_prefwin (void) weblink = create_plugin_weblink ("weblink", "", "", 0, 0); gtk_widget_show (weblink); gtk_box_pack_start (GTK_BOX (hbox20), weblink, TRUE, FALSE, 0); - GTK_WIDGET_UNSET_FLAGS (weblink, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (weblink, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(weblink, FALSE); + gtk_widget_set_can_default(weblink, FALSE); label3 = gtk_label_new (_("Plugins")); gtk_widget_show (label3); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 6), label3); gtk_misc_set_alignment (GTK_MISC (label3), 0.48, 0.5); - dialog_action_area2 = GTK_DIALOG (prefwin)->action_area; + dialog_action_area2 = gtk_dialog_get_action_area (GTK_DIALOG (prefwin)); gtk_widget_show (dialog_action_area2); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area2), GTK_BUTTONBOX_END); closebutton1 = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (closebutton1); gtk_dialog_add_action_widget (GTK_DIALOG (prefwin), closebutton1, GTK_RESPONSE_CLOSE); - GTK_WIDGET_SET_FLAGS (closebutton1, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(closebutton1, TRUE); g_signal_connect ((gpointer) prefwin, "configure_event", G_CALLBACK (on_prefwin_configure_event), @@ -2524,6 +2567,9 @@ create_prefwin (void) g_signal_connect ((gpointer) replaygain_preamp, "value_changed", G_CALLBACK (on_replaygain_preamp_value_changed), NULL); + g_signal_connect ((gpointer) global_preamp, "value_changed", + G_CALLBACK (on_global_preamp_value_changed), + NULL); g_signal_connect ((gpointer) cli_add_to_playlist, "toggled", G_CALLBACK (on_cli_add_to_playlist_toggled), NULL); @@ -2684,11 +2730,17 @@ create_prefwin (void) GLADE_HOOKUP_OBJECT (prefwin, label8, "label8"); GLADE_HOOKUP_OBJECT (prefwin, pref_replaygain_mode, "pref_replaygain_mode"); GLADE_HOOKUP_OBJECT (prefwin, pref_replaygain_scale, "pref_replaygain_scale"); + GLADE_HOOKUP_OBJECT (prefwin, table1, "table1"); GLADE_HOOKUP_OBJECT (prefwin, hbox100, "hbox100"); - GLADE_HOOKUP_OBJECT (prefwin, label124, "label124"); GLADE_HOOKUP_OBJECT (prefwin, label125, "label125"); GLADE_HOOKUP_OBJECT (prefwin, replaygain_preamp, "replaygain_preamp"); GLADE_HOOKUP_OBJECT (prefwin, label126, "label126"); + GLADE_HOOKUP_OBJECT (prefwin, label124, "label124"); + GLADE_HOOKUP_OBJECT (prefwin, label124a, "label124a"); + GLADE_HOOKUP_OBJECT (prefwin, hbox100a, "hbox100a"); + GLADE_HOOKUP_OBJECT (prefwin, label125a, "label125a"); + GLADE_HOOKUP_OBJECT (prefwin, global_preamp, "global_preamp"); + GLADE_HOOKUP_OBJECT (prefwin, label126a, "label126a"); GLADE_HOOKUP_OBJECT (prefwin, hbox66, "hbox66"); GLADE_HOOKUP_OBJECT (prefwin, cli_add_to_playlist, "cli_add_to_playlist"); GLADE_HOOKUP_OBJECT (prefwin, cli_playlist_name, "cli_playlist_name"); @@ -2845,7 +2897,7 @@ create_entrydialog (void) gtk_window_set_destroy_with_parent (GTK_WINDOW (entrydialog), TRUE); gtk_window_set_type_hint (GTK_WINDOW (entrydialog), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox3 = GTK_DIALOG (entrydialog)->vbox; + dialog_vbox3 = gtk_dialog_get_content_area (GTK_DIALOG (entrydialog)); gtk_widget_show (dialog_vbox3); vbox15 = gtk_vbox_new (FALSE, 0); @@ -2867,14 +2919,14 @@ create_entrydialog (void) gtk_entry_set_invisible_char (GTK_ENTRY (title), 8226); gtk_entry_set_activates_default (GTK_ENTRY (title), TRUE); - dialog_action_area3 = GTK_DIALOG (entrydialog)->action_area; + dialog_action_area3 = gtk_dialog_get_action_area (GTK_DIALOG (entrydialog)); gtk_widget_show (dialog_action_area3); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_END); cancelbutton2 = gtk_button_new (); gtk_widget_show (cancelbutton2); gtk_dialog_add_action_widget (GTK_DIALOG (entrydialog), cancelbutton2, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton2, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton2, TRUE); alignment17 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment17); @@ -2895,7 +2947,7 @@ create_entrydialog (void) okbutton2 = gtk_button_new (); gtk_widget_show (okbutton2); gtk_dialog_add_action_widget (GTK_DIALOG (entrydialog), okbutton2, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton2, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton2, TRUE); alignment16 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment16); @@ -2960,7 +3012,7 @@ create_addlocationdlg (void) gtk_window_set_title (GTK_WINDOW (addlocationdlg), _("Add location")); gtk_window_set_type_hint (GTK_WINDOW (addlocationdlg), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox4 = GTK_DIALOG (addlocationdlg)->vbox; + dialog_vbox4 = gtk_dialog_get_content_area (GTK_DIALOG (addlocationdlg)); gtk_widget_show (dialog_vbox4); hbox34 = gtk_hbox_new (FALSE, 8); @@ -2979,14 +3031,14 @@ create_addlocationdlg (void) gtk_entry_set_invisible_char (GTK_ENTRY (addlocation_entry), 8226); gtk_entry_set_activates_default (GTK_ENTRY (addlocation_entry), TRUE); - addlocation_actionarea = GTK_DIALOG (addlocationdlg)->action_area; + addlocation_actionarea = gtk_dialog_get_action_area (GTK_DIALOG (addlocationdlg)); gtk_widget_show (addlocation_actionarea); gtk_button_box_set_layout (GTK_BUTTON_BOX (addlocation_actionarea), GTK_BUTTONBOX_END); cancelbutton3 = gtk_button_new (); gtk_widget_show (cancelbutton3); gtk_dialog_add_action_widget (GTK_DIALOG (addlocationdlg), cancelbutton3, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton3, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton3, TRUE); alignment18 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment18); @@ -3007,7 +3059,7 @@ create_addlocationdlg (void) okbutton3 = gtk_button_new (); gtk_widget_show (okbutton3); gtk_dialog_add_action_widget (GTK_DIALOG (addlocationdlg), okbutton3, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton3, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton3, TRUE); alignment19 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment19); @@ -3073,7 +3125,7 @@ create_groupbydlg (void) gtk_window_set_title (GTK_WINDOW (groupbydlg), _("Group By")); gtk_window_set_type_hint (GTK_WINDOW (groupbydlg), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox5 = GTK_DIALOG (groupbydlg)->vbox; + dialog_vbox5 = gtk_dialog_get_content_area (GTK_DIALOG (groupbydlg)); gtk_widget_show (dialog_vbox5); vbox25 = gtk_vbox_new (FALSE, 8); @@ -3102,17 +3154,17 @@ create_groupbydlg (void) custom1 = title_formatting_help_link_create ("custom1", "", "", 0, 0); gtk_widget_show (custom1); gtk_box_pack_start (GTK_BOX (hbox75), custom1, TRUE, TRUE, 0); - GTK_WIDGET_UNSET_FLAGS (custom1, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (custom1, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(custom1, FALSE); + gtk_widget_set_can_default(custom1, FALSE); - dialog_action_area4 = GTK_DIALOG (groupbydlg)->action_area; + dialog_action_area4 = gtk_dialog_get_action_area (GTK_DIALOG (groupbydlg)); gtk_widget_show (dialog_action_area4); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area4), GTK_BUTTONBOX_END); cancelbutton4 = gtk_button_new (); gtk_widget_show (cancelbutton4); gtk_dialog_add_action_widget (GTK_DIALOG (groupbydlg), cancelbutton4, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton4, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton4, TRUE); alignment7 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment7); @@ -3133,7 +3185,7 @@ create_groupbydlg (void) okbutton4 = gtk_button_new (); gtk_widget_show (okbutton4); gtk_dialog_add_action_widget (GTK_DIALOG (groupbydlg), okbutton4, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton4, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton4, TRUE); alignment6 = gtk_alignment_new (0.5, 0.5, 0, 0); gtk_widget_show (alignment6); @@ -3198,7 +3250,7 @@ create_sortbydlg (void) gtk_window_set_modal (GTK_WINDOW (sortbydlg), TRUE); gtk_window_set_type_hint (GTK_WINDOW (sortbydlg), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox8 = GTK_DIALOG (sortbydlg)->vbox; + dialog_vbox8 = gtk_dialog_get_content_area (GTK_DIALOG (sortbydlg)); gtk_widget_show (dialog_vbox8); vbox28 = gtk_vbox_new (FALSE, 8); @@ -3226,8 +3278,8 @@ create_sortbydlg (void) custom3 = title_formatting_help_link_create ("custom3", "", "", 0, 0); gtk_widget_show (custom3); gtk_box_pack_start (GTK_BOX (hbox77), custom3, TRUE, TRUE, 0); - GTK_WIDGET_UNSET_FLAGS (custom3, GTK_CAN_FOCUS); - GTK_WIDGET_UNSET_FLAGS (custom3, GTK_CAN_DEFAULT); + gtk_widget_set_can_focus(custom3, FALSE); + gtk_widget_set_can_default(custom3, FALSE); hbox78 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox78); @@ -3237,25 +3289,25 @@ create_sortbydlg (void) gtk_widget_show (label109); gtk_box_pack_start (GTK_BOX (hbox78), label109, FALSE, FALSE, 0); - sortorder = gtk_combo_box_new_text (); + sortorder = gtk_combo_box_text_new (); gtk_widget_show (sortorder); gtk_box_pack_start (GTK_BOX (hbox78), sortorder, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (sortorder), _("Ascending")); - gtk_combo_box_append_text (GTK_COMBO_BOX (sortorder), _("Descending")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (sortorder), _("Ascending")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (sortorder), _("Descending")); - dialog_action_area7 = GTK_DIALOG (sortbydlg)->action_area; + dialog_action_area7 = gtk_dialog_get_action_area (GTK_DIALOG (sortbydlg)); gtk_widget_show (dialog_action_area7); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area7), GTK_BUTTONBOX_END); cancelbutton5 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton5); gtk_dialog_add_action_widget (GTK_DIALOG (sortbydlg), cancelbutton5, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton5, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton5, TRUE); okbutton5 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton5); gtk_dialog_add_action_widget (GTK_DIALOG (sortbydlg), okbutton5, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton5, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton5, TRUE); g_signal_connect ((gpointer) sortfmt, "activate", G_CALLBACK (on_sortfmt_activate), @@ -3298,7 +3350,7 @@ create_select_dsp_plugin (void) gtk_window_set_modal (GTK_WINDOW (select_dsp_plugin), TRUE); gtk_window_set_type_hint (GTK_WINDOW (select_dsp_plugin), GDK_WINDOW_TYPE_HINT_DIALOG); - dialog_vbox10 = GTK_DIALOG (select_dsp_plugin)->vbox; + dialog_vbox10 = gtk_dialog_get_content_area (GTK_DIALOG (select_dsp_plugin)); gtk_widget_show (dialog_vbox10); vbox31 = gtk_vbox_new (FALSE, 8); @@ -3314,23 +3366,23 @@ create_select_dsp_plugin (void) gtk_widget_show (label113); gtk_box_pack_start (GTK_BOX (hbox85), label113, FALSE, FALSE, 0); - plugin = gtk_combo_box_new_text (); + plugin = gtk_combo_box_text_new (); gtk_widget_show (plugin); gtk_box_pack_start (GTK_BOX (hbox85), plugin, TRUE, TRUE, 0); - dialog_action_area9 = GTK_DIALOG (select_dsp_plugin)->action_area; + dialog_action_area9 = gtk_dialog_get_action_area (GTK_DIALOG (select_dsp_plugin)); gtk_widget_show (dialog_action_area9); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area9), GTK_BUTTONBOX_END); cancelbutton7 = gtk_button_new_from_stock ("gtk-cancel"); gtk_widget_show (cancelbutton7); gtk_dialog_add_action_widget (GTK_DIALOG (select_dsp_plugin), cancelbutton7, GTK_RESPONSE_CANCEL); - GTK_WIDGET_SET_FLAGS (cancelbutton7, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(cancelbutton7, TRUE); okbutton7 = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (okbutton7); gtk_dialog_add_action_widget (GTK_DIALOG (select_dsp_plugin), okbutton7, GTK_RESPONSE_OK); - GTK_WIDGET_SET_FLAGS (okbutton7, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(okbutton7, TRUE); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (select_dsp_plugin, select_dsp_plugin, "select_dsp_plugin"); @@ -3401,7 +3453,7 @@ create_tagwritersettings (void) gtk_window_set_type_hint (GTK_WINDOW (tagwritersettings), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_dialog_set_has_separator (GTK_DIALOG (tagwritersettings), FALSE); - dialog_vbox11 = GTK_DIALOG (tagwritersettings)->vbox; + dialog_vbox11 = gtk_dialog_get_content_area (GTK_DIALOG (tagwritersettings)); gtk_widget_show (dialog_vbox11); vbox32 = gtk_vbox_new (FALSE, 0); @@ -3463,11 +3515,11 @@ create_tagwritersettings (void) gtk_widget_show (label118); gtk_box_pack_start (GTK_BOX (hbox91), label118, FALSE, FALSE, 0); - id3v2_version = gtk_combo_box_new_text (); + id3v2_version = gtk_combo_box_text_new (); gtk_widget_show (id3v2_version); gtk_box_pack_start (GTK_BOX (hbox91), id3v2_version, TRUE, TRUE, 0); - gtk_combo_box_append_text (GTK_COMBO_BOX (id3v2_version), _("2.3 (Recommended)")); - gtk_combo_box_append_text (GTK_COMBO_BOX (id3v2_version), _("2.4")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id3v2_version), _("2.3 (Recommended)")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (id3v2_version), _("2.4")); hbox92 = gtk_hbox_new (FALSE, 8); gtk_widget_show (hbox92); @@ -3579,14 +3631,14 @@ create_tagwritersettings (void) gtk_frame_set_label_widget (GTK_FRAME (frame10), label122); gtk_label_set_use_markup (GTK_LABEL (label122), TRUE); - dialog_action_area10 = GTK_DIALOG (tagwritersettings)->action_area; + dialog_action_area10 = gtk_dialog_get_action_area (GTK_DIALOG (tagwritersettings)); gtk_widget_show (dialog_action_area10); gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area10), GTK_BUTTONBOX_END); closebutton2 = gtk_button_new_from_stock ("gtk-close"); gtk_widget_show (closebutton2); gtk_dialog_add_action_widget (GTK_DIALOG (tagwritersettings), closebutton2, GTK_RESPONSE_CLOSE); - GTK_WIDGET_SET_FLAGS (closebutton2, GTK_CAN_DEFAULT); + gtk_widget_set_can_default(closebutton2, TRUE); g_signal_connect ((gpointer) write_id3v2, "toggled", G_CALLBACK (on_write_id3v2_toggled), diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c index 17083b7c..ceb61573 100644 --- a/plugins/gtkui/mainplaylist.c +++ b/plugins/gtkui/mainplaylist.c @@ -118,6 +118,7 @@ main_drag_n_drop (DdbListviewIter before, DdbPlaylistHandle from_playlist, uint3 } deadbeef->plt_unref (plt); deadbeef->pl_unlock (); + deadbeef->pl_save_all (); } void main_external_drag_n_drop (DdbListviewIter before, char *mem, int length) { @@ -161,13 +162,13 @@ void main_selection_changed (DdbListviewIter it, int idx) { deadbeef->sendmessage (DB_EV_SELCHANGED, 0, deadbeef->plt_get_curr_idx (), PL_MAIN); } -void main_draw_group_title (DdbListview *listview, GdkDrawable *drawable, DdbListviewIter it, int x, int y, int width, int height) { +void main_draw_group_title (DdbListview *listview, cairo_t *drawable, DdbListviewIter it, int x, int y, int width, int height) { if (group_by_str && group_by_str[0]) { char str[1024]; deadbeef->pl_format_title ((DB_playItem_t *)it, -1, str, sizeof (str), -1, group_by_str); int theming = !gtkui_override_listview_colors (); if (theming) { - GdkColor *clr = &theme_treeview->style->fg[GTK_STATE_NORMAL]; + GdkColor *clr = >k_widget_get_style(theme_treeview)->fg[GTK_STATE_NORMAL]; float rgb[] = {clr->red/65535.f, clr->green/65535.f, clr->blue/65535.f}; draw_set_fg_color (rgb); } @@ -186,6 +187,7 @@ void main_draw_group_title (DdbListview *listview, GdkDrawable *drawable, DdbLis void main_delete_selected (void) { deadbeef->pl_delete_selected (); + deadbeef->pl_save_all (); main_refresh (); search_refresh (); } diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c index 5cc749d8..64f45d6d 100644 --- a/plugins/gtkui/plcommon.c +++ b/plugins/gtkui/plcommon.c @@ -74,7 +74,7 @@ rewrite_column_config (DdbListview *listview, const char *name) { #define ART_PADDING_HORZ 8 #define ART_PADDING_VERT 0 -void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListviewIter it, DdbListviewIter group_it, int column, int group_y, int x, int y, int width, int height) { +void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, DdbListviewIter group_it, int column, int group_y, int x, int y, int width, int height) { const char *ctitle; int cwidth; int calign_right; @@ -89,20 +89,27 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview if (cinf->id == DB_COLUMN_ALBUM_ART) { if (theming) { +#if GTK_CHECK_VERSION(3,0,0) + cairo_rectangle (cr, x, y, width, height); + cairo_clip (cr); + gtk_paint_flat_box (gtk_widget_get_style (theme_treeview), cr, GTK_STATE_NORMAL, GTK_SHADOW_NONE, theme_treeview, "cell_even_ruled", x-1, y, width+2, height); + cairo_reset_clip (cr); +#else GdkRectangle clip = { .x = x, .y = y, .width = width, .height = height, }; - gtk_paint_flat_box (theme_treeview->style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_NONE, &clip, theme_treeview, "cell_even_ruled", x-1, y, width+2, height); + gtk_paint_flat_box (gtk_widget_get_style (theme_treeview), gtk_widget_get_window (listview->list), GTK_STATE_NORMAL, GTK_SHADOW_NONE, &clip, theme_treeview, "cell_even_ruled", x-1, y, width+2, height); +#endif } else { - GdkGC *gc = gdk_gc_new (drawable); GdkColor clr; - gdk_gc_set_rgb_fg_color (gc, (gtkui_get_listview_even_row_color (&clr), &clr)); - gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height); - g_object_unref (gc); + gtkui_get_listview_even_row_color (&clr); + cairo_set_source_rgb (cr, clr.red/65535.f, clr.green/65535.f, clr.blue/65535.f); + cairo_rectangle (cr, x, y, width, height); + cairo_fill (cr); } int art_width = width - ART_PADDING_HORZ * 2; int art_y = y; // dest y @@ -120,7 +127,6 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview if (group_it) { int h = cwidth - group_y; h = min (height, art_h); -// gdk_draw_rectangle (drawable, GTK_WIDGET (listview)->style->white_gc, TRUE, x, y, width, h); const char *album = deadbeef->pl_find_meta (group_it, "album"); const char *artist = deadbeef->pl_find_meta (group_it, "artist"); if (!album || !*album) { @@ -135,8 +141,9 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview pw = min (art_width, pw); ph -= sy; ph = min (ph, h); - gdk_draw_pixbuf (drawable, GTK_WIDGET (listview)->style->white_gc, pixbuf, 0, sy, x + ART_PADDING_HORZ, art_y, pw, ph, GDK_RGB_DITHER_NONE, 0, 0); -// gdk_draw_rectangle (drawable, GTK_WIDGET (listview)->style->black_gc, FALSE, x + ART_PADDING_HORZ, art_y, pw, ph); + gdk_cairo_set_source_pixbuf (cr, pixbuf, (x + ART_PADDING_HORZ)-0, (art_y)-sy); + cairo_rectangle (cr, x + ART_PADDING_HORZ, art_y, pw, ph); + cairo_fill (cr); } g_object_unref (pixbuf); } @@ -156,7 +163,9 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview else { pixbuf = buffering16_pixbuf; } - gdk_draw_pixbuf (drawable, GTK_WIDGET (listview)->style->black_gc, pixbuf, 0, 0, x + cwidth/2 - 8, y + height/2 - 8, 16, 16, GDK_RGB_DITHER_NONE, 0, 0); + gdk_cairo_set_source_pixbuf (cr, pixbuf, x + cwidth/2 - 8, y + height/2 - 8); + cairo_rectangle (cr, x + cwidth/2 - 8, y + height/2 - 8, 16, 16); + cairo_fill (cr); } else if (it) { char text[1024]; @@ -164,10 +173,10 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview GdkColor *color = NULL; if (theming) { if (deadbeef->pl_is_selected (it)) { - color = &theme_treeview->style->text[GTK_STATE_SELECTED]; + color = >k_widget_get_style (theme_treeview)->text[GTK_STATE_SELECTED]; } else { - color = &theme_treeview->style->text[GTK_STATE_NORMAL]; + color = >k_widget_get_style (theme_treeview)->text[GTK_STATE_NORMAL]; } } else { @@ -182,7 +191,7 @@ void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListview float fg[3] = {(float)color->red/0xffff, (float)color->green/0xffff, (float)color->blue/0xffff}; draw_set_fg_color (fg); - draw_init_font (GTK_WIDGET (listview)->style); + draw_init_font (gtk_widget_get_style (GTK_WIDGET (listview))); if (gtkui_embolden_current_track && it && it == playing_track) { draw_init_font_bold (); } @@ -281,6 +290,7 @@ on_clear1_activate (GtkMenuItem *menuitem, gpointer user_data) { deadbeef->pl_clear (); + deadbeef->pl_save_all (); deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); } @@ -289,6 +299,7 @@ on_remove1_activate (GtkMenuItem *menuitem, gpointer user_data) { int cursor = deadbeef->pl_delete_selected (); + deadbeef->pl_save_all (); deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); } @@ -298,6 +309,7 @@ on_crop1_activate (GtkMenuItem *menuitem, gpointer user_data) { deadbeef->pl_crop_selected (); + deadbeef->pl_save_all (); deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); } @@ -306,6 +318,7 @@ on_remove2_activate (GtkMenuItem *menuitem, gpointer user_data) { int cursor = deadbeef->pl_delete_selected (); + deadbeef->pl_save_all (); deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); } @@ -340,6 +353,7 @@ on_remove_from_disk_activate (GtkMenuItem *menuitem, } int cursor = deadbeef->pl_delete_selected (); + deadbeef->pl_save_all (); deadbeef->pl_unlock (); deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); @@ -378,7 +392,7 @@ actionitem_activate (GtkMenuItem *menuitem, #define HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ - gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + g_object_ref (widget), (GDestroyNotify) g_object_unref) static GtkWidget* @@ -392,7 +406,7 @@ find_popup (GtkWidget *widget, if (GTK_IS_MENU (widget)) parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); else - parent = widget->parent; + parent = gtk_widget_get_parent (widget); if (!parent) parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); if (parent == NULL) @@ -404,6 +418,7 @@ find_popup (GtkWidget *widget, widget_name); return found_widget; } + void list_context_menu (DdbListview *listview, DdbListviewIter it, int idx) { clicked_idx = deadbeef->pl_get_idx_of (it); diff --git a/plugins/gtkui/plcommon.h b/plugins/gtkui/plcommon.h index edd7d3f2..d0ebedad 100644 --- a/plugins/gtkui/plcommon.h +++ b/plugins/gtkui/plcommon.h @@ -35,7 +35,7 @@ write_column_config (const char *name, int idx, const char *title, int width, in void rewrite_column_config (DdbListview *listview, const char *name); -void draw_column_data (DdbListview *listview, GdkDrawable *drawable, DdbListviewIter it, DdbListviewIter group_it, int column, int group_y, int x, int y, int width, int height); +void draw_column_data (DdbListview *listview, cairo_t *drawable, DdbListviewIter it, DdbListviewIter group_it, int column, int group_y, int x, int y, int width, int height); void list_context_menu (DdbListview *listview, DdbListviewIter it, int idx); diff --git a/plugins/gtkui/pluginconf.c b/plugins/gtkui/pluginconf.c index 04f73084..42070d4d 100644 --- a/plugins/gtkui/pluginconf.c +++ b/plugins/gtkui/pluginconf.c @@ -252,9 +252,9 @@ gtkui_run_dialog (GtkWidget *parentwin, ddb_dialog_t *conf, uint32_t buttons, in int pack[100] = {0}; int ncurr = 0; - widgets[ncurr] = GTK_DIALOG (win)->vbox; + widgets[ncurr] = gtk_dialog_get_content_area (GTK_DIALOG (win)); gtk_box_set_spacing (GTK_BOX (widgets[ncurr]), 8); - GtkWidget *action_area = GTK_DIALOG (win)->action_area; + GtkWidget *action_area = gtk_dialog_get_action_area (GTK_DIALOG (win)); gtk_widget_show (action_area); gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area), GTK_BUTTONBOX_END); @@ -421,7 +421,7 @@ gtkui_run_dialog (GtkWidget *parentwin, ddb_dialog_t *conf, uint32_t buttons, in label = gtk_label_new (_(labeltext)); gtk_widget_show (label); - prop = gtk_combo_box_new_text (); + prop = gtk_combo_box_text_new (); gtk_widget_show (prop); for (int i = 0; i < n; i++) { @@ -431,7 +431,7 @@ gtkui_run_dialog (GtkWidget *parentwin, ddb_dialog_t *conf, uint32_t buttons, in break; } - gtk_combo_box_append_text (GTK_COMBO_BOX (prop), entry); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (prop), entry); } if (!script) { break; diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index d2d09300..bfcc80c9 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -57,7 +57,7 @@ gtk_enum_sound_callback (const char *name, const char *desc, void *userdata) { return; } GtkComboBox *combobox = GTK_COMBO_BOX (userdata); - gtk_combo_box_append_text (combobox, desc); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), desc); deadbeef->conf_lock (); if (!strcmp (deadbeef->conf_get_str_fast ("alsa_soundcard", "default"), name)) { @@ -79,7 +79,7 @@ preferences_fill_soundcards (void) { GtkTreeModel *mdl = gtk_combo_box_get_model (combobox); gtk_list_store_clear (GTK_LIST_STORE (mdl)); - gtk_combo_box_append_text (combobox, _("Default Audio Device")); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Default Audio Device")); deadbeef->conf_lock (); const char *s = deadbeef->conf_get_str_fast ("alsa_soundcard", "default"); @@ -318,12 +318,12 @@ prefwin_add_hotkeys_tab (GtkWidget *prefwin) { addhotkey = gtk_button_new_with_mnemonic (_("Add")); gtk_widget_show (addhotkey); gtk_container_add (GTK_CONTAINER (hbuttonbox3), addhotkey); - GTK_WIDGET_SET_FLAGS (addhotkey, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (addhotkey, TRUE); removehotkey = gtk_button_new_with_mnemonic (_("Remove")); gtk_widget_show (removehotkey); gtk_container_add (GTK_CONTAINER (hbuttonbox3), removehotkey); - GTK_WIDGET_SET_FLAGS (removehotkey, GTK_CAN_DEFAULT); + gtk_widget_set_can_default (removehotkey, TRUE); label66 = gtk_label_new (_("Global Hotkeys")); gtk_widget_show (label66); @@ -473,7 +473,7 @@ on_preferences_activate (GtkMenuItem *menuitem, const char *outplugname = deadbeef->conf_get_str_fast ("output_plugin", "ALSA output plugin"); DB_output_t **out_plugs = deadbeef->plug_get_output_list (); for (int i = 0; out_plugs[i]; i++) { - gtk_combo_box_append_text (combobox, out_plugs[i]->plugin.name); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), out_plugs[i]->plugin.name); if (!strcmp (outplugname, out_plugs[i]->plugin.name)) { gtk_combo_box_set_active (combobox, i); } @@ -500,6 +500,9 @@ on_preferences_activate (GtkMenuItem *menuitem, // replaygain_preamp gtk_range_set_value (GTK_RANGE (lookup_widget (w, "replaygain_preamp")), deadbeef->conf_get_int ("replaygain_preamp", 0)); + // global_preamp + gtk_range_set_value (GTK_RANGE (lookup_widget (w, "global_preamp")), deadbeef->conf_get_int ("global_preamp", 0)); + // 8_to_16 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lookup_widget (w, "convert8to16")), deadbeef->conf_get_int ("streamer.8_to_16", 1)); @@ -547,7 +550,7 @@ on_preferences_activate (GtkMenuItem *menuitem, combobox = GTK_COMBO_BOX (lookup_widget (w, "gui_plugin")); const char **names = deadbeef->plug_get_gui_names (); for (int i = 0; names[i]; i++) { - gtk_combo_box_append_text (combobox, names[i]); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), names[i]); if (!strcmp (names[i], deadbeef->conf_get_str_fast ("gui_plugin", "GTK2"))) { gtk_combo_box_set_active (combobox, i); } @@ -725,6 +728,14 @@ on_replaygain_preamp_value_changed (GtkRange *range, deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); } +void +on_global_preamp_value_changed (GtkRange *range, + gpointer user_data) +{ + float val = gtk_range_get_value (range); + deadbeef->conf_set_float ("global_preamp", val); + deadbeef->sendmessage (DB_EV_CONFIGCHANGED, 0, 0, 0); +} void on_pref_close_send_to_tray_clicked (GtkButton *button, @@ -1326,7 +1337,7 @@ void on_gui_plugin_changed (GtkComboBox *combobox, gpointer user_data) { - gchar *txt = gtk_combo_box_get_active_text (combobox); + gchar *txt = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combobox)); if (txt) { deadbeef->conf_set_str ("gui_plugin", txt); g_free (txt); diff --git a/plugins/gtkui/support.c b/plugins/gtkui/support.c index 00aff298..82e22c73 100644 --- a/plugins/gtkui/support.c +++ b/plugins/gtkui/support.c @@ -27,7 +27,7 @@ lookup_widget (GtkWidget *widget, if (GTK_IS_MENU (widget)) parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); else - parent = widget->parent; + parent = gtk_widget_get_parent (widget); if (!parent) parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); if (parent == NULL) @@ -142,3 +142,57 @@ glade_set_atk_action_description (AtkAction *action, } } +#if GTK_CHECK_VERSION(3,0,0) +GtkWidget * +gtk_combo_box_entry_new_text(void) { + GtkWidget *w = gtk_combo_box_text_new_with_entry (); +} + +void +gtk_dialog_set_has_separator (GtkDialog *dlg, gboolean has) { +} +#endif + +#if !GTK_CHECK_VERSION(2,22,0) +GdkDragAction +gdk_drag_context_get_selected_action (GdkDragContext *context) { + return context->action; +} +GList * +gdk_drag_context_list_targets (GdkDragContext *context) { + return context->targets; +} +#endif + +#if !GTK_CHECK_VERSION(2,24,0) +#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX +GtkWidget * +gtk_combo_box_text_new () { + return gtk_combo_box_new_text (); +} + +GtkWidget * +gtk_combo_box_text_new_with_entry (void) { + return gtk_combo_box_entry_new (); +} + +void +gtk_combo_box_text_append_text (GtkComboBoxText *combo_box, const gchar *text) { + gtk_combo_box_append_text (combo_box, text); +} + +void +gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box, gint position, const gchar *text) { + gtk_combo_box_insert_text (combo_box, position, text); +} + +void +gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box, const gchar *text) { + gtk_combo_box_prepend_text (combo_box, text); +} +gchar * +gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box) { + return gtk_combo_box_get_active_text (combo_box); +} + +#endif diff --git a/plugins/gtkui/support.h b/plugins/gtkui/support.h index b4b0ace3..351878b3 100644 --- a/plugins/gtkui/support.h +++ b/plugins/gtkui/support.h @@ -1,12 +1,16 @@ -/* - * DO NOT EDIT THIS FILE - it is generated by Glade. - */ +#ifndef __GTKUI_SUPPORT_H +#define __GTKUI_SUPPORT_H #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <gtk/gtk.h> +#if GTK_CHECK_VERSION(3,0,0) +#include <gdk/gdkkeysyms-compat.h> +#else +#include <gdk/gdkkeysyms.h> +#endif /* * Standard gettext macros. @@ -69,3 +73,30 @@ void glade_set_atk_action_description (AtkAction *action, const gchar *action_name, const gchar *description); +#if GTK_CHECK_VERSION(3,0,0) +GtkWidget * +gtk_combo_box_entry_new_text(void); + +void +gtk_dialog_set_has_separator (GtkDialog *dlg, gboolean has); +#endif + +#if !GTK_CHECK_VERSION(2,22,0) +GdkDragAction +gdk_drag_context_get_selected_action (GdkDragContext *context); +GList * +gdk_drag_context_list_targets (GdkDragContext *context); +#endif + +#if !GTK_CHECK_VERSION(2,24,0) +#define GTK_COMBO_BOX_TEXT GTK_COMBO_BOX +typedef GtkComboBox GtkComboBoxText; +GtkWidget *gtk_combo_box_text_new (); +GtkWidget *gtk_combo_box_text_new_with_entry (void); +void gtk_combo_box_text_append_text (GtkComboBoxText *combo_box, const gchar *text); +void gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box, gint position, const gchar *text); +void gtk_combo_box_text_prepend_text (GtkComboBoxText *combo_box, const gchar *text); +gchar *gtk_combo_box_text_get_active_text (GtkComboBoxText *combo_box); +#endif + +#endif diff --git a/plugins/gtkui/trkproperties.c b/plugins/gtkui/trkproperties.c index 5ff479ce..3601f48b 100644 --- a/plugins/gtkui/trkproperties.c +++ b/plugins/gtkui/trkproperties.c @@ -67,7 +67,7 @@ build_key_list (const char ***pkeys, int props, DB_playItem_t **tracks, int numt for (int i = 0; i < numtracks; i++) { DB_metaInfo_t *meta = deadbeef->pl_get_metadata_head (tracks[i]); while (meta) { - if ((props && meta->key[0] == ':') || (!props && meta->key[0] != ':')) { + if (meta->key[0] != '!' && ((props && meta->key[0] == ':') || (!props && meta->key[0] != ':'))) { int k = 0; for (; k < n; k++) { if (meta->key == keys[k]) { @@ -255,7 +255,7 @@ add_field (GtkListStore *store, const char *key, const char *title, int is_prop, char val[1000]; size_t ml = strlen (mult); memcpy (val, mult, ml+1); - int n = get_field_value (val + ml, sizeof (val) - ml, key, deadbeef->pl_find_meta, equals_ptr, tracks, numtracks); + int n = get_field_value (val + ml, sizeof (val) - ml, key, deadbeef->pl_find_meta_raw, equals_ptr, tracks, numtracks); GtkTreeIter iter; gtk_list_store_append (store, &iter); @@ -265,7 +265,7 @@ add_field (GtkListStore *store, const char *key, const char *title, int is_prop, } else { deadbeef->pl_lock (); - const char *val = deadbeef->pl_find_meta (tracks[0], key); + const char *val = deadbeef->pl_find_meta_raw (tracks[0], key); if (!val) { val = ""; } @@ -498,7 +498,7 @@ static gboolean set_progress_cb (void *ctx) { DB_playItem_t *track = ctx; GtkWidget *progressitem = lookup_widget (progressdlg, "progresstitle"); - const char *fname = deadbeef->pl_find_meta (track, ":URI"); + const char *fname = deadbeef->pl_find_meta_raw (track, ":URI"); gtk_entry_set_text (GTK_ENTRY (progressitem), fname); deadbeef->pl_item_unref (track); } @@ -510,7 +510,7 @@ write_meta_worker (void *ctx) { break; } DB_playItem_t *track = tracks[t]; - const char *decoder_id = deadbeef->pl_find_meta (track, ":DECODER"); + const char *decoder_id = deadbeef->pl_find_meta_raw (track, ":DECODER"); if (track && decoder_id) { int is_subtrack = deadbeef->pl_get_item_flags (track) & DDB_IS_SUBTRACK; if (is_subtrack) { @@ -564,7 +564,7 @@ on_write_tags_clicked (GtkButton *button, DB_metaInfo_t *meta = deadbeef->pl_get_metadata_head (tracks[i]); while (meta) { DB_metaInfo_t *next = meta->next; - if (meta->key[0] != ':') { + if (meta->key[0] != ':' && meta->key[0] != '!' && meta->key[0] != '_') { GtkTreeIter iter; gboolean res = gtk_tree_model_get_iter_first (model, &iter); int mult = 0; @@ -638,7 +638,7 @@ on_add_field_activate (GtkMenuItem *menuitem, GtkTreeIter iter; // check for _ and : - if (text[0] == '_' || text[0] == ':') { + if (text[0] == '_' || text[0] == ':' || text[0] == '!') { GtkWidget *d = gtk_message_dialog_new (GTK_WINDOW (dlg), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Field names must not start with : or _")); gtk_window_set_title (GTK_WINDOW (d), _("Cannot add field")); diff --git a/plugins/gtkui/wingeom.c b/plugins/gtkui/wingeom.c index 8591a5c6..47b6f960 100644 --- a/plugins/gtkui/wingeom.c +++ b/plugins/gtkui/wingeom.c @@ -27,7 +27,7 @@ void wingeom_save (GtkWidget *widget, const char *name) { #if GTK_CHECK_VERSION(2,2,0) - GdkWindowState window_state = gdk_window_get_state (GDK_WINDOW (widget->window)); + GdkWindowState window_state = gdk_window_get_state (gtk_widget_get_window (widget)); #else GdkWindowState window_state = gdk_window_get_state (G_OBJECT (widget)); #endif @@ -46,6 +46,7 @@ wingeom_save (GtkWidget *widget, const char *name) { snprintf (key, sizeof (key), "%s.geometry.h", name); deadbeef->conf_set_int (key, h); } + deadbeef->conf_save (); } void diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index 14361445..17bc5a6b 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -347,7 +347,7 @@ static int lfm_uri_encode (char *out, int outl, const char *str) { int l = outl; //trace ("lfm_uri_encode %p %d %s\n", out, outl, str); - while (*str) { + while (*str && *((uint8_t*)str) >= 32) { if (outl <= 1) { //trace ("no space left for 1 byte in buffer\n"); return -1; diff --git a/plugins/m3u/m3u.c b/plugins/m3u/m3u.c index bcf6a13c..f19a674c 100644 --- a/plugins/m3u/m3u.c +++ b/plugins/m3u/m3u.c @@ -58,14 +58,45 @@ load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab } deadbeef->fread (buffer, 1, sz, fp); deadbeef->fclose (fp); + + int line = 0; + int read_extm3u = 0; + const uint8_t *p = buffer; const uint8_t *end = buffer+sz; + const uint8_t *e; + int length = -1; + char title[1000] = ""; + char artist[1000] = ""; while (p < end) { + line++; p = skipspaces (p, end); if (p >= end) { break; } if (*p == '#') { + if (line == 1) { + if (end - p >= 7 && !strncmp (p, "#EXTM3U", 7)) { + read_extm3u = 1; + } + } + else if (read_extm3u) { + if (end - p >= 8 && !strncmp (p, "#EXTINF:", 8)) { + length = -1; + title[0] = 0; + artist[0] = 0; + p += 8; + e = p; + while (e < end && *e >= 0x20) { + e++; + } + int n = e-p; + uint8_t nm[n+1]; + memcpy (nm, p, n); + nm[n] = 0; + sscanf (nm, "%d,%1000s - %1000s", &length, artist, title); + } + } while (p < end && *p >= 0x20) { p++; } @@ -74,7 +105,7 @@ load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab } continue; } - const uint8_t *e = p; + e = p; while (e < end && *e >= 0x20) { e++; } @@ -87,6 +118,18 @@ load_m3u (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab if (strrchr (nm, '/')) { trace ("pl_insert_m3u: adding file %s\n", nm); it = deadbeef->plt_insert_file (plt, after, nm, pabort, cb, user_data); + if (length >= 0) { + deadbeef->plt_set_item_duration (plt, it, length); + } + if (title[0]) { + deadbeef->pl_replace_meta (it, "title", title); + } + else if (artist[0]) { + deadbeef->pl_replace_meta (it, "title", " "); + } + if (artist[0]) { + deadbeef->pl_replace_meta (it, "artist", artist); + } } else { int l = strlen (nm); @@ -341,19 +384,20 @@ load_pls (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pab static DB_playItem_t * m3uplug_load (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname, int *pabort, int (*cb)(DB_playItem_t *it, void *data), void *user_data) { const char *ext = strrchr (fname, '.'); - if (!ext) { - return NULL; + if (ext) { + ext++; } - ext++; - if (!strcasecmp (ext, "m3u") || !strcasecmp (ext, "m3u8")) { - return load_m3u (plt, after, fname, pabort, cb, user_data); + DB_playItem_t *ret = NULL; + if (ext && !strcasecmp (ext, "pls")) { + ret = load_pls (plt, after, fname, pabort, cb, user_data); } - else if (!strcasecmp (ext, "pls")) { - return load_pls (plt, after, fname, pabort, cb, user_data); + + if (!ret) { + ret = load_m3u (plt, after, fname, pabort, cb, user_data); } - return NULL; + return ret; } int diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 5c712050..041386a2 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -723,7 +723,7 @@ cmp3_open (uint32_t hints) { } void -cmp3_set_extra_properties (buffer_t *buffer) { +cmp3_set_extra_properties (buffer_t *buffer, int fake) { char s[100]; int64_t size = deadbeef->fgetlength (buffer->file); if (size >= 0) { @@ -785,7 +785,7 @@ cmp3_set_extra_properties (buffer_t *buffer) { snprintf (s, sizeof (s), "MPEG%s layer%d", versions[buffer->version-1], buffer->layer); deadbeef->pl_replace_meta (buffer->it, ":MPEG_VERSION", s); deadbeef->pl_replace_meta (buffer->it, ":XING_HEADER", buffer->have_xing_header ? "Yes" : "No"); - deadbeef->pl_replace_meta (buffer->it, ":FILETYPE", "MP3"); + deadbeef->pl_replace_meta (buffer->it, fake ? "!FILETYPE" : ":FILETYPE", "MP3"); } static int @@ -839,7 +839,6 @@ cmp3_init (DB_fileinfo_t *_info, DB_playItem_t *it) { } else { deadbeef->fset_track (info->buffer.file, it); - deadbeef->pl_delete_meta (info->buffer.it, ":FILETYPE"); int64_t len = deadbeef->fgetlength (info->buffer.file); if (len > 0) { deadbeef->pl_delete_all_meta (it); @@ -856,7 +855,7 @@ cmp3_init (DB_fileinfo_t *_info, DB_playItem_t *it) { } deadbeef->fseek (info->buffer.file, 0, SEEK_SET); - cmp3_set_extra_properties (&info->buffer); + cmp3_set_extra_properties (&info->buffer, 1); ddb_playlist_t *plt = deadbeef->pl_get_playlist (it); deadbeef->plt_set_item_duration (plt, it, info->buffer.duration); @@ -1353,7 +1352,7 @@ cmp3_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { deadbeef->pl_set_meta_int (it, ":MP3_PADDING", buffer.padding); buffer.it = it; - cmp3_set_extra_properties (&buffer); + cmp3_set_extra_properties (&buffer, 0); deadbeef->plt_set_item_duration (plt, it, buffer.duration); deadbeef->fclose (fp); diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c index 8a069300..5b1add5a 100644 --- a/plugins/vfs_curl/vfs_curl.c +++ b/plugins/vfs_curl/vfs_curl.c @@ -202,22 +202,47 @@ http_parse_shoutcast_meta (HTTP_FILE *fp, const char *meta, int size) { title[s] = 0; trace ("got stream title: %s\n", title); if (fp->track) { + int songstarted = 0; char *tit = strstr (title, " - "); + deadbeef->pl_lock (); if (tit) { *tit = 0; tit += 3; - vfs_curl_set_meta (fp->track, "artist", title); - vfs_curl_set_meta (fp->track, "title", tit); + + const char *orig_title = deadbeef->pl_find_meta (fp->track, "title"); + const char *orig_artist = deadbeef->pl_find_meta (fp->track, "artist"); + + if (!orig_title || strcasecmp (orig_title, tit)) { + vfs_curl_set_meta (fp->track, "title", tit); + songstarted = 1; + } + if (!orig_artist || strcasecmp (orig_artist, title)) { + vfs_curl_set_meta (fp->track, "artist", title); + songstarted = 1; + } } else { - vfs_curl_set_meta (fp->track, "title", title); + const char *orig_title = deadbeef->pl_find_meta (fp->track, "title"); + if (!orig_title || strcasecmp (orig_title, title)) { + vfs_curl_set_meta (fp->track, "title", title); + songstarted = 1; + } } + deadbeef->pl_unlock (); ddb_playlist_t *plt = deadbeef->plt_get_curr (); if (plt) { deadbeef->plt_modified (plt); deadbeef->plt_unref (plt); } deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0); + if (songstarted) { + ddb_event_track_t *ev = (ddb_event_track_t *)deadbeef->event_alloc (DB_EV_SONGSTARTED); + ev->track = fp->track; + if (ev->track) { + deadbeef->pl_item_ref (ev->track); + } + deadbeef->event_send ((ddb_event_t *)ev, 0, 0); + } } return 0; } @@ -452,9 +477,7 @@ http_content_header_handler (void *ptr, size_t size, size_t nmemb, void *stream) fp->content_type = strdup (value); } else if (!strcasecmp (key, "Content-Length")) { - if (fp->length < 0) { - fp->length = atoi (value); - } + fp->length = atoi (value); } else if (!strcasecmp (key, "icy-name")) { if (fp->track) { diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index f12123ee..6911f667 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -764,7 +764,7 @@ error: } -static const char * exts[] = { "ogg", "ogx", NULL }; +static const char * exts[] = { "ogg", "ogx", "oga", NULL }; // define plugin interface static DB_decoder_t plugin = { @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: DeaDBeeF\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-10 18:04+0200\n" +"POT-Creation-Date: 2011-09-01 12:39+0200\n" "PO-Revision-Date: 2010-06-03 17:59+0100\n" "Last-Translator: Jan D. Behrens <zykure@web.de>\n" "Language-Team: \n" @@ -22,7 +22,7 @@ msgstr "" msgid "Supported sound formats" msgstr "Unterstützte Tonformate" -#: ../plugins/gtkui/callbacks.c:132 ../plugins/gtkui/gtkui.c:789 +#: ../plugins/gtkui/callbacks.c:132 ../plugins/gtkui/gtkui.c:776 msgid "Other files (*)" msgstr "Andere Dateien (*)" @@ -42,56 +42,58 @@ msgstr "Verzeichnisse zur Wiedergabeliste hinzufügen..." msgid "Follow symlinks" msgstr "Symbolischen Links folgen" -#: ../plugins/gtkui/callbacks.c:697 +#: ../plugins/gtkui/callbacks.c:724 msgid "Failed while reading help file" msgstr "Fehler beim Lesen der Hilfedatei" -#: ../plugins/gtkui/callbacks.c:707 +#: ../plugins/gtkui/callbacks.c:734 msgid "Failed to load help file" msgstr "Fehler beim Laden der Hilfedatei" -#: ../plugins/gtkui/callbacks.c:722 +#: ../plugins/gtkui/callbacks.c:749 msgid "help.txt" msgstr "" -#: ../plugins/gtkui/callbacks.c:723 ../plugins/gtkui/interface.c:1150 -#: ../plugins/gtkui/deadbeef.glade.h:47 +#: ../plugins/gtkui/callbacks.c:750 ../plugins/gtkui/interface.c:1155 +#: ../plugins/gtkui/deadbeef.glade.h:49 ../plugins/converter/convgui.c:1240 +#: ../plugins/converter/convgui.c:1248 msgid "Help" msgstr "Hilfe" -#: ../plugins/gtkui/callbacks.c:733 +#: ../plugins/gtkui/callbacks.c:760 #, c-format msgid "About DeaDBeeF %s" msgstr "Über DeaDBeeF %s" -#: ../plugins/gtkui/callbacks.c:746 +#: ../plugins/gtkui/callbacks.c:773 #, c-format msgid "DeaDBeeF %s ChangeLog" msgstr "DeaDBeeF %s ChangeLog" -#: ../plugins/gtkui/callbacks.c:1091 +#: ../plugins/gtkui/callbacks.c:1122 #, c-format msgid "DeaDBeeF Translators" msgstr "DeaDBeeF Übersetzer" -#: ../plugins/gtkui/ddbtabstrip.c:660 ../plugins/gtkui/trkproperties.c:597 +#: ../plugins/gtkui/ddbtabstrip.c:689 ../plugins/gtkui/trkproperties.c:618 msgid "Edit playlist" msgstr "Wiedergabeliste bearbeiten" -#: ../plugins/gtkui/ddbtabstrip.c:663 ../plugins/gtkui/interface.c:1481 -#: ../plugins/gtkui/interface.c:2836 ../plugins/gtkui/deadbeef.glade.h:134 +#: ../plugins/gtkui/ddbtabstrip.c:692 ../plugins/gtkui/interface.c:1486 +#: ../plugins/gtkui/interface.c:2905 ../plugins/gtkui/deadbeef.glade.h:136 +#: ../plugins/converter/interface.c:402 msgid "Title:" msgstr "Titel:" -#: ../plugins/gtkui/ddbtabstrip.c:716 +#: ../plugins/gtkui/ddbtabstrip.c:748 msgid "Rename Playlist" msgstr "Wiedergabeliste umbenennen" -#: ../plugins/gtkui/ddbtabstrip.c:720 +#: ../plugins/gtkui/ddbtabstrip.c:755 msgid "Remove Playlist" msgstr "Wiedergabeliste löschen" -#: ../plugins/gtkui/ddbtabstrip.c:724 +#: ../plugins/gtkui/ddbtabstrip.c:762 msgid "Add New Playlist" msgstr "Neue Wiedergabeliste hinzufügen" @@ -147,7 +149,7 @@ msgstr "Vorverstärkung zurücksetzen" msgid "Zero Bands" msgstr "Equalizer zurücksetzen" -#: ../plugins/gtkui/eq.c:387 +#: ../plugins/gtkui/eq.c:387 ../plugins/converter/interface.c:826 msgid "Presets" msgstr "Voreinstellungen" @@ -190,700 +192,724 @@ msgid "" msgstr "" "%s%s %s| %dHz | %d bit | %s | %d:%02d / %s | %d Titel | %s gesamte Spielzeit" -#: ../plugins/gtkui/gtkui.c:670 +#: ../plugins/gtkui/gtkui.c:632 msgid "Save Playlist As" msgstr "Wiedergabeliste speichern unter..." -#: ../plugins/gtkui/gtkui.c:681 +#: ../plugins/gtkui/gtkui.c:643 msgid "DeaDBeeF playlist files (*.dbpl)" msgstr "DeaDBeeF Wiedergabeliste (*.dbpl)" -#: ../plugins/gtkui/gtkui.c:774 +#: ../plugins/gtkui/gtkui.c:761 msgid "Load Playlist" msgstr "Wiedergabeliste laden..." -#: ../plugins/gtkui/gtkui.c:925 +#: ../plugins/gtkui/gtkui.c:914 ../plugins/gtkui/fileman.c:40 msgid "New Playlist" msgstr "Neue Wiedergabeliste" -#: ../plugins/gtkui/gtkui.c:928 +#: ../plugins/gtkui/gtkui.c:917 #, c-format msgid "New Playlist (%d)" msgstr "Neue Wiedergabeliste (%d)" -#: ../plugins/gtkui/interface.c:149 ../plugins/gtkui/deadbeef.glade.h:152 +#: ../plugins/gtkui/interface.c:150 ../plugins/gtkui/deadbeef.glade.h:156 msgid "_File" msgstr "_Datei" -#: ../plugins/gtkui/interface.c:156 ../plugins/gtkui/deadbeef.glade.h:159 +#: ../plugins/gtkui/interface.c:157 ../plugins/gtkui/deadbeef.glade.h:163 msgid "_Open file(s)" msgstr "Dateien ö_ffnen" -#: ../plugins/gtkui/interface.c:172 ../plugins/gtkui/deadbeef.glade.h:6 +#: ../plugins/gtkui/interface.c:173 ../plugins/gtkui/deadbeef.glade.h:6 msgid "Add file(s)" msgstr "Dateien hinzufügen" -#: ../plugins/gtkui/interface.c:180 ../plugins/gtkui/deadbeef.glade.h:8 +#: ../plugins/gtkui/interface.c:181 ../plugins/gtkui/deadbeef.glade.h:8 msgid "Add folder(s)" msgstr "Verzeichnisse hinzufügen" -#: ../plugins/gtkui/interface.c:188 ../plugins/gtkui/interface.c:2936 +#: ../plugins/gtkui/interface.c:189 ../plugins/gtkui/interface.c:3005 #: ../plugins/gtkui/deadbeef.glade.h:9 msgid "Add location" msgstr "Ort hinzufügen" -#: ../plugins/gtkui/interface.c:197 ../plugins/gtkui/deadbeef.glade.h:78 +#: ../plugins/gtkui/interface.c:198 ../plugins/gtkui/deadbeef.glade.h:80 msgid "New playlist" msgstr "Neue Wiedergabeliste" -#: ../plugins/gtkui/interface.c:204 ../plugins/gtkui/deadbeef.glade.h:70 +#: ../plugins/gtkui/interface.c:205 ../plugins/gtkui/deadbeef.glade.h:72 msgid "Load playlist" msgstr "Wiedergabeliste laden" -#: ../plugins/gtkui/interface.c:208 ../plugins/gtkui/deadbeef.glade.h:108 +#: ../plugins/gtkui/interface.c:209 ../plugins/gtkui/deadbeef.glade.h:110 msgid "Save playlist" msgstr "Wiedergabeliste speichern" -#: ../plugins/gtkui/interface.c:212 ../plugins/gtkui/deadbeef.glade.h:109 -msgid "Save playlist as" -msgstr "Wiedergabeliste speichern unter" - -#: ../plugins/gtkui/interface.c:221 ../plugins/gtkui/deadbeef.glade.h:161 +#: ../plugins/gtkui/interface.c:218 ../plugins/gtkui/deadbeef.glade.h:165 msgid "_Quit" msgstr "_Beenden" -#: ../plugins/gtkui/interface.c:232 ../plugins/gtkui/deadbeef.glade.h:151 +#: ../plugins/gtkui/interface.c:229 ../plugins/gtkui/deadbeef.glade.h:155 msgid "_Edit" msgstr "_Bearbeiten" -#: ../plugins/gtkui/interface.c:239 ../plugins/gtkui/deadbeef.glade.h:149 +#: ../plugins/gtkui/interface.c:236 ../plugins/gtkui/deadbeef.glade.h:153 msgid "_Clear" msgstr "_Löschen" -#: ../plugins/gtkui/interface.c:247 ../plugins/gtkui/deadbeef.glade.h:114 +#: ../plugins/gtkui/interface.c:244 ../plugins/gtkui/deadbeef.glade.h:115 msgid "Select all" msgstr "Alles auswählen" -#: ../plugins/gtkui/interface.c:254 ../plugins/gtkui/deadbeef.glade.h:31 +#: ../plugins/gtkui/interface.c:251 ../plugins/gtkui/deadbeef.glade.h:32 msgid "Deselect all" msgstr "Alles abwählen" -#: ../plugins/gtkui/interface.c:261 ../plugins/gtkui/deadbeef.glade.h:53 +#: ../plugins/gtkui/interface.c:258 ../plugins/gtkui/deadbeef.glade.h:55 msgid "Invert selection" msgstr "Auswahl umkehren" -#: ../plugins/gtkui/interface.c:265 ../plugins/gtkui/deadbeef.glade.h:117 +#: ../plugins/gtkui/interface.c:262 ../plugins/gtkui/deadbeef.glade.h:118 msgid "Selection" msgstr "Auswahl" -#: ../plugins/gtkui/interface.c:272 ../plugins/gtkui/plcommon.c:421 -#: ../plugins/gtkui/prefwin.c:323 ../plugins/gtkui/deadbeef.glade.h:103 +#: ../plugins/gtkui/interface.c:269 ../plugins/gtkui/plcommon.c:458 +#: ../plugins/gtkui/prefwin.c:323 ../plugins/gtkui/deadbeef.glade.h:105 +#: ../plugins/converter/interface.c:653 msgid "Remove" msgstr "Entfernen" -#: ../plugins/gtkui/interface.c:280 ../plugins/gtkui/deadbeef.glade.h:23 +#: ../plugins/gtkui/interface.c:277 ../plugins/gtkui/deadbeef.glade.h:24 msgid "Crop" msgstr "Abschneiden" -#: ../plugins/gtkui/interface.c:284 ../plugins/gtkui/deadbeef.glade.h:153 +#: ../plugins/gtkui/interface.c:281 ../plugins/gtkui/deadbeef.glade.h:157 msgid "_Find" msgstr "Suchen" -#: ../plugins/gtkui/interface.c:291 ../plugins/gtkui/deadbeef.glade.h:121 +#: ../plugins/gtkui/interface.c:288 ../plugins/gtkui/deadbeef.glade.h:122 msgid "Sort By" msgstr "Sortieren nach" -#: ../plugins/gtkui/interface.c:298 ../plugins/gtkui/interface.c:1510 -#: ../plugins/gtkui/interface.c:1856 ../plugins/gtkui/deadbeef.glade.h:10 -#: ../translation/extra.c:68 +#: ../plugins/gtkui/interface.c:295 ../plugins/gtkui/interface.c:1516 +#: ../plugins/gtkui/mainplaylist.c:317 ../plugins/gtkui/prefwin.c:626 +#: ../plugins/gtkui/search.c:393 ../plugins/gtkui/deadbeef.glade.h:135 +#: ../plugins/converter/convgui.c:790 ../plugins/converter/convgui.c:1211 +#: ../plugins/converter/interface.c:630 +msgid "Title" +msgstr "Titel" + +#: ../plugins/gtkui/interface.c:299 ../plugins/gtkui/deadbeef.glade.h:140 +msgid "Track number" +msgstr "Track-Nummer" + +#: ../plugins/gtkui/interface.c:303 ../plugins/gtkui/interface.c:1515 +#: ../plugins/gtkui/interface.c:1874 ../plugins/gtkui/deadbeef.glade.h:10 +#: ../translation/extra.c:69 msgid "Album" msgstr "Album" #. Track properties dialog -#: ../plugins/gtkui/interface.c:302 ../plugins/gtkui/interface.c:1509 -#: ../plugins/gtkui/plcommon.c:882 ../plugins/gtkui/deadbeef.glade.h:12 -#: ../translation/extra.c:64 +#: ../plugins/gtkui/interface.c:307 ../plugins/gtkui/interface.c:1514 +#: ../plugins/gtkui/plcommon.c:1003 ../plugins/gtkui/deadbeef.glade.h:13 +#: ../translation/extra.c:65 msgid "Artist" msgstr "Künstler" -#: ../plugins/gtkui/interface.c:306 ../plugins/gtkui/deadbeef.glade.h:30 -#: ../translation/extra.c:69 +#: ../plugins/gtkui/interface.c:311 ../plugins/gtkui/deadbeef.glade.h:31 +#: ../translation/extra.c:70 msgid "Date" msgstr "Datum" -#: ../plugins/gtkui/interface.c:310 ../plugins/gtkui/interface.c:1515 -#: ../plugins/gtkui/plcommon.c:886 ../plugins/gtkui/deadbeef.glade.h:26 +#: ../plugins/gtkui/interface.c:315 ../plugins/gtkui/interface.c:1520 +#: ../plugins/gtkui/plcommon.c:1007 ../plugins/gtkui/deadbeef.glade.h:27 msgid "Custom" msgstr "Benutzerdefiniert" -#: ../plugins/gtkui/interface.c:319 ../plugins/gtkui/interface.c:1789 -#: ../plugins/gtkui/deadbeef.glade.h:93 +#: ../plugins/gtkui/interface.c:324 ../plugins/gtkui/interface.c:1803 +#: ../plugins/gtkui/deadbeef.glade.h:95 msgid "Preferences" msgstr "Einstellungen" -#: ../plugins/gtkui/interface.c:323 ../plugins/gtkui/deadbeef.glade.h:163 +#: ../plugins/gtkui/interface.c:328 ../plugins/gtkui/deadbeef.glade.h:167 msgid "_View" msgstr "_Ansicht" -#: ../plugins/gtkui/interface.c:330 ../plugins/gtkui/deadbeef.glade.h:124 +#: ../plugins/gtkui/interface.c:335 ../plugins/gtkui/deadbeef.glade.h:125 msgid "Status bar" msgstr "Statusleiste" -#: ../plugins/gtkui/interface.c:334 ../plugins/gtkui/deadbeef.glade.h:20 +#: ../plugins/gtkui/interface.c:339 ../plugins/gtkui/deadbeef.glade.h:21 msgid "Column headers" msgstr "Spaltentitel" -#: ../plugins/gtkui/interface.c:338 ../plugins/gtkui/deadbeef.glade.h:131 +#: ../plugins/gtkui/interface.c:343 ../plugins/gtkui/deadbeef.glade.h:132 msgid "Tabs" msgstr "Reiter" -#: ../plugins/gtkui/interface.c:342 ../plugins/gtkui/deadbeef.glade.h:39 +#: ../plugins/gtkui/interface.c:347 ../plugins/gtkui/deadbeef.glade.h:40 msgid "Equalizer" msgstr "Equalizer" -#: ../plugins/gtkui/interface.c:346 ../plugins/gtkui/deadbeef.glade.h:160 +#: ../plugins/gtkui/interface.c:351 ../plugins/gtkui/deadbeef.glade.h:164 msgid "_Playback" msgstr "_Wiedergabe" -#: ../plugins/gtkui/interface.c:353 ../plugins/gtkui/interface.c:3212 -#: ../plugins/gtkui/deadbeef.glade.h:81 +#: ../plugins/gtkui/interface.c:358 ../plugins/gtkui/interface.c:3281 +#: ../plugins/gtkui/deadbeef.glade.h:83 msgid "Order" msgstr "Reihenfolge" -#: ../plugins/gtkui/interface.c:360 ../plugins/gtkui/deadbeef.glade.h:69 +#: ../plugins/gtkui/interface.c:365 ../plugins/gtkui/deadbeef.glade.h:71 msgid "Linear" msgstr "Linear" -#: ../plugins/gtkui/interface.c:366 ../plugins/gtkui/deadbeef.glade.h:120 +#: ../plugins/gtkui/interface.c:370 ../plugins/gtkui/deadbeef.glade.h:121 msgid "Shuffle tracks" msgstr "Track-Shuffle" -#: ../plugins/gtkui/interface.c:372 ../plugins/gtkui/deadbeef.glade.h:119 +#: ../plugins/gtkui/interface.c:375 ../plugins/gtkui/deadbeef.glade.h:120 msgid "Shuffle albums" msgstr "Album-Shuffle" -#: ../plugins/gtkui/interface.c:378 ../plugins/gtkui/deadbeef.glade.h:102 +#: ../plugins/gtkui/interface.c:380 ../plugins/gtkui/deadbeef.glade.h:104 msgid "Random" msgstr "Zufällig" -#: ../plugins/gtkui/interface.c:384 ../plugins/gtkui/deadbeef.glade.h:73 +#: ../plugins/gtkui/interface.c:386 ../plugins/gtkui/deadbeef.glade.h:75 msgid "Looping" msgstr "Wiederholen" -#: ../plugins/gtkui/interface.c:391 ../plugins/gtkui/deadbeef.glade.h:71 +#: ../plugins/gtkui/interface.c:393 ../plugins/gtkui/deadbeef.glade.h:73 msgid "Loop All" msgstr "Wiederhole alle" -#: ../plugins/gtkui/interface.c:397 ../plugins/gtkui/deadbeef.glade.h:72 +#: ../plugins/gtkui/interface.c:398 ../plugins/gtkui/deadbeef.glade.h:74 msgid "Loop Single Song" msgstr "Wiederhole einzelnes Lied" -#: ../plugins/gtkui/interface.c:403 ../plugins/gtkui/deadbeef.glade.h:35 +#: ../plugins/gtkui/interface.c:403 ../plugins/gtkui/deadbeef.glade.h:36 msgid "Don't Loop" msgstr "Nicht wiederholen" -#: ../plugins/gtkui/interface.c:409 ../plugins/gtkui/deadbeef.glade.h:110 +#: ../plugins/gtkui/interface.c:409 ../plugins/gtkui/deadbeef.glade.h:111 msgid "Scroll follows playback" msgstr "Bildlauf folgt Wiedergabe" -#: ../plugins/gtkui/interface.c:414 ../plugins/gtkui/deadbeef.glade.h:25 +#: ../plugins/gtkui/interface.c:414 ../plugins/gtkui/deadbeef.glade.h:26 msgid "Cursor follows playback" msgstr "Mauszeiger folgt Wiedergabe" -#: ../plugins/gtkui/interface.c:418 ../plugins/gtkui/deadbeef.glade.h:126 +#: ../plugins/gtkui/interface.c:418 ../plugins/gtkui/deadbeef.glade.h:127 msgid "Stop after current" msgstr "Nach aktuellem Titel beenden" -#: ../plugins/gtkui/interface.c:430 ../plugins/gtkui/deadbeef.glade.h:65 +#: ../plugins/gtkui/interface.c:430 ../plugins/gtkui/deadbeef.glade.h:67 msgid "Jump to current track" msgstr "Zu aktuellem Titel springen" #: ../plugins/gtkui/interface.c:437 ../plugins/gtkui/interface.c:444 -#: ../plugins/gtkui/deadbeef.glade.h:155 +#: ../plugins/gtkui/deadbeef.glade.h:159 msgid "_Help" msgstr "_Hilfe" -#: ../plugins/gtkui/interface.c:452 ../plugins/gtkui/deadbeef.glade.h:148 +#: ../plugins/gtkui/interface.c:452 ../plugins/gtkui/deadbeef.glade.h:152 msgid "_ChangeLog" msgstr "_ChangeLog" -#: ../plugins/gtkui/interface.c:461 ../plugins/gtkui/deadbeef.glade.h:154 +#: ../plugins/gtkui/interface.c:461 ../plugins/gtkui/deadbeef.glade.h:158 msgid "_GPLv2" msgstr "_GPLv2" -#: ../plugins/gtkui/interface.c:465 ../plugins/gtkui/deadbeef.glade.h:156 +#: ../plugins/gtkui/interface.c:465 ../plugins/gtkui/deadbeef.glade.h:160 msgid "_LGPLv2.1" msgstr "_LGPLv2.1" -#: ../plugins/gtkui/interface.c:474 ../plugins/gtkui/deadbeef.glade.h:145 +#: ../plugins/gtkui/interface.c:474 ../plugins/gtkui/deadbeef.glade.h:149 msgid "_About" msgstr "_Info" -#: ../plugins/gtkui/interface.c:482 ../plugins/gtkui/deadbeef.glade.h:162 +#: ../plugins/gtkui/interface.c:482 ../plugins/gtkui/deadbeef.glade.h:166 msgid "_Translators" msgstr "_Übersetzer" -#: ../plugins/gtkui/interface.c:894 ../plugins/gtkui/deadbeef.glade.h:111 +#: ../plugins/gtkui/interface.c:898 ../plugins/gtkui/deadbeef.glade.h:112 msgid "Search" msgstr "Suche" -#: ../plugins/gtkui/interface.c:969 ../plugins/gtkui/deadbeef.glade.h:125 +#: ../plugins/gtkui/interface.c:973 ../plugins/gtkui/deadbeef.glade.h:126 msgid "Stop" msgstr "Stopp" -#: ../plugins/gtkui/interface.c:977 ../plugins/gtkui/deadbeef.glade.h:87 +#: ../plugins/gtkui/interface.c:981 ../plugins/gtkui/deadbeef.glade.h:89 msgid "Play" msgstr "Abspielen" -#: ../plugins/gtkui/interface.c:985 ../plugins/gtkui/deadbeef.glade.h:86 +#: ../plugins/gtkui/interface.c:989 ../plugins/gtkui/deadbeef.glade.h:88 msgid "Pause" msgstr "Anhalten" -#: ../plugins/gtkui/interface.c:993 ../plugins/gtkui/deadbeef.glade.h:94 +#: ../plugins/gtkui/interface.c:997 ../plugins/gtkui/deadbeef.glade.h:96 msgid "Previous" msgstr "Vorheriges" -#: ../plugins/gtkui/interface.c:1001 ../plugins/gtkui/deadbeef.glade.h:79 +#: ../plugins/gtkui/interface.c:1005 ../plugins/gtkui/deadbeef.glade.h:81 msgid "Next" msgstr "Nächstes" -#: ../plugins/gtkui/interface.c:1009 ../plugins/gtkui/deadbeef.glade.h:88 +#: ../plugins/gtkui/interface.c:1013 ../plugins/gtkui/deadbeef.glade.h:90 msgid "Play Random" msgstr "Zufälliges Abspielen" -#: ../plugins/gtkui/interface.c:1018 ../plugins/gtkui/deadbeef.glade.h:5 +#: ../plugins/gtkui/interface.c:1022 ../plugins/gtkui/deadbeef.glade.h:5 msgid "About" msgstr "Info" -#: ../plugins/gtkui/interface.c:1031 ../plugins/gtkui/deadbeef.glade.h:101 +#: ../plugins/gtkui/interface.c:1035 ../plugins/gtkui/deadbeef.glade.h:103 msgid "Quit" msgstr "Beenden" -#: ../plugins/gtkui/interface.c:1220 ../plugins/gtkui/deadbeef.glade.h:137 +#: ../plugins/gtkui/interface.c:1225 ../plugins/gtkui/deadbeef.glade.h:139 msgid "Track Properties" msgstr "Titeleigenschaften" -#: ../plugins/gtkui/interface.c:1265 ../plugins/gtkui/deadbeef.glade.h:118 +#: ../plugins/gtkui/interface.c:1270 ../plugins/gtkui/deadbeef.glade.h:119 msgid "Settings" msgstr "Einstellungen" -#: ../plugins/gtkui/interface.c:1291 ../plugins/gtkui/deadbeef.glade.h:146 +#: ../plugins/gtkui/interface.c:1296 ../plugins/gtkui/deadbeef.glade.h:150 msgid "_Apply" msgstr "A_nwenden" -#: ../plugins/gtkui/interface.c:1312 ../plugins/gtkui/interface.c:1358 -#: ../plugins/gtkui/deadbeef.glade.h:150 +#: ../plugins/gtkui/interface.c:1317 ../plugins/gtkui/interface.c:1363 +#: ../plugins/gtkui/deadbeef.glade.h:154 msgid "_Close" msgstr "S_chließen" -#: ../plugins/gtkui/interface.c:1316 ../plugins/gtkui/deadbeef.glade.h:74 +#: ../plugins/gtkui/interface.c:1321 ../plugins/gtkui/deadbeef.glade.h:76 msgid "Metadata" msgstr "Metadaten" -#: ../plugins/gtkui/interface.c:1362 ../plugins/gtkui/plcommon.c:508 -#: ../plugins/gtkui/deadbeef.glade.h:95 +#: ../plugins/gtkui/interface.c:1367 ../plugins/gtkui/plcommon.c:608 +#: ../plugins/gtkui/deadbeef.glade.h:97 msgid "Properties" msgstr "Eigenschaften" -#: ../plugins/gtkui/interface.c:1489 ../plugins/gtkui/deadbeef.glade.h:38 +#: ../plugins/gtkui/interface.c:1494 ../plugins/gtkui/deadbeef.glade.h:39 msgid "Enter new column title here" msgstr "Neuen Spaltentitel eingeben" -#: ../plugins/gtkui/interface.c:1497 ../plugins/gtkui/deadbeef.glade.h:138 +#: ../plugins/gtkui/interface.c:1502 ../plugins/gtkui/deadbeef.glade.h:141 msgid "Type:" msgstr "Typ:" -#: ../plugins/gtkui/interface.c:1505 +#: ../plugins/gtkui/interface.c:1510 msgid "Item Index" msgstr "Index" #. create default set of columns -#: ../plugins/gtkui/interface.c:1506 ../plugins/gtkui/mainplaylist.c:305 +#: ../plugins/gtkui/interface.c:1511 ../plugins/gtkui/mainplaylist.c:314 msgid "Playing" msgstr "Wiedergabe" -#: ../plugins/gtkui/interface.c:1507 +#: ../plugins/gtkui/interface.c:1512 msgid "Album Art" msgstr "Album Artwork" -#: ../plugins/gtkui/interface.c:1508 +#: ../plugins/gtkui/interface.c:1513 msgid "Artist - Album" msgstr "Künstler - Album" -#: ../plugins/gtkui/interface.c:1511 ../plugins/gtkui/mainplaylist.c:308 -#: ../plugins/gtkui/prefwin.c:620 ../plugins/gtkui/search.c:387 -msgid "Title" -msgstr "Titel" - -#: ../plugins/gtkui/interface.c:1512 ../plugins/gtkui/mainplaylist.c:309 -#: ../plugins/gtkui/search.c:388 +#: ../plugins/gtkui/interface.c:1517 ../plugins/gtkui/mainplaylist.c:318 +#: ../plugins/gtkui/search.c:394 msgid "Duration" msgstr "Dauer" -#: ../plugins/gtkui/interface.c:1513 ../plugins/gtkui/mainplaylist.c:307 -#: ../plugins/gtkui/search.c:386 -msgid "Track No" -msgstr "Track-Nr." +#: ../plugins/gtkui/interface.c:1518 ../translation/extra.c:71 +msgid "Track Number" +msgstr "Track-Nummer" -#: ../plugins/gtkui/interface.c:1514 ../translation/extra.c:67 +#: ../plugins/gtkui/interface.c:1519 ../translation/extra.c:68 msgid "Band / Album Artist" msgstr "Band / Album-Künstler" -#: ../plugins/gtkui/interface.c:1521 ../plugins/gtkui/interface.c:3064 -#: ../plugins/gtkui/deadbeef.glade.h:43 +#: ../plugins/gtkui/interface.c:1526 ../plugins/gtkui/interface.c:3133 +#: ../plugins/gtkui/deadbeef.glade.h:44 msgid "Format:" msgstr "Format:" -#: ../plugins/gtkui/interface.c:1546 ../plugins/gtkui/deadbeef.glade.h:11 +#: ../plugins/gtkui/interface.c:1551 ../plugins/gtkui/deadbeef.glade.h:11 msgid "Alignment:" msgstr "Ausrichtung:" -#: ../plugins/gtkui/interface.c:1554 +#: ../plugins/gtkui/interface.c:1559 msgid "Left" msgstr "Linksbündig" -#: ../plugins/gtkui/interface.c:1555 +#: ../plugins/gtkui/interface.c:1560 msgid "Right" msgstr "Rechtsbündig" -#: ../plugins/gtkui/interface.c:1578 ../plugins/gtkui/interface.c:2867 -#: ../plugins/gtkui/interface.c:2979 ../plugins/gtkui/interface.c:3105 -#: ../plugins/gtkui/deadbeef.glade.h:147 +#: ../plugins/gtkui/interface.c:1583 ../plugins/gtkui/interface.c:2936 +#: ../plugins/gtkui/interface.c:3048 ../plugins/gtkui/interface.c:3174 +#: ../plugins/gtkui/deadbeef.glade.h:151 msgid "_Cancel" msgstr "_Abbrechen" -#: ../plugins/gtkui/interface.c:1599 ../plugins/gtkui/interface.c:2888 -#: ../plugins/gtkui/interface.c:3000 ../plugins/gtkui/interface.c:3126 -#: ../plugins/gtkui/deadbeef.glade.h:158 +#: ../plugins/gtkui/interface.c:1604 ../plugins/gtkui/interface.c:2957 +#: ../plugins/gtkui/interface.c:3069 ../plugins/gtkui/interface.c:3195 +#: ../plugins/gtkui/deadbeef.glade.h:162 msgid "_OK" msgstr "_OK" -#: ../plugins/gtkui/interface.c:1810 ../plugins/gtkui/deadbeef.glade.h:83 +#: ../plugins/gtkui/interface.c:1824 ../plugins/gtkui/deadbeef.glade.h:85 msgid "Output plugin:" msgstr "Ausgabeplugin:" -#: ../plugins/gtkui/interface.c:1823 ../plugins/gtkui/deadbeef.glade.h:82 +#: ../plugins/gtkui/interface.c:1837 ../plugins/gtkui/deadbeef.glade.h:84 msgid "Output device:" msgstr "Ausgabegerät:" -#: ../plugins/gtkui/interface.c:1832 ../plugins/gtkui/deadbeef.glade.h:123 +#: ../plugins/gtkui/interface.c:1846 ../plugins/gtkui/deadbeef.glade.h:12 +msgid "Always convert 8 bit audio to 16 bit" +msgstr "Immer 8-bit Audio nach 16-bit konvertieren" + +#: ../plugins/gtkui/interface.c:1850 ../plugins/gtkui/deadbeef.glade.h:124 msgid "Sound" msgstr "Wiedergabe" -#: ../plugins/gtkui/interface.c:1845 ../plugins/gtkui/deadbeef.glade.h:104 +#: ../plugins/gtkui/interface.c:1863 ../plugins/gtkui/deadbeef.glade.h:106 msgid "Replaygain mode:" msgstr "Replaygain-Modus:" -#: ../plugins/gtkui/interface.c:1854 +#: ../plugins/gtkui/interface.c:1872 msgid "Disable" msgstr "Deaktivieren" -#: ../plugins/gtkui/interface.c:1855 +#: ../plugins/gtkui/interface.c:1873 msgid "Track" msgstr "Titel" -#: ../plugins/gtkui/interface.c:1858 ../plugins/gtkui/deadbeef.glade.h:105 +#: ../plugins/gtkui/interface.c:1876 ../plugins/gtkui/deadbeef.glade.h:107 msgid "Replaygain peak scale" msgstr "Replaygain-Ausschlagschutz" -#: ../plugins/gtkui/interface.c:1866 ../plugins/gtkui/deadbeef.glade.h:106 +#: ../plugins/gtkui/interface.c:1884 ../plugins/gtkui/deadbeef.glade.h:108 msgid "Replaygain preamp:" msgstr "Replaygain-Vorverstärkung:" -#: ../plugins/gtkui/interface.c:1870 ../plugins/gtkui/deadbeef.glade.h:2 +#: ../plugins/gtkui/interface.c:1888 ../plugins/gtkui/interface.c:1910 +#: ../plugins/gtkui/deadbeef.glade.h:2 msgid "-12 dB" msgstr "-12 dB" -#: ../plugins/gtkui/interface.c:1880 ../plugins/gtkui/deadbeef.glade.h:1 +#: ../plugins/gtkui/interface.c:1898 ../plugins/gtkui/interface.c:1920 +#: ../plugins/gtkui/deadbeef.glade.h:1 msgid "+12 dB" msgstr "+12 dB" -#: ../plugins/gtkui/interface.c:1888 ../plugins/gtkui/deadbeef.glade.h:7 +#: ../plugins/gtkui/interface.c:1906 ../plugins/gtkui/deadbeef.glade.h:47 +msgid "Global preamp:" +msgstr "Globale Vorverstärkung:" + +#: ../plugins/gtkui/interface.c:1928 ../plugins/gtkui/deadbeef.glade.h:7 msgid "Add files from command line (or file manager) to this playlist:" msgstr "" "Datein beim Hinzufügen von Kommandozeile (oder Dateimanager) an Liste " "anhängen:" -#: ../plugins/gtkui/interface.c:1897 ../plugins/gtkui/deadbeef.glade.h:107 +#: ../plugins/gtkui/interface.c:1937 ../plugins/gtkui/deadbeef.glade.h:109 msgid "Resume previous session on startup" msgstr "Beim Start letzte Sitzung wiederherstellen" -#: ../plugins/gtkui/interface.c:1901 ../plugins/gtkui/deadbeef.glade.h:36 +#: ../plugins/gtkui/interface.c:1941 ../plugins/gtkui/deadbeef.glade.h:37 msgid "Don't add from archives when adding folders" msgstr "" "Dateien innerhalb von Archiven beim Hinzufügen von Verzeichnissen auslassen" -#: ../plugins/gtkui/interface.c:1905 ../plugins/gtkui/deadbeef.glade.h:89 +#: ../plugins/gtkui/interface.c:1945 ../plugins/gtkui/deadbeef.glade.h:91 msgid "Playback" msgstr "Wiedergabe" -#: ../plugins/gtkui/interface.c:1926 ../plugins/gtkui/interface.c:2444 -#: ../plugins/gtkui/deadbeef.glade.h:21 +#: ../plugins/gtkui/interface.c:1966 ../plugins/gtkui/interface.c:2498 +#: ../plugins/gtkui/deadbeef.glade.h:22 ../plugins/converter/interface.c:657 msgid "Configure" msgstr "Einstellungen" -#: ../plugins/gtkui/interface.c:1961 ../plugins/gtkui/deadbeef.glade.h:28 +#: ../plugins/gtkui/interface.c:2001 ../plugins/gtkui/deadbeef.glade.h:29 msgid "DSP Chain Preset" msgstr "DSP Voreinstellung" -#: ../plugins/gtkui/interface.c:1973 ../plugins/gtkui/deadbeef.glade.h:157 +#: ../plugins/gtkui/interface.c:2013 ../plugins/gtkui/deadbeef.glade.h:161 msgid "_Load" msgstr "_Laden" -#: ../plugins/gtkui/interface.c:1977 ../plugins/gtkui/deadbeef.glade.h:27 +#: ../plugins/gtkui/interface.c:2017 ../plugins/gtkui/deadbeef.glade.h:28 msgid "DSP" msgstr "DSP" -#: ../plugins/gtkui/interface.c:1986 ../plugins/gtkui/deadbeef.glade.h:18 +#: ../plugins/gtkui/interface.c:2026 ../plugins/gtkui/deadbeef.glade.h:19 msgid "Close minimizes to tray" msgstr "Beim Schließen minimieren" -#: ../plugins/gtkui/interface.c:1990 ../plugins/gtkui/deadbeef.glade.h:76 +#: ../plugins/gtkui/interface.c:2030 ../plugins/gtkui/deadbeef.glade.h:78 msgid "Middle mouse button closes playlist" msgstr "Mittlere Maustaste zum Schließen der Wiedergabeliste verwenden" -#: ../plugins/gtkui/interface.c:1994 ../plugins/gtkui/deadbeef.glade.h:49 +#: ../plugins/gtkui/interface.c:2034 ../plugins/gtkui/deadbeef.glade.h:51 msgid "Hide system tray icon" msgstr "Systemleisten-Icon verstecken" -#: ../plugins/gtkui/interface.c:1998 ../plugins/gtkui/deadbeef.glade.h:140 +#: ../plugins/gtkui/interface.c:2038 ../plugins/gtkui/deadbeef.glade.h:143 msgid "Use bold font for currently playing track" msgstr "Aktuellen Titel hervorheben" -#: ../plugins/gtkui/interface.c:2002 ../plugins/gtkui/deadbeef.glade.h:48 +#: ../plugins/gtkui/interface.c:2042 ../plugins/gtkui/deadbeef.glade.h:50 msgid "Hide \"Delete from disk\" context menu item" msgstr "Eintrag \"Vom Datenträger entfernen\" im Kontextmenü verstecken" -#: ../plugins/gtkui/interface.c:2006 ../plugins/gtkui/deadbeef.glade.h:15 +#: ../plugins/gtkui/interface.c:2046 ../plugins/gtkui/deadbeef.glade.h:16 msgid "Auto-name playlists when adding a single folder" msgstr "" "Wiedergabeliste beim Hinzufügen einzelner Verzeichnisse automatisch benennen" -#: ../plugins/gtkui/interface.c:2014 ../plugins/gtkui/deadbeef.glade.h:52 +#: ../plugins/gtkui/interface.c:2054 ../plugins/gtkui/deadbeef.glade.h:54 msgid "Interface refresh rate (times per second):" msgstr "Aktualisierungsrate der Benutzeroberfläche (Ereignisse pro Sekunde):" -#: ../plugins/gtkui/interface.c:2028 ../plugins/gtkui/deadbeef.glade.h:135 +#: ../plugins/gtkui/interface.c:2068 ../plugins/gtkui/deadbeef.glade.h:137 msgid "Titlebar text while playing:" msgstr "Fenstertitel beim Abspielen:" -#: ../plugins/gtkui/interface.c:2042 ../plugins/gtkui/deadbeef.glade.h:136 +#: ../plugins/gtkui/interface.c:2082 ../plugins/gtkui/deadbeef.glade.h:138 msgid "Titlebar text while stopped:" msgstr "Fenstertitel wenn angehalten:" -#: ../plugins/gtkui/interface.c:2056 ../plugins/gtkui/deadbeef.glade.h:45 +#: ../plugins/gtkui/interface.c:2096 ../plugins/gtkui/deadbeef.glade.h:46 msgid "GUI Plugin (changing requires restart):" msgstr "GUI-Plugin (Änderung benötigt Neustart):" -#: ../plugins/gtkui/interface.c:2064 ../plugins/gtkui/deadbeef.glade.h:44 +#: ../plugins/gtkui/interface.c:2104 ../plugins/gtkui/deadbeef.glade.h:45 msgid "GUI" msgstr "GUI" -#: ../plugins/gtkui/interface.c:2079 ../plugins/gtkui/interface.c:2123 -#: ../plugins/gtkui/deadbeef.glade.h:84 +#: ../plugins/gtkui/interface.c:2119 ../plugins/gtkui/interface.c:2163 +#: ../plugins/gtkui/deadbeef.glade.h:86 msgid "Override" msgstr "Überschreiben" -#: ../plugins/gtkui/interface.c:2088 ../plugins/gtkui/deadbeef.glade.h:41 +#: ../plugins/gtkui/interface.c:2128 ../plugins/gtkui/deadbeef.glade.h:42 msgid "Foreground" msgstr "Vordergrund" -#: ../plugins/gtkui/interface.c:2095 ../plugins/gtkui/deadbeef.glade.h:16 +#: ../plugins/gtkui/interface.c:2135 ../plugins/gtkui/deadbeef.glade.h:17 msgid "Background" msgstr "Hintergrund" -#: ../plugins/gtkui/interface.c:2114 ../plugins/gtkui/deadbeef.glade.h:112 +#: ../plugins/gtkui/interface.c:2154 ../plugins/gtkui/deadbeef.glade.h:113 msgid "Seekbar/Volumebar colors" msgstr "Farben von Suchleiste und Lautstärkeregler" -#: ../plugins/gtkui/interface.c:2132 ../plugins/gtkui/deadbeef.glade.h:75 +#: ../plugins/gtkui/interface.c:2172 ../plugins/gtkui/deadbeef.glade.h:77 msgid "Middle" msgstr "Mittel" -#: ../plugins/gtkui/interface.c:2139 ../plugins/gtkui/deadbeef.glade.h:68 +#: ../plugins/gtkui/interface.c:2179 ../plugins/gtkui/deadbeef.glade.h:70 msgid "Light" msgstr "Hell" -#: ../plugins/gtkui/interface.c:2146 ../plugins/gtkui/deadbeef.glade.h:29 +#: ../plugins/gtkui/interface.c:2186 ../plugins/gtkui/deadbeef.glade.h:30 msgid "Dark" msgstr "Dunkel" -#: ../plugins/gtkui/interface.c:2177 ../plugins/gtkui/deadbeef.glade.h:17 +#: ../plugins/gtkui/interface.c:2217 ../plugins/gtkui/deadbeef.glade.h:18 msgid "Base" msgstr "Basis" -#: ../plugins/gtkui/interface.c:2184 ../plugins/gtkui/interface.c:2241 -#: ../plugins/gtkui/deadbeef.glade.h:133 +#: ../plugins/gtkui/interface.c:2224 ../plugins/gtkui/interface.c:2281 +#: ../plugins/gtkui/deadbeef.glade.h:134 msgid "Text" msgstr "Text" -#: ../plugins/gtkui/interface.c:2197 ../plugins/gtkui/deadbeef.glade.h:130 +#: ../plugins/gtkui/interface.c:2237 ../plugins/gtkui/deadbeef.glade.h:131 msgid "Tab strip colors" msgstr "Farben der Reiterleiste" -#: ../plugins/gtkui/interface.c:2206 ../plugins/gtkui/deadbeef.glade.h:85 +#: ../plugins/gtkui/interface.c:2246 ../plugins/gtkui/deadbeef.glade.h:87 msgid "Override (looses GTK treeview theming, but speeds up rendering)" msgstr "Überschreiben (beschleunigt die Darstellung)" -#: ../plugins/gtkui/interface.c:2215 ../plugins/gtkui/deadbeef.glade.h:40 +#: ../plugins/gtkui/interface.c:2255 ../plugins/gtkui/deadbeef.glade.h:41 msgid "Even row" msgstr "Gerade Zeile" -#: ../plugins/gtkui/interface.c:2222 ../plugins/gtkui/deadbeef.glade.h:80 +#: ../plugins/gtkui/interface.c:2262 ../plugins/gtkui/deadbeef.glade.h:82 msgid "Odd row" msgstr "Ungerade Zeile" -#: ../plugins/gtkui/interface.c:2248 ../plugins/gtkui/deadbeef.glade.h:115 +#: ../plugins/gtkui/interface.c:2288 ../plugins/gtkui/deadbeef.glade.h:116 msgid "Selected row" msgstr "Ausgewählte Zeile" -#: ../plugins/gtkui/interface.c:2267 ../plugins/gtkui/deadbeef.glade.h:116 +#: ../plugins/gtkui/interface.c:2307 ../plugins/gtkui/deadbeef.glade.h:117 msgid "Selected text" msgstr "Ausgewählter Text" -#: ../plugins/gtkui/interface.c:2280 ../plugins/gtkui/deadbeef.glade.h:24 +#: ../plugins/gtkui/interface.c:2320 ../plugins/gtkui/deadbeef.glade.h:25 msgid "Cursor" msgstr "Mauszeiger" -#: ../plugins/gtkui/interface.c:2293 ../plugins/gtkui/deadbeef.glade.h:90 +#: ../plugins/gtkui/interface.c:2333 ../plugins/gtkui/deadbeef.glade.h:92 msgid "Playlist colors" msgstr "Farben der Wiedergabeliste" -#: ../plugins/gtkui/interface.c:2297 ../plugins/gtkui/deadbeef.glade.h:19 +#: ../plugins/gtkui/interface.c:2337 ../plugins/gtkui/deadbeef.glade.h:20 msgid "Colors" msgstr "Farben" -#: ../plugins/gtkui/interface.c:2306 ../plugins/gtkui/deadbeef.glade.h:37 +#: ../plugins/gtkui/interface.c:2346 ../plugins/gtkui/deadbeef.glade.h:38 msgid "Enable Proxy Server" msgstr "Proxyserver aktivieren" -#: ../plugins/gtkui/interface.c:2314 ../plugins/gtkui/deadbeef.glade.h:97 +#: ../plugins/gtkui/interface.c:2354 ../plugins/gtkui/deadbeef.glade.h:99 msgid "Proxy Server Address:" msgstr "Adresse des Proxyservers:" -#: ../plugins/gtkui/interface.c:2328 ../plugins/gtkui/deadbeef.glade.h:98 +#: ../plugins/gtkui/interface.c:2368 ../plugins/gtkui/deadbeef.glade.h:100 msgid "Proxy Server Port:" msgstr "Port des Proxyservers:" -#: ../plugins/gtkui/interface.c:2342 ../plugins/gtkui/deadbeef.glade.h:99 +#: ../plugins/gtkui/interface.c:2382 ../plugins/gtkui/deadbeef.glade.h:101 msgid "Proxy Type:" msgstr "Art des Proxyservers:" -#: ../plugins/gtkui/interface.c:2361 ../plugins/gtkui/deadbeef.glade.h:100 +#: ../plugins/gtkui/interface.c:2401 ../plugins/gtkui/deadbeef.glade.h:102 msgid "Proxy Username:" msgstr "Benutzername für Proxyserver:" -#: ../plugins/gtkui/interface.c:2374 ../plugins/gtkui/deadbeef.glade.h:96 +#: ../plugins/gtkui/interface.c:2414 ../plugins/gtkui/deadbeef.glade.h:98 msgid "Proxy Password:" msgstr "Passwort für Proxyserver:" -#: ../plugins/gtkui/interface.c:2384 ../plugins/gtkui/deadbeef.glade.h:77 +#: ../plugins/gtkui/interface.c:2424 ../plugins/gtkui/deadbeef.glade.h:79 msgid "Network" msgstr "Netzwerk" -#: ../plugins/gtkui/interface.c:2465 ../plugins/gtkui/deadbeef.glade.h:22 -#: ../translation/extra.c:77 +#: ../plugins/gtkui/interface.c:2455 ../plugins/gtkui/deadbeef.glade.h:144 +msgid "Version: " +msgstr "Version: " + +#: ../plugins/gtkui/interface.c:2519 ../plugins/gtkui/deadbeef.glade.h:23 +#: ../translation/extra.c:78 msgid "Copyright" msgstr "Copyright" -#: ../plugins/gtkui/interface.c:2475 ../plugins/gtkui/deadbeef.glade.h:92 +#: ../plugins/gtkui/interface.c:2529 ../plugins/gtkui/deadbeef.glade.h:94 msgid "Plugins" msgstr "Erweiterungen" -#: ../plugins/gtkui/interface.c:2947 ../plugins/gtkui/deadbeef.glade.h:139 +#: ../plugins/gtkui/interface.c:3016 ../plugins/gtkui/deadbeef.glade.h:142 msgid "URL:" msgstr "URL:" -#: ../plugins/gtkui/interface.c:3049 ../plugins/gtkui/deadbeef.glade.h:46 +#: ../plugins/gtkui/interface.c:3118 ../plugins/gtkui/deadbeef.glade.h:48 msgid "Group By" msgstr "Gruppieren nach" -#: ../plugins/gtkui/interface.c:3173 ../plugins/gtkui/deadbeef.glade.h:122 +#: ../plugins/gtkui/interface.c:3242 ../plugins/gtkui/deadbeef.glade.h:123 msgid "Sort by..." msgstr "Sortieren nach..." -#: ../plugins/gtkui/interface.c:3189 ../plugins/gtkui/deadbeef.glade.h:42 +#: ../plugins/gtkui/interface.c:3258 ../plugins/gtkui/deadbeef.glade.h:43 msgid "Format" msgstr "Format" -#: ../plugins/gtkui/interface.c:3219 +#: ../plugins/gtkui/interface.c:3288 msgid "Ascending" msgstr "Auftseigend" -#: ../plugins/gtkui/interface.c:3220 +#: ../plugins/gtkui/interface.c:3289 msgid "Descending" msgstr "Absteigend" -#: ../plugins/gtkui/interface.c:3273 ../plugins/gtkui/deadbeef.glade.h:113 +#: ../plugins/gtkui/interface.c:3342 ../plugins/gtkui/deadbeef.glade.h:114 +#: ../plugins/converter/interface.c:758 msgid "Select DSP Plugin" msgstr "Auswahl des DSP-Plugins" -#: ../plugins/gtkui/interface.c:3289 ../plugins/gtkui/deadbeef.glade.h:91 +#: ../plugins/gtkui/interface.c:3358 ../plugins/gtkui/deadbeef.glade.h:93 +#: ../plugins/converter/convgui.c:1016 ../plugins/converter/interface.c:774 +#: ../plugins/gtkui/dspconfig.c:139 msgid "Plugin" msgstr "Erweiterung" -#: ../plugins/gtkui/interface.c:3375 ../plugins/gtkui/deadbeef.glade.h:132 +#: ../plugins/gtkui/interface.c:3444 ../plugins/gtkui/deadbeef.glade.h:133 msgid "Tag Writer Settings" msgstr "Einstellungen für den Tag-Editor" -#: ../plugins/gtkui/interface.c:3406 ../plugins/gtkui/deadbeef.glade.h:143 +#: ../plugins/gtkui/interface.c:3475 ../plugins/gtkui/deadbeef.glade.h:147 msgid "Write ID3v2" msgstr "Schreibe ID3v2" -#: ../plugins/gtkui/interface.c:3410 ../plugins/gtkui/interface.c:3537 -#: ../plugins/gtkui/deadbeef.glade.h:142 +#: ../plugins/gtkui/interface.c:3479 ../plugins/gtkui/interface.c:3606 +#: ../plugins/gtkui/deadbeef.glade.h:146 msgid "Write ID3v1" msgstr "Schreibe ID3v1" -#: ../plugins/gtkui/interface.c:3414 ../plugins/gtkui/interface.c:3493 -#: ../plugins/gtkui/interface.c:3533 ../plugins/gtkui/deadbeef.glade.h:141 +#: ../plugins/gtkui/interface.c:3483 ../plugins/gtkui/interface.c:3562 +#: ../plugins/gtkui/interface.c:3602 ../plugins/gtkui/deadbeef.glade.h:145 msgid "Write APEv2" msgstr "APEv2 schreiben" -#: ../plugins/gtkui/interface.c:3422 ../plugins/gtkui/interface.c:3501 -#: ../plugins/gtkui/deadbeef.glade.h:129 +#: ../plugins/gtkui/interface.c:3491 ../plugins/gtkui/interface.c:3570 +#: ../plugins/gtkui/deadbeef.glade.h:130 msgid "Strip ID3v2" msgstr "ID3v2 entfernen" -#: ../plugins/gtkui/interface.c:3426 ../plugins/gtkui/interface.c:3549 -#: ../plugins/gtkui/deadbeef.glade.h:128 +#: ../plugins/gtkui/interface.c:3495 ../plugins/gtkui/interface.c:3618 +#: ../plugins/gtkui/deadbeef.glade.h:129 msgid "Strip ID3v1" msgstr "ID3v1 entfernen" -#: ../plugins/gtkui/interface.c:3430 ../plugins/gtkui/interface.c:3505 -#: ../plugins/gtkui/interface.c:3545 ../plugins/gtkui/deadbeef.glade.h:127 +#: ../plugins/gtkui/interface.c:3499 ../plugins/gtkui/interface.c:3574 +#: ../plugins/gtkui/interface.c:3614 ../plugins/gtkui/deadbeef.glade.h:128 msgid "Strip APEv2" msgstr "APEv2 entfernen" -#: ../plugins/gtkui/interface.c:3438 ../plugins/gtkui/deadbeef.glade.h:51 +#: ../plugins/gtkui/interface.c:3507 ../plugins/gtkui/deadbeef.glade.h:53 msgid "ID3v2 version" msgstr "ID3v2 Version" -#: ../plugins/gtkui/interface.c:3445 +#: ../plugins/gtkui/interface.c:3514 msgid "2.3 (Recommended)" msgstr "2.3 (empfohlen)" -#: ../plugins/gtkui/interface.c:3446 +#: ../plugins/gtkui/interface.c:3515 msgid "2.4" msgstr "2.4" -#: ../plugins/gtkui/interface.c:3452 ../plugins/gtkui/deadbeef.glade.h:50 +#: ../plugins/gtkui/interface.c:3521 ../plugins/gtkui/deadbeef.glade.h:52 msgid "ID3v1 character encoding (default is iso8859-1)" msgstr "ID3v1 Zeichensatz (Vorgabe ist iso8859-1)" -#: ../plugins/gtkui/interface.c:3489 ../plugins/gtkui/deadbeef.glade.h:144 +#: ../plugins/gtkui/interface.c:3558 ../plugins/gtkui/deadbeef.glade.h:148 msgid "Write ID3v2.4" msgstr "Schreibe ID3v2.4" -#: ../plugins/gtkui/mainplaylist.c:306 ../plugins/gtkui/search.c:385 +#: ../plugins/gtkui/mainplaylist.c:315 ../plugins/gtkui/search.c:391 msgid "Artist / Album" msgstr "Künstler / Album" -#: ../plugins/gtkui/plcommon.c:319 +#: ../plugins/gtkui/mainplaylist.c:316 ../plugins/gtkui/search.c:392 +msgid "Track No" +msgstr "Track-Nr." + +#: ../plugins/gtkui/plcommon.c:329 msgid "Delete files from disk" msgstr "Dateien vom Datenträger entfernen" -#: ../plugins/gtkui/plcommon.c:320 +#: ../plugins/gtkui/plcommon.c:330 msgid "" "Files will be lost. Proceed?\n" "(This dialog can be turned off in GTKUI plugin settings)" @@ -891,48 +917,49 @@ msgstr "" "Dateien werden verloren gehen. Weitermachen?\n" "(Diese Abfrage kann in den Einstellungen des GTK-Plugin abgeschaltet werden)" -#: ../plugins/gtkui/plcommon.c:321 ../plugins/gtkui/trkproperties.c:162 -#: ../plugins/gtkui/trkproperties.c:672 +#: ../plugins/gtkui/plcommon.c:331 ../plugins/gtkui/trkproperties.c:162 +#: ../plugins/gtkui/trkproperties.c:693 ../plugins/converter/convgui.c:759 +#: ../plugins/converter/convgui.c:1136 msgid "Warning" msgstr "Warnung" -#: ../plugins/gtkui/plcommon.c:397 +#: ../plugins/gtkui/plcommon.c:434 msgid "Add to playback queue" msgstr "Zur Warteschlange hinzufügen" -#: ../plugins/gtkui/plcommon.c:402 +#: ../plugins/gtkui/plcommon.c:439 msgid "Remove from playback queue" msgstr "Von Warteschlange entfernen" -#: ../plugins/gtkui/plcommon.c:410 +#: ../plugins/gtkui/plcommon.c:447 msgid "Reload metadata" msgstr "Metadaten neu laden" -#: ../plugins/gtkui/plcommon.c:429 +#: ../plugins/gtkui/plcommon.c:466 msgid "Remove from disk" msgstr "Vom Datenträger entfernen" -#: ../plugins/gtkui/plcommon.c:724 ../plugins/gtkui/plcommon.c:849 +#: ../plugins/gtkui/plcommon.c:845 ../plugins/gtkui/plcommon.c:970 msgid "Add column" msgstr "Spalte hinzufügen" -#: ../plugins/gtkui/plcommon.c:754 ../plugins/gtkui/plcommon.c:853 +#: ../plugins/gtkui/plcommon.c:875 ../plugins/gtkui/plcommon.c:974 msgid "Edit column" msgstr "Spalte bearbeiten" -#: ../plugins/gtkui/plcommon.c:857 +#: ../plugins/gtkui/plcommon.c:978 msgid "Remove column" msgstr "Spalte entfernen" -#: ../plugins/gtkui/plcommon.c:867 +#: ../plugins/gtkui/plcommon.c:988 msgid "Group by" msgstr "Gruppieren nach" -#: ../plugins/gtkui/plcommon.c:874 +#: ../plugins/gtkui/plcommon.c:995 msgid "None" msgstr "Nichts" -#: ../plugins/gtkui/plcommon.c:878 +#: ../plugins/gtkui/plcommon.c:999 msgid "Artist/Date/Album" msgstr "Künstler/Datum/Album" @@ -949,7 +976,7 @@ msgstr "%s konfigurieren" msgid "Default Audio Device" msgstr "Standard Ausgabegerät" -#: ../plugins/gtkui/prefwin.c:318 +#: ../plugins/gtkui/prefwin.c:318 ../plugins/converter/interface.c:649 msgid "Add" msgstr "Hinzufügen" @@ -969,7 +996,7 @@ msgstr "Tastenkombination" msgid "Adding files..." msgstr "Dateien hinzufügen..." -#: ../plugins/gtkui/progress.c:91 +#: ../plugins/gtkui/progress.c:90 msgid "Initializing..." msgstr "Initialisiere..." @@ -987,45 +1014,45 @@ msgstr "Möchten Sie das Fenster wirklich schließen?" msgid "[Multiple values] " msgstr "[Mehrere Werte] " -#: ../plugins/gtkui/trkproperties.c:398 ../plugins/gtkui/trkproperties.c:410 +#: ../plugins/gtkui/trkproperties.c:407 ../plugins/gtkui/trkproperties.c:419 msgid "Key" msgstr "Schlüssel" -#: ../plugins/gtkui/trkproperties.c:399 ../plugins/gtkui/trkproperties.c:411 +#: ../plugins/gtkui/trkproperties.c:408 ../plugins/gtkui/trkproperties.c:420 msgid "Value" msgstr "Wert" -#: ../plugins/gtkui/trkproperties.c:573 +#: ../plugins/gtkui/trkproperties.c:594 msgid "Writing tags..." msgstr "Speichere Tags..." -#: ../plugins/gtkui/trkproperties.c:600 +#: ../plugins/gtkui/trkproperties.c:621 msgid "Name:" msgstr "Name:" -#: ../plugins/gtkui/trkproperties.c:612 +#: ../plugins/gtkui/trkproperties.c:633 msgid "Field names must not start with : or _" msgstr "Feldnamen dürfen nicht mit : oder _ beginnen" -#: ../plugins/gtkui/trkproperties.c:613 ../plugins/gtkui/trkproperties.c:647 +#: ../plugins/gtkui/trkproperties.c:634 ../plugins/gtkui/trkproperties.c:668 msgid "Cannot add field" msgstr "Kann Feld nicht hinzufügen" -#: ../plugins/gtkui/trkproperties.c:646 +#: ../plugins/gtkui/trkproperties.c:667 msgid "Field with such name already exists, please try different name." msgstr "" "Ein Feld mit diesem Namen existiert bereits, bitte einen anderen Name wählen." # Soll das Fenster wirklich geschlossen werden? -#: ../plugins/gtkui/trkproperties.c:671 +#: ../plugins/gtkui/trkproperties.c:692 msgid "Really remove selected field?" msgstr "Möchten Sie das Fenster wirklich schließen?" -#: ../plugins/gtkui/trkproperties.c:713 +#: ../plugins/gtkui/trkproperties.c:734 msgid "Add field" msgstr "Feld hinzufügen" -#: ../plugins/gtkui/trkproperties.c:716 +#: ../plugins/gtkui/trkproperties.c:737 msgid "Remove field" msgstr "Feld entfernen" @@ -1076,32 +1103,39 @@ msgstr " --toggle-pause Wiedergabe umschalten (Play/Pause)\n" #: ../main.c:99 #, c-format +msgid "" +" --play-pause Start playback if stopped, toggle pause otherwise\n" +msgstr "" +" --play-pause Wiedergabe starten falls angehalten, sonst pausieren\n" + +#: ../main.c:100 +#, c-format msgid " --next Next song in playlist\n" msgstr " --next Nächster Titel in der Wiedergabeliste\n" -#: ../main.c:100 +#: ../main.c:101 #, c-format msgid " --prev Previous song in playlist\n" msgstr " --prev Vorheriger Titel in der Wiedergabeliste\n" -#: ../main.c:101 +#: ../main.c:102 #, c-format msgid " --random Random song in playlist\n" msgstr " --random Zufälliger Titel in der Wiedergabeliste\n" -#: ../main.c:102 +#: ../main.c:103 #, c-format msgid " --queue Append file(s) to existing playlist\n" msgstr "" " --queue Datei(en) an bestehende Wiedergabeliste anhängen\n" -#: ../main.c:103 +#: ../main.c:104 #, c-format msgid " --nowplaying FMT Print formatted track name to stdout\n" msgstr "" " --nowplaying FMT Formatierten Tracknamen auf Standardausgabe schreiben\n" -#: ../main.c:104 +#: ../main.c:105 #, c-format msgid "" " FMT %%-syntax: [a]rtist, [t]itle, al[b]um,\n" @@ -1109,7 +1143,7 @@ msgid "" " copy[r]ight, [e]lapsed\n" msgstr "" -#: ../main.c:107 +#: ../main.c:108 #, c-format msgid "" " e.g.: --nowplaying \"%%a - %%t\" should print \"artist " @@ -1118,15 +1152,22 @@ msgstr "" " z.B.: --nowplaying \"%%a - %%t\" sollte \"Artist - " "Titel\" ausgeben\n" -#: ../playlist.c:397 ../playlist.c:2484 +#: ../main.c:109 +#, c-format +msgid "" +" for more info, see http://sourceforge.net/apps/" +"mediawiki/deadbeef/index.php?title=Title_Formatting\n" +msgstr "" + +#: ../playlist.c:443 ../playlist.c:2613 msgid "Default" msgstr "Standard" -#: ../playlist.c:3645 +#: ../playlist.c:3862 msgid "Yes" msgstr "Ja" -#: ../playlist.c:3645 +#: ../playlist.c:3862 msgid "No" msgstr "Nein" @@ -1138,7 +1179,7 @@ msgstr "" "2.3 (Empfohlen)\n" "2.4" -#: ../plugins/gtkui/deadbeef.glade.h:13 +#: ../plugins/gtkui/deadbeef.glade.h:14 msgid "" "Ascending\n" "Descending" @@ -1146,7 +1187,7 @@ msgstr "" "Aufsteigend\n" "Absteigend" -#: ../plugins/gtkui/deadbeef.glade.h:32 +#: ../plugins/gtkui/deadbeef.glade.h:33 msgid "" "Disable\n" "Track\n" @@ -1156,7 +1197,7 @@ msgstr "" "Track\n" "Album" -#: ../plugins/gtkui/deadbeef.glade.h:54 +#: ../plugins/gtkui/deadbeef.glade.h:56 msgid "" "Item Index\n" "Playing\n" @@ -1166,7 +1207,7 @@ msgid "" "Album\n" "Title\n" "Duration\n" -"Track No\n" +"Track Number\n" "Band / Album Artist\n" "Custom" msgstr "" @@ -1182,7 +1223,7 @@ msgstr "" "Band / Album-Künstler\n" "Benutzerdefiniert" -#: ../plugins/gtkui/deadbeef.glade.h:66 +#: ../plugins/gtkui/deadbeef.glade.h:68 msgid "" "Left\n" "Right" @@ -1191,6 +1232,7 @@ msgstr "" "Rechts" #: ../plugins/gtkui/support.c:90 ../plugins/gtkui/support.c:114 +#: ../plugins/converter/support.c:90 ../plugins/converter/support.c:114 #, c-format msgid "Couldn't find pixmap file: %s" msgstr "Pixmap-Datei nicht gefunden: %s" @@ -1224,7 +1266,7 @@ msgstr "ALSA-Resampling verwenden" msgid "Release device while stopped" msgstr "Gerät bei angehaltener Wiedergabe freigeben" -#: ../translation/extra.c:8 ../translation/extra.c:50 +#: ../translation/extra.c:8 ../translation/extra.c:51 msgid "Preferred buffer size" msgstr "Bevorzugte Puffergröße" @@ -1258,192 +1300,470 @@ msgstr "Scrobble-URL" msgid "Device file" msgstr "Ausgabegerät" +#: ../translation/extra.c:18 +msgid "OSS4 samplerate bug workaround" +msgstr "" + #. Album Artwork plugin -#: ../translation/extra.c:19 +#: ../translation/extra.c:20 msgid "Cache update period (hr)" msgstr "Cache-Aktualisierungsperiode (Stunden)" -#: ../translation/extra.c:20 +#: ../translation/extra.c:21 msgid "Fetch from embedded tags" msgstr "Aus eingebetteten Tags lesen" -#: ../translation/extra.c:21 +#: ../translation/extra.c:22 msgid "Fetch from local folder" msgstr "Aus lokalem Verzeichnis lesen" -#: ../translation/extra.c:22 +#: ../translation/extra.c:23 msgid "Local cover file mask" msgstr "Maske für lokale Cover-Dateien" -#: ../translation/extra.c:23 +#: ../translation/extra.c:24 msgid "Fetch from last.fm" msgstr "Von Last.fm holen" -#: ../translation/extra.c:24 +#: ../translation/extra.c:25 msgid "Fetch from albumart.org" msgstr "Von albumart.org holen" -#: ../translation/extra.c:25 +#: ../translation/extra.c:26 msgid "Scale artwork towards longer side" msgstr "Artwork zu längerer Seite skalieren" #. Audio CD player -#: ../translation/extra.c:27 +#: ../translation/extra.c:28 msgid "Use CDDB/FreeDB" msgstr "CDDB/FreeDB verwenden" -#: ../translation/extra.c:28 +#: ../translation/extra.c:29 msgid "Prefer CD-Text over CDDB" msgstr "CD-Text gegenüber CDDB vorziehen" -#: ../translation/extra.c:29 +#: ../translation/extra.c:30 msgid "CDDB url (e.g. 'freedb.org')" msgstr "CDDB-URL (z.B. 'freedb.org')" -#: ../translation/extra.c:30 +#: ../translation/extra.c:31 msgid "CDDB port number (e.g. '888')" msgstr "CDDB-Port (z.B. '888')" -#: ../translation/extra.c:31 +#: ../translation/extra.c:32 msgid "Prefer CDDB protocol over HTTP" msgstr "CDDB-Protokoll gegenüber HTTP vorziehen" -#: ../translation/extra.c:32 +#: ../translation/extra.c:33 msgid "Enable NRG image support" msgstr "Unterstützung von NRG-Abbilddateien einschalten" #. DUMB module player plugin -#: ../translation/extra.c:34 +#: ../translation/extra.c:35 msgid "Resampling quality (0..2, higher is better)" msgstr "Resampling-Qualität (0..2, höher ist besser)" #. Game_Music_Emu decoder plugin -#: ../translation/extra.c:36 +#: ../translation/extra.c:37 msgid "Max song length (in minutes)" msgstr "Maximale Song-Länge (in Minuten)" #. Standard GTK2 user interface plugin -#: ../translation/extra.c:38 +#: ../translation/extra.c:39 msgid "Ask confirmation to delete files from disk" msgstr "Entfernen von Dateien vom Datenträger bestätigen lassen" -#: ../translation/extra.c:39 +#: ../translation/extra.c:40 msgid "Status icon volume control sensitivity" msgstr "Sensitivität des Volumenreglers im Systemleisten-Icon" -#: ../translation/extra.c:40 +#: ../translation/extra.c:41 msgid "Custom status icon" msgstr "Benutzerdefiniertes Systemleisten-Icon" -#: ../translation/extra.c:41 +#: ../translation/extra.c:42 msgid "Run gtk_init with --sync (debug mode)" msgstr "gtk_init mit --sync ausführen (Debug-Modus)" -#: ../translation/extra.c:42 +#: ../translation/extra.c:43 msgid "Add separators between plugin context menu items" msgstr "Kontextmenü-Einträge von verschiedenen Plugins trennen" #. OSD Notify plugin -#: ../translation/extra.c:44 +#: ../translation/extra.c:45 msgid "Notification title format" msgstr "Titel der Benachrichtigung" -#: ../translation/extra.c:45 +#: ../translation/extra.c:46 msgid "Notification content format" msgstr "Inhalt der Benachrichtigung" -#: ../translation/extra.c:46 +#: ../translation/extra.c:47 msgid "Show album art" msgstr "Album Artwork anzeigen" -#: ../translation/extra.c:47 +#: ../translation/extra.c:48 msgid "Album art size (px)" msgstr "Größe des Album Artworks (Pixel)" #. PulseAudio output plugin -#: ../translation/extra.c:49 +#: ../translation/extra.c:50 msgid "PulseAudio server" msgstr "PulseAudio Server" -#: ../translation/extra.c:51 +#: ../translation/extra.c:52 msgid "Samplerate" msgstr "Samplerate" #. SHN player plugin -#: ../translation/extra.c:53 +#: ../translation/extra.c:54 msgid "Relative seek table path" msgstr "Relativer Pfad der Suchtabelle" -#: ../translation/extra.c:54 +#: ../translation/extra.c:55 msgid "Absolute seek table path" msgstr "Absoluter Pfad der Suchtabelle" -#: ../translation/extra.c:55 +#: ../translation/extra.c:56 msgid "Swap audio bytes (toggle if all you hear is static)" msgstr "Audio-Bytes vertauschen (umschalten, falls nur Rauschen zu hören ist)" #. SID decoder plugin -#: ../translation/extra.c:57 +#: ../translation/extra.c:58 msgid "Enable HVSC Songlength DB" msgstr "HVSC Songlängen-Datenbank aktivieren" -#: ../translation/extra.c:58 +#: ../translation/extra.c:59 msgid "Songlengths.txt (from HVSC)" msgstr "Pfad zur songlengths.txt (von HVSC)" -#: ../translation/extra.c:59 +#: ../translation/extra.c:60 msgid "Bits per sample (8 or 16)" msgstr "Bits pro Sample (8 oder 16)" -#: ../translation/extra.c:60 +#: ../translation/extra.c:61 msgid "Default song length (sec)" msgstr "Standard-Songlänge (Sekunden)" #. WildMidi player plugin -#: ../translation/extra.c:62 +#: ../translation/extra.c:63 msgid "Timidity++ bank configuration file" msgstr "Timidity++ Konfigurationsdatei" -#: ../translation/extra.c:65 +#: ../translation/extra.c:66 msgid "Track Title" msgstr "Titel" -#: ../translation/extra.c:66 +#: ../translation/extra.c:67 msgid "Performer" msgstr "Interpret" -#: ../translation/extra.c:70 -msgid "Track Number" -msgstr "Track-Nummer" - -#: ../translation/extra.c:71 +#: ../translation/extra.c:72 msgid "Total Tracks" msgstr "Gesamtanzahl Tracks" -#: ../translation/extra.c:72 +#: ../translation/extra.c:73 msgid "Genre" msgstr "Genre" -#: ../translation/extra.c:73 +#: ../translation/extra.c:74 msgid "Composer" msgstr "Verfasser" -#: ../translation/extra.c:74 +#: ../translation/extra.c:75 msgid "Disc Number" msgstr "Disk-Nummer" -#: ../translation/extra.c:75 +#: ../translation/extra.c:76 msgid "Comment" msgstr "Kommentar" -#: ../translation/extra.c:76 +#: ../translation/extra.c:77 msgid "Encoder / Vendor" msgstr "Encoder / Anbieter" -#. FFmpeg deocder plugin #: ../translation/extra.c:79 +msgid "Location" +msgstr "Ort" + +#: ../translation/extra.c:80 +msgid "Subtrack Index" +msgstr "Subtrack-Index" + +#: ../translation/extra.c:81 +msgid "Tag Type(s)" +msgstr "Tag-Typ" + +#: ../translation/extra.c:82 +msgid "Embedded Cuesheet" +msgstr "Eingebettetes Cusheet" + +#: ../translation/extra.c:83 +msgid "Codec" +msgstr "Codec" + +#. FFmpeg deocder plugin +#: ../translation/extra.c:85 msgid "File Extensions (separate with ';')" msgstr "Dateiendungen (trennen mit ';')" +#. Converter GUI +#: ../translation/extra.c:87 +msgid "Convert" +msgstr "Konvertieren" + +#. Resampler (Secret Rabbit Code) +#: ../translation/extra.c:89 +msgid "Target Samplerate" +msgstr "Samplerate" + +#: ../translation/extra.c:90 +msgid "Quality / Algorythm" +msgstr "Qualität / Algorithmus" + +#: ../translation/extra.c:91 +msgid "Automatic Samplerate (overrides Target Samplerate)" +msgstr "Automatische Samplerate (überschreibt die Ziel-Samplerate)" + +#: ../plugins/converter/convgui.c:108 +msgid "The file already exists. Overwrite?" +msgstr "Die Datei existiert bereits. Überschreiben?" + +#: ../plugins/converter/convgui.c:110 +msgid "Converter warning" +msgstr "Converter: Warnung" + +#: ../plugins/converter/convgui.c:222 +msgid "Please select encoder" +msgstr "Bitte einen Encoder auswählen" + +#: ../plugins/converter/convgui.c:224 +msgid "Converter error" +msgstr "Converter: Fehler" + +#: ../plugins/converter/convgui.c:248 +msgid "Converting..." +msgstr "Konvertiere..." + +#: ../plugins/converter/convgui.c:394 ../plugins/converter/convgui.c:496 +msgid "Select folder..." +msgstr "Verzeichnis wählen..." + +#: ../plugins/converter/convgui.c:635 +msgid "Failed to save encoder preset" +msgstr "Fehler beim Speichern des Encoder-Profil" + +#: ../plugins/converter/convgui.c:637 ../plugins/converter/convgui.c:1035 +msgid "" +"Check preset folder permissions, try to pick different title, or free up " +"some disk space" +msgstr "Bitte Zugriffsrechte auf das Verzeichnis prüfen, einen anderen Titel " +"wählen oder freien Platz auf der Festplatte schaffen" + +#: ../plugins/converter/convgui.c:637 ../plugins/converter/convgui.c:1035 +msgid "Preset with the same name already exists. Try to pick another title." +msgstr "Ein Profil mit diesem Namen existiert bereits. Bitte einen anderen Titel wählen." + +#: ../plugins/converter/convgui.c:638 ../plugins/converter/convgui.c:1036 +msgid "Error" +msgstr "Fehler" + +#: ../plugins/converter/convgui.c:692 +msgid "Add new encoder" +msgstr "Neuen Encoder hinzufügen" + +#: ../plugins/converter/convgui.c:724 +msgid "Edit encoder" +msgstr "Encoder bearbeiten" + +#: ../plugins/converter/convgui.c:756 ../plugins/converter/convgui.c:1133 +msgid "Remove preset" +msgstr "Profil entfernen" + +#: ../plugins/converter/convgui.c:758 ../plugins/converter/convgui.c:1135 +msgid "This action will delete the selected preset. Are you sure?" +msgstr "Diese Aktion wird das gewählte Profil löschen. Sind Sie sicher?" + +#: ../plugins/converter/convgui.c:782 +msgid "Encoders" +msgstr "Encoder" + +#: ../plugins/converter/convgui.c:838 ../plugins/gtkui/dspconfig.c:183 +msgid "Add plugin to DSP chain" +msgstr "Plugin in DSP-Kette einfügen" + +#: ../plugins/converter/convgui.c:1034 +msgid "Failed to save DSP preset" +msgstr "Fehler beim Speichern des DSP-Profils" + +#: ../plugins/converter/convgui.c:1098 +msgid "New DSP Preset" +msgstr "Neues DSP-Profil" + +#: ../plugins/converter/convgui.c:1183 +msgid "Edit DSP Preset" +msgstr "DSP-Profil bearbeiten" + +#: ../plugins/converter/convgui.c:1203 +msgid "DSP Presets" +msgstr "DSP-Profile" + +#: ../plugins/converter/interface.c:97 +msgid "Output folder:" +msgstr "Zielverzeichnis:" + +#: ../plugins/converter/interface.c:118 +msgid "Output file name:" +msgstr "Dateiname:" + +#: ../plugins/converter/interface.c:129 +msgid "" +"Extension (e.g. .mp3) will be appended automatically.\n" +"Leave the field empty for default (%a - %t)." +msgstr "" +"Erweiterung (z.B. .mp3) wird automatisch angehängt.\n" +"Feld leer lassen um Standardwert zu verwenden (%a - %t)." + +#: ../plugins/converter/interface.c:142 +msgid "Encoder:" +msgstr "Encoder:" + +#: ../plugins/converter/interface.c:166 +msgid "DSP preset:" +msgstr "DSP-Profil:" + +#: ../plugins/converter/interface.c:189 +msgid "Number of threads:" +msgstr "Thread-Anzahl:" + +#: ../plugins/converter/interface.c:202 +msgid "Output sample format:" +msgstr "Ausgabe-Sampleformat:" + +#: ../plugins/converter/interface.c:209 +msgid "Keep source format" +msgstr "Format der Eingangsdatei verwenden" + +#: ../plugins/converter/interface.c:210 +msgid "8 bit signed int" +msgstr "" + +#: ../plugins/converter/interface.c:211 +msgid "16 bit signed int" +msgstr "" + +#: ../plugins/converter/interface.c:212 +msgid "24 bit signed int" +msgstr "" + +#: ../plugins/converter/interface.c:213 +msgid "32 bit signed int" +msgstr "" + +#: ../plugins/converter/interface.c:214 +msgid "32 bit float" +msgstr "" + +#: ../plugins/converter/interface.c:220 +msgid "When file exists:" +msgstr "Falls Datei bereits existiert:" + +#: ../plugins/converter/interface.c:227 +msgid "Prompt" +msgstr "Nachfragen" + +#: ../plugins/converter/interface.c:228 +msgid "Overwrite" +msgstr "Überschreiben" + +#: ../plugins/converter/interface.c:230 +msgid "Preserve folder structure, starting from:" +msgstr "Verzeichnis-Struktur beibehalten, starten mit:" + +#: ../plugins/converter/interface.c:386 +msgid "Edit Encoder Preset" +msgstr "Profil laden" + +#: ../plugins/converter/interface.c:409 +msgid "Untitled Encoder" +msgstr "Neuer Encoder" + +#: ../plugins/converter/interface.c:417 +msgid "Output file extension:" +msgstr "Endung der Zieldatei:" + +#: ../plugins/converter/interface.c:424 +msgid "E.g. mp3" +msgstr "Z.B. mp3" + +#: ../plugins/converter/interface.c:432 +msgid "Command line:" +msgstr "Kommandozeile:" + +#: ../plugins/converter/interface.c:443 +#, c-format +msgid "" +"Example: lame - %o\n" +"%i for input file, %o for output file, - for stdin" +msgstr "" +"Beispiel: lame - %o\n" +"%i für Eingabedatei, %o für Zieldatei, - für stdin" + +#: ../plugins/converter/interface.c:453 +#, c-format +msgid "" +"<small>%o - output file name\n" +"%i - temporary input file name</small>" +msgstr "" +"<small>%o - Name der Zieldatei\n" +"%i - Name der temporären Eingabedatei</small>" + +#: ../plugins/converter/interface.c:462 +msgid "Method:" +msgstr "Methode:" + +#: ../plugins/converter/interface.c:469 +msgid "Pipe" +msgstr "" + +#: ../plugins/converter/interface.c:470 +msgid "Temporary file" +msgstr "Temporäre Datei" + +#: ../plugins/converter/interface.c:487 +msgid "APEv2" +msgstr "APEv2" + +#: ../plugins/converter/interface.c:493 +msgid "ID3v1" +msgstr "ID3v1" + +#: ../plugins/converter/interface.c:499 +msgid "OggVorbis" +msgstr "OggVorbis" + +#: ../plugins/converter/interface.c:505 +msgid "FLAC" +msgstr "FLAC" + +#: ../plugins/converter/interface.c:517 +msgid "ID3v2" +msgstr "ID3v2" + +#: ../plugins/converter/interface.c:527 +msgid "<b>Tag writer</b>" +msgstr "<b>Tags schreiben</b>" + +#: ../plugins/converter/interface.c:614 +msgid "DSP Preset Editor" +msgstr "DSP-Profileditor" + +#: ../plugins/converter/interface.c:637 +msgid "Untitled DSP Preset" +msgstr "Neues DSP-Profil" + +#~ msgid "Save playlist as" +#~ msgstr "Wiedergabeliste speichern unter" + #~ msgid "HVSC path" #~ msgstr "HVSC Pfad" diff --git a/replaygain.c b/replaygain.c index 18e07264..b2791b4c 100644 --- a/replaygain.c +++ b/replaygain.c @@ -24,13 +24,16 @@ static int conf_replaygain_mode = 0; static int conf_replaygain_scale = 1; static float conf_replaygain_preamp = 0; +static float conf_global_preamp = 0; static float rg_albumgain = 1; static float rg_albumpeak = 1; static float rg_trackgain = 1; static float rg_trackpeak = 1; -static float rg_albumgain_preamp = 1; -static float rg_trackgain_preamp = 1; +static float rg_albumgain_full_preamp = 1; +static float rg_trackgain_full_preamp = 1; +static float rg_albumgain_global_preamp = 1; +static float rg_trackgain_global_preamp = 1; void replaygain_apply (ddb_waveformat_t *fmt, playItem_t *it, char *bytes, int bytesread) { @@ -53,12 +56,15 @@ replaygain_apply (ddb_waveformat_t *fmt, playItem_t *it, char *bytes, int bytesr } void -replaygain_set (int mode, int scale, float preamp) { +replaygain_set (int mode, int scale, float preamp, float global_preamp) { conf_replaygain_mode = mode; conf_replaygain_scale = scale; conf_replaygain_preamp = db_to_amp (preamp); - rg_albumgain_preamp = rg_albumgain * conf_replaygain_preamp; - rg_trackgain_preamp = rg_trackgain * conf_replaygain_preamp; + conf_global_preamp = db_to_amp (global_preamp); + rg_albumgain_full_preamp = rg_albumgain * conf_replaygain_preamp * conf_global_preamp; + rg_trackgain_full_preamp = rg_trackgain * conf_replaygain_preamp * conf_global_preamp; + rg_albumgain_global_preamp = rg_albumgain * conf_global_preamp; + rg_trackgain_global_preamp = rg_trackgain * conf_global_preamp; } void @@ -76,8 +82,10 @@ replaygain_set_values (float albumgain, float albumpeak, float trackgain, float } rg_albumgain = db_to_amp (albumgain); rg_trackgain = db_to_amp (trackgain); - rg_albumgain_preamp = rg_albumgain * conf_replaygain_preamp; - rg_trackgain_preamp = rg_trackgain * conf_replaygain_preamp; + rg_albumgain_full_preamp = rg_albumgain * conf_replaygain_preamp * conf_global_preamp; + rg_trackgain_full_preamp = rg_trackgain * conf_replaygain_preamp * conf_global_preamp; + rg_albumgain_global_preamp = rg_albumgain * conf_global_preamp; + rg_trackgain_global_preamp = rg_trackgain * conf_global_preamp; rg_albumpeak = albumpeak; rg_trackpeak = trackpeak; } @@ -87,9 +95,10 @@ get_int_volume (void) { int vol = 1000; if (conf_replaygain_mode == 1) { if (rg_trackgain == 1) { - return -1; + vol = rg_trackgain_global_preamp * 1000; + } else { + vol = rg_trackgain_full_preamp * 1000; } - vol = rg_trackgain_preamp * 1000; if (conf_replaygain_scale) { if (vol * rg_trackpeak > 1000) { vol = 1000 / rg_trackpeak; @@ -98,9 +107,10 @@ get_int_volume (void) { } else if (conf_replaygain_mode == 2) { if (rg_albumgain == 1) { - return -1; + vol = rg_albumgain_global_preamp * 1000; + } else { + vol = rg_albumgain_full_preamp * 1000; } - vol = rg_albumgain_preamp * 1000; if (conf_replaygain_scale) { if (vol * rg_albumpeak > 1000) { vol = 1000 / rg_albumpeak; @@ -213,9 +223,10 @@ apply_replay_gain_float32 (playItem_t *it, char *bytes, int size) { float vol = 1.f; if (conf_replaygain_mode == 1) { if (rg_trackgain == 1) { - return; + vol = rg_trackgain_global_preamp; + } else { + vol = rg_trackgain_full_preamp; } - vol = rg_trackgain_preamp; if (conf_replaygain_scale) { if (vol * rg_trackpeak > 1.f) { vol = 1.f / rg_trackpeak; @@ -224,9 +235,10 @@ apply_replay_gain_float32 (playItem_t *it, char *bytes, int size) { } else if (conf_replaygain_mode == 2) { if (rg_albumgain == 1) { - return; + vol = rg_albumgain_global_preamp; + } else { + vol = rg_albumgain_full_preamp; } - vol = rg_albumgain_preamp; if (conf_replaygain_scale) { if (vol * rg_albumpeak > 1.f) { vol = 1.f / rg_albumpeak; diff --git a/replaygain.h b/replaygain.h index cee57782..f7027230 100644 --- a/replaygain.h +++ b/replaygain.h @@ -25,7 +25,7 @@ void replaygain_apply (ddb_waveformat_t *fmt, playItem_t *it, char *bytes, int bytesread); void -replaygain_set (int mode, int scale, float preamp); +replaygain_set (int mode, int scale, float preamp, float global_preamp); void replaygain_set_values (float albumgain, float albumpeak, float trackgain, float trackpeak); diff --git a/scripts/quickinstall.sh b/scripts/quickinstall.sh index b7cda98b..61c08cd3 100755 --- a/scripts/quickinstall.sh +++ b/scripts/quickinstall.sh @@ -18,6 +18,7 @@ cp ./plugins/lastfm/.libs/lastfm.so /usr/local/lib/deadbeef/ cp ./plugins/sid/.libs/sid.so /usr/local/lib/deadbeef/ cp ./plugins/adplug/.libs/adplug.so /usr/local/lib/deadbeef/ cp ./plugins/gtkui/.libs/ddb_gui_GTK2.so /usr/local/lib/deadbeef/ +cp ./plugins/gtkui/.libs/ddb_gui_GTK3.so /usr/local/lib/deadbeef/ cp ./plugins/sndfile/.libs/sndfile.so /usr/local/lib/deadbeef/ cp ./plugins/pulse/.libs/pulse.so /usr/local/lib/deadbeef/ cp ./plugins/artwork/.libs/artwork.so /usr/local/lib/deadbeef/ @@ -38,7 +39,8 @@ cp ./plugins/dsp_libsrc/.libs/dsp_libsrc.so /usr/local/lib/deadbeef/ cp ./plugins/m3u/.libs/m3u.so /usr/local/lib/deadbeef/ cp ./plugins/ddb_input_uade2/ddb_input_uade2.so /usr/local/lib/deadbeef/ cp ./plugins/converter/.libs/converter.so /usr/local/lib/deadbeef/ -cp ./plugins/converter/.libs/converter_gtkui.so /usr/local/lib/deadbeef/ +cp ./plugins/converter/.libs/converter_gtk2.so /usr/local/lib/deadbeef/ +cp ./plugins/converter/.libs/converter_gtk3.so /usr/local/lib/deadbeef/ cp ./plugins/soundtouch/ddb_soundtouch.so /usr/local/lib/deadbeef/ cp ./plugins/vfs_zip/.libs/vfs_zip.so /usr/local/lib/deadbeef/ cp ./plugins/mono2stereo/mono2stereo.so /usr/local/lib/deadbeef/ @@ -24,6 +24,7 @@ #include <sys/prctl.h> #endif #include <sys/time.h> +#include <errno.h> #include "threading.h" #include "playlist.h" #include "common.h" @@ -48,6 +49,7 @@ FILE *out; #endif +#define MAX_PLAYLIST_DOWNLOAD_SIZE 25000 static int streamer_read_async (char *bytes, int size); @@ -142,6 +144,7 @@ streamer_unlock (void) { static void streamer_abort_files (void) { + trace ("\033[0;33mstreamer_abort_files\033[37;0m\n"); if (fileinfo && fileinfo->file) { deadbeef->fabort (fileinfo->file); } @@ -699,46 +702,157 @@ streamer_set_current (playItem_t *it) { strncpy (filetype, ft, sizeof (filetype)); } pl_unlock (); - if (!decoder_id[0] && filetype && !strcmp (filetype, "content")) { + if (!decoder_id[0] && (!strcmp (filetype, "content") || !filetype[0])) { // try to get content-type mutex_lock (decodemutex); trace ("\033[0;34mopening file %s\033[37;0m\n", pl_find_meta (it, ":URI")); DB_FILE *fp = streamer_file = vfs_fopen (pl_find_meta (it, ":URI")); mutex_unlock (decodemutex); const char *plug = NULL; - if (fp && vfs_get_content_type) { - const char *ct = vfs_get_content_type (fp); - if (ct) { - trace ("got content-type: %s\n", ct); - if (!strcmp (ct, "audio/mpeg")) { - plug = "stdmpg"; - } - else if (!strcmp (ct, "application/ogg")) { - plug = "stdogg"; + trace ("\033[0;34mgetting content-type\033[37;0m\n"); + if (!fp) { + goto error; + } + const char *ct = vfs_get_content_type (fp); + if (!ct) { + vfs_fclose (fp); + goto error; + } + trace ("got content-type: %s\n", ct); + if (!strcmp (ct, "audio/mpeg")) { + plug = "stdmpg"; + } + else if (!strcmp (ct, "application/ogg")) { + plug = "stdogg"; + } + else if (!strcmp (ct, "audio/aacp")) { + plug = "aac"; + } + else if (!strcmp (ct, "audio/aac")) { + plug = "aac"; + } + else if (!strcmp (ct, "audio/wma")) { + plug = "ffmpeg"; + } + else if (!strcmp (ct, "audio/x-mpegurl") || !strncmp (ct, "text/html", 9)) { + // download playlist into temp file + char *buf = NULL; + int fd = -1; + FILE *out = NULL; + + int size = vfs_fgetlength (fp); + if (size <= 0) { + size = MAX_PLAYLIST_DOWNLOAD_SIZE; + } + buf = malloc (size); + if (!buf) { + trace ("failed to alloc %d bytes for playlist buffer\n"); + goto m3u_error; + } + int rd = vfs_fread (buf, 1, size, fp); + if (rd != size) { + trace ("failed to download %d bytes (got %d bytes)\n", size, rd); + goto m3u_error; + } + char tempfile[1000]; + const char *tmpdir = getenv ("TMPDIR"); + if (!tmpdir) { + tmpdir = "/tmp"; + } + snprintf (tempfile, sizeof (tempfile), "%s/ddbm3uXXXXXX", tmpdir); + + fd = mkstemp (tempfile); + if (fd == -1) { + trace ("failed to open temp file %s\n", tempfile); + goto m3u_error; + } + out = fdopen (fd, "w+b"); + if (!out) { + trace ("fdopen failed for %s\n", tempfile); + goto m3u_error; + } + int rw = fwrite (buf, 1, size, out); + if (rw != size) { + trace ("failed to write %d bytes into file %s\n", size, tempfile); + goto m3u_error; + } + fclose (out); + fd = -1; + out = NULL; + + // load playlist + playlist_t *plt = plt_alloc ("temp"); + DB_playlist_t **plug = plug_get_playlist_list (); + int p, e; + DB_playItem_t *m3u = NULL; + for (p = 0; plug[p]; p++) { + if (plug[p]->load) { + m3u = plug[p]->load ((ddb_playlist_t *)plt, NULL, tempfile, NULL, NULL, NULL); + if (m3u) { + break; + } } - else if (!strcmp (ct, "audio/aacp")) { - plug = "aac"; + } + if (!m3u) { + trace ("failed to load playlist from %s using any of the installed playlist plugins\n", tempfile); + plt_free (plt); + goto m3u_error; + } + + // for every playlist uri: override stream uri with the one from playlist, and try to play it + playItem_t *i = (playItem_t *)m3u; + pl_item_ref (i); + int res = -1; + while (i) { + pl_replace_meta (it, "!URI", pl_find_meta_raw (i, ":URI")); + res = streamer_set_current (it); + if (!res) { + pl_item_unref (i); + break; } - else if (!strcmp (ct, "audio/aac")) { - plug = "aac"; + playItem_t *next = pl_get_next (i, PL_MAIN); + pl_item_unref (i); + i = next; + } + pl_item_unref ((playItem_t*)m3u); + plt_free (plt); + if (res == 0) { + // succeeded -- playing now + if (from) { + pl_item_unref (from); } - else if (!strcmp (ct, "audio/wma")) { - plug = "ffmpeg"; + if (to) { + pl_item_unref (to); } + return res; } - mutex_lock (decodemutex); - streamer_file = NULL; - vfs_fclose (fp); - mutex_unlock (decodemutex); + unlink (tempfile); + +m3u_error: + if (buf) { + free (buf); + } + if (out) { + fclose (out); + } + else if (fd != -1) { + close (fd); + } + goto error; } + mutex_lock (decodemutex); + streamer_file = NULL; + vfs_fclose (fp); + mutex_unlock (decodemutex); if (plug) { DB_decoder_t **decoders = plug_get_decoder_list (); // match by decoder for (int i = 0; decoders[i]; i++) { if (!strcmp (decoders[i]->plugin.id, plug)) { - pl_replace_meta (it, ":DECODER", decoders[i]->plugin.id); + pl_replace_meta (it, "!DECODER", decoders[i]->plugin.id); strncpy (decoder_id, decoders[i]->plugin.id, sizeof (decoder_id)); trace ("\033[0;34mfound plugin %s\033[37;0m\n", plug); + break; } } } @@ -763,8 +877,8 @@ streamer_set_current (playItem_t *it) { for (int j = 0; exts[j]; j++) { if (!strcasecmp (exts[j], ext)) { fprintf (stderr, "streamer: %s : changed decoder plugin to %s\n", fname, decs[i]->plugin.id); - pl_replace_meta (it, ":DECODER", decs[i]->plugin.id); - pl_replace_meta (it, ":FILETYPE", ext); + pl_replace_meta (it, "!DECODER", decs[i]->plugin.id); + pl_replace_meta (it, "!FILETYPE", ext); dec = decs[i]; break; } @@ -780,6 +894,7 @@ streamer_set_current (playItem_t *it) { trace ("\033[0;31mfailed to init decoder\033[37;0m\n") dec->free (new_fileinfo); new_fileinfo = NULL; + goto error; } } @@ -1598,7 +1713,7 @@ streamer_init (void) { streamer_dsp_init (); - replaygain_set (conf_get_int ("replaygain_mode", 0), conf_get_int ("replaygain_scale", 1), conf_get_float ("replaygain_preamp", 0)); + replaygain_set (conf_get_int ("replaygain_mode", 0), conf_get_int ("replaygain_scale", 1), conf_get_float ("replaygain_preamp", 0), conf_get_float ("global_preamp", 0)); streamer_tid = thread_start (streamer_thread, NULL); return 0; } @@ -1828,7 +1943,7 @@ streamer_read_async (char *bytes, int size) { } else { // that means EOF -// trace ("streamer: EOF! buns: %d, bytesread: %d, buffering: %d, bufferfill: %d\n", bytes_until_next_song, bytesread, streamer_buffering, streamer_ringbuf.remaining); + // trace ("streamer: EOF! buns: %d, bytesread: %d, buffering: %d, bufferfill: %d\n", bytes_until_next_song, bytesread, streamer_buffering, streamer_ringbuf.remaining); // in case of decoder error, or EOF while buffering - switch to next song instantly if (bytesread < 0 || (bytes_until_next_song >= 0 && streamer_buffering && bytesread == 0) || bytes_until_next_song < 0) { @@ -1974,7 +2089,7 @@ streamer_ok_to_read (int len) { void streamer_configchanged (void) { - replaygain_set (conf_get_int ("replaygain_mode", 0), conf_get_int ("replaygain_scale", 1), conf_get_float ("replaygain_preamp", 0)); + replaygain_set (conf_get_int ("replaygain_mode", 0), conf_get_int ("replaygain_scale", 1), conf_get_float ("replaygain_preamp", 0), conf_get_float ("global_preamp", 0)); pl_set_order (conf_get_int ("playback.order", 0)); if (playing_track) { playing_track->played = 1; |