fix position where rubberband rect is drawn
This commit is contained in:
parent
b54a2713a1
commit
5285bb587f
@ -118,6 +118,15 @@ Editor::initialize_canvas ()
|
|||||||
_trackview_group = new ArdourCanvas::Group (hv_scroll_group);
|
_trackview_group = new ArdourCanvas::Group (hv_scroll_group);
|
||||||
CANVAS_DEBUG_NAME (_trackview_group, "Canvas TrackViews");
|
CANVAS_DEBUG_NAME (_trackview_group, "Canvas TrackViews");
|
||||||
|
|
||||||
|
// used to show zoom mode active zooming
|
||||||
|
zoom_rect = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
|
||||||
|
zoom_rect->hide();
|
||||||
|
zoom_rect->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0));
|
||||||
|
|
||||||
|
// used as rubberband rect
|
||||||
|
rubberband_rect = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
|
||||||
|
rubberband_rect->hide();
|
||||||
|
|
||||||
/* a group to hold stuff while it gets dragged around. Must be the
|
/* a group to hold stuff while it gets dragged around. Must be the
|
||||||
* uppermost (last) group with hv_scroll_group as a parent
|
* uppermost (last) group with hv_scroll_group as a parent
|
||||||
*/
|
*/
|
||||||
@ -202,15 +211,6 @@ Editor::initialize_canvas ()
|
|||||||
transport_punchout_line->set_y1 (ArdourCanvas::COORD_MAX);
|
transport_punchout_line->set_y1 (ArdourCanvas::COORD_MAX);
|
||||||
transport_punchout_line->hide();
|
transport_punchout_line->hide();
|
||||||
|
|
||||||
// used to show zoom mode active zooming
|
|
||||||
zoom_rect = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
|
|
||||||
zoom_rect->hide();
|
|
||||||
zoom_rect->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_zoom_rect_event), (ArdourCanvas::Item*) 0));
|
|
||||||
|
|
||||||
// used as rubberband rect
|
|
||||||
rubberband_rect = new ArdourCanvas::Rectangle (hv_scroll_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, 0.0));
|
|
||||||
rubberband_rect->hide();
|
|
||||||
|
|
||||||
tempo_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar));
|
tempo_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_tempo_bar_event), tempo_bar));
|
||||||
meter_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar));
|
meter_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_meter_bar_event), meter_bar));
|
||||||
marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar));
|
marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_marker_bar_event), marker_bar));
|
||||||
|
@ -181,6 +181,9 @@ DragManager::motion_handler (GdkEvent* e, bool from_autoscroll)
|
|||||||
|
|
||||||
for (list<Drag*>::iterator i = _drags.begin(); i != _drags.end(); ++i) {
|
for (list<Drag*>::iterator i = _drags.begin(); i != _drags.end(); ++i) {
|
||||||
bool const t = (*i)->motion_handler (e, from_autoscroll);
|
bool const t = (*i)->motion_handler (e, from_autoscroll);
|
||||||
|
/* run all handlers; return true if at least one of them
|
||||||
|
returns true (indicating that the event has been handled).
|
||||||
|
*/
|
||||||
if (t) {
|
if (t) {
|
||||||
r = true;
|
r = true;
|
||||||
}
|
}
|
||||||
@ -3577,28 +3580,28 @@ RubberbandSelectDrag::motion (GdkEvent* event, bool)
|
|||||||
double x2 = _editor->sample_to_pixel (end);
|
double x2 = _editor->sample_to_pixel (end);
|
||||||
const double min_dimension = 2.0;
|
const double min_dimension = 2.0;
|
||||||
|
|
||||||
_editor->rubberband_rect->set_x0 (x1);
|
|
||||||
if (_vertical_only) {
|
if (_vertical_only) {
|
||||||
/* fixed 10 pixel width */
|
/* fixed 10 pixel width */
|
||||||
_editor->rubberband_rect->set_x1 (x1 + 10);
|
x2 = x1 + 10;
|
||||||
} else {
|
} else {
|
||||||
if (x2 < x1) {
|
if (x2 < x1) {
|
||||||
x2 = min (x1 - min_dimension, x2);
|
x2 = min (x1 - min_dimension, x2);
|
||||||
} else {
|
} else {
|
||||||
x2 = max (x1 + min_dimension, x2);
|
x2 = max (x1 + min_dimension, x2);
|
||||||
}
|
}
|
||||||
_editor->rubberband_rect->set_x1 (x2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_editor->rubberband_rect->set_y0 (y1);
|
|
||||||
if (y2 < y1) {
|
if (y2 < y1) {
|
||||||
y2 = min (y1 - min_dimension, y2);
|
y2 = min (y1 - min_dimension, y2);
|
||||||
} else {
|
} else {
|
||||||
y2 = max (y1 + min_dimension, y2);
|
y2 = max (y1 + min_dimension, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_editor->rubberband_rect->set_y1 (y2);
|
/* translate rect into item space and set */
|
||||||
|
|
||||||
|
Rect r (x1, y1, x2, y2);
|
||||||
|
|
||||||
|
_editor->rubberband_rect->set (_editor->rubberband_rect->canvas_to_item (r));
|
||||||
_editor->rubberband_rect->show();
|
_editor->rubberband_rect->show();
|
||||||
_editor->rubberband_rect->raise_to_top();
|
_editor->rubberband_rect->raise_to_top();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user