mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Remove unused resize-line code. When resizing multiple tracks, resize them in proportion, as per mantis 2732.
git-svn-id: svn://localhost/ardour2/branches/3.0@5213 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
45671f13e3
commit
9402d3f1e3
6 changed files with 51 additions and 177 deletions
|
|
@ -19,11 +19,14 @@
|
||||||
|
|
||||||
/* Note: public Editor methods are documented in public_editor.h */
|
/* Note: public Editor methods are documented in public_editor.h */
|
||||||
|
|
||||||
|
#define __STDC_LIMIT_MACROS 1
|
||||||
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include <boost/none.hpp>
|
#include <boost/none.hpp>
|
||||||
|
|
||||||
|
|
@ -347,9 +350,6 @@ Editor::Editor ()
|
||||||
}
|
}
|
||||||
allow_vertical_scroll = false;
|
allow_vertical_scroll = false;
|
||||||
no_save_visual = false;
|
no_save_visual = false;
|
||||||
need_resize_line = false;
|
|
||||||
resize_line_y = 0;
|
|
||||||
old_resize_line_y = -1;
|
|
||||||
no_region_list_redisplay = false;
|
no_region_list_redisplay = false;
|
||||||
resize_idle_id = -1;
|
resize_idle_id = -1;
|
||||||
|
|
||||||
|
|
@ -5171,169 +5171,67 @@ Editor::first_idle ()
|
||||||
_have_idled = true;
|
_have_idled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Editor::start_resize_line_ops ()
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
old_resize_line_y = -1;
|
|
||||||
resize_line_y = -1;
|
|
||||||
need_resize_line = true;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Editor::end_resize_line_ops ()
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
need_resize_line = false;
|
|
||||||
|
|
||||||
if (old_resize_line_y >= 0) {
|
|
||||||
Gdk::Rectangle r (0, old_resize_line_y, (int) _canvas_width, 3);
|
|
||||||
Glib::RefPtr<Gdk::Window> win = get_window();
|
|
||||||
cerr << "Final invalidation at " << old_resize_line_y << endl;
|
|
||||||
win->invalidate_rect (r, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Editor::queue_draw_resize_line (int at)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
Glib::RefPtr<Gdk::Window> win = get_window();
|
|
||||||
|
|
||||||
resize_line_y = at;
|
|
||||||
|
|
||||||
if (win && _canvas_width) {
|
|
||||||
|
|
||||||
int controls_width = controls_layout.get_width();
|
|
||||||
int xroot, discard;
|
|
||||||
|
|
||||||
controls_layout.get_window()->get_origin (xroot, discard);
|
|
||||||
|
|
||||||
if (old_resize_line_y >= 0) {
|
|
||||||
|
|
||||||
/* redraw where it used to be */
|
|
||||||
|
|
||||||
|
|
||||||
Gdk::Rectangle r (0, old_resize_line_y - 1, controls_width + (int) _canvas_width, 3);
|
|
||||||
win->invalidate_rect (r, true);
|
|
||||||
cerr << "invalidate " << xroot << "," << old_resize_line_y - 1 << ' '
|
|
||||||
<< controls_width + _canvas_width << " x 3\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* draw where it is */
|
|
||||||
|
|
||||||
Gdk::Rectangle r (0, at - 1, controls_width + (int) _canvas_width, 3);
|
|
||||||
win->invalidate_rect (r, true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
Editor::on_expose_event (GdkEventExpose* ev)
|
|
||||||
{
|
|
||||||
/* cerr << "+++ editor expose "
|
|
||||||
<< ev->area.x << ',' << ev->area.y
|
|
||||||
<< ' '
|
|
||||||
<< ev->area.width << " x " << ev->area.height
|
|
||||||
<< " need reize ? " << need_resize_line
|
|
||||||
<< endl;
|
|
||||||
*/
|
|
||||||
bool ret = Window::on_expose_event (ev);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (need_resize_line) {
|
|
||||||
|
|
||||||
int xroot, yroot, discard;
|
|
||||||
int controls_width;
|
|
||||||
|
|
||||||
/* Our root coordinates for drawing the line will be the left edge
|
|
||||||
of the track controls, and the upper left edge of our own window.
|
|
||||||
*/
|
|
||||||
|
|
||||||
get_window()->get_origin (discard, yroot);
|
|
||||||
controls_layout.get_window()->get_origin (xroot, discard);
|
|
||||||
controls_width = controls_layout.get_width();
|
|
||||||
|
|
||||||
GdkRectangle lr;
|
|
||||||
GdkRectangle intersection;
|
|
||||||
|
|
||||||
lr.x = 0;
|
|
||||||
lr.y = resize_line_y;
|
|
||||||
lr.width = controls_width + (int) _canvas_width;
|
|
||||||
lr.height = 3;
|
|
||||||
|
|
||||||
if (gdk_rectangle_intersect (&lr, &ev->area, &intersection)) {
|
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::Style> style (get_style());
|
|
||||||
Glib::RefPtr<Gdk::GC> black_gc (style->get_black_gc ());
|
|
||||||
Glib::RefPtr<Gdk::GC> gc = wrap (black_gc->gobj_copy(), false);
|
|
||||||
|
|
||||||
/* draw on root window */
|
|
||||||
|
|
||||||
GdkWindow* win = gdk_get_default_root_window();
|
|
||||||
|
|
||||||
gc->set_subwindow (Gdk::INCLUDE_INFERIORS);
|
|
||||||
gc->set_line_attributes (3, Gdk::LINE_SOLID,
|
|
||||||
Gdk::CAP_NOT_LAST,
|
|
||||||
Gdk::JOIN_MITER);
|
|
||||||
|
|
||||||
gdk_draw_line (win, gc->gobj(),
|
|
||||||
0,
|
|
||||||
resize_line_y,
|
|
||||||
(int) _canvas_width + controls_width,
|
|
||||||
resize_line_y);
|
|
||||||
#if 0
|
|
||||||
cerr << "drew line @ " << xroot << ", " << yroot + resize_line_y
|
|
||||||
<< " to " << xroot + (int) _canvas_width + controls_width
|
|
||||||
<< ", " << yroot + resize_line_y
|
|
||||||
<< endl;
|
|
||||||
#endif
|
|
||||||
old_resize_line_y = resize_line_y;
|
|
||||||
cerr << "NEXT EXPOSE SHOULD BE AT " << old_resize_line_y << endl;
|
|
||||||
} else {
|
|
||||||
cerr << "no intersect with "
|
|
||||||
<< lr.x << ',' << lr.y
|
|
||||||
<< ' '
|
|
||||||
<< lr.width << " x " << lr.height
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//cerr << "--- editor expose\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_idle_resizer (gpointer arg)
|
_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, uint32_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);
|
||||||
}
|
}
|
||||||
|
|
||||||
resize_idle_target = h;
|
/* make a note of the smallest resulting height, so that we can clamp the
|
||||||
|
lower limit at TimeAxisView::hSmall */
|
||||||
|
|
||||||
pending_resizes.push_back (view);
|
int32_t min_resulting = INT32_MAX;
|
||||||
|
|
||||||
if (selection->selected (view) && !selection->tracks.empty()) {
|
if (selection->selected (view)) {
|
||||||
pending_resizes.insert (pending_resizes.end(), selection->tracks.begin(), selection->tracks.end());
|
for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
|
||||||
|
min_resulting = min (min_resulting, add_single_to_idle_resize (*i, h));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
min_resulting = min (min_resulting, add_single_to_idle_resize (view, h));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (min_resulting < 0) {
|
||||||
|
min_resulting = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clamp */
|
||||||
|
if (uint32_t (min_resulting) < TimeAxisView::hSmall) {
|
||||||
|
for (std::map<TimeAxisView*, int32_t>::iterator i = pending_resizes.begin(); i != pending_resizes.end(); ++i) {
|
||||||
|
i->second += TimeAxisView::hSmall - min_resulting;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Handle pending resizing of tracks */
|
||||||
bool
|
bool
|
||||||
Editor::idle_resize ()
|
Editor::idle_resize ()
|
||||||
{
|
{
|
||||||
for (vector<TimeAxisView*>::iterator i = pending_resizes.begin(); i != pending_resizes.end(); ++i) {
|
for (std::map<TimeAxisView*, int32_t>::iterator i = pending_resizes.begin(); i != pending_resizes.end(); ++i) {
|
||||||
(*i)->idle_resize (resize_idle_target);
|
i->first->idle_resize (i->first->current_height() + i->second);
|
||||||
}
|
}
|
||||||
pending_resizes.clear();
|
pending_resizes.clear();
|
||||||
flush_canvas ();
|
flush_canvas ();
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ class Editor : public PublicEditor
|
||||||
|
|
||||||
TimeAxisView* get_named_time_axis(const std::string & name) ;
|
TimeAxisView* get_named_time_axis(const std::string & name) ;
|
||||||
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
|
void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>);
|
||||||
void add_to_idle_resize (TimeAxisView*, uint32_t);
|
void add_to_idle_resize (TimeAxisView*, int32_t);
|
||||||
|
|
||||||
RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
|
RouteTimeAxisView* get_route_view_by_id (PBD::ID& id);
|
||||||
|
|
||||||
|
|
@ -399,16 +399,11 @@ class Editor : public PublicEditor
|
||||||
void goto_visual_state (uint32_t);
|
void goto_visual_state (uint32_t);
|
||||||
void save_visual_state (uint32_t);
|
void save_visual_state (uint32_t);
|
||||||
|
|
||||||
void queue_draw_resize_line (int at);
|
|
||||||
void start_resize_line_ops ();
|
|
||||||
void end_resize_line_ops ();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void map_transport_state ();
|
void map_transport_state ();
|
||||||
void map_position_change (nframes64_t);
|
void map_position_change (nframes64_t);
|
||||||
|
|
||||||
void on_realize();
|
void on_realize();
|
||||||
bool on_expose_event (GdkEventExpose*);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
@ -600,10 +595,6 @@ class Editor : public PublicEditor
|
||||||
Gtk::VBox global_vpacker;
|
Gtk::VBox global_vpacker;
|
||||||
Gtk::VBox vpacker;
|
Gtk::VBox vpacker;
|
||||||
|
|
||||||
bool need_resize_line;
|
|
||||||
int resize_line_y;
|
|
||||||
int old_resize_line_y;
|
|
||||||
|
|
||||||
Gdk::Cursor* current_canvas_cursor;
|
Gdk::Cursor* current_canvas_cursor;
|
||||||
void set_canvas_cursor ();
|
void set_canvas_cursor ();
|
||||||
Gdk::Cursor* which_grabber_cursor ();
|
Gdk::Cursor* which_grabber_cursor ();
|
||||||
|
|
@ -2222,10 +2213,9 @@ public:
|
||||||
|
|
||||||
bool _have_idled;
|
bool _have_idled;
|
||||||
int resize_idle_id;
|
int resize_idle_id;
|
||||||
int32_t resize_idle_target;
|
|
||||||
bool idle_resize();
|
bool idle_resize();
|
||||||
friend gboolean _idle_resize (gpointer);
|
friend gboolean _idle_resize (gpointer);
|
||||||
std::vector<TimeAxisView*> pending_resizes;
|
std::map<TimeAxisView*, int32_t> pending_resizes;
|
||||||
|
|
||||||
void visible_order_range (int*, int*) const;
|
void visible_order_range (int*, int*) const;
|
||||||
|
|
||||||
|
|
@ -2237,6 +2227,7 @@ 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;
|
||||||
|
|
|
||||||
|
|
@ -6046,10 +6046,6 @@ Editor::set_track_height (uint32_t h)
|
||||||
{
|
{
|
||||||
TrackSelection& ts (selection->tracks);
|
TrackSelection& ts (selection->tracks);
|
||||||
|
|
||||||
if (ts.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) {
|
for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) {
|
||||||
(*x)->set_height (h);
|
(*x)->set_height (h);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
|
||||||
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret) = 0;
|
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret) = 0;
|
||||||
virtual void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false) = 0;
|
virtual void mouse_add_new_marker (nframes64_t where, bool is_cd=false, bool is_xrun=false) = 0;
|
||||||
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
|
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
|
||||||
virtual void add_to_idle_resize (TimeAxisView*,uint32_t) = 0;
|
virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0;
|
||||||
|
|
||||||
#ifdef WITH_CMT
|
#ifdef WITH_CMT
|
||||||
virtual void add_imageframe_time_axis(const std::string & track_name, void*) = 0;
|
virtual void add_imageframe_time_axis(const std::string & track_name, void*) = 0;
|
||||||
|
|
@ -322,10 +322,6 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
|
||||||
virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
|
virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void queue_draw_resize_line (int at) = 0;
|
|
||||||
virtual void start_resize_line_ops () = 0;
|
|
||||||
virtual void end_resize_line_ops () = 0;
|
|
||||||
|
|
||||||
static const int window_border_width;
|
static const int window_border_width;
|
||||||
static const int container_border_width;
|
static const int container_border_width;
|
||||||
static const int vertical_spacing;
|
static const int vertical_spacing;
|
||||||
|
|
|
||||||
|
|
@ -1284,8 +1284,6 @@ bool
|
||||||
TimeAxisView::resizer_button_press (GdkEventButton* event)
|
TimeAxisView::resizer_button_press (GdkEventButton* event)
|
||||||
{
|
{
|
||||||
_resize_drag_start = event->y_root;
|
_resize_drag_start = event->y_root;
|
||||||
_resize_idle_target = current_height ();
|
|
||||||
_editor.start_resize_line_ops ();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1293,7 +1291,6 @@ bool
|
||||||
TimeAxisView::resizer_button_release (GdkEventButton* ev)
|
TimeAxisView::resizer_button_release (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
_resize_drag_start = -1;
|
_resize_drag_start = -1;
|
||||||
_editor.end_resize_line_ops ();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1310,11 +1307,8 @@ TimeAxisView::resizer_motion (GdkEventMotion* ev)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t const delta = (int32_t) floor (_resize_drag_start - ev->y_root);
|
int32_t const delta = (int32_t) floor (ev->y_root - _resize_drag_start);
|
||||||
|
_editor.add_to_idle_resize (this, delta);
|
||||||
_resize_idle_target = std::max (_resize_idle_target - delta, (int) hSmall);
|
|
||||||
_editor.add_to_idle_resize (this, _resize_idle_target);
|
|
||||||
|
|
||||||
_resize_drag_start = ev->y_root;
|
_resize_drag_start = ev->y_root;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,6 @@ private:
|
||||||
int _order;
|
int _order;
|
||||||
uint32_t _effective_height;
|
uint32_t _effective_height;
|
||||||
double _resize_drag_start;
|
double _resize_drag_start;
|
||||||
int32_t _resize_idle_target;
|
|
||||||
ArdourCanvas::Group* _ghost_group;
|
ArdourCanvas::Group* _ghost_group;
|
||||||
|
|
||||||
static int const _max_order;
|
static int const _max_order;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue