repeat play, in/out <> shortcuts, append to proj wording, cleanup
[goodguy/history.git] / cinelerra-5.1 / cinelerra / vwindowgui.C
index 0c4621e2bb2f3e096dda7ae4364d708177b32c9a..4458eb764c80ba1bf608fd1e25f80f5284a1c9c4 100644 (file)
@@ -104,6 +104,7 @@ void VWindowGUI::change_source(EDL *edl, const char *title)
                sprintf(string, _(PROGRAM_NAME ": Viewer"));
 
        lock_window("VWindowGUI::change_source");
                sprintf(string, _(PROGRAM_NAME ": Viewer"));
 
        lock_window("VWindowGUI::change_source");
+       canvas->clear();
        timebar->update(0);
        set_title(string);
        unlock_window();
        timebar->update(0);
        set_title(string);
        unlock_window();
@@ -351,8 +352,27 @@ int VWindowGUI::keypress_event()
        return result;
 }
 
        return result;
 }
 
+void VWindowGUI::stop_transport(const char *lock_msg)
+{
+       if( !transport->is_stopped() ) {
+               if( lock_msg ) unlock_window();
+               transport->handle_transport(STOP, 1, 0, 0);
+               if( lock_msg ) lock_window(lock_msg);
+       }
+}
+
 int VWindowGUI::button_press_event()
 {
 int VWindowGUI::button_press_event()
 {
+       if( get_buttonpress() == LEFT_BUTTON && canvas->get_canvas() &&
+           canvas->get_canvas()->get_cursor_over_window() ) {
+               PlaybackEngine *playback_engine = vwindow->playback_engine;
+               if( !playback_engine->is_playing_back && vwindow->get_edl() != 0 ) {
+                       double length = vwindow->get_edl()->tracks->total_playable_length();
+                       double position = playback_engine->get_tracking_position();
+                       if( position >= length ) transport->goto_start();
+               }
+               return transport->forward_play->handle_event();
+       }
        if(canvas->get_canvas())
                return canvas->button_press_event_base(canvas->get_canvas());
        return 0;
        if(canvas->get_canvas())
                return canvas->button_press_event_base(canvas->get_canvas());
        return 0;
@@ -410,6 +430,7 @@ int VWindowGUI::drag_stop()
        {
                highlighted = 0;
                canvas->draw_refresh();
        {
                highlighted = 0;
                canvas->draw_refresh();
+               unlock_window();
 
                Indexable *indexable = mwindow->session->drag_assets->size() ?
                        mwindow->session->drag_assets->get(0) :
 
                Indexable *indexable = mwindow->session->drag_assets->size() ?
                        mwindow->session->drag_assets->get(0) :
@@ -417,12 +438,12 @@ int VWindowGUI::drag_stop()
                EDL *edl = mwindow->session->drag_clips->size() ?
                        mwindow->session->drag_clips->get(0) :
                        0;
                EDL *edl = mwindow->session->drag_clips->size() ?
                        mwindow->session->drag_clips->get(0) :
                        0;
-
                if(indexable)
                        vwindow->change_source(indexable);
                else
                if(edl)
                        vwindow->change_source(edl);
                if(indexable)
                        vwindow->change_source(indexable);
                else
                if(edl)
                        vwindow->change_source(edl);
+               lock_window("VWindowGUI::drag_stop");
                return 1;
        }
 
                return 1;
        }
 
@@ -614,8 +635,7 @@ void VWindowEditing::next_label()
 double VWindowEditing::get_position()
 {
        EDL *edl = vwindow->get_edl();
 double VWindowEditing::get_position()
 {
        EDL *edl = vwindow->get_edl();
-       double position = !edl ? 0 : edl->local_session->get_selectionstart(1) +
-                       edl->session->get_frame_offset() / edl->session->frame_rate;
+       double position = !edl ? 0 : edl->local_session->get_selectionstart(1);
        return position;
 }
 
        return position;
 }
 
@@ -624,7 +644,6 @@ void VWindowEditing::set_position(double position)
        EDL *edl = vwindow->get_edl();
        if( !edl ) return;
        if( get_position() != position ) {
        EDL *edl = vwindow->get_edl();
        if( !edl ) return;
        if( get_position() != position ) {
-               position -= edl->session->get_frame_offset() / edl->session->frame_rate;
                if( position < 0 ) position = 0;
                edl->local_session->set_selectionstart(position);
                edl->local_session->set_selectionend(position);
                if( position < 0 ) position = 0;
                edl->local_session->set_selectionstart(position);
                edl->local_session->set_selectionend(position);
@@ -642,15 +661,11 @@ void VWindowEditing::set_outpoint()
        vwindow->set_outpoint();
 }
 
        vwindow->set_outpoint();
 }
 
-void VWindowEditing::clear_inpoint()
+void VWindowEditing::unset_inoutpoint()
 {
 {
-       vwindow->clear_inpoint();
+       vwindow->unset_inoutpoint();
 }
 
 }
 
-void VWindowEditing::clear_outpoint()
-{
-       vwindow->clear_outpoint();
-}
 
 void VWindowEditing::to_clip()
 {
 
 void VWindowEditing::to_clip()
 {
@@ -881,7 +896,7 @@ void VWindowGUI::update_points()
 
 //printf("VWindowGUI::update_points 2\n");
        long pixel = (long)((double)edl->local_session->in_point /
 
 //printf("VWindowGUI::update_points 2\n");
        long pixel = (long)((double)edl->local_session->in_point /
-               edl->tracks->total_playable_length() *
+               edl->tracks->total_length() *
                (mwindow->theme->vtimebar_w -
                        2 *
                        mwindow->theme->in_point[0]->get_w())) +
                (mwindow->theme->vtimebar_w -
                        2 *
                        mwindow->theme->in_point[0]->get_w())) +
@@ -933,7 +948,7 @@ void VWindowGUI::update_points()
 //printf("VWindowGUI::update_points 10\n");
 
        pixel = (long)((double)edl->local_session->out_point /
 //printf("VWindowGUI::update_points 10\n");
 
        pixel = (long)((double)edl->local_session->out_point /
-               (edl->tracks->total_playable_length() + 0.5) *
+               (edl->tracks->total_length() + 0.5) *
                (mwindow->theme->vtimebar_w -
                        2 *
                        mwindow->theme->in_point[0]->get_w())) +
                (mwindow->theme->vtimebar_w -
                        2 *
                        mwindow->theme->in_point[0]->get_w())) +