00001 #include "ctimebar.h"
00002 #include "cwindow.h"
00003 #include "cwindowgui.h"
00004 #include "edl.h"
00005 #include "localsession.h"
00006 #include "maincursor.h"
00007 #include "mbuttons.h"
00008 #include "mwindow.h"
00009 #include "mwindowgui.h"
00010 #include "theme.h"
00011
00012
00013 CTimeBar::CTimeBar(MWindow *mwindow,
00014 CWindowGUI *gui,
00015 int x,
00016 int y,
00017 int w,
00018 int h)
00019 : TimeBar(mwindow,
00020 gui,
00021 x,
00022 y,
00023 w,
00024 h)
00025 {
00026 this->mwindow = mwindow;
00027 this->gui = gui;
00028 }
00029
00030 int CTimeBar::resize_event()
00031 {
00032 reposition_window(mwindow->theme->ctimebar_x,
00033 mwindow->theme->ctimebar_y,
00034 mwindow->theme->ctimebar_w,
00035 mwindow->theme->ctimebar_h);
00036 update();
00037 return 1;
00038 }
00039
00040
00041 EDL* CTimeBar::get_edl()
00042 {
00043 return mwindow->edl;
00044 }
00045
00046 void CTimeBar::draw_time()
00047 {
00048 get_edl_length();
00049 draw_range();
00050 }
00051
00052
00053 void CTimeBar::update_preview()
00054 {
00055 gui->slider->set_position();
00056 }
00057
00058
00059 void CTimeBar::select_label(double position)
00060 {
00061 EDL *edl = mwindow->edl;
00062
00063 gui->unlock_window();
00064 mwindow->gui->mbuttons->transport->handle_transport(STOP, 1);
00065 gui->lock_window();
00066
00067 position = mwindow->edl->align_to_frame(position, 1);
00068
00069 if(shift_down())
00070 {
00071 if(position > edl->local_session->get_selectionend(1) / 2 +
00072 edl->local_session->get_selectionstart(1) / 2)
00073 {
00074
00075 edl->local_session->set_selectionend(position);
00076 }
00077 else
00078 {
00079 edl->local_session->set_selectionstart(position);
00080 }
00081 }
00082 else
00083 {
00084 edl->local_session->set_selectionstart(position);
00085 edl->local_session->set_selectionend(position);
00086 }
00087
00088
00089 mwindow->cwindow->update(1, 0, 0, 0, 1);
00090
00091
00092
00093 mwindow->gui->lock_window();
00094 mwindow->gui->cursor->hide();
00095 mwindow->gui->cursor->draw();
00096 mwindow->gui->update(0,
00097 1,
00098 1,
00099 0,
00100 1,
00101 1,
00102 0);
00103 mwindow->gui->unlock_window();
00104
00105 }
00106
00107
00108
00109
00110