4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "bcsignals.h"
25 #include "mainprogress.h"
27 #include "statusbar.h"
33 StatusBar::StatusBar(MWindow *mwindow, MWindowGUI *gui)
34 : BC_SubWindow(mwindow->theme->mstatus_x,
35 mwindow->theme->mstatus_y,
36 mwindow->theme->mstatus_w,
37 mwindow->theme->mstatus_h)
39 this->mwindow = mwindow;
43 StatusBar::~StatusBar()
49 void StatusBar::create_objects()
51 //printf("StatusBar::create_objects 1\n");
52 int x = 10; //int y = 5;
53 //printf("StatusBar::create_objects 1\n");
54 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
55 add_subwindow(status_text = new BC_Title(mwindow->theme->mstatus_message_x,
56 mwindow->theme->mstatus_message_y,
59 mwindow->theme->message_normal));
61 // printf("StatusBar::create_objects %d: 0x%08x\n",
62 // __LINE__, mwindow->theme->message_normal);
63 add_subwindow(main_progress =
64 new BC_ProgressBar(mwindow->theme->mstatus_progress_x,
65 mwindow->theme->mstatus_progress_y,
66 mwindow->theme->mstatus_progress_w,
67 mwindow->theme->mstatus_progress_w));
68 x += main_progress->get_w() + 5;
69 //printf("StatusBar::create_objects 1\n");
70 add_subwindow(main_progress_cancel =
71 new StatusBarCancel(mwindow,
72 mwindow->theme->mstatus_cancel_x,
73 mwindow->theme->mstatus_cancel_y));
74 //printf("StatusBar::create_objects 1\n");
75 reset_default_message();
79 void StatusBar::resize_event()
81 int x = 10; //int y = 1;
84 reposition_window(mwindow->theme->mstatus_x,
85 mwindow->theme->mstatus_y,
86 mwindow->theme->mstatus_w,
87 mwindow->theme->mstatus_h);
89 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
92 status_text->reposition_window(mwindow->theme->mstatus_message_x,
93 mwindow->theme->mstatus_message_y);
96 main_progress->reposition_window(mwindow->theme->mstatus_progress_x,
97 mwindow->theme->mstatus_progress_y);
99 x += main_progress->get_w() + 5;
100 main_progress_cancel->reposition_window(mwindow->theme->mstatus_cancel_x,
101 mwindow->theme->mstatus_cancel_y);
106 void StatusBar::set_message(const char *text, int color)
108 if( color < 0 ) color = mwindow->theme->message_normal;
109 status_text->set_color(color);
110 status_text->update(text);
112 void StatusBar::set_default_message(const char *text)
114 strcpy(default_msg, text);
117 void StatusBar::reset_default_message()
119 set_default_message(_("Welcome to cinelerra"));
121 void StatusBar::default_message()
123 set_message(default_msg, mwindow->theme->message_normal);
126 StatusBarCancel::StatusBarCancel(MWindow *mwindow, int x, int y)
127 : BC_Button(x, y, mwindow->theme->statusbar_cancel_data)
129 this->mwindow = mwindow;
130 set_tooltip(_("Cancel operation"));
132 int StatusBarCancel::handle_event()
134 mwindow->mainprogress->cancelled = 1;