#include "show.h"
#include "slash.h"

/**
 * Copyright (C) 2001-2006 Tino Reichardt
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 2, as
 * published by the Free Software Foundation.
 *
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

void show_status(void)
{
	static unsigned int last=0;
	unsigned int c=0;
	char *x;

	/* can happen, when starting mcdp */
	if (!show_x1) return;

	show_sa(&c_status);
	show_gotoxy(show_x1, 4);

	if (cd->ds != DS_OKAY) {
		x=lang_msg(MSG_DRIVESTATUS_NODISC+cd->ds);
		show(x);
		c += str_len(x) + 3;
	}

	if (c) show(slash);
	x=lang_msg(MSG_AUDIOSTATUS_PLAY+cd->as);
	show(x);
	c += str_len(x) + 3;

	if (cd->xs != XS_NONE) {
		if (c) show(slash);
		x=lang_msg(MSG_EXTRASTATUS_OPENING+cd->xs);
		show(x);
		c += str_len(x) + 3;
	}

	/* remember written chars */
	while (c < last) { show(" "); last--; }
	last=c;

	flush();

	return;
}

