aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* wreadln: convert public globals to local constantsMax Kellermann2008-10-061-4/+0
| | | | | Convert wrln_max_line_size and wrln_max_history_length to local constants. They have no real use outside of wreadln.c.
* removed my_wgetch(), switch to wgetch()Max Kellermann2008-10-061-2/+0
| | | | | There are no special cases left for my_wgetch() to handle. We can remove it and use the original wgetch() instead.
* screen: declare time constants as GTimeMax Kellermann2008-10-041-2/+2
| | | | | Variables which store integer seconds should be declared as GTime. This fixes a gcc warning.
* screen: export the global variable "screen"Max Kellermann2008-10-031-4/+4
| | | | | screen_t is a singleton. We do not have to pass it around everywhere. Export the one global variable.
* screen: don't pass mpdclient pointer to method paint()Max Kellermann2008-10-031-1/+1
| | | | | None of the paint() implementations acutally uses the mpdclient pointer. Remove it from the method signature.
* screen: removed "painted" flagMax Kellermann2008-10-031-9/+5
| | | | Repaint immediately instead of setting "painted=0".
* colors: make color support optional at compile timeMax Kellermann2008-10-031-0/+2
| | | | | Default is colors disabled. Those who love colorful terminals have the option to enable it with --enable-colors.
* code style, indent with tabs XIMax Kellermann2008-10-031-2/+0
| | | | Follow the same code style als MPD itself.
* charset: renamed my_strlen() to utf8_width()Max Kellermann2008-10-021-7/+7
| | | | | | my_strlen() is a bad name for the function, since the return value is not a length, but a visible width on the screen. Rename it to utf8_width() and change its return type to "unsigned".
* moved code to charset.cMax Kellermann2008-10-021-0/+1
| | | | | Move everything which deals with UTF-8 strings and character set conversion to charset.c, header charset.h.
* moved macros from ncmpc.h to main.c and screen.cMax Kellermann2008-10-021-1/+10
| | | | | Moved constants which are only used in one source file. Remove several unused macros.
* removed LIST_FORMAT, STATUS_FORMATMax Kellermann2008-10-021-1/+2
| | | | | Use options.list_format and options.status_format directly instead of these two macros.
* moved i18n macros to i18n.hMax Kellermann2008-10-021-0/+1
| | | | | Don't make everybody include ncmpc.h just to have generic features. Move generic i18n macros to a separate header.
* removed the debugging function D()Max Kellermann2008-10-021-4/+0
| | | | gdb is for debugging. We don't need D() calls littered all over.
* screen: export function screen_switch()Max Kellermann2008-10-021-10/+10
| | | | | Provide an API for switching the currently displayed screen. Rename switch_screen_mode() to screen_switch().
* fix miscellaneous sparse warningsMax Kellermann2008-09-251-1/+1
| | | | Static variables, pointers vs integers, void function returning, ...
* screen: removed screen.modeMax Kellermann2008-09-251-9/+6
| | | | | Everything is now managed with a pointer to the screen_functions struct.
* screen: pass screen_functions pointer to switch_screen_mode()Max Kellermann2008-09-251-12/+20
| | | | | Trying to get rid of the screen ids. A pointer to screen_functions is better for identifying a screen.
* screen: replaced get_cur_mode_id() with screen_is_visible()Max Kellermann2008-09-251-2/+3
| | | | | | Screen code shouldn't know anything about the screen ids (which will be eliminated completely later). Instead of comparing ids, compare the screen_functions pointer.
* screen: moved code to screen_list.cMax Kellermann2008-09-251-110/+10
| | | | | Move the hard-coded screen list and everything which works with this array to screen_list.c.
* screen: don't compile disabled sourcesMax Kellermann2008-09-251-0/+2
| | | | | Instead of evaluating macros from config.h in the disabled source, don't start the compiler on it at all.
* screen: don't pass screen pointer to method update()Max Kellermann2008-09-251-1/+1
| | | | | play_update() is the only update() implementation left, and it does not use the screen pointer. Remove it from the method signature.
* screen: don't pass screen pointer to method paint()Max Kellermann2008-09-251-1/+1
| | | | | None of the paint() implementations actually use the screen pointer - remove it from the method signature.
* screen: moved input_timestamp to screen_play.cMax Kellermann2008-09-221-2/+0
| | | | Since the input_timestamp is only used by screen_play, move it there.
* screen: moved list_window mouse code to list_window.cMax Kellermann2008-09-221-21/+1
| | | | | | Move the portion of screen_get_mouse_event() which handles list_window clicks to list_window.c. The code contained a NULL pointer dereference, which is now fixed.
* screen: moved code to ncu.cMax Kellermann2008-09-221-31/+2
| | | | | Moved basic libncurses initialization to ncu.c and ncu.h. Keep generic code out of screen.c.
* added option "welcome-screen-list"David Shakaryan2008-09-221-1/+2
| | | | | "welcome-screen-list" shows the screen list in the top row shortly after startup, and is enabled by default.
* added optional bitrate display to status barJ. Alexander Treuman2008-09-211-4/+14
| | | | | If visible-bitrate is enabled, then the current bitrate will be drawn next to the song time in the status bar. By default it will not be displayed.
* Adding crop feature in ncmpcYannick LM2008-09-211-0/+3
| | | | | The "crop" command deletes all songs from the playlist, except the one currently being played.
* removed the clock screenMax Kellermann2008-09-181-10/+0
| | | | Why should an audio player display a large clock?
* screen: don't handle CMD_PLAYMax Kellermann2008-09-181-0/+2
| | | | | | | | | | CMD_PLAY is mapped to the Enter key by default. Some screens (mis-)use it for navigation, for entering a directory. The playlist screen actually plays the file under the cursor. On all other screens, pressing Enter may be confusing, since it is more of a "confirmation" key instead of "play". We should probaby add CMD_CONFIRM later, but for now, disable the general CMD_PLAY handler in screen.c. This fixes bug 240.
* quit with g_main_loop_quit()Max Kellermann2008-09-181-2/+0
| | | | | Call g_main_loop_quit() on CMD_QUIT, instead of exit() with an atexit() handler.
* use the glib main event loopMax Kellermann2008-09-181-2/+0
| | | | | | | | | | This big patch replaces our custom main loop with the event based glib main loop. This has several advantages: we can make all the tiny code bits in the main loop independent from each others, we can add additional file descriptors for polling (e.g. the mpdclient socket). We don't need the ncurses timeout() anymore, because glib will poll stdin for us.
* screen: check MPD status only if connectedMax Kellermann2008-09-181-38/+51
| | | | | | Fix several segmentation faults: when the connection to the MPD server is lost, there were NULL pointer dereferences because client->status==NULL. Check before accessing it.
* screen: moved code to screen_client_cmd()Max Kellermann2008-09-181-9/+24
| | | | | | Move all command handlers which need a connection to the MPD server to screen_client_cmd(). This will allow us to unify error handling later.
* code style, indent with tabs IVMax Kellermann2008-09-171-16/+15
| | | | Follow the same code style als MPD itself.
* make several functions return voidMax Kellermann2008-09-171-6/+2
|
* screen: return early in switch_screen_mode() on errorMax Kellermann2008-09-171-7/+7
| | | | | When the selected screen does not exist, return before calling close().
* screen: added macro NUM_SCREENSMax Kellermann2008-09-171-25/+16
| | | | | Since the number of screens is known at compile time, define a macro which calculates this, instead of having a sentinel element.
* screen: close only current screen in screen_exit()Max Kellermann2008-09-171-2/+3
| | | | | Screens which are not active have already been closed, or have never been opened. Don't call close again on them.
* screen: don't store "screen" as a pointerMax Kellermann2008-09-171-140/+135
| | | | | | There can only be onle screen struct instance at a time. Declare it as a static struct, instead of a pointer to the struct. This simplifies all accesses, and avoids the dynamic allocation.
* screen: moved code to find_configured_screen()Max Kellermann2008-09-171-10/+13
|
* screen: mode_fn cannot be NULL, removed checksMax Kellermann2008-09-171-17/+9
| | | | | At startup, mode_fn is initialized with &screen_playlist, and it will never be reset to NULL. Remove all checks.
* screen: before calling update(), check if it is definedMax Kellermann2008-09-171-1/+1
| | | | | That seems to be a fn->paint was checked, then the code called fn->update(). Fix this.
* screen: removed screen_functions.get_lw()Max Kellermann2008-09-171-9/+2
| | | | | | If it is really important to set the curser, we should think of a better way, instead of exporting one non-generic method. For now, just set the cursor to the origin.
* replaced get_screen_X() with static screen_functions variableMax Kellermann2008-09-171-32/+40
| | | | | | Compile time initialization saves resources, compared to run-time initialization. Declare all screen_function structs as global variables, and remove all get functions.
* code style, indent with tabs IIIMax Kellermann2008-09-171-9/+8
| | | | Follow the same code style als MPD itself.
* initial draw without delayMax Kellermann2008-09-161-0/+2
| | | | | Due to a missing refresh() call, ncmpc painted the screen after one second. Add refresh(), make ncmpc display immediately.
* screen: added struct namesMax Kellermann2008-09-161-20/+17
| | | | | Let us declare struct names in addition to typedef names, so we can forward-declare them.
* code style, indent with tabs IIMax Kellermann2008-09-161-5/+3
| | | | Follow the same code style als MPD itself.