X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindowgui.C;h=6e72494ace07c5326e7a64e5d600cb86e044753f;hb=a5f3544d96519b0655e78d2013f3ce157d92f91e;hp=43b3a1c76346e9e8737c97d5c669577cc5bd4930;hpb=b0adaf11e855fd84af935d879848467a957d6c67;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 43b3a1c7..6e72494a 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -143,7 +143,9 @@ MWindowGUI::~MWindowGUI() delete resource_thread; resource_pixmaps.remove_all_objects(); delete swindow; +#ifdef HAVE_DVB delete channel_info; +#endif delete db_window; delete x_divider; delete y_divider; @@ -353,7 +355,9 @@ void MWindowGUI::create_objects() add_subwindow(transition_menu = new TransitionPopup(mwindow, this)); transition_menu->create_objects(); +#ifdef HAVE_DVB channel_info = new ChannelInfo(mwindow); +#endif db_window = new DbWindow(mwindow); swindow = new SWindow(mwindow); @@ -1014,7 +1018,7 @@ int MWindowGUI::drag_stop() if(pane[i]) result |= pane[i]->canvas->drag_stop( &redraw); } - + mwindow->edl->optimize(); // since we don't have subwindows we have to terminate any drag operation if(result) @@ -1157,249 +1161,136 @@ int MWindowGUI::save_defaults(BC_Hash *defaults) int MWindowGUI::keypress_event() { //printf("MWindowGUI::keypress_event 1 %d\n", get_keypress()); - int result = 0; - result = mbuttons->keypress_event(); + int result = mbuttons->keypress_event(); + if( result ) return result; - if(!result) - { - switch(get_keypress()) - { - case 'e': - mwindow->toggle_editing_mode(); - result = 1; - break; - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': - if( !alt_down() || shift_down() ) break; - if( !mwindow->select_asset(get_keypress()-'1',1) ) - result = 1; - break; - case LEFT: - if(!ctrl_down()) - { - if (alt_down()) - { - unlock_window(); - mbuttons->transport->handle_transport(STOP, 1, 0, 0); - lock_window("MWindowGUI::keypress_event 1"); - mwindow->prev_edit_handle(shift_down()); - } - else - mwindow->move_left(); - result = 1; - } - break; - case RIGHT: - if(!ctrl_down()) - { - if (alt_down()) - { - unlock_window(); - mbuttons->transport->handle_transport(STOP, 1, 0, 0); - lock_window("MWindowGUI::keypress_event 2"); - mwindow->next_edit_handle(shift_down()); - } - else - mwindow->move_right(); - result = 1; - } - break; - - case UP: - if(ctrl_down() && !alt_down()) - { - mwindow->expand_y(); - result = 1; - } - else - if(!ctrl_down() && alt_down()) - { - mwindow->expand_autos(0,1,1); - result = 1; - } - else - if(ctrl_down() && alt_down()) - { - mwindow->expand_autos(1,1,1); - result = 1; - } - else - { - mwindow->expand_sample(); - result = 1; - } - break; - - case DOWN: - if(ctrl_down() && !alt_down()) - { - mwindow->zoom_in_y(); - result = 1; - } - else - if(!ctrl_down() && alt_down()) - { - mwindow->shrink_autos(0,1,1); - result = 1; - } - else - if(ctrl_down() && alt_down()) - { - mwindow->shrink_autos(1,1,1); - result = 1; - } - else - { - mwindow->zoom_in_sample(); - result = 1; - } - break; - - case PGUP: - if(!ctrl_down()) - { - mwindow->move_up(); - result = 1; - } - else - { - mwindow->expand_t(); - result = 1; - } - break; - - case PGDN: - if(!ctrl_down()) - { - mwindow->move_down(); - result = 1; - } - else - { - mwindow->zoom_in_t(); - result = 1; - } - break; - -// case TAB: -// case LEFTTAB: -// //int cursor_x = 0; -// int cursor_y = 0; -// for(int i = 0; i < TOTAL_PANES; i++) -// { -// if(pane[i]) -// { -// //cursor_x = pane[i]->canvas->get_relative_cursor_x(); -// cursor_y = pane[i]->canvas->get_relative_cursor_y(); -// } -// } -// -// -// if(get_keypress() == TAB) -// { -// // Switch the record button -// for(Track *track = mwindow->edl->tracks->first; track; track = track->next) -// { -// int64_t track_x, track_y, track_w, track_h; -// canvas->track_dimensions(track, track_x, track_y, track_w, track_h); -// -// if(cursor_y >= track_y && -// cursor_y < track_y + track_h) -// { -// if (track->record) -// track->record = 0; -// else -// track->record = 1; -// result = 1; -// break; -// } -// } -// } -// else -// { -// Track *this_track = 0; -// for(Track *track = mwindow->edl->tracks->first; track; track = track->next) -// { -// int64_t track_x, track_y, track_w, track_h; -// canvas->track_dimensions(track, track_x, track_y, track_w, track_h); -// -// if(cursor_y >= track_y && -// cursor_y < track_y + track_h) -// { -// // This is our track -// this_track = track; -// break; -// } -// } -// -// int total_selected = mwindow->edl->tracks->total_of(Tracks::RECORD); -// -// // nothing previously selected -// if(total_selected == 0) -// { -// mwindow->edl->tracks->select_all(Tracks::RECORD, -// 1); -// } -// else -// if(total_selected == 1) -// { -// // this patch was previously the only one on -// if(this_track && this_track->record) -// { -// mwindow->edl->tracks->select_all(Tracks::RECORD, -// 1); -// } -// // another patch was previously the only one on -// else -// { -// mwindow->edl->tracks->select_all(Tracks::RECORD, -// 0); -// if (this_track) -// this_track->record = 1; -// -// } -// } -// else -// if(total_selected > 1) -// { -// mwindow->edl->tracks->select_all(Tracks::RECORD, -// 0); -// if (this_track) -// this_track->record = 1; -// } -// -// } -// -// update (0, -// 1, -// 0, -// 0, -// 1, -// 0, -// 1); -// unlock_window(); -// mwindow->cwindow->update(0, 1, 1); -// lock_window("TrackCanvas::keypress_event 3"); -// -// result = 1; -// break; + switch(get_keypress()) { + case 'e': + mwindow->toggle_editing_mode(); + result = 1; + break; + + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': + if( !alt_down() || shift_down() ) break; + if( !mwindow->select_asset(get_keypress()-'1',1) ) + result = 1; + break; + + case LEFT: + if( !ctrl_down() ) { + if( alt_down() ) { + unlock_window(); + mbuttons->transport->handle_transport(STOP, 1, 0, 0); + lock_window("MWindowGUI::keypress_event 1"); + mwindow->prev_edit_handle(shift_down()); + } + else + mwindow->move_left(); + result = 1; } + break; -// since things under cursor have changed... - if(result) - cursor_motion_event(); + case RIGHT: + if( !ctrl_down() ) { + if( alt_down() ) { + unlock_window(); + mbuttons->transport->handle_transport(STOP, 1, 0, 0); + lock_window("MWindowGUI::keypress_event 2"); + mwindow->next_edit_handle(shift_down()); + } + else + mwindow->move_right(); + result = 1; + } + break; + + case UP: + if( ctrl_down() && !alt_down() ) + mwindow->expand_y(); + else if( !ctrl_down() && alt_down() ) + mwindow->expand_autos(0,1,1); + else if( ctrl_down() && alt_down() ) + mwindow->expand_autos(1,1,1); + else + mwindow->expand_sample(); + result = 1; + break; + + case DOWN: + if( ctrl_down() && !alt_down() ) + mwindow->zoom_in_y(); + else if( !ctrl_down() && alt_down() ) + mwindow->shrink_autos(0,1,1); + else if( ctrl_down() && alt_down() ) + mwindow->shrink_autos(1,1,1); + else + mwindow->zoom_in_sample(); + result = 1; + break; + + case PGUP: + if( !ctrl_down() ) + mwindow->move_up(); + else + mwindow->expand_t(); + result = 1; + break; + + case PGDN: + if( !ctrl_down() ) + mwindow->move_down(); + else + mwindow->zoom_in_t(); + result = 1; + break; + + case TAB: + case LEFTTAB: + Track *this_track = 0; + for( int i=0; iover_track()) != 0 ) break; + if( (this_track = pane[i]->over_patchbay()) != 0 ) break; + } + + if( get_keypress() == TAB ) { // Switch the record button + if( this_track ) + this_track->record = !this_track->record ? 1 : 0; + } + else { + int total_selected = mwindow->edl->tracks->total_of(Tracks::RECORD); + // all selected if nothing previously selected or + // if this patch was previously the only one selected and armed + int selected = !total_selected || (total_selected == 1 && + this_track && this_track->record ) ? 1 : 0; + mwindow->edl->tracks->select_all(Tracks::RECORD, selected); + if( !selected && this_track ) this_track->record = 1; + } + + update(0, 1, 0, 0, 1, 0, 1); + unlock_window(); + mwindow->cwindow->update(0, 1, 1); + lock_window("TrackCanvas::keypress_event 3"); + + result = 1; + break; } +// since things under cursor have changed... + if(result) + cursor_motion_event(); + return result; } int MWindowGUI::keyboard_listener(BC_WindowBase *wp) { - return keyboard_listener(wp->get_keypress()); + return key_listener(wp->get_keypress()); } -int MWindowGUI::keyboard_listener(int key) +int MWindowGUI::key_listener(int key) { int result = 1; switch( key ) { @@ -1412,9 +1303,11 @@ int MWindowGUI::keyboard_listener(int key) case KPHAND: mwindow->quit(0); break; +#ifdef HAVE_DVB case KPBOOK: channel_info->toggle_scan(); break; +#endif case KPMENU: if( !remote_control->deactivate() ) remote_control->activate();