00001 #include "edl.h"
00002 #include "localsession.h"
00003 #include "mwindow.h"
00004 #include "theme.h"
00005 #include "vtimebar.h"
00006 #include "vwindow.h"
00007 #include "vwindowgui.h"
00008
00009
00010 VTimeBar::VTimeBar(MWindow *mwindow,
00011 VWindowGUI *gui,
00012 int x,
00013 int y,
00014 int w,
00015 int h)
00016 : TimeBar(mwindow,
00017 gui,
00018 x,
00019 y,
00020 w,
00021 h)
00022 {
00023 this->mwindow = mwindow;
00024 this->gui = gui;
00025 }
00026
00027 int VTimeBar::resize_event()
00028 {
00029 reposition_window(mwindow->theme->vtimebar_x,
00030 mwindow->theme->vtimebar_y,
00031 mwindow->theme->vtimebar_w,
00032 mwindow->theme->vtimebar_h);
00033 update();
00034 return 1;
00035 }
00036
00037 EDL* VTimeBar::get_edl()
00038 {
00039 return gui->vwindow->get_edl();
00040 }
00041
00042 void VTimeBar::draw_time()
00043 {
00044 draw_range();
00045 }
00046
00047 void VTimeBar::update_preview()
00048 {
00049 gui->slider->set_position();
00050 }
00051
00052
00053 void VTimeBar::select_label(double position)
00054 {
00055 EDL *edl = get_edl();
00056
00057 if(edl)
00058 {
00059 unlock_window();
00060 gui->transport->handle_transport(STOP, 1);
00061 lock_window();
00062
00063 position = mwindow->edl->align_to_frame(position, 1);
00064
00065 if(shift_down())
00066 {
00067 if(position > edl->local_session->get_selectionend(1) / 2 +
00068 edl->local_session->get_selectionstart(1) / 2)
00069 {
00070
00071 edl->local_session->set_selectionend(position);
00072 }
00073 else
00074 {
00075 edl->local_session->set_selectionstart(position);
00076 }
00077 }
00078 else
00079 {
00080 edl->local_session->set_selectionstart(position);
00081 edl->local_session->set_selectionend(position);
00082 }
00083
00084
00085 mwindow->vwindow->update_position(CHANGE_NONE,
00086 0,
00087 1);
00088 update();
00089 }
00090 }
00091
00092
00093