00001 #include "mainprogress.h"
00002 #include "mwindow.h"
00003 #include "statusbar.h"
00004 #include "theme.h"
00005 #include "vframe.h"
00006
00007
00008 #include <libintl.h>
00009 #define _(String) gettext(String)
00010 #define gettext_noop(String) String
00011 #define N_(String) gettext_noop (String)
00012
00013
00014 StatusBar::StatusBar(MWindow *mwindow, MWindowGUI *gui)
00015 : BC_SubWindow(mwindow->theme->mstatus_x,
00016 mwindow->theme->mstatus_y,
00017 mwindow->theme->mstatus_w,
00018 mwindow->theme->mstatus_h)
00019 {
00020 this->mwindow = mwindow;
00021 this->gui = gui;
00022 }
00023
00024 StatusBar::~StatusBar()
00025 {
00026 }
00027
00028
00029
00030 int StatusBar::create_objects()
00031 {
00032
00033 int x = 10, y = 5;
00034
00035 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
00036 add_subwindow(status_text = new BC_Title(mwindow->theme->mstatus_message_x,
00037 mwindow->theme->mstatus_message_y,
00038 "",
00039 MEDIUMFONT,
00040 mwindow->theme->message_normal));
00041 x = get_w() - 290;
00042
00043 add_subwindow(main_progress =
00044 new BC_ProgressBar(mwindow->theme->mstatus_progress_x,
00045 mwindow->theme->mstatus_progress_y,
00046 mwindow->theme->mstatus_progress_w,
00047 mwindow->theme->mstatus_progress_w));
00048 x += main_progress->get_w() + 5;
00049
00050 add_subwindow(main_progress_cancel =
00051 new StatusBarCancel(mwindow,
00052 mwindow->theme->mstatus_cancel_x,
00053 mwindow->theme->mstatus_cancel_y));
00054
00055 default_message();
00056 flash();
00057
00058 return 0;
00059 }
00060
00061 void StatusBar::resize_event()
00062 {
00063 int x = 10, y = 1;
00064
00065
00066 reposition_window(mwindow->theme->mstatus_x,
00067 mwindow->theme->mstatus_y,
00068 mwindow->theme->mstatus_w,
00069 mwindow->theme->mstatus_h);
00070 draw_top_background(get_parent(), 0, 0, get_w(), get_h());
00071
00072 status_text->reposition_window(mwindow->theme->mstatus_message_x,
00073 mwindow->theme->mstatus_message_y);
00074 x = get_w() - 290;
00075 main_progress->reposition_window(mwindow->theme->mstatus_progress_x,
00076 mwindow->theme->mstatus_progress_y);
00077 x += main_progress->get_w() + 5;
00078 main_progress_cancel->reposition_window(mwindow->theme->mstatus_cancel_x,
00079 mwindow->theme->mstatus_cancel_y);
00080 flash();
00081 }
00082
00083 void StatusBar::set_message(char *text)
00084 {
00085 status_text->update(text);
00086 }
00087
00088 void StatusBar::default_message()
00089 {
00090 status_text->set_color(mwindow->theme->message_normal);
00091 status_text->update(_("Welcome to Cinelerra."));
00092 }
00093
00094
00095 StatusBarCancel::StatusBarCancel(MWindow *mwindow, int x, int y)
00096 : BC_Button(x, y, mwindow->theme->statusbar_cancel_data)
00097 {
00098 this->mwindow = mwindow;
00099 set_tooltip(_("Cancel operation"));
00100 }
00101 int StatusBarCancel::handle_event()
00102 {
00103 mwindow->mainprogress->cancelled = 1;
00104 return 1;
00105 }