mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
Reduce complexity of previous commit slightly.
git-svn-id: svn://localhost/ardour2/branches/3.0@5215 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
bca8efab60
commit
1fed50f817
2 changed files with 17 additions and 31 deletions
|
|
@ -5177,28 +5177,12 @@ _idle_resizer (gpointer arg)
|
||||||
return ((Editor*)arg)->idle_resize ();
|
return ((Editor*)arg)->idle_resize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a view and change to the idle track resize list.
|
|
||||||
* @param view View.
|
|
||||||
* @param h Change in height (+ve is bigger).
|
|
||||||
* @return Resulting height of the view.
|
|
||||||
*/
|
|
||||||
int32_t
|
|
||||||
Editor::add_single_to_idle_resize (TimeAxisView* view, int32_t h)
|
|
||||||
{
|
|
||||||
if (pending_resizes.find (view) != pending_resizes.end()) {
|
|
||||||
pending_resizes[view] += h;
|
|
||||||
} else {
|
|
||||||
pending_resizes[view] = h;
|
|
||||||
}
|
|
||||||
|
|
||||||
return view->current_height() + pending_resizes[view];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
|
Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
|
||||||
{
|
{
|
||||||
if (resize_idle_id < 0) {
|
if (resize_idle_id < 0) {
|
||||||
resize_idle_id = g_idle_add (_idle_resizer, this);
|
resize_idle_id = g_idle_add (_idle_resizer, this);
|
||||||
|
_pending_resize_amount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make a note of the smallest resulting height, so that we can clamp the
|
/* make a note of the smallest resulting height, so that we can clamp the
|
||||||
|
|
@ -5206,12 +5190,13 @@ Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
|
||||||
|
|
||||||
int32_t min_resulting = INT32_MAX;
|
int32_t min_resulting = INT32_MAX;
|
||||||
|
|
||||||
if (selection->selected (view)) {
|
_pending_resize_amount += h;
|
||||||
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
|
_pending_resize_view = view;
|
||||||
min_resulting = min (min_resulting, add_single_to_idle_resize (*i, h));
|
|
||||||
}
|
min_resulting = min (min_resulting, int32_t (_pending_resize_view->current_height()) + _pending_resize_amount);
|
||||||
} else {
|
|
||||||
min_resulting = min (min_resulting, add_single_to_idle_resize (view, h));
|
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
|
||||||
|
min_resulting = min (min_resulting, int32_t ((*i)->current_height()) + _pending_resize_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_resulting < 0) {
|
if (min_resulting < 0) {
|
||||||
|
|
@ -5220,9 +5205,7 @@ Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
|
||||||
|
|
||||||
/* clamp */
|
/* clamp */
|
||||||
if (uint32_t (min_resulting) < TimeAxisView::hSmall) {
|
if (uint32_t (min_resulting) < TimeAxisView::hSmall) {
|
||||||
for (std::map<TimeAxisView*, int32_t>::iterator i = pending_resizes.begin(); i != pending_resizes.end(); ++i) {
|
_pending_resize_amount += TimeAxisView::hSmall - min_resulting;
|
||||||
i->second += TimeAxisView::hSmall - min_resulting;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5230,10 +5213,13 @@ Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
|
||||||
bool
|
bool
|
||||||
Editor::idle_resize ()
|
Editor::idle_resize ()
|
||||||
{
|
{
|
||||||
for (std::map<TimeAxisView*, int32_t>::iterator i = pending_resizes.begin(); i != pending_resizes.end(); ++i) {
|
_pending_resize_view->idle_resize (_pending_resize_view->current_height() + _pending_resize_amount);
|
||||||
i->first->idle_resize (i->first->current_height() + i->second);
|
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
|
||||||
|
if (*i != _pending_resize_view) {
|
||||||
|
(*i)->idle_resize ((*i)->current_height() + _pending_resize_amount);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
pending_resizes.clear();
|
|
||||||
flush_canvas ();
|
flush_canvas ();
|
||||||
resize_idle_id = -1;
|
resize_idle_id = -1;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -2215,7 +2215,8 @@ public:
|
||||||
int resize_idle_id;
|
int resize_idle_id;
|
||||||
bool idle_resize();
|
bool idle_resize();
|
||||||
friend gboolean _idle_resize (gpointer);
|
friend gboolean _idle_resize (gpointer);
|
||||||
std::map<TimeAxisView*, int32_t> pending_resizes;
|
int32_t _pending_resize_amount;
|
||||||
|
TimeAxisView* _pending_resize_view;
|
||||||
|
|
||||||
void visible_order_range (int*, int*) const;
|
void visible_order_range (int*, int*) const;
|
||||||
|
|
||||||
|
|
@ -2227,7 +2228,6 @@ public:
|
||||||
|
|
||||||
void update_canvas_now ();
|
void update_canvas_now ();
|
||||||
void streamview_height_changed ();
|
void streamview_height_changed ();
|
||||||
int32_t add_single_to_idle_resize (TimeAxisView*, int32_t);
|
|
||||||
|
|
||||||
friend class Drag;
|
friend class Drag;
|
||||||
friend class RegionDrag;
|
friend class RegionDrag;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue