X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindowgui.C;h=8825e25d7e680b4167f85f064642273518710c39;hp=91bc6b8d61eb2ccb650ef60134a72365620363a2;hb=0513350234a8dcd08e5a0117d5121724ef7b76b6;hpb=c88e3df2c765bfff605a98f1feed145af81ca238 diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 91bc6b8d..8825e25d 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -120,6 +120,7 @@ MWindowGUI::MWindowGUI(MWindow *mwindow) plugin_menu = 0; keyframe_menu = 0; keyframe_hide = 0; + keyvalue_popup = 0; transition_menu = 0; remote_control = 0; cwindow_remote_handler = 0; @@ -134,6 +135,7 @@ MWindowGUI::~MWindowGUI() delete cwindow_remote_handler; delete record_remote_handler; delete remote_control; + delete keyvalue_popup; // delete samplescroll; // delete trackscroll; for(int i = 0; i < TOTAL_PANES; i++) @@ -318,12 +320,8 @@ void MWindowGUI::create_objects() if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__); add_subwindow(mainclock = new MainClock(mwindow, - mwindow->theme->mclock_x, - mwindow->theme->mclock_y, + mwindow->theme->mclock_x, mwindow->theme->mclock_y, mwindow->theme->mclock_w)); - mainclock->set_position_offset( (double) - (mwindow->edl->session->get_frame_offset() / - mwindow->edl->session->frame_rate)); if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__); mainclock->update(0); @@ -403,11 +401,12 @@ int MWindowGUI::resize_event(int w, int h) int x = w - MainShBtns::calculate_w(0); mainmenu->resize_event(x, mainmenu->get_h()); mainshbtns->reposition_window(x, -1); + ffmpeg_toggle->reposition_window(menu_w(), menu_h()+2); mwindow->theme->get_mwindow_sizes(this, w, h); mwindow->theme->draw_mwindow_bg(this); mbuttons->resize_event(); - ffmpeg_toggle->reposition_window(menu_w(), menu_h()+2); statusbar->resize_event(); + zoombar->resize_event(); resource_thread->stop_draw(1); @@ -527,17 +526,12 @@ int MWindowGUI::resize_event(int w, int h) pane[BOTTOM_RIGHT_PANE]->y); } - resource_thread->start_draw(); - update_pane_dividers(); - zoombar->resize_event(); pane_button->reposition_window(w - mwindow->theme->get_image_set("pane")[0]->get_w(), mwindow->theme->mzoom_y + 1 - mwindow->theme->get_image_set("pane")[0]->get_h()); -// get_scrollbars(0); -// canvas->resize_event(); -//printf("MWindowGUI::resize_event %d\n", __LINE__); -// required to get new widgets to appear after a pane deletion - show_window(); + resource_thread->start_draw(); + + flash(1); return 0; } @@ -920,16 +914,25 @@ int MWindowGUI::visible(int64_t x1, int64_t x2, int64_t view_x1, int64_t view_x2 } -int MWindowGUI::show_message(char *message, int color) +void MWindowGUI::show_message(const char *message, int color) { -// printf("MWindowGUI::show_message %d: %s 0x%08x 0x%08x\n", -// __LINE__, message, color, mwindow->theme->message_normal); - if(color < 0) color = mwindow->theme->message_normal; - statusbar->status_text->set_color(color); - statusbar->status_text->update(message); - return 0; + statusbar->show_message(message, color); } +void MWindowGUI::update_default_message() +{ + statusbar->update_default_message(); +} + +void MWindowGUI::reset_default_message() +{ + statusbar->reset_default_message(); +} + +void MWindowGUI::default_message() +{ + statusbar->default_message(); +} // Drag motion called from other window int MWindowGUI::drag_motion() @@ -1059,7 +1062,8 @@ void MWindowGUI::default_positions() { //printf("MWindowGUI::default_positions 1\n"); VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ? - mwindow->vwindows.get(0) : 0; + mwindow->vwindows.get(DEFAULT_VWINDOW) : 0; + if( vwindow && !vwindow->is_running() ) vwindow = 0; if( vwindow ) vwindow->gui->lock_window("MWindowGUI::default_positions"); mwindow->cwindow->gui->lock_window("MWindowGUI::default_positions"); mwindow->awindow->gui->lock_window("MWindowGUI::default_positions"); @@ -1112,19 +1116,13 @@ void MWindowGUI::default_positions() } - - - - - - - - - - - - - +int MWindowGUI::button_release_event() +{ + if( keyvalue_popup ) { + delete keyvalue_popup; keyvalue_popup = 0; + } + return 0; +} int MWindowGUI::repeat_event(int64_t duration) @@ -1161,243 +1159,129 @@ 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 key_listener(wp->get_keypress()); @@ -1414,7 +1298,7 @@ int MWindowGUI::key_listener(int key) record->record_gui->interrupt_thread->start(0); break; case KPHAND: - mwindow->quit(0); + mwindow->quit(); break; #ifdef HAVE_DVB case KPBOOK: @@ -2119,7 +2003,7 @@ void MWindowGUI::load_panes() cursor_y, mwindow->theme->mcanvas_x + mwindow->theme->mcanvas_w - - cursor_x, + cursor_x - mwindow->theme->pane_w, mwindow->theme->mcanvas_h - cursor_y); pane[TOP_RIGHT_PANE]->create_objects(); @@ -2150,7 +2034,7 @@ void MWindowGUI::load_panes() cursor_y, mwindow->theme->mcanvas_x + mwindow->theme->mcanvas_w - - cursor_x, + cursor_x - mwindow->theme->pane_w, mwindow->theme->mcanvas_h - cursor_y); pane[BOTTOM_RIGHT_PANE]->resize_event( @@ -2352,6 +2236,23 @@ void MWindowGUI::draw_trackmovement() } +void MWindowGUI::update_mixers(Track *track, int v) +{ + for( int i=0; ipatchbay; + if( !patchbay ) continue; + for( int j=0; jpatches.total; ++j ) { + PatchGUI *patchgui = patchbay->patches.values[j]; + if( !patchgui->mix ) continue; + if( !track || patchgui->track == track ) { + patchgui->mix->update(v>=0 ? v : + mwindow->mixer_track_active(patchgui->track)); + } + } + } +} + PaneButton::PaneButton(MWindow *mwindow, int x, int y) : BC_Button(x, y, mwindow->theme->get_image_set("pane")) { @@ -2387,19 +2288,18 @@ int PaneButton::cursor_motion_event() int PaneButton::button_release_event() { mwindow->gui->stop_pane_drag(); - int result = BC_Button::button_release_event(); return result; } FFMpegToggle::FFMpegToggle(MWindow *mwindow, MButtons *mbuttons, int x, int y) - : BC_Toggle(x, y, mwindow->theme->ffmpeg_toggle, mwindow->preferences->ffmpeg_early_probe) + : BC_Toggle(x, y, mwindow->theme->ffmpeg_toggle, + mwindow->preferences->get_file_probe_armed("FFMPEG_Early") > 0 ? 1 : 0) { this->mwindow = mwindow; this->mbuttons = mbuttons; - set_tooltip( mwindow->preferences->ffmpeg_early_probe ? - _("Try FFMpeg first") : _("Try FFMpeg last")); + set_tooltip(get_value() ? FFMPEG_EARLY_TIP : FFMPEG_LATE_TIP); } FFMpegToggle::~FFMpegToggle() @@ -2408,9 +2308,11 @@ FFMpegToggle::~FFMpegToggle() int FFMpegToggle::handle_event() { - mwindow->preferences->ffmpeg_early_probe = get_value(); - set_tooltip( mwindow->preferences->ffmpeg_early_probe ? - _("Try FFMpeg first") : _("Try FFMpeg last")); + int ffmpeg_early_probe = get_value(); + set_tooltip(ffmpeg_early_probe ? FFMPEG_EARLY_TIP : FFMPEG_LATE_TIP); + mwindow->preferences->set_file_probe_armed("FFMPEG_Early", ffmpeg_early_probe); + mwindow->preferences->set_file_probe_armed("FFMPEG_Late", !ffmpeg_early_probe); + mwindow->show_warning(&mwindow->preferences->warn_indexes, _("Changing the base codecs may require rebuilding indexes.")); return 1;