X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fzoombar.C;h=51d0df733e3fab5ae79e61b4bac651af1939f811;hp=408473d6ec0167c6ca7d1a722ffbc245e5bc1fd3;hb=fb661e853152fd63537629a20f493a4cdcd4f019;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/zoombar.C b/cinelerra-5.1/cinelerra/zoombar.C index 408473d6..51d0df73 100644 --- a/cinelerra-5.1/cinelerra/zoombar.C +++ b/cinelerra-5.1/cinelerra/zoombar.C @@ -39,8 +39,6 @@ #include "zoombar.h" - - ZoomBar::ZoomBar(MWindow *mwindow, MWindowGUI *gui) : BC_SubWindow(mwindow->theme->mzoom_x, mwindow->theme->mzoom_y, @@ -49,7 +47,6 @@ ZoomBar::ZoomBar(MWindow *mwindow, MWindowGUI *gui) { this->gui = gui; this->mwindow = mwindow; - old_position = 0; } ZoomBar::~ZoomBar() @@ -107,14 +104,14 @@ void ZoomBar::create_objects() x += length_value->get_w() + 5; add_subwindow(to_value = new ToTextBox(mwindow, this, x, y)); x += to_value->get_w() + 5; + add_subwindow(title_alpha_bar = new TitleAlphaBar(mwindow, this, x, y)); + x += title_alpha_bar->get_w() + 5; + add_subwindow(title_alpha_text = new TitleAlphaText(mwindow, this, x, y)); update_formatting(from_value); update_formatting(length_value); update_formatting(to_value); - add_subwindow(playback_value = new BC_Title(x, 100, "--", MEDIUMFONT, RED)); - - add_subwindow(zoom_value = new BC_Title(x, 100, "--", MEDIUMFONT, BLACK)); update(); } @@ -151,9 +148,22 @@ int ZoomBar::draw() } void ZoomBar::update_autozoom() +{ + update_autozoom(mwindow->edl->local_session->zoombar_showautocolor); +} + +void ZoomBar::update_autozoom(int grouptype, int color) +{ + mwindow->edl->local_session->zoombar_showautotype = grouptype; + update_autozoom(color); +} + +void ZoomBar::update_autozoom(int color) { char string[BCTEXTLEN]; int autogroup_type = mwindow->edl->local_session->zoombar_showautotype; + mwindow->edl->local_session->zoombar_showautocolor = color; + if( color < 0 ) color = get_resources()->default_text_color; switch( autogroup_type ) { case AUTOGROUPTYPE_AUDIO_FADE: case AUTOGROUPTYPE_VIDEO_FADE: @@ -179,6 +189,7 @@ void ZoomBar::update_autozoom() auto_type->set_text(group_name); } + int ZoomBar::update() { sample_zoom->update(mwindow->edl->local_session->zoom_sample); @@ -198,19 +209,41 @@ int ZoomBar::update_clocks() return 0; } -int ZoomBar::update_playback(int64_t new_position) +TitleAlphaBar::TitleAlphaBar(MWindow *mwindow, ZoomBar *zoombar, int x, int y) + : BC_FSlider(x, y, 0, 150, 200, 0, 1.0, mwindow->session->title_bar_alpha, 0) { - if(new_position != old_position) - { - Units::totext(string, new_position, - mwindow->edl->session->sample_rate, - mwindow->edl->session->time_format, - mwindow->edl->session->frame_rate, - mwindow->edl->session->frames_per_foot); - playback_value->update(string); - old_position = new_position; - } - return 0; + this->mwindow = mwindow; + this->zoombar = zoombar; + set_precision(0.01); + enable_show_value(0); +} + +int TitleAlphaBar::handle_event() +{ + float v = get_value(); + mwindow->session->title_bar_alpha = v; + zoombar->title_alpha_text->update(v); + mwindow->gui->draw_trackmovement(); + mwindow->gui->flush(); + return 1; +} + +TitleAlphaText::TitleAlphaText(MWindow *mwindow, ZoomBar *zoombar, int x, int y) + : BC_TextBox(x, y, 48, 1, mwindow->session->title_bar_alpha, 0, MEDIUMFONT, 2) +{ + this->mwindow = mwindow; + this->zoombar = zoombar; + set_tooltip(_("Title Alpha")); +} + +int TitleAlphaText::handle_event() +{ + float v = atof(get_text()); + mwindow->session->title_bar_alpha = v; + zoombar->title_alpha_bar->update(v); + mwindow->gui->draw_trackmovement(); + mwindow->gui->flush(); + return 1; } int ZoomBar::resize_event(int w, int h) @@ -328,7 +361,7 @@ int ZoomBar::set_selection(int which_one) SampleZoomPanel::SampleZoomPanel(MWindow *mwindow, ZoomBar *zoombar, int x, int y) : ZoomPanel(mwindow, zoombar, mwindow->edl->local_session->zoom_sample, - x, y, 110, MIN_ZOOM_TIME, MAX_ZOOM_TIME, ZOOM_TIME) + x, y, 130, MIN_ZOOM_TIME, MAX_ZOOM_TIME, ZOOM_TIME) { this->mwindow = mwindow; this->zoombar = zoombar; @@ -342,7 +375,7 @@ int SampleZoomPanel::handle_event() AmpZoomPanel::AmpZoomPanel(MWindow *mwindow, ZoomBar *zoombar, int x, int y) : ZoomPanel(mwindow, zoombar, mwindow->edl->local_session->zoom_y, - x, y, 80, MIN_AMP_ZOOM, MAX_AMP_ZOOM, ZOOM_LONG) + x, y, 100, MIN_AMP_ZOOM, MAX_AMP_ZOOM, ZOOM_LONG) { this->mwindow = mwindow; this->zoombar = zoombar; @@ -355,7 +388,7 @@ int AmpZoomPanel::handle_event() TrackZoomPanel::TrackZoomPanel(MWindow *mwindow, ZoomBar *zoombar, int x, int y) : ZoomPanel(mwindow, zoombar, mwindow->edl->local_session->zoom_track, - x, y, 70, MIN_TRACK_ZOOM, MAX_TRACK_ZOOM, ZOOM_LONG) + x, y, 90, MIN_TRACK_ZOOM, MAX_TRACK_ZOOM, ZOOM_LONG) { this->mwindow = mwindow; this->zoombar = zoombar; @@ -407,7 +440,8 @@ int AutoZoom::handle_down_event() AutoTypeMenu::AutoTypeMenu(MWindow *mwindow, ZoomBar *zoombar, int x, int y, int wid) - : BC_PopupMenu(x, y, wid, to_text(mwindow->edl->local_session->zoombar_showautotype), 1) + : BC_PopupMenu(x, y, wid + 24, + to_text(mwindow->edl->local_session->zoombar_showautotype), 1, 0, 12) { this->mwindow = mwindow; this->zoombar = zoombar; @@ -448,6 +482,20 @@ int AutoTypeMenu::from_text(char *text) return AUTOGROUPTYPE_INT255; } +int AutoTypeMenu::draw_face(int dx, int color) +{ + BC_PopupMenu::draw_face(dx+8, color); + color = mwindow->edl->local_session->zoombar_showautocolor; + if( color >= 0 ) { + set_color(color); + int margin = get_margin(); + int mx = margin+8, my = 3*margin/8; + int bh = get_h() - 2*my; + draw_box(mx,my, bh,bh); + } + return 1; +} + int AutoTypeMenu::handle_event() { mwindow->edl->local_session->zoombar_showautotype = from_text(this->get_text());