/* A NCURSES/CDK TUI (Text User Interface) for MuSE * Copyright (C) 2002 Luca 'rubik' Profico * * This source code is free software; you can redistribute it and/or * modify it under the terms of the GNU Public License as published * by the Free Software Foundation; either version 2 of the License, * or (at your option) any later version. * * This source code 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. * Please refer to the GNU Public License for more details. * * You should have received a copy of the GNU Public License along with * this source code; if not, write to: * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: play_infobox.cpp,v 1.1.1.1 2003/12/08 12:20:35 jaromil Exp $ * */ #include "play_infobox.h" #include "muse_console.h" PlayInfoBox::PlayInfoBox() { /* song = (char *) malloc (255) ; elapsed = (char *) malloc (32) ; mode = (char *) malloc (32); act = (char *) malloc (32); */ message[0] = (char *) malloc (255); message[1] = (char *) malloc (255); snprintf (song,255, "null"); snprintf (elapsed,32, "Elapsed: 00:00:00"); snprintf (mode,32, " Mode: null"); snprintf (curract,32, " "); snprintf (message[0],255,"%s", song); snprintf (message[1],255,"%s %s %s", elapsed,mode,curract); } PlayInfoBox::~PlayInfoBox() { func("PlayInfoBox::~PlayInfoBox()"); free (message[0]); free (message[1]); } void PlayInfoBox::setscreen (CDKSCREEN *screen) { cdkscreen=screen; } void PlayInfoBox::reg (void) { func ("PlayInfoBox::reg"); registerCDKObject (cdkscreen, vLABEL, infobox); } void PlayInfoBox::unreg (void) { func ("PlayInfoBox::unreg() screen=%p",cdkscreen); unregisterCDKObject (vLABEL, infobox); func ("end PlayInfoBox::unreg()"); } void PlayInfoBox::setparm(int xpos, int ypos, int width) { /*int i; for (i=0; iElapsed:%s",newelap); snprintf(message[1],255,"%s %s %s",elapsed,mode,curract); setCDKLabel ( infobox, (char**)message, 2, TRUE ); } void PlayInfoBox::setelapsedNR(char * newelap) { snprintf(elapsed,32,"Elapsed:%s",newelap); snprintf(message[1],255,"%s %s %s",elapsed,mode,curract); setCDKLabelNR ( infobox, (char**)message, 2, TRUE ); } void PlayInfoBox::setmode (char * newmode) { func ("PlayInfoBox::setmode()"); snprintf(mode,32,"Mode: %s",newmode); snprintf(message[1],255,"%s %s %s",elapsed,mode,curract); setCDKLabel ( infobox, (char**)message, 2, TRUE ); } void PlayInfoBox::setmodeNR (char * newmode) { func ("PlayInfoBox::setmode()"); snprintf(mode,32,"Mode: %s",newmode); snprintf(message[1],255,"%s %s %s",elapsed,mode,curract); setCDKLabelNR ( infobox, (char**)message, 2, TRUE ); } void PlayInfoBox::setact (const char * newact) { func ("PlayInfoBox::setact()"); snprintf(curract,32,"%s",newact); sprintf(message[1],"%s %s %s",elapsed,mode,curract); setCDKLabelMessage ( infobox, message, 2 ); } void PlayInfoBox::setactNR (const char * newact) { snprintf(curract,32,"%s",newact); sprintf(message[1],"%s %s %s",elapsed,mode,curract); setCDKLabelMessage_NR ( infobox, message, 2 ); } void PlayInfoBox::setctrl (void) { func ("PlayInfoBox::setctrl()"); setact (" [CTRL]"); setCDKLabelBoxAttribute (infobox, A_BOLD); setCDKLabelBackgroundColor (infobox, ""); } void PlayInfoBox::setctrlNR (void) { setactNR (" [CTRL]"); setCDKLabelBoxAttribute (infobox, A_BOLD); setCDKLabelBackgroundColor (infobox, ""); } void PlayInfoBox::unsetctrl (void) { setact (" "); setCDKLabelBoxAttribute (infobox, A_NORMAL); setCDKLabelBackgroundColor (infobox, ""); } void PlayInfoBox::unsetctrlNR (void) { setactNR (" "); setCDKLabelBoxAttribute (infobox, A_NORMAL); setCDKLabelBackgroundColor (infobox, ""); } void PlayInfoBox::draw(void) { drawCDKLabel (infobox, TRUE); } void PlayInfoBox::hide(void) { eraseCDKLabel (infobox); }