From 36b275659adf666f05d538ed801107fc9538d5ae Mon Sep 17 00:00:00 2001 From: Pierre Dumuid Date: Sat, 7 Jan 2006 06:33:29 +0000 Subject: [PATCH] r719: Turn the Automation range text label into an editable textbox.. --- cinelerra/zoombar.C | 28 +++++++++++++++++++++++++--- cinelerra/zoombar.h | 12 +++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/cinelerra/zoombar.C b/cinelerra/zoombar.C index acb43073..c54b3c14 100644 --- a/cinelerra/zoombar.C +++ b/cinelerra/zoombar.C @@ -59,8 +59,10 @@ int ZoomBar::create_objects() track_zoom->create_objects(); x += track_zoom->get_w() + 10; -#define DEFAULT_TEXT "000.00 - 000.00" - add_subwindow(auto_zoom_text = new BC_Title( +#define DEFAULT_TEXT "000.00 to 000.00" + add_subwindow(auto_zoom_text = new ZoomTextBox( + mwindow, + this, x, get_h() / 2 - BC_Title::calculate_h(this, "0") / 2, DEFAULT_TEXT)); @@ -132,7 +134,7 @@ int ZoomBar::draw() void ZoomBar::update_autozoom() { char string[BCTEXTLEN]; - sprintf(string, "%0.02f - %0.02f\n", + sprintf(string, "%0.02f to %0.02f\n", mwindow->edl->local_session->automation_min, mwindow->edl->local_session->automation_max); auto_zoom_text->update(string); @@ -386,6 +388,26 @@ int AutoZoom::handle_down_event() +ZoomTextBox::ZoomTextBox(MWindow *mwindow, ZoomBar *zoombar, int x, int y, char *text) + : BC_TextBox(x, y, 130, 1, text) +{ + this->mwindow = mwindow; + this->zoombar = zoombar; +} + +int ZoomTextBox::handle_event() +{ + float min, max; + sscanf(this->get_text(),"%f to %f",&min, &max); + if (max > min) { + mwindow->edl->local_session->automation_min = min; + mwindow->edl->local_session->automation_max = max; + mwindow->gui->zoombar->update_autozoom(); + mwindow->gui->canvas->draw_overlays(); + mwindow->gui->canvas->flash(); + } + return 0; +} diff --git a/cinelerra/zoombar.h b/cinelerra/zoombar.h index 10cc94bc..a95a37fc 100644 --- a/cinelerra/zoombar.h +++ b/cinelerra/zoombar.h @@ -1,6 +1,8 @@ #ifndef ZOOMBAR_H #define ZOOMBAR_H +class ZoomTextBox; + class FromTextBox; class LengthTextBox; class ToTextBox; @@ -41,7 +43,7 @@ public: AmpZoomPanel *amp_zoom; TrackZoomPanel *track_zoom; AutoZoom *auto_zoom; - BC_Title *auto_zoom_text; + ZoomTextBox *auto_zoom_text; BC_Title *zoom_value, *playback_value; LengthTextBox *length_value; @@ -93,6 +95,14 @@ public: +class ZoomTextBox : public BC_TextBox +{ +public: + ZoomTextBox(MWindow *mwindow, ZoomBar *zoombar, int x, int y, char *text); + int handle_event(); + MWindow *mwindow; + ZoomBar *zoombar; +}; -- 2.11.4.GIT