X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fcwindowgui.C;h=b387bfe19a9e0ec146688b60be2e893f622de4f9;hp=1c56a6d641e3b70f3f737906fe8c6d794d4a7884;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hpb=243336668c89096732786c6b3f3c5918aa2eff26 diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 1c56a6d6..b387bfe1 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -219,14 +219,7 @@ void CWindowGUI::create_objects() tool_panel = new CWindowTool(mwindow, this); tool_panel->Thread::start(); - set_operation(mwindow->edl->session->cwindow_operation); - - - - canvas->draw_refresh(0); - - draw_status(0); unlock_window(); } @@ -296,6 +289,32 @@ int CWindowGUI::resize_event(int w, int h) int CWindowGUI::button_press_event() { + if( current_operation == CWINDOW_NONE && + mwindow->edl != 0 && canvas->get_canvas() && + mwindow->edl->session->cwindow_click2play && + canvas->get_canvas()->get_cursor_over_window() ) { + switch( get_buttonpress() ) { + case LEFT_BUTTON: + if( !cwindow->playback_engine->is_playing_back ) { + double length = mwindow->edl->tracks->total_playable_length(); + double position = cwindow->playback_engine->get_tracking_position(); + if( position >= length ) transport->goto_start(); + } + return transport->forward_play->handle_event(); + case MIDDLE_BUTTON: + if( !cwindow->playback_engine->is_playing_back ) { + double position = cwindow->playback_engine->get_tracking_position(); + if( position <= 0 ) transport->goto_end(); + } + return transport->reverse_play->handle_event(); + case RIGHT_BUTTON: // activates popup + break; + case WHEEL_UP: + return transport->frame_forward_play->handle_event(); + case WHEEL_DOWN: + return transport->frame_reverse_play->handle_event(); + } + } if(canvas->get_canvas()) return canvas->button_press_event_base(canvas->get_canvas()); return 0; @@ -399,15 +418,26 @@ void CWindowGUI::zoom_canvas(double value, int update_menu) canvas->draw_refresh(); } - - void CWindowGUI::set_operation(int value) { - mwindow->edl->session->cwindow_operation = value; + switch( value ) { + case CWINDOW_TOOL_WINDOW: + mwindow->edl->session->tool_window = !mwindow->edl->session->tool_window; + composite_panel->operation[CWINDOW_TOOL_WINDOW]->update(mwindow->edl->session->tool_window); + tool_panel->update_show_window(); + return; + case CWINDOW_TITLESAFE: + mwindow->edl->session->safe_regions = !mwindow->edl->session->safe_regions; + composite_panel->operation[CWINDOW_TITLESAFE]->update(mwindow->edl->session->safe_regions); + value = mwindow->edl->session->cwindow_operation; + break; + default: + mwindow->edl->session->cwindow_operation = value; + composite_panel->set_operation(value); + break; + } - composite_panel->set_operation(value); edit_panel->update(); - tool_panel->start_tool(value); canvas->draw_refresh(); } @@ -427,6 +457,7 @@ int CWindowGUI::close_event() int CWindowGUI::keypress_event() { int result = 0; + int cwindow_operation = CWINDOW_NONE; switch(get_keypress()) { @@ -473,61 +504,80 @@ int CWindowGUI::keypress_event() lock_window("CWindowGUI::keypress_event 4"); break; case LEFT: - if(!ctrl_down()) - { - if (alt_down()) - { - int shift_down = this->shift_down(); - unlock_window(); - mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0); - - mwindow->gui->lock_window("CWindowGUI::keypress_event 2"); + if( !ctrl_down() ) { + int alt_down = this->alt_down(); + int shift_down = this->shift_down(); + unlock_window(); + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 5"); + if( alt_down ) mwindow->prev_edit_handle(shift_down); - mwindow->gui->unlock_window(); - - lock_window("CWindowGUI::keypress_event 1"); - } else - { - unlock_window(); - - mwindow->gui->lock_window("CWindowGUI::keypress_event 3"); mwindow->move_left(); - mwindow->gui->unlock_window(); - - lock_window("CWindowGUI::keypress_event 2"); - } + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 6"); result = 1; } break; - case RIGHT: - if(!ctrl_down()) - { - if (alt_down()) - { - int shift_down = this->shift_down(); - unlock_window(); - mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0); - mwindow->gui->lock_window("CWindowGUI::keypress_event 2"); - mwindow->next_edit_handle(shift_down); - mwindow->gui->unlock_window(); + case ',': + if( !ctrl_down() && !alt_down() ) { + unlock_window(); + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 7"); + mwindow->move_left(); + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 8"); + result = 1; + } + break; - lock_window("CWindowGUI::keypress_event 2"); - } + case RIGHT: + if( !ctrl_down() ) { + int alt_down = this->alt_down(); + int shift_down = this->shift_down(); + unlock_window(); + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 8"); + if( alt_down ) + mwindow->next_edit_handle(shift_down); else - { - unlock_window(); - - mwindow->gui->lock_window("CWindowGUI::keypress_event 4"); mwindow->move_right(); - mwindow->gui->unlock_window(); + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 9"); + result = 1; + } + break; - lock_window("CWindowGUI::keypress_event 3"); - } + case '.': + if( !ctrl_down() && !alt_down() ) { + unlock_window(); + stop_transport(0); + mwindow->gui->lock_window("CWindowGUI::keypress_event 10"); + mwindow->move_right(); + mwindow->gui->unlock_window(); + lock_window("CWindowGUI::keypress_event 11"); result = 1; } break; + + case KEY_F1: cwindow_operation = CWINDOW_PROTECT; break; + case KEY_F2: cwindow_operation = CWINDOW_ZOOM; break; + case KEY_F3: cwindow_operation = CWINDOW_MASK; break; + case KEY_F4: cwindow_operation = CWINDOW_RULER; break; + case KEY_F5: cwindow_operation = CWINDOW_CAMERA; break; + case KEY_F6: cwindow_operation = CWINDOW_PROJECTOR; break; + case KEY_F7: cwindow_operation = CWINDOW_CROP; break; + case KEY_F8: cwindow_operation = CWINDOW_EYEDROP; break; + case KEY_F9: cwindow_operation = CWINDOW_TOOL_WINDOW; break; + case KEY_F10: cwindow_operation = CWINDOW_TITLESAFE; break; + case KEY_F11: canvas->reset_camera(); break; + case KEY_F12: canvas->reset_projector(); break; + } + + if( cwindow_operation >= 0 ) { + set_operation(cwindow_operation); + result = 1; } if(!result) result = transport->keypress_event(); @@ -676,30 +726,36 @@ void CWindowGUI::update_meters() } } +void CWindowGUI::stop_transport(const char *lock_msg) +{ + if( lock_msg ) unlock_window(); + mwindow->stop_transport(); + if( lock_msg ) lock_window(lock_msg); +} + CWindowEditing::CWindowEditing(MWindow *mwindow, CWindow *cwindow) - : EditPanel(mwindow, - cwindow->gui, - mwindow->theme->cedit_x, - mwindow->theme->cedit_y, + : EditPanel(mwindow, cwindow->gui, CWINDOW_ID, + mwindow->theme->cedit_x, mwindow->theme->cedit_y, mwindow->edl->session->editing_mode, - 0, - 1, - 0, - 0, - 1, - 1, - 1, - 1, - 1, - 0, + 0, // use_editing_mode + 1, // use_keyframe + 0, // use_splice + 0, // use_overwrite + 1, // use_lift + 1, // use_extract + 1, // use_copy + 1, // use_paste + 1, // use_undo + 0, // use_fit 0, // locklabels - 1, - 1, - 1, - 0, - 1, - 0) + 1, // use_labels + 1, // use_toclip + 1, // use_meters + 1, // use_cut + 0, // use_commerical + 0, // use_goto + 1) // use_clk2play { this->mwindow = mwindow; this->cwindow = cwindow; @@ -718,14 +774,20 @@ CWrapper(set_inpoint) CWrapper(set_outpoint) CWrapper(unset_inoutpoint) CWrapper(toggle_label) -CWrapper(prev_label) -CWrapper(next_label) -CWrapper(prev_edit) -CWrapper(next_edit) + +#define CWrapper_cut(fn) void CWindowEditing::fn(int cut) { \ + mwindow->gui->lock_window("CWrapper::" #fn); \ + EditPanel::fn(cut); \ + mwindow->gui->unlock_window(); \ +} +CWrapper_cut(prev_label) +CWrapper_cut(next_label) +CWrapper_cut(prev_edit) +CWrapper_cut(next_edit) void CWindowEditing::to_clip() { - mwindow->to_clip(mwindow->edl, _("composer window: ")); + mwindow->to_clip(mwindow->edl, _("composer window: "), 0); } @@ -3204,7 +3266,8 @@ int CWindowCanvas::button_press_event() gui->y_offset = get_y_offset(mwindow->edl, 0, zoom_y, conformed_w, conformed_h); // Scroll view - if(get_buttonpress() == 2) + if( mwindow->edl->session->cwindow_operation != CWINDOW_PROTECT && + get_buttonpress() == 2 ) { gui->current_operation = CWINDOW_SCROLL; result = 1;