+int CWindowToolAutoRangeTumbler::handle_down_event()
+{
+ coord->gui->mwindow->update_autorange(coord->type, 0, use_max);
+ coord->range_text->update_range();
+ return 1;
+}
+
+CWindowToolAutoRangeReset::CWindowToolAutoRangeReset(CWindowCoord *coord, int x, int y)
+ : BC_Button(x, y, coord->gui->mwindow->theme->get_image_set("reset_button"))
+{
+ this->coord = coord;
+ set_tooltip(_("Reset"));
+}
+
+int CWindowToolAutoRangeReset::handle_event()
+{
+ float v = 0;
+ int group = Automation::autogrouptype(coord->type, 0);
+ MWindow *mwindow = coord->gui->mwindow;
+ LocalSession *local_session = mwindow->edl->local_session;
+ float min = local_session->automation_mins[group];
+ float max = local_session->automation_maxs[group];
+ switch( group ) {
+ case AUTOGROUPTYPE_ZOOM: // exp
+ min = 0.005; max= 5.000; v = 1;
+ break;
+ case AUTOGROUPTYPE_X:
+ max = mwindow->edl->session->output_w;
+ min = -max;
+ break;
+ case AUTOGROUPTYPE_Y:
+ max = mwindow->edl->session->output_h;
+ min = -max;
+ break;
+ }
+ local_session->automation_mins[group] = min;
+ local_session->automation_maxs[group] = max;
+ coord->range_text->update_range();
+ unlock_window();
+ MWindowGUI *mgui = mwindow->gui;
+ mgui->lock_window("CWindowToolAutoRangeReset::update");
+ int color = GWindowGUI::auto_colors[coord->type];
+ mgui->zoombar->update_autozoom(group, color);
+ mgui->draw_overlays(0);
+ mgui->update_patchbay();
+ mgui->flash_canvas(1);
+ mgui->unlock_window();
+ mwindow->save_backup();
+ lock_window("CWindowToolAutoRangeReset::update");
+ CWindowCoordSlider *slider = coord->slider;
+ slider->update(slider->get_pointer_motion_range(), v, min, max);
+ return slider->handle_event();
+}
+
+CWindowToolAutoRangeTextBox::CWindowToolAutoRangeTextBox(CWindowCoord *coord, int x, int y)
+ : BC_TextBox(x, y, xS(130), 1, "0.000 to 0.000")
+{
+ this->coord = coord;
+ set_tooltip(_("Automation range"));
+}
+
+int CWindowToolAutoRangeTextBox::button_press_event()
+{
+ if (!is_event_win()) return 0;
+ int use_max = get_cursor_x() < get_w()/2 ? 0 : 1;
+ switch( get_buttonpress() ) {
+ case WHEEL_UP:
+ coord->gui->mwindow->update_autorange(coord->type, 1, use_max);
+ break;
+ case WHEEL_DOWN:
+ coord->gui->mwindow->update_autorange(coord->type, 0, use_max);
+ break;
+ default:
+ return BC_TextBox::button_press_event();
+ }
+ return coord->range_text->update_range();
+}
+
+int CWindowToolAutoRangeTextBox::handle_event()
+{
+ float imin, imax;
+ if( sscanf(this->get_text(),"%f to%f",&imin, &imax) == 2 ) {
+ MWindow *mwindow = coord->gui->mwindow;
+ int group = Automation::autogrouptype(coord->type, 0);
+ LocalSession *local_session = mwindow->edl->local_session;
+ float min = imin, max = imax;
+ switch( group ) {
+ case AUTOGROUPTYPE_ZOOM:
+ if( min < ZOOM_MIN ) min = ZOOM_MIN;
+ if( max > ZOOM_MAX ) max = ZOOM_MAX;
+ break;
+ case AUTOGROUPTYPE_X:
+ case AUTOGROUPTYPE_Y:
+ if( min < XY_MIN ) min = XY_MIN;
+ if( max > XY_MAX ) max = XY_MAX;
+ break;
+ }
+ if( max > min ) {
+ local_session->automation_mins[group] = min;
+ local_session->automation_maxs[group] = max;
+ if( min != imin || max != imax ) update_range();
+ mwindow->gui->lock_window("CWindowToolAutoRangeTextBox::handle_event");
+ int color = GWindowGUI::auto_colors[coord->type];
+ mwindow->gui->zoombar->update_autozoom(group, color);
+ mwindow->gui->draw_overlays(0);
+ mwindow->gui->update_patchbay();
+ mwindow->gui->flash_canvas(1);
+ mwindow->gui->unlock_window();
+ }
+ }
+ return 1;
+}
+
+int CWindowToolAutoRangeTextBox::update_range()
+{
+ char string[BCSTRLEN];
+ LocalSession *local_session = coord->gui->mwindow->edl->local_session;
+ int group = Automation::autogrouptype(coord->type, 0);
+ float min = local_session->automation_mins[group];
+ float max = local_session->automation_maxs[group];
+ switch( group ) {
+ case AUTOGROUPTYPE_ZOOM:
+ sprintf(string, "%0.03f to %0.03f\n", min, max);
+ break;
+ case AUTOGROUPTYPE_X:
+ case AUTOGROUPTYPE_Y:
+ sprintf(string, "%0.0f to %.0f\n", min, max);
+ break;
+ }
+ update(string);
+ return 1;
+}