From 77c69999a63e6b999814cb39c35bb4d30646c145 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Sun, 6 Jun 2004 21:03:03 +0000 Subject: [PATCH] Added an optional clock screen :) git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1360 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- configure.ac | 122 ++++++++++----------- po/POTFILES.in | 1 + po/ncmpc.pot | 210 ++++++++++++++++++------------------ po/sv.po | 210 ++++++++++++++++++------------------ src/Makefile.am | 6 +- src/command.c | 8 +- src/command.h | 1 + src/screen.c | 21 +++- src/screen.h | 1 + src/screen_clock.c | 259 +++++++++++++++++++++++++++++++++++++++++++++ src/screen_help.c | 3 + 11 files changed, 576 insertions(+), 266 deletions(-) create mode 100644 src/screen_clock.c diff --git a/configure.ac b/configure.ac index 20cc143..94e0562 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,6 @@ dnl ======================================================= set -- $CFLAGS -keydef_screen=yes dnl dnl Check for types @@ -31,19 +30,19 @@ dnl dnl Check for headers dnl -AC_CHECK_HEADER(libgen.h, - AC_DEFINE(HAVE_LIBGEN_H, 1, glibc - libgen.h), +AC_CHECK_HEADER([libgen.h], + AC_DEFINE([HAVE_LIBGEN_H], [1], [glibc - libgen.h]), ,) -AC_CHECK_HEADER(locale.h, - AC_DEFINE(HAVE_LOCALE_H, 1, locale.h), +AC_CHECK_HEADER([locale.h], + AC_DEFINE([HAVE_LOCALE_H], [1], [locale.h]), ,) dnl dnl Check for functions dnl -AC_CHECK_FUNCS(basename strcasestr) +AC_CHECK_FUNCS([basename strcasestr]) dnl @@ -51,15 +50,22 @@ dnl Check for libraries dnl dnl ncurses -AC_CHECK_LIB(ncurses, initscr,, [AC_MSG_ERROR(ncurses library is required)]) +AC_CHECK_LIB([ncurses], [initscr],, + [AC_MSG_ERROR(ncurses library is required)]) LIBS="$LIBS -lncurses" +dnl popt +AC_CHECK_LIB([popt], + [poptGetArg], + [LIBS="$LIBS -lpopt"], + AC_MSG_ERROR([Missing popt command line parsing library])) + + dnl Check for glib-2 -#AM_PATH_GLIB_2_0(, , [AC_MSG_ERROR(glib-2.x is required)], glib) -PKG_CHECK_MODULES(GLIB, - glib-2.0 >= 2.2, +PKG_CHECK_MODULES([GLIB], + [glib-2.0 >= 2.2], , - AC_MSG_ERROR(glib-2.2 is required)) + AC_MSG_ERROR([glib-2.2 is required])) dnl i18n ALL_LINGUAS="" @@ -82,66 +88,64 @@ if test "x$nls" = "xyes"; then fi -dnl popt -AC_CHECK_LIB(popt, - poptGetArg, - LIBS="$LIBS -lpopt", - AC_MSG_ERROR(Missing popt command line parsing library)) - - - - dnl Debugging -AC_ARG_ENABLE(debug, - AC_HELP_STRING(--enable-debug,Enable debugging (default=no)), - , - enable_debug=no) - -if test "$enable_debug" = yes; then +AC_MSG_CHECKING([whether to build with debug support]) +AC_ARG_ENABLE([debug], + AC_HELP_STRING([--enable-debug], + [Enable debugging @<:@default=no@:>@)]), + [enable_debug="$enableval"], + [enable_debug=no]) +AC_MSG_RESULT([$enable_debug]) +if test "x$enable_debug" = "xyes" ; then CFLAGS="$CFLAGS -Wall -g -DDEBUG" fi -dnl Key editor -AC_ARG_ENABLE(key-editor, - AC_HELP_STRING(--enable-key-editor, - Enable key editor (default=yes)), - keydef_screen=no, - keydef_screen=yes) -if test "$keydef_screen" = yes; then - AC_DEFINE(ENABLE_KEYDEF_SCREEN, 1, [Enable builtin key editor]) +dnl Optional screen - key editor +AC_MSG_CHECKING([whether to include the key editor screen]) +AC_ARG_ENABLE([key-screen], + AC_HELP_STRING([--enable-key-screen], + [Enable key editor screen @<:@default=yes@:>@]), + [keydef_screen="$enableval"], + [keydef_screen=yes]) +AC_MSG_RESULT([$keydef_screen]) +if test "x$keydef_screen" = "xyes" ; then + AC_DEFINE(ENABLE_KEYDEF_SCREEN, 1, [Enable key editor screen]) fi - +dnl Optional screen - clock +AC_MSG_CHECKING([whether to include the clock screen]) +AC_ARG_ENABLE([clock-screen], + AC_HELP_STRING([--enable-clock-screen], + [Enable clock screen @<:@default=no@:>@]), + [clock_screen="$enableval"], + [clock_screen=no]) +AC_MSG_RESULT([$clock_screen]) +if test "x$clock_screen" = "xyes" ; then + AC_DEFINE(ENABLE_CLOCK_SCREEN, 1, [Enable clock screen]) +fi dnl Default host -AC_ARG_WITH(default-host, - AC_HELP_STRING(--with-default-host=ARG,Default MPD host (localhost)), - DEFAULT_HOST="$withval", - DEFAULT_HOST="localhost") +AC_MSG_CHECKING([for default MPD host]) +AC_ARG_WITH([default-host], + AC_HELP_STRING([--with-default-host=ARG], + [Default MPD host @<:@localhost@:>@]), + [DEFAULT_HOST="$withval"], + [DEFAULT_HOST="localhost"]) +AC_MSG_RESULT([$DEFAULT_HOST]) +AC_DEFINE_UNQUOTED([DEFAULT_HOST], ["$DEFAULT_HOST"], [Default MPD host]) dnl Default port -AC_ARG_WITH(default-port, - AC_HELP_STRING(--with-default-port=ARG,Default port (6600)), - DEFAULT_PORT="$withval", - DEFAULT_PORT="6600") - +AC_MSG_CHECKING([for default MPD port]) +AC_ARG_WITH([default-port], + AC_HELP_STRING([--with-default-port=ARG], + [Default port @<:@6600@:>@]), + [DEFAULT_PORT="$withval"], + [DEFAULT_PORT="6600"]) +AC_MSG_RESULT([$DEFAULT_PORT]) +AC_DEFINE_UNQUOTED([DEFAULT_PORT], [$DEFAULT_PORT], [Default MPD port]) +AC_DEFINE_UNQUOTED([DEFAULT_PORT_STR], ["$DEFAULT_PORT"], [Default MPD port]) -dnl Autoheader -AC_DEFINE_UNQUOTED(DEFAULT_PORT, $DEFAULT_PORT, Default MPD port) -AC_DEFINE_UNQUOTED(DEFAULT_PORT_STR, "$DEFAULT_PORT", Default MPD port) -AC_DEFINE_UNQUOTED(DEFAULT_HOST, "$DEFAULT_HOST", Default MPD host) AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile po/Makefile.in]) AC_OUTPUT -echo " -Configuration: - prefix: ${prefix} - nls: ${nls} - sysconfdir: ${sysconfdir} - Default MPD host: ${DEFAULT_HOST} - Default MPD port: ${DEFAULT_PORT} - Enable debugging: ${enable_debug} - Key edit screen: ${keydef_screen} -" -echo diff --git a/po/POTFILES.in b/po/POTFILES.in index b726079..15ae504 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -6,6 +6,7 @@ src/screen_utils.c src/screen_play.c src/screen_file.c src/screen_keydef.c +src/screen_clock.c src/screen_help.c src/command.c src/colors.c diff --git a/po/ncmpc.pot b/po/ncmpc.pot index 88a9dda..103383b 100644 --- a/po/ncmpc.pot +++ b/po/ncmpc.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-06-06 00:24+0200\n" +"POT-Creation-Date: 2004-06-06 22:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,135 +16,135 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/main.c:59 +#: src/main.c:60 msgid "" "\n" "Exiting...\n" msgstr "" -#: src/main.c:89 +#: src/main.c:102 msgid "Confusing key bindings - exiting!\n" msgstr "" -#: src/main.c:153 +#: src/main.c:162 #, c-format msgid "Lost connection to %s" msgstr "" -#: src/main.c:183 +#: src/main.c:192 #, c-format msgid "Connecting to %s... [Press Ctrl-C to abort]" msgstr "" -#: src/main.c:190 +#: src/main.c:199 #, c-format msgid "Connected to %s!" msgstr "" -#: src/screen.c:131 +#: src/screen.c:144 msgid ":Help " msgstr "" -#: src/screen.c:135 +#: src/screen.c:148 msgid ":Playlist " msgstr "" -#: src/screen.c:139 +#: src/screen.c:152 msgid ":Browse" msgstr "" -#: src/screen.c:143 +#: src/screen.c:156 msgid "Volume n/a " msgstr "" -#: src/screen.c:147 +#: src/screen.c:160 #, c-format msgid " Volume %d%%" msgstr "" -#: src/screen.c:266 +#: src/screen.c:279 msgid "Stopped! " msgstr "" -#: src/screen.c:269 +#: src/screen.c:282 msgid "Playing:" msgstr "" -#: src/screen.c:272 +#: src/screen.c:285 msgid "[Paused]" msgstr "" -#: src/screen.c:382 src/screen.c:482 +#: src/screen.c:411 src/screen.c:511 msgid "Error: Screen to small!\n" msgstr "" -#: src/screen.c:627 +#: src/screen.c:664 msgid "Repeat is on" msgstr "" -#: src/screen.c:628 +#: src/screen.c:665 msgid "Repeat is off" msgstr "" -#: src/screen.c:631 +#: src/screen.c:668 msgid "Random is on" msgstr "" -#: src/screen.c:632 +#: src/screen.c:669 msgid "Random is off" msgstr "" -#: src/screen.c:635 +#: src/screen.c:672 #, c-format msgid "Crossfade %d seconds" msgstr "" -#: src/screen.c:637 +#: src/screen.c:674 msgid "Database updated!" msgstr "" -#: src/screen.c:767 +#: src/screen.c:808 msgid "Shuffled playlist!" msgstr "" -#: src/screen.c:773 +#: src/screen.c:814 msgid "Cleared playlist!" msgstr "" -#: src/screen.c:800 +#: src/screen.c:841 #, c-format msgid "Database update started [%d]" msgstr "" -#: src/screen.c:803 +#: src/screen.c:844 msgid "Database update running..." msgstr "" -#: src/screen.c:824 +#: src/screen.c:865 msgid "Find mode: Wrapped" msgstr "" -#: src/screen.c:825 +#: src/screen.c:866 msgid "Find mode: Normal" msgstr "" -#: src/screen.c:830 +#: src/screen.c:871 msgid "Auto center mode: On" msgstr "" -#: src/screen.c:831 +#: src/screen.c:872 msgid "Auto center mode: Off" msgstr "" -#: src/screen_utils.c:36 +#: src/screen_utils.c:39 msgid "Find: " msgstr "" -#: src/screen_utils.c:37 +#: src/screen_utils.c:40 msgid "Find backward: " msgstr "" -#: src/screen_utils.c:144 +#: src/screen_utils.c:150 #, c-format msgid "Unable to find '%s'" msgstr "" @@ -287,275 +287,283 @@ msgstr "" msgid "Edit keys for %s" msgstr "" +#: src/screen_clock.c:153 +msgid "Music Player Client - Clock" +msgstr "" + #: src/screen_help.c:43 msgid "Keys - Movement" msgstr "" -#: src/screen_help.c:62 +#: src/screen_help.c:65 msgid "Keys - Global" msgstr "" -#: src/screen_help.c:89 +#: src/screen_help.c:92 msgid "Keys - Playlist screen" msgstr "" -#: src/screen_help.c:91 +#: src/screen_help.c:94 msgid "Play" msgstr "" -#: src/screen_help.c:94 +#: src/screen_help.c:97 msgid "Move song up" msgstr "" -#: src/screen_help.c:95 +#: src/screen_help.c:98 msgid "Move song down" msgstr "" -#: src/screen_help.c:97 +#: src/screen_help.c:100 msgid "Center" msgstr "" -#: src/screen_help.c:102 +#: src/screen_help.c:105 msgid "Keys - Browse screen" msgstr "" -#: src/screen_help.c:104 +#: src/screen_help.c:107 msgid "Enter directory" msgstr "" -#: src/screen_help.c:201 +#: src/screen_help.c:209 msgid "Music Player Client - Help" msgstr "" -#: src/command.c:65 +#: src/command.c:67 msgid "Play/Enter directory" msgstr "" -#: src/command.c:67 +#: src/command.c:69 msgid "Pause" msgstr "" -#: src/command.c:69 +#: src/command.c:71 msgid "Stop" msgstr "" -#: src/command.c:71 +#: src/command.c:73 msgid "Next track" msgstr "" -#: src/command.c:73 +#: src/command.c:75 msgid "Previous track" msgstr "" -#: src/command.c:75 +#: src/command.c:77 msgid "Seek forward" msgstr "" -#: src/command.c:77 +#: src/command.c:79 msgid "Seek backward" msgstr "" -#: src/command.c:80 +#: src/command.c:82 msgid "Increase volume" msgstr "" -#: src/command.c:82 +#: src/command.c:84 msgid "Decrease volume" msgstr "" -#: src/command.c:85 +#: src/command.c:87 msgid "Toggle find mode" msgstr "" -#: src/command.c:87 +#: src/command.c:89 msgid "Toggle auto center mode" msgstr "" -#: src/command.c:90 +#: src/command.c:92 msgid "Select/deselect song in playlist" msgstr "" -#: src/command.c:92 +#: src/command.c:94 msgid "Delete song from playlist" msgstr "" -#: src/command.c:94 +#: src/command.c:96 msgid "Shuffle playlist" msgstr "" -#: src/command.c:96 +#: src/command.c:98 msgid "Clear playlist" msgstr "" -#: src/command.c:98 +#: src/command.c:100 msgid "Toggle repeat mode" msgstr "" -#: src/command.c:100 +#: src/command.c:102 msgid "Toggle random mode" msgstr "" -#: src/command.c:102 +#: src/command.c:104 msgid "Toggle crossfade mode" msgstr "" -#: src/command.c:104 +#: src/command.c:106 msgid "Start a music database update" msgstr "" -#: src/command.c:107 +#: src/command.c:109 msgid "Save playlist" msgstr "" -#: src/command.c:110 +#: src/command.c:112 msgid "Move item up" msgstr "" -#: src/command.c:112 +#: src/command.c:114 msgid "Move item down" msgstr "" -#: src/command.c:115 +#: src/command.c:117 msgid "Move cursor up" msgstr "" -#: src/command.c:117 +#: src/command.c:119 msgid "Move cursor down" msgstr "" -#: src/command.c:119 +#: src/command.c:121 msgid "Home " msgstr "" -#: src/command.c:121 +#: src/command.c:123 msgid "End " msgstr "" -#: src/command.c:123 +#: src/command.c:125 msgid "Page up" msgstr "" -#: src/command.c:125 +#: src/command.c:127 msgid "Page down" msgstr "" -#: src/command.c:127 +#: src/command.c:129 msgid "Forward find" msgstr "" -#: src/command.c:129 +#: src/command.c:131 msgid "Forward find next" msgstr "" -#: src/command.c:131 +#: src/command.c:133 msgid "Backward find" msgstr "" -#: src/command.c:133 +#: src/command.c:135 msgid "Backward find previous" msgstr "" -#: src/command.c:137 +#: src/command.c:139 msgid "Next screen" msgstr "" -#: src/command.c:140 +#: src/command.c:142 msgid "Previous screen" msgstr "" -#: src/command.c:143 +#: src/command.c:145 msgid "Help screen" msgstr "" -#: src/command.c:145 +#: src/command.c:147 msgid "Playlist screen" msgstr "" -#: src/command.c:147 +#: src/command.c:149 msgid "Browse screen" msgstr "" -#: src/command.c:149 +#: src/command.c:151 msgid "Update screen" msgstr "" -#: src/command.c:152 +#: src/command.c:154 +msgid "Clock screen" +msgstr "" + +#: src/command.c:158 msgid "Key configuration screen" msgstr "" -#: src/command.c:156 +#: src/command.c:162 msgid "Quit" msgstr "" -#: src/command.c:177 +#: src/command.c:183 msgid "Undefined" msgstr "" -#: src/command.c:179 +#: src/command.c:185 msgid "Space" msgstr "" -#: src/command.c:181 +#: src/command.c:187 msgid "Enter" msgstr "" -#: src/command.c:183 +#: src/command.c:189 msgid "Backspace" msgstr "" -#: src/command.c:185 +#: src/command.c:191 msgid "Delete" msgstr "" -#: src/command.c:187 +#: src/command.c:193 msgid "Up" msgstr "" -#: src/command.c:189 +#: src/command.c:195 msgid "Down" msgstr "" -#: src/command.c:191 +#: src/command.c:197 msgid "Left" msgstr "" -#: src/command.c:193 +#: src/command.c:199 msgid "Right" msgstr "" -#: src/command.c:195 +#: src/command.c:201 msgid "Home" msgstr "" -#: src/command.c:197 +#: src/command.c:203 msgid "End" msgstr "" -#: src/command.c:199 +#: src/command.c:205 msgid "PageDown" msgstr "" -#: src/command.c:201 +#: src/command.c:207 msgid "PageUp" msgstr "" -#: src/command.c:203 +#: src/command.c:209 msgid "Tab" msgstr "" -#: src/command.c:205 +#: src/command.c:211 msgid "Shift+Tab" msgstr "" -#: src/command.c:207 +#: src/command.c:213 msgid "Esc" msgstr "" -#: src/command.c:209 +#: src/command.c:215 msgid "Insert" msgstr "" -#: src/command.c:395 +#: src/command.c:401 #, c-format msgid "Error: Key %s assigned to %s and %s !!!\n" msgstr "" @@ -578,11 +586,11 @@ msgstr "" msgid "Terminal lacks color capabilities!\n" msgstr "" -#: src/support.c:172 +#: src/support.c:147 #, c-format msgid "Error: Unable to convert characters to %s" msgstr "" -#: src/support.c:201 +#: src/support.c:176 msgid "Error: Unable to convert characters to UTF-8" msgstr "" diff --git a/po/sv.po b/po/sv.po index cbe5d83..268a422 100644 --- a/po/sv.po +++ b/po/sv.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ncmpc 0.11.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2004-06-06 00:24+0200\n" +"POT-Creation-Date: 2004-06-06 22:59+0200\n" "PO-Revision-Date: 2004-06-05 18:16+0200\n" "Last-Translator: Kalle Wallin \n" "Language-Team: sv \n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=ISO-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -#: src/main.c:59 +#: src/main.c:60 msgid "" "\n" "Exiting...\n" @@ -24,129 +24,129 @@ msgstr "" "\n" "Avslutar...\n" -#: src/main.c:89 +#: src/main.c:102 msgid "Confusing key bindings - exiting!\n" msgstr "Felaktiga tangent definitioner!\n" -#: src/main.c:153 +#: src/main.c:162 #, c-format msgid "Lost connection to %s" msgstr "Ingen anslutning till %s" -#: src/main.c:183 +#: src/main.c:192 #, c-format msgid "Connecting to %s... [Press Ctrl-C to abort]" msgstr "Ansluter till %s... [Tryck Ctrl-C för att avbryta]" -#: src/main.c:190 +#: src/main.c:199 #, c-format msgid "Connected to %s!" msgstr "Ansluten till %s!" -#: src/screen.c:131 +#: src/screen.c:144 msgid ":Help " msgstr ":Hjälp " -#: src/screen.c:135 +#: src/screen.c:148 msgid ":Playlist " msgstr ":Spellista " -#: src/screen.c:139 +#: src/screen.c:152 msgid ":Browse" msgstr ":Filer " -#: src/screen.c:143 +#: src/screen.c:156 msgid "Volume n/a " msgstr "Volym: n/a " -#: src/screen.c:147 +#: src/screen.c:160 #, c-format msgid " Volume %d%%" msgstr " Volym: %d%%" -#: src/screen.c:266 +#: src/screen.c:279 msgid "Stopped! " msgstr "Stoppad" -#: src/screen.c:269 +#: src/screen.c:282 msgid "Playing:" msgstr "Spelar:" -#: src/screen.c:272 +#: src/screen.c:285 msgid "[Paused]" msgstr "[Pausad]" -#: src/screen.c:382 src/screen.c:482 +#: src/screen.c:411 src/screen.c:511 msgid "Error: Screen to small!\n" msgstr "Fel: Terminal är för liten!\n" -#: src/screen.c:627 +#: src/screen.c:664 msgid "Repeat is on" msgstr "Repeat är på" -#: src/screen.c:628 +#: src/screen.c:665 msgid "Repeat is off" msgstr "Repeat är av" -#: src/screen.c:631 +#: src/screen.c:668 msgid "Random is on" msgstr "Random är på" -#: src/screen.c:632 +#: src/screen.c:669 msgid "Random is off" msgstr "Random är av" -#: src/screen.c:635 +#: src/screen.c:672 #, c-format msgid "Crossfade %d seconds" msgstr "Crossfade %d sekunder" -#: src/screen.c:637 +#: src/screen.c:674 msgid "Database updated!" msgstr "Databasen är uppdaterad!" -#: src/screen.c:767 +#: src/screen.c:808 msgid "Shuffled playlist!" msgstr "Slumpsorterat spellistan!" -#: src/screen.c:773 +#: src/screen.c:814 msgid "Cleared playlist!" msgstr "Rensar spellistan!" -#: src/screen.c:800 +#: src/screen.c:841 #, c-format msgid "Database update started [%d]" msgstr "Uppdatering av databasen startad [%d]" -#: src/screen.c:803 +#: src/screen.c:844 msgid "Database update running..." msgstr "Databasen uppdateras..." -#: src/screen.c:824 +#: src/screen.c:865 msgid "Find mode: Wrapped" msgstr "Sök runt (börja om)" -#: src/screen.c:825 +#: src/screen.c:866 msgid "Find mode: Normal" msgstr "Sök normalt (till slut/början)" -#: src/screen.c:830 +#: src/screen.c:871 msgid "Auto center mode: On" msgstr "Automatisk centrering är på" -#: src/screen.c:831 +#: src/screen.c:872 msgid "Auto center mode: Off" msgstr "Automatisk centrering är av" -#: src/screen_utils.c:36 +#: src/screen_utils.c:39 msgid "Find: " msgstr "Sök: " -#: src/screen_utils.c:37 +#: src/screen_utils.c:40 msgid "Find backward: " msgstr "Sök (bakåt): " -#: src/screen_utils.c:144 +#: src/screen_utils.c:150 #, c-format msgid "Unable to find '%s'" msgstr "Hittar inte '%s'" @@ -289,275 +289,283 @@ msgstr " msgid "Edit keys for %s" msgstr "Ändra tangenter för kommandot '%s'" +#: src/screen_clock.c:153 +msgid "Music Player Client - Clock" +msgstr "[ncmpc] Klocka" + #: src/screen_help.c:43 msgid "Keys - Movement" msgstr "Tangenter - Navigation" -#: src/screen_help.c:62 +#: src/screen_help.c:65 msgid "Keys - Global" msgstr "Tangenter - Globala" -#: src/screen_help.c:89 +#: src/screen_help.c:92 msgid "Keys - Playlist screen" msgstr "Tangenter - Spellista" -#: src/screen_help.c:91 +#: src/screen_help.c:94 msgid "Play" msgstr "Starta/Spela markerad" -#: src/screen_help.c:94 +#: src/screen_help.c:97 msgid "Move song up" msgstr "Flytta markerad uppåt i spellistan" -#: src/screen_help.c:95 +#: src/screen_help.c:98 msgid "Move song down" msgstr "Flytta markerad nedåt i spellistan" -#: src/screen_help.c:97 +#: src/screen_help.c:100 msgid "Center" msgstr "Centrera" -#: src/screen_help.c:102 +#: src/screen_help.c:105 msgid "Keys - Browse screen" msgstr "Tangenter - Filer" -#: src/screen_help.c:104 +#: src/screen_help.c:107 msgid "Enter directory" msgstr "Välj bibliotek" -#: src/screen_help.c:201 +#: src/screen_help.c:209 msgid "Music Player Client - Help" msgstr "[ncmpc] Hjälp" -#: src/command.c:65 +#: src/command.c:67 msgid "Play/Enter directory" msgstr "Spela/Välj" -#: src/command.c:67 +#: src/command.c:69 msgid "Pause" msgstr "Paus" -#: src/command.c:69 +#: src/command.c:71 msgid "Stop" msgstr "Stopp" -#: src/command.c:71 +#: src/command.c:73 msgid "Next track" msgstr "Nästa" -#: src/command.c:73 +#: src/command.c:75 msgid "Previous track" msgstr "Föregånde" -#: src/command.c:75 +#: src/command.c:77 msgid "Seek forward" msgstr "Spola/Sök framåt" -#: src/command.c:77 +#: src/command.c:79 msgid "Seek backward" msgstr "Spola/Sök tillbaka" -#: src/command.c:80 +#: src/command.c:82 msgid "Increase volume" msgstr "Öka volymen" -#: src/command.c:82 +#: src/command.c:84 msgid "Decrease volume" msgstr "Minska volymen" -#: src/command.c:85 +#: src/command.c:87 msgid "Toggle find mode" msgstr "Ändra sök inställningar" -#: src/command.c:87 +#: src/command.c:89 msgid "Toggle auto center mode" msgstr "Automatisk centrering På/Av" -#: src/command.c:90 +#: src/command.c:92 msgid "Select/deselect song in playlist" msgstr "Lägg till/Ta bort" -#: src/command.c:92 +#: src/command.c:94 msgid "Delete song from playlist" msgstr "Ta bort/Radera" -#: src/command.c:94 +#: src/command.c:96 msgid "Shuffle playlist" msgstr "Slumpsportera spellista" -#: src/command.c:96 +#: src/command.c:98 msgid "Clear playlist" msgstr "Rensa spellistan" -#: src/command.c:98 +#: src/command.c:100 msgid "Toggle repeat mode" msgstr "Repeat På/Av" -#: src/command.c:100 +#: src/command.c:102 msgid "Toggle random mode" msgstr "Random På/Av" -#: src/command.c:102 +#: src/command.c:104 msgid "Toggle crossfade mode" msgstr "Crossfade På/Av" -#: src/command.c:104 +#: src/command.c:106 msgid "Start a music database update" msgstr "Updatera databasen" -#: src/command.c:107 +#: src/command.c:109 msgid "Save playlist" msgstr "Spara spellista" -#: src/command.c:110 +#: src/command.c:112 msgid "Move item up" msgstr "Flytta upp" -#: src/command.c:112 +#: src/command.c:114 msgid "Move item down" msgstr "Flytta ner" -#: src/command.c:115 +#: src/command.c:117 msgid "Move cursor up" msgstr "Markör nedåt" -#: src/command.c:117 +#: src/command.c:119 msgid "Move cursor down" msgstr "Markör uppåt" -#: src/command.c:119 +#: src/command.c:121 msgid "Home " msgstr "Markören till den första raden" -#: src/command.c:121 +#: src/command.c:123 msgid "End " msgstr "Markören till den sista raden" -#: src/command.c:123 +#: src/command.c:125 msgid "Page up" msgstr "Markören en skärm uppåt" -#: src/command.c:125 +#: src/command.c:127 msgid "Page down" msgstr "Markören en skärm nedåt" -#: src/command.c:127 +#: src/command.c:129 msgid "Forward find" msgstr "Sök" -#: src/command.c:129 +#: src/command.c:131 msgid "Forward find next" msgstr "Upprepa Sökning" -#: src/command.c:131 +#: src/command.c:133 msgid "Backward find" msgstr "Sök bakåt" -#: src/command.c:133 +#: src/command.c:135 msgid "Backward find previous" msgstr "Upprepa Sökning bakåt" -#: src/command.c:137 +#: src/command.c:139 msgid "Next screen" msgstr "Nästa skärm" -#: src/command.c:140 +#: src/command.c:142 msgid "Previous screen" msgstr "Tidigare skärm" -#: src/command.c:143 +#: src/command.c:145 msgid "Help screen" msgstr "Hjälp" -#: src/command.c:145 +#: src/command.c:147 msgid "Playlist screen" msgstr "Spellista" -#: src/command.c:147 +#: src/command.c:149 msgid "Browse screen" msgstr "Filer" -#: src/command.c:149 +#: src/command.c:151 msgid "Update screen" msgstr "Updatera" -#: src/command.c:152 +#: src/command.c:154 +msgid "Clock screen" +msgstr "Klocka" + +#: src/command.c:158 msgid "Key configuration screen" msgstr "Tangentdefinitioner" -#: src/command.c:156 +#: src/command.c:162 msgid "Quit" msgstr "Avsluta" -#: src/command.c:177 +#: src/command.c:183 msgid "Undefined" msgstr "Ej definerad" -#: src/command.c:179 +#: src/command.c:185 msgid "Space" msgstr "Mellanslag" -#: src/command.c:181 +#: src/command.c:187 msgid "Enter" msgstr "" -#: src/command.c:183 +#: src/command.c:189 msgid "Backspace" msgstr "" -#: src/command.c:185 +#: src/command.c:191 msgid "Delete" msgstr "Del" -#: src/command.c:187 +#: src/command.c:193 msgid "Up" msgstr "Uppåtpil" -#: src/command.c:189 +#: src/command.c:195 msgid "Down" msgstr "Nedåtpil" -#: src/command.c:191 +#: src/command.c:197 msgid "Left" msgstr "Vänsterpil" -#: src/command.c:193 +#: src/command.c:199 msgid "Right" msgstr "Högerpil" -#: src/command.c:195 +#: src/command.c:201 msgid "Home" msgstr "" -#: src/command.c:197 +#: src/command.c:203 msgid "End" msgstr "" -#: src/command.c:199 +#: src/command.c:205 msgid "PageDown" msgstr "" -#: src/command.c:201 +#: src/command.c:207 msgid "PageUp" msgstr "" -#: src/command.c:203 +#: src/command.c:209 msgid "Tab" msgstr "" -#: src/command.c:205 +#: src/command.c:211 msgid "Shift+Tab" msgstr "" -#: src/command.c:207 +#: src/command.c:213 msgid "Esc" msgstr "" -#: src/command.c:209 +#: src/command.c:215 msgid "Insert" msgstr "Ins" -#: src/command.c:395 +#: src/command.c:401 #, c-format msgid "Error: Key %s assigned to %s and %s !!!\n" msgstr "Fel: Tangenten %s är tilldelad både %s och %s !!!\n" @@ -580,11 +588,11 @@ msgstr "Terminalen saknar st msgid "Terminal lacks color capabilities!\n" msgstr "Terminalen saknar stöd för färger!\n" -#: src/support.c:172 +#: src/support.c:147 #, c-format msgid "Error: Unable to convert characters to %s" msgstr "Fel vid konvertering av tecken från UTF-8 till %s" -#: src/support.c:201 +#: src/support.c:176 msgid "Error: Unable to convert characters to UTF-8" msgstr "Fel vid konvertering av tecken till UTF-8" diff --git a/src/Makefile.am b/src/Makefile.am index ff4fb7a..79822f0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,12 +11,12 @@ AM_CPPFLAGS = $(GLIB_CFLAGS) -DLOCALE_DIR=\""$(datadir)/locale"\" -DSYSCONFDIR=\ ncmpc_headers = libmpdclient.h mpc.h options.h conf.h command.h screen.h \ screen_utils.h screen_play.h screen_file.h screen_search.h \ - screen_help.h list_window.h colors.h support.h wreadln.h \ - ncmpc.h + screen_clock.h screen_help.h list_window.h colors.h support.h \ + wreadln.h ncmpc.h ncmpc_SOURCES = libmpdclient.c main.c mpc.c options.c conf.c command.c \ screen.c screen_utils.c screen_play.c screen_file.c \ - screen_search.c screen_help.c screen_keydef.c \ + screen_search.c screen_help.c screen_keydef.c screen_clock.c \ list_window.c colors.c support.c wreadln.c $(ncmpc_headers) diff --git a/src/command.c b/src/command.c index 78199f2..294f231 100644 --- a/src/command.c +++ b/src/command.c @@ -1,5 +1,7 @@ /* - * (c) 2004 by Kalle Wallin (kaw@linux.se) + * $Id$ + * + * (c) 2004 by Kalle Wallin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -147,6 +149,10 @@ static command_definition_t cmds[] = N_("Browse screen") }, { {'u', 0, 0 }, CMD_SCREEN_UPDATE, "update", N_("Update screen") }, +#ifdef ENABLE_CLOCK_SCREEN + { {'4', F4, 0 }, CMD_SCREEN_CLOCK, "screen-clock", + N_("Clock screen") }, +#endif #ifdef ENABLE_KEYDEF_SCREEN { {'K', 0, 0 }, CMD_SCREEN_KEYDEF, "screen-keyedit", N_("Key configuration screen") }, diff --git a/src/command.h b/src/command.h index f880998..9c20acb 100644 --- a/src/command.h +++ b/src/command.h @@ -45,6 +45,7 @@ typedef enum CMD_SCREEN_FILE, CMD_SCREEN_SEARCH, CMD_SCREEN_KEYDEF, + CMD_SCREEN_CLOCK, CMD_SCREEN_HELP, CMD_QUIT } command_t; diff --git a/src/screen.c b/src/screen.c index 7522ad2..d77faf2 100644 --- a/src/screen.c +++ b/src/screen.c @@ -53,6 +53,10 @@ #ifdef ENABLE_KEYDEF_SCREEN extern screen_functions_t *get_screen_keydef(void); #endif +#ifdef ENABLE_CLOCK_SCREEN +extern screen_functions_t *get_screen_clock(void); +#endif + static screen_t *screen = NULL; static screen_functions_t *mode_fn = NULL; @@ -84,6 +88,12 @@ switch_screen_mode(screen_mode_t new_mode, mpd_client_t *c) mode_fn = get_screen_keydef(); break; #endif +#ifdef ENABLE_CLOCK_SCREEN + case SCREEN_CLOCK_WINDOW: + mode_fn = get_screen_clock(); + break; +#endif + default: break; } @@ -578,6 +588,10 @@ screen_init(void) screen->screen_list = g_list_append(screen->screen_list, (gpointer) get_screen_keydef()); #endif +#ifdef ENABLE_CLOCK_SCREEN + screen->screen_list = g_list_append(screen->screen_list, + (gpointer) get_screen_clock()); +#endif list = screen->screen_list; while( list ) @@ -596,6 +610,7 @@ screen_init(void) /* initialize wreadln */ wrln_resize_callback = screen_resize; + wrln_max_history_length = 16; return 0; } @@ -885,13 +900,17 @@ screen_cmd(mpd_client_t *c, command_t cmd) case CMD_SCREEN_KEYDEF: switch_screen_mode(SCREEN_KEYDEF_WINDOW, c); break; +#endif +#ifdef ENABLE_CLOCK_SCREEN + case CMD_SCREEN_CLOCK: + switch_screen_mode(SCREEN_CLOCK_WINDOW, c); + break; #endif case CMD_QUIT: exit(EXIT_SUCCESS); default: break; } - } diff --git a/src/screen.h b/src/screen.h index cb4abc8..f674b1c 100644 --- a/src/screen.h +++ b/src/screen.h @@ -18,6 +18,7 @@ typedef enum SCREEN_FILE_WINDOW, SCREEN_HELP_WINDOW, SCREEN_KEYDEF_WINDOW, + SCREEN_CLOCK_WINDOW, SCREEN_SEARCH_WINDOW } screen_mode_t; diff --git a/src/screen_clock.c b/src/screen_clock.c new file mode 100644 index 0000000..57dcac0 --- /dev/null +++ b/src/screen_clock.c @@ -0,0 +1,259 @@ +/* + * This file is based on the 'Grand digital clock' (gdc.c) shipped with + * ncurses. + */ + +#include +#include +#include +#include +#include + +#include "config.h" + +#ifdef ENABLE_CLOCK_SCREEN +#include "ncmpc.h" +#include "libmpdclient.h" +#include "options.h" +#include "mpc.h" +#include "command.h" +#include "screen.h" +#include "screen_utils.h" + +#define YDEPTH 5 +#define BUFSIZE 64 + +#define ENABLE_SECONDS 0 + +static window_t win = { NULL, 0, 0 }; +static gboolean enable_seconds = ENABLE_SECONDS; + +/* orginal variables from gdc.c */ +static short disp[11] = +{ + 075557, 011111, 071747, 071717, 055711, + 074717, 074757, 071111, 075757, 075717, 002020 +}; + +static long older[6], next[6], newer[6], mask; + +static int YBASE = 10; +static int XBASE = 10; +static int XLENGTH = 54; + +/* orginal functions */ +static void +set(int t, int n) +{ + int i, m; + + m = 7 << n; + for (i = 0; i < 5; i++) { + next[i] |= ((disp[t] >> ((4 - i) * 3)) & 07) << n; + mask |= (next[i] ^ older[i]) & m; + } + if (mask & m) + mask |= m; +} + +static void +drawbox(void) +{ + chtype bottom[XLENGTH + 1]; + int n; + + mvwaddch(win.w, YBASE - 1, XBASE - 1, ACS_ULCORNER); + whline(win.w, ACS_HLINE, XLENGTH); + mvwaddch(win.w, YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); + + mvwaddch(win.w, YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); + mvwinchnstr(win.w, YBASE + YDEPTH, XBASE, bottom, XLENGTH); + for (n = 0; n < XLENGTH; n++) + bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); + mvwaddchnstr(win.w, YBASE + YDEPTH, XBASE, bottom, XLENGTH); + mvwaddch(win.w, YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); + + wmove(win.w, YBASE, XBASE - 1); + wvline(win.w, ACS_VLINE, YDEPTH); + + wmove(win.w, YBASE, XBASE + XLENGTH); + wvline(win.w, ACS_VLINE, YDEPTH); +} + + +static void +standt(int on) +{ + if(on) + wattron(win.w, A_REVERSE); + else + wattroff(win.w, A_REVERSE); +} + + + +/* ncmpc screen functions */ + +static void +clock_resize(int cols, int rows) +{ + int j; + + for (j = 0; j < 5; j++) + older[j] = newer[j] = next[j] = 0; + + win.cols = cols; + win.rows = rows; + + if( cols<60 ) + enable_seconds = FALSE; + else + enable_seconds = ENABLE_SECONDS; + + if( enable_seconds ) + XLENGTH = 54; + else + XLENGTH = 54-18; + + + XBASE = (cols-XLENGTH)/2; + YBASE = (rows-YDEPTH)/2-(YDEPTH/2); +} + +static void +clock_init(WINDOW *w, int cols, int rows) +{ + win.w = w; + clock_resize(cols, rows); +} + +static void +clock_exit(void) +{ +} + +static void +clock_open(screen_t *screen, mpd_client_t *c) +{ + int j; + + for (j = 0; j < 5; j++) + older[j] = newer[j] = next[j] = 0; + +} + +static void +clock_close(void) +{ +} + +static char * +clock_title(void) +{ + return _("Music Player Client - Clock"); +} + +static void +clock_update(screen_t *screen, mpd_client_t *c) +{ + time_t now; + struct tm *tm; + long t, a; + int i, j, s, k; + char buf[BUFSIZE]; + + time(&now); + tm = localtime(&now); + + mask = 0; + set(tm->tm_sec % 10, 0); + set(tm->tm_sec / 10, 4); + set(tm->tm_min % 10, 10); + set(tm->tm_min / 10, 14); + set(tm->tm_hour % 10, 20); + set(tm->tm_hour / 10, 24); + set(10, 7); + set(10, 17); + + for (k = 0; k < 6; k++) { + newer[k] = (newer[k] & ~mask) | (next[k] & mask); + next[k] = 0; + for (s = 1; s >= 0; s--) { + standt(s); + for (i = 0; i < 6; i++) { + if ((a = (newer[i] ^ older[i]) & (s ? newer : older)[i]) + != 0) { + for (j = 0, t = 1 << 26; t; t >>= 1, j++) { + if (a & t) { + if (!(a & (t << 1))) { + wmove(win.w, YBASE + i, XBASE + 2 * j); + } + if( enable_seconds || j<18 ) + waddstr(win.w, " "); + } + } + } + if (!s) { + older[i] = newer[i]; + } + } + if (!s) { + wrefresh(win.w); + } + } + } + +#ifdef HAVE_LOCALE_H + strftime(buf, BUFSIZE, "%x", tm); +# else + /* this depends on the detailed format of ctime(3) */ + strcpy(buf, ctime(&now)); + strcpy(buf + 10, buf + 19); +#endif + mvwaddstr(win.w, YBASE+YDEPTH+1, (win.cols-strlen(buf))/2, buf); + + wmove(win.w, 6, 0); + drawbox(); + wrefresh(win.w); +} + +static void +clock_paint(screen_t *screen, mpd_client_t *c) +{ + /* this seems to be a better way to clear the window than wclear() ?! */ + wmove(win.w, 0, 0); + wclrtobot(win.w); + clock_update(screen, c); +} + + + +static int +clock_cmd(screen_t *screen, mpd_client_t *c, command_t cmd) +{ + return 0; +} + + +screen_functions_t * +get_screen_clock(void) +{ + static screen_functions_t functions; + + memset(&functions, 0, sizeof(screen_functions_t)); + functions.init = clock_init; + functions.exit = clock_exit; + functions.open = clock_open; + functions.close = clock_close; + functions.resize = clock_resize; + functions.paint = clock_paint; + functions.update = clock_update; + functions.cmd = clock_cmd; + functions.get_lw = NULL; + functions.get_title = clock_title; + + return &functions; +} + + +#endif diff --git a/src/screen_help.c b/src/screen_help.c index ced6606..0299d6c 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -53,6 +53,9 @@ static help_text_row_t help_text[] = { 0, CMD_SCREEN_HELP, NULL }, { 0, CMD_SCREEN_PLAY, NULL }, { 0, CMD_SCREEN_FILE, NULL }, +#ifdef ENABLE_CLOCK_SCREEN + { 0, CMD_SCREEN_CLOCK, NULL }, +#endif #ifdef ENABLE_KEYDEF_SCREEN { 0, CMD_SCREEN_KEYDEF, NULL }, #endif -- 2.30.2