X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fscopewindow.C;h=e1cfe335d254bbc4248b7adc063505360869c6d7;hp=283564bc6c4915a9a95320c7082dc820df8e565a;hb=HEAD;hpb=205a66f9f2abd6eac72076f773ce5d75921fa151 diff --git a/cinelerra-5.1/cinelerra/scopewindow.C b/cinelerra-5.1/cinelerra/scopewindow.C index 283564bc..e1cfe335 100644 --- a/cinelerra-5.1/cinelerra/scopewindow.C +++ b/cinelerra-5.1/cinelerra/scopewindow.C @@ -44,6 +44,7 @@ ScopeUnit::ScopeUnit(ScopeGUI *gui, this->gui = gui; } +#define SCOPE_SEARCHPATH "/scopes" #define incr_point(rows,h, iv,comp) { \ if(iy >= 0 && iy < h) { \ @@ -447,13 +448,14 @@ void ScopeGUI::reset() grat_image = 0; overlay = 0; grat_idx = 0; - vect_grats = 0; + settings = 0; output_frame = 0; data_frame = 0; frame_w = 1; use_smooth = 1; use_refresh = 0; + use_release = 0; use_wave_gain = 5; use_vect_gain = 5; use_hist = 0; @@ -488,16 +490,13 @@ void ScopeGUI::create_objects() lock_window("ScopeGUI::create_objects"); int margin = theme->widget_border; - int x = margin; - int y = margin; + int x = margin, y = margin; add_subwindow(scope_menu = new ScopeMenu(this, x, y)); scope_menu->create_objects(); int x1 = x + scope_menu->get_w() + 2*margin; - add_subwindow(smooth = new ScopeSmooth(this, x1, y)); - if( use_refresh >= 0 ) { - y += smooth->get_h() + margin; - add_subwindow(refresh = new ScopeRefresh(this, x, y)); - } + add_subwindow(settings = new ScopeSettings(this, x1, y)); + settings->create_objects(); + create_panels(); update_toggles(); show_window(); @@ -509,7 +508,6 @@ void ScopeGUI::create_panels() { calculate_sizes(get_w(), get_h()); int slider_w = xS(100); - int margin = theme->widget_border; if( (use_wave || use_wave_parade) ) { int px = wave_x + wave_w - slider_w - xS(5); int py = wave_y - ScopeGain::calculate_h() - yS(5); @@ -541,33 +539,17 @@ void ScopeGUI::create_panels() vectorscope->create_objects(); vect_slider = new ScopeVectSlider(this, vx, vy, slider_w); vect_slider->create_objects(); - if( use_vector < 0 ) { - vect_grats = new ScopeVectGrats(this, vx, 2*margin); - add_subwindow(vect_grats); - vect_grats->create_objects(); - } } else { vectorscope->reposition_window( vector_x, vector_y, vector_w, vector_h); vectorscope->clear_box(0, 0, vector_w, vector_h); vect_slider->reposition_window(vx, vy); - if( use_vector > 0 ) { - delete vect_grats; vect_grats = 0; - } - else if( !vect_grats ) { - vect_grats = new ScopeVectGrats(this, vx, 2*margin); - add_subwindow(vect_grats); - vect_grats->create_objects(); - } - else - vect_grats->reposition_window(vx, 2*margin); } } else if( !use_vector && vectorscope ) { delete vectorscope; vectorscope = 0; delete vect_slider; vect_slider = 0; - delete vect_grats; vect_grats = 0; } if( (use_hist || use_hist_parade) ) { @@ -616,7 +598,7 @@ void ScopeGUI::toggle_event() void ScopeGUI::calculate_sizes(int w, int h) { int margin = theme->widget_border; - int menu_h = smooth->get_h() + scope_menu->get_h() + margin * 3; + int menu_h = scope_menu->get_h() + ScopeGain::calculate_h() + margin * 3; int text_w = get_text_width(SMALLFONT, "000") + margin * 2; int total_panels = ((use_hist || use_hist_parade) ? 1 : 0) + ((use_wave || use_wave_parade) ? 1 : 0) + @@ -714,8 +696,6 @@ int ScopeGUI::resize_event(int w, int h) int vx = vector_x + vector_w - vect_slider->get_w() - margin; int vy = vector_y - vect_slider->get_h() - margin; vect_slider->reposition_window(vx, vy); - if( vect_grats ) - vect_grats->reposition_window(vx, 2*margin); } allocate_vframes(); @@ -774,6 +754,32 @@ void ScopeGUI::draw_overlays(int overlays, int borders, int flush) waveform->draw_line(0, y, wave_w, y); waveform->draw_rectangle(0, 0, wave_w, wave_h); } + + int y1 = wave_h * 1.8 / WAVEFORM_DIVISIONS; + int text_y1 = y1 + wave_y + get_text_ascent(SMALLFONT) / 2; + CLAMP(text_y1, waveform->get_y() + get_text_ascent(SMALLFONT), waveform->get_y() + waveform->get_h() - 1); + char string1[BCTEXTLEN]; + sprintf( string1, "%d",(int)lround((FLOAT_MAX - + 1.8 * (FLOAT_MAX - FLOAT_MIN ) / WAVEFORM_DIVISIONS ) * 100) ); + int text_x1 = wave_x + get_text_width(SMALLFONT, string1) - margin +wave_w; + set_color(text_color); + draw_text(text_x1, text_y1, string1); + CLAMP(y1, 0, waveform->get_h() - 1); + set_color(dark_color); + waveform->draw_line(0, y1, wave_w, y1); + + int y2 = wave_h * 10.4 / WAVEFORM_DIVISIONS; + int text_y2 = y2 + wave_y + get_text_ascent(SMALLFONT) / 2; + CLAMP(text_y2, waveform->get_y() + get_text_ascent(SMALLFONT), waveform->get_y() + waveform->get_h() - 1); + char string2[BCTEXTLEN]; + sprintf( string2, "%d",(int)lround((FLOAT_MAX - + 10.4 * (FLOAT_MAX - FLOAT_MIN ) / WAVEFORM_DIVISIONS) * 100) ); + set_color(text_color); + draw_text(text_x1, text_y2, string2); + CLAMP(y2, 0, waveform->get_h() - 1); + set_color(dark_color); + waveform->draw_line(0, y2, wave_w, y2); + set_line_dashes(0); waveform->draw_point(); set_line_dashes(1); @@ -940,6 +946,7 @@ void ScopeGUI::process(VFrame *output_frame) void ScopeGUI::update_toggles() { scope_menu->update_toggles(); + settings->update_toggles(); } ScopePanel::ScopePanel(ScopeGUI *gui, int x, int y, int w, int h) @@ -1263,7 +1270,7 @@ int ScopeScopesOn::handle_event() } ScopeMenu::ScopeMenu(ScopeGUI *gui, int x, int y) - : BC_PopupMenu(x, y, xS(100), _("Scopes")) + : BC_PopupMenu(x, y, xS(110), _("Scopes")) { this->gui = gui; } @@ -1300,18 +1307,63 @@ void ScopeMenu::update_toggles() } -ScopeVectGrats::ScopeVectGrats(ScopeGUI *gui, int x, int y) - : BC_PopupMenu(x, y, _("Overlay")) +ScopeSettingOn::ScopeSettingOn(ScopeSettings *settings, const char *text, int id) + : BC_MenuItem(text) { - this->gui = gui; + this->settings = settings; + this->id = id; } -#define SCOPE_SEARCHPATH "/scopes" -void ScopeVectGrats::create_objects() +int ScopeSettingOn::handle_event() +{ + int v = get_checked() ? 0 : 1; + set_checked(v); + ScopeGUI *gui = settings->gui; + switch( id ) { + case SCOPE_SMOOTH: + gui->use_smooth = v; + break; + case SCOPE_REFRESH: + gui->use_refresh = v; + gui->use_release = 0; + break; + case SCOPE_RELEASE: + gui->use_release = v; + gui->use_refresh = 0; + } + gui->toggle_event(); + gui->update_toggles(); + gui->update_scope(); + gui->show_window(); + return 1; +} + +ScopeSettings::ScopeSettings(ScopeGUI *gui, int x, int y) + : BC_PopupMenu(x, y, xS(150), _("Settings")) { + this->gui = gui; + refresh_on = 0; + release_on = 0; +} + +void ScopeSettings::create_objects() +{ + add_item(smooth_on = + new ScopeSettingOn(this, _("Smooth"), SCOPE_SMOOTH)); + smooth_on->set_checked(gui->use_smooth); + if( gui->use_refresh >= 0 ) { + add_item(refresh_on = + new ScopeSettingOn(this, _("Refresh on Stop"), SCOPE_REFRESH)); + add_item(release_on = + new ScopeSettingOn(this, _("Refresh on Release"), SCOPE_RELEASE)); + refresh_on->set_checked(gui->use_refresh); + release_on->set_checked(gui->use_release); + } + add_item(new BC_MenuItem(_("-VectorWheel Grids-"))); + gui->grat_paths.remove_all_objects(); ScopeGratItem *item; - add_item(item = new ScopeGratItem(this, _("none"), 0)); + add_item(item = new ScopeGratItem(this, _("None"), 0)); if( item->idx == gui->grat_idx ) item->set_checked(1); gui->grat_paths.append(0); FileSystem fs; @@ -1331,20 +1383,28 @@ void ScopeVectGrats::create_objects() } } -ScopeGratItem::ScopeGratItem(ScopeVectGrats *vect_grats, const char *text, int idx) +void ScopeSettings::update_toggles() +{ + if( refresh_on ) + refresh_on->set_checked(gui->use_refresh); + if( release_on ) + release_on->set_checked(gui->use_release); +} + +ScopeGratItem::ScopeGratItem(ScopeSettings *settings, const char *text, int idx) : BC_MenuItem(text) { - this->vect_grats = vect_grats; + this->settings = settings; this->idx = idx; } int ScopeGratItem::handle_event() { - for( int i=0,n=vect_grats->total_items(); iget_item(i); + for( int i=0,n=settings->total_items(); iget_item(i); item->set_checked(item->idx == idx); } - vect_grats->gui->update_graticule(idx); + settings->gui->update_graticule(idx); return 1; } @@ -1432,30 +1492,3 @@ ScopeVectSlider::ScopeVectSlider(ScopeGUI *gui, int x, int y, int w) { } -ScopeSmooth::ScopeSmooth(ScopeGUI *gui, int x, int y) - : BC_CheckBox(x, y, gui->use_smooth, _("Smooth")) -{ - this->gui = gui; -} - -int ScopeSmooth::handle_event() -{ - gui->use_smooth = get_value(); - gui->update_scope(); - gui->toggle_event(); - return 1; -} - -ScopeRefresh::ScopeRefresh(ScopeGUI *gui, int x, int y) - : BC_CheckBox(x, y, gui->use_refresh, _("Refresh only")) -{ - this->gui = gui; -} - -int ScopeRefresh::handle_event() -{ - gui->use_refresh = get_value(); - gui->toggle_event(); - return 1; -} -