+CWindowCoordSlider::CWindowCoordSlider(CWindowCoord *coord,
+ int x, int y, int w, float mn, float mx, float value)
+ : BC_FSlider(x, y, 0, w, w, mn, mx, value)
+{
+ this->coord = coord;
+ set_precision(0.01);
+}
+
+CWindowCoordSlider::~CWindowCoordSlider()
+{
+}
+
+int CWindowCoordSlider::handle_event()
+{
+ float value = get_value();
+ coord->update(value);
+ coord->gui->event_caller = coord;
+ coord->gui->handle_event();
+ return 1;
+}
+
+CWindowCoordRange::CWindowCoordRange(CWindowCoord *coord, int x, int y)
+ : BC_Tumbler(x, y)
+{
+ this->coord = coord;
+}
+CWindowCoordRange::~CWindowCoordRange()
+{
+}
+
+int CWindowCoordRange::update(float scale)
+{
+ MWindow *mwindow = coord->gui->mwindow;
+ LocalSession *local_session = 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];
+ if( min >= max ) {
+ switch( group ) {
+ case AUTOGROUPTYPE_ZOOM: min = 0.005; max = 5.0; break;
+ case AUTOGROUPTYPE_X: min = -100; max = 100; break;
+ case AUTOGROUPTYPE_Y: min = -100; max = 100; break;
+ }
+ }
+ float range = max - min;
+ min -= range * scale;
+ max += range * scale;
+ switch( group ) {
+ case AUTOGROUPTYPE_ZOOM:
+ if( min < 0.001 ) min = 0.001;
+ if( max > 1000. ) max = 1000.;
+ break;
+ case AUTOGROUPTYPE_X:
+ case AUTOGROUPTYPE_Y:
+ if( min < -32767 ) min = -32767;
+ if( max > 32767 ) max = 32767;
+ break;
+ }
+ CWindowCoordSlider *slider = coord->slider;
+ coord->slider->update(slider->get_pointer_motion_range(),
+ slider->get_value(), min, max);
+ unlock_window();
+ MWindowGUI *mgui = mwindow->gui;
+ mgui->lock_window("CWindowCoordRange::update");
+ local_session->zoombar_showautotype = group;
+ local_session->automation_mins[group] = min;
+ local_session->automation_maxs[group] = max;
+ mgui->zoombar->update_autozoom();
+ mgui->draw_overlays(0);
+ mgui->update_patchbay();
+ mgui->flash_canvas(1);
+ mgui->unlock_window();
+ lock_window("CWindowCoordRange::update");
+ return 1;
+}
+
+int CWindowCoordRange::handle_up_event()
+{
+ return update(0.5);
+}
+int CWindowCoordRange::handle_down_event()
+{
+ return update(-0.25);
+}