X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcprogress.C;h=100ef766a381adb92402c02335c9fd82fbe72053;hb=ccd23c15fae578be22d48b1a1e8b09cb43d593ae;hp=b2ba8cb474100d375aaaf7dae0c59d5b4ef34df8;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcprogress.C b/cinelerra-5.1/guicast/bcprogress.C index b2ba8cb4..100ef766 100644 --- a/cinelerra-5.1/guicast/bcprogress.C +++ b/cinelerra-5.1/guicast/bcprogress.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * 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 @@ -25,7 +25,7 @@ #define PROGRESS_UP 0 #define PROGRESS_HI 1 -#include "colors.h" +#include "bccolors.h" #include "fonts.h" #include "bcprogress.h" #include "bcpixmap.h" @@ -87,8 +87,8 @@ int BC_ProgressBar::set_images() for(int i = 0; i < 2; i++) { - images[i] = new BC_Pixmap(parent_window, - get_resources()->progress_images[i], + images[i] = new BC_Pixmap(parent_window, + get_resources()->progress_images[i], PIXMAP_ALPHA); } return 0; @@ -113,9 +113,12 @@ int BC_ProgressBar::draw(int force, int flush) if(do_text) { + float pos = position > length ? (float)1 : + length > 0 && position > 0 ? (float)position / length : + (float)0; set_font(MEDIUMFONT); set_color(get_resources()->progress_text); // draw decimal percentage - sprintf(string, "%d%%", (int)(100 * (float)position / length + 0.5 / w)); + sprintf(string, "%d%%", (int)(100 * pos + 0.5f)); draw_center_text(w / 2, h / 2 + get_text_ascent(MEDIUMFONT) / 2, string); } flash(flush);