r999: maintainers added to README_en.
[cinelerra_cv/mob.git] / cinelerra / statusbar.C
blobea196c12dd8500c84d62e4b3c8f4d6d1026c951b
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                 MEDIUMFONT,
40                 mwindow->theme->message_normal));
41         x = get_w() - 290;
42 //printf("StatusBar::create_objects 1\n");
43         add_subwindow(main_progress = 
44                 new BC_ProgressBar(mwindow->theme->mstatus_progress_x, 
45                         mwindow->theme->mstatus_progress_y, 
46                         mwindow->theme->mstatus_progress_w, 
47                         mwindow->theme->mstatus_progress_w));
48         x += main_progress->get_w() + 5;
49 //printf("StatusBar::create_objects 1\n");
50         add_subwindow(main_progress_cancel = 
51                 new StatusBarCancel(mwindow, 
52                         mwindow->theme->mstatus_cancel_x, 
53                         mwindow->theme->mstatus_cancel_y));
54 //printf("StatusBar::create_objects 1\n");
55         default_message();
56         flash();
57 //printf("StatusBar::create_objects 2\n");
58         return 0;
61 void StatusBar::resize_event()
63         int x = 10, y = 1;
66         reposition_window(mwindow->theme->mstatus_x,
67                 mwindow->theme->mstatus_y,
68                 mwindow->theme->mstatus_w,
69                 mwindow->theme->mstatus_h);
70         draw_top_background(get_parent(), 0, 0, get_w(), get_h());
72         status_text->reposition_window(mwindow->theme->mstatus_message_x, 
73                 mwindow->theme->mstatus_message_y);
74         x = get_w() - 290;
75         main_progress->reposition_window(mwindow->theme->mstatus_progress_x, 
76                 mwindow->theme->mstatus_progress_y);
77         x += main_progress->get_w() + 5;
78         main_progress_cancel->reposition_window(mwindow->theme->mstatus_cancel_x, 
79                 mwindow->theme->mstatus_cancel_y);
80         flash();
83 void StatusBar::set_message(char *text)
85         status_text->update(text);
88 void StatusBar::default_message()
90         status_text->set_color(mwindow->theme->message_normal);
91         status_text->update(_("Welcome to Cinelerra."));
95 StatusBarCancel::StatusBarCancel(MWindow *mwindow, int x, int y)
96  : BC_Button(x, y, mwindow->theme->statusbar_cancel_data)
98         this->mwindow = mwindow;
99         set_tooltip(_("Cancel operation"));
101 int StatusBarCancel::handle_event()
103         mwindow->mainprogress->cancelled = 1;
104         return 1;