r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / statusbar.C
blob017df66cc9d4d0ab7ff446ce6f67139893cb66bb
1 #include "mainprogress.h"
2 #include "mwindow.h"
3 #include "statusbar.h"
4 #include "theme.h"
5 #include "vframe.h"
8 #include <libintl.h>
9 #define _(String) gettext(String)
10 #define gettext_noop(String) String
11 #define N_(String) gettext_noop (String)
14 StatusBar::StatusBar(MWindow *mwindow, MWindowGUI *gui)
15  : BC_SubWindow(mwindow->theme->mstatus_x, 
16         mwindow->theme->mstatus_y, 
17         mwindow->theme->mstatus_w, 
18         mwindow->theme->mstatus_h)
20         this->mwindow = mwindow;
21         this->gui = gui;
24 StatusBar::~StatusBar()
30 int StatusBar::create_objects()
32 //printf("StatusBar::create_objects 1\n");
33         int x = 10, y = 5;
34 //printf("StatusBar::create_objects 1\n");
35         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
36         add_subwindow(status_text = new BC_Title(mwindow->theme->mstatus_message_x, 
37                 mwindow->theme->mstatus_message_y, 
38                 ""));
39         x = get_w() - 290;
40 //printf("StatusBar::create_objects 1\n");
41         add_subwindow(main_progress = 
42                 new BC_ProgressBar(mwindow->theme->mstatus_progress_x, 
43                         mwindow->theme->mstatus_progress_y, 
44                         mwindow->theme->mstatus_progress_w, 
45                         mwindow->theme->mstatus_progress_w));
46         x += main_progress->get_w() + 5;
47 //printf("StatusBar::create_objects 1\n");
48         add_subwindow(main_progress_cancel = 
49                 new StatusBarCancel(mwindow, 
50                         mwindow->theme->mstatus_cancel_x, 
51                         mwindow->theme->mstatus_cancel_y));
52 //printf("StatusBar::create_objects 1\n");
53         default_message();
54         flash();
55 //printf("StatusBar::create_objects 2\n");
56         return 0;
59 void StatusBar::resize_event()
61         int x = 10, y = 1;
64         reposition_window(mwindow->theme->mstatus_x,
65                 mwindow->theme->mstatus_y,
66                 mwindow->theme->mstatus_w,
67                 mwindow->theme->mstatus_h);
68         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
70         status_text->reposition_window(mwindow->theme->mstatus_message_x, 
71                 mwindow->theme->mstatus_message_y);
72         x = get_w() - 290;
73         main_progress->reposition_window(mwindow->theme->mstatus_progress_x, 
74                 mwindow->theme->mstatus_progress_y);
75         x += main_progress->get_w() + 5;
76         main_progress_cancel->reposition_window(mwindow->theme->mstatus_cancel_x, 
77                 mwindow->theme->mstatus_cancel_y);
78         flash();
81 void StatusBar::set_message(char *text)
83         status_text->update(text);
86 void StatusBar::default_message()
88         status_text->set_color(BLACK);
89         status_text->update(_("Welcome to Cinelerra."));
93 StatusBarCancel::StatusBarCancel(MWindow *mwindow, int x, int y)
94  : BC_Button(x, y, mwindow->theme->statusbar_cancel_data)
96         this->mwindow = mwindow;
97         set_tooltip(_("Cancel operation"));
99 int StatusBarCancel::handle_event()
101         mwindow->mainprogress->cancelled = 1;
102         return 1;