From 230b0fe73ac3a07293d495e895207b43cdfb3369 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Mon, 19 Apr 2004 22:10:13 +0000 Subject: [PATCH] Added copyright notice and license notice git-svn-id: https://svn.musicpd.org/ncmpc/trunk@833 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- command.c | 68 +++++++++++++++++++++++++++++++++++++------------- conf.c | 43 +++++++++++++++++++++++++++++-- list_window.c | 18 +++++++++++++ main.c | 18 +++++++++++++ options.c | 18 +++++++++++++ screen_utils.c | 18 +++++++++++++ support.c | 18 +++++++++++++ 7 files changed, 181 insertions(+), 20 deletions(-) diff --git a/command.c b/command.c index 15ebd50..75dd75e 100644 --- a/command.c +++ b/command.c @@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include @@ -80,9 +98,9 @@ static command_definition_t cmds[] = { { DWN, '.', 0 }, CMD_LIST_NEXT, "down", "Move cursor down" }, { { HOME, 0x01, 0 }, CMD_LIST_FIRST, "home", - "Home" }, + "Home " }, { { END, 0x05, 0 }, CMD_LIST_LAST, "end", - "End" }, + "End " }, { { PGUP, 'A', 0 }, CMD_LIST_PREVIOUS_PAGE, "pgup", "Page up" }, { { PGDN, 'B', 0 }, CMD_LIST_NEXT_PAGE, "pgdn", @@ -111,6 +129,10 @@ static command_definition_t cmds[] = "Browse screen" }, { {'u', 0, 0 }, CMD_SCREEN_UPDATE, "update", "Update screen" }, +#ifdef ENABLE_KEYDEF_SCREEN + { {'K', 0, 0 }, CMD_SCREEN_KEYDEF, "screen-keyedit", + "Key edit screen" }, +#endif { { 'q', 0, 0 }, CMD_QUIT, "quit", "Quit " PACKAGE }, @@ -118,10 +140,17 @@ static command_definition_t cmds[] = { { -1, -1, -1 }, CMD_NONE, NULL, NULL } }; +command_definition_t * +get_command_definitions(void) +{ + return cmds; +} + char * key2str(int key) { - static char buf[2]; + static char buf[4]; + int i; buf[0] = 0; switch(key) @@ -158,20 +187,16 @@ key2str(int key) return "Shift+Tab"; case ESC: return "Esc"; - case F1: - return "F1"; - case F2: - return "F2"; - case F3: - return "F3"; - case F4: - return "F4"; - case F5: - return "F5"; - case F6: - return "F6"; + case KEY_IC: + return "Insert"; default: - snprintf(buf, 2, "%c", key); + for(i=0; i<=63; i++) + if( key==KEY_F(i) ) + { + snprintf(buf, 4, "F%d", i ); + return buf; + } + snprintf(buf, 4, "%c", key); } return buf; } @@ -265,13 +290,14 @@ get_key_command_from_name(char *name) return CMD_NONE; } + command_t -get_key_command(int key) +find_key_command(int key, command_definition_t *cmds) { int i; i=0; - while( cmds[i].name ) + while( cmds && cmds[i].name ) { if( cmds[i].keys[0] == key || cmds[i].keys[1] == key || @@ -282,6 +308,12 @@ get_key_command(int key) return CMD_NONE; } +command_t +get_key_command(int key) +{ + return find_key_command(key, cmds); +} + command_t get_keyboard_command(void) diff --git a/conf.c b/conf.c index a8deb89..0c0448e 100644 --- a/conf.c +++ b/conf.c @@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include @@ -384,6 +402,28 @@ read_rc_file(char *filename, options_t *options) return 0; } +int +check_user_conf_dir(void) +{ + int retval; + char *dirname = g_build_filename(g_get_home_dir(), "." PACKAGE, NULL); + + if( g_file_test(dirname, G_FILE_TEST_IS_DIR) ) + { + g_free(dirname); + return 0; + } + retval = mkdir(dirname, 0755); + g_free(dirname); + return retval; +} + +char * +get_user_key_binding_filename(void) +{ + return g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL); +} + int read_configuration(options_t *options) @@ -418,7 +458,7 @@ read_configuration(options_t *options) } /* check for user key bindings ~/.ncmpc/keys */ - filename = g_build_filename(g_get_home_dir(), "." PACKAGE, "keys", NULL); + filename = get_user_key_binding_filename(); if( !g_file_test(filename, G_FILE_TEST_IS_REGULAR) ) { g_free(filename); @@ -442,7 +482,6 @@ read_configuration(options_t *options) read_rc_file(filename, options); g_free(filename); filename = NULL; - //write_key_bindings(stderr); } return 0; diff --git a/list_window.c b/list_window.c index 5a07f60..fcb25ca 100644 --- a/list_window.c +++ b/list_window.c @@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include diff --git a/main.c b/main.c index cfa1151..07a623b 100644 --- a/main.c +++ b/main.c @@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include diff --git a/options.c b/options.c index 81f67bd..16a61ec 100644 --- a/options.c +++ b/options.c @@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include diff --git a/screen_utils.c b/screen_utils.c index b93069c..c9fff74 100644 --- a/screen_utils.c +++ b/screen_utils.c @@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include diff --git a/support.c b/support.c index 564fd9b..d292e84 100644 --- a/support.c +++ b/support.c @@ -1,3 +1,21 @@ +/* + * (c) 2004 by Kalle Wallin (kaw@linux.se) + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + #include #include #include -- 2.30.2