/* * Copyright (C) 2002 - David W. Durham * * This file is part of ReZound, an audio editing application. * * ReZound 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. * * ReZound 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 "CStatusComm.h" #include #include #include #include "CProgressDialog.h" const string escapeAmpersand(const string i) { string o; // escape '&' for the reopen menu for(size_t t=0;tgetApp()->beep(); } int CStatusComm::beginProgressBar(const string &title,bool showCancelButton) { //printf("begin progress bar: %s\n",title.c_str()); // find a place in progressDialogs to create a new one for(int handle=0;handlecreate(); progressDialogs[handle]->show(); return(handle); } catch(exception &e) { progressDialogs[handle]=NULL; Error(e.what()); return(-1); } } } return(-1); } bool CStatusComm::updateProgressBar(int handle,int progress,const string timeElapsed,const string timeRemaining) { ////printf("update progress bar: %d\n",progress); if(handle>=0 && handlesetProgress(progress,timeElapsed,timeRemaining); #if FOX_MAJOR>0 progressDialogs[handle]->getApp()->repaint(); #endif return progressDialogs[handle]->isCancelled; } catch(exception &e) { // oh well fprintf(stderr,"exception caught in %s -- %s\n",__func__,e.what()); } } return false; } void CStatusComm::endProgressBar(int handle) { //printf("end progress bar\n"); if(handle>=0 && handlehide(); delete progressDialogs[handle]; progressDialogs[handle]=NULL; } catch(exception &e) { progressDialogs[handle]=NULL; Error(e.what()); } } } void CStatusComm::endAllProgressBars() { //printf("end all progress bars\n"); for(int t=0;t