2 Copyright (C) 2000 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <libgnomecanvasmm.h>
27 #include <libgnomecanvasmm/canvas.h>
28 #include <libgnomecanvasmm/item.h>
30 #include <pbd/error.h>
32 #include <gtkmm2ext/utils.h>
33 #include <gtkmm2ext/selector.h>
34 #include <gtkmm2ext/stop_signal.h>
36 #include <ardour/session.h>
37 #include <ardour/utils.h>
38 #include <ardour/ladspa_plugin.h>
39 #include <ardour/processor.h>
40 #include <ardour/location.h>
42 #include "ardour_ui.h"
43 #include "public_editor.h"
44 #include "time_axis_view.h"
45 #include "region_view.h"
46 #include "ghostregion.h"
47 #include "simplerect.h"
48 #include "simpleline.h"
49 #include "selection.h"
51 #include "rgb_macros.h"
59 using namespace ARDOUR;
61 using namespace Editing;
62 using namespace ArdourCanvas;
64 const double trim_handle_size = 6.0; /* pixels */
66 uint32_t TimeAxisView::hLargest = 0;
67 uint32_t TimeAxisView::hLarge = 0;
68 uint32_t TimeAxisView::hLarger = 0;
69 uint32_t TimeAxisView::hNormal = 0;
70 uint32_t TimeAxisView::hSmaller = 0;
71 uint32_t TimeAxisView::hSmall = 0;
72 bool TimeAxisView::need_size_info = true;
74 TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& canvas)
83 compute_controls_size_info ();
84 need_size_info = false;
87 canvas_display = new Group (*canvas.root(), 0.0, 0.0);
89 ghost_group = new Group (*canvas_display);
90 ghost_group->lower_to_bottom();
93 selection_group = new Group (*canvas_display);
94 selection_group->hide();
99 _marked_for_display = false;
101 in_destructor = false;
103 effective_height = 0;
106 last_name_entry_key_press_event = 0;
107 name_packing = NamePackingBits (0);
110 Create the standard LHS Controls
111 We create the top-level container and name add the name label here,
112 subclasses can add to the layout as required
115 name_entry.set_name ("EditorTrackNameDisplay");
116 name_entry.signal_button_release_event().connect (mem_fun (*this, &TimeAxisView::name_entry_button_release));
117 name_entry.signal_button_press_event().connect (mem_fun (*this, &TimeAxisView::name_entry_button_press));
118 name_entry.signal_key_release_event().connect (mem_fun (*this, &TimeAxisView::name_entry_key_release));
119 name_entry.signal_activate().connect (mem_fun(*this, &TimeAxisView::name_entry_activated));
120 name_entry.signal_focus_in_event().connect (mem_fun (*this, &TimeAxisView::name_entry_focus_in));
121 name_entry.signal_focus_out_event().connect (mem_fun (*this, &TimeAxisView::name_entry_focus_out));
122 Gtkmm2ext::set_size_request_to_display_given_text (name_entry, N_("gTortnam"), 10, 10); // just represents a short name
124 name_label.set_name ("TrackLabel");
125 name_label.set_alignment (0.0, 0.5);
127 /* typically, either name_label OR name_entry are visible,
128 but not both. its up to derived classes to show/hide them as they
134 controls_table.set_border_width (2);
135 controls_table.set_row_spacings (0);
136 controls_table.set_col_spacings (0);
137 controls_table.set_homogeneous (true);
139 controls_table.attach (name_hbox, 0, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0);
140 controls_table.show_all ();
141 controls_table.set_no_show_all ();
143 controls_vbox.pack_start (controls_table, false, false);
144 controls_vbox.show ();
146 //controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
147 controls_ebox.add (controls_vbox);
148 controls_ebox.add_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK|SCROLL_MASK);
149 controls_ebox.set_flags (CAN_FOCUS);
151 controls_ebox.signal_button_release_event().connect (mem_fun (*this, &TimeAxisView::controls_ebox_button_release));
152 controls_ebox.signal_scroll_event().connect (mem_fun (*this, &TimeAxisView::controls_ebox_scroll), true);
154 controls_hbox.pack_start (controls_ebox,true,true);
155 controls_hbox.show ();
157 //controls_frame.add (controls_hbox);
158 //controls_frame.set_name ("TimeAxisViewControlsBaseUnselected");
159 //controls_vbox.set_name ("TimeAxisViewControlsBaseUnselected");
160 //controls_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
162 ColorsChanged.connect (mem_fun (*this, &TimeAxisView::color_handler));
165 TimeAxisView::~TimeAxisView()
167 in_destructor = true;
169 for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
173 for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
175 delete (*i)->start_trim;
176 delete (*i)->end_trim;
180 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
182 delete (*i)->start_trim;
183 delete (*i)->end_trim;
186 for (list<SimpleLine*>::iterator i = feature_lines.begin(); i != feature_lines.end(); ++i) {
190 if (selection_group) {
191 delete selection_group;
195 if (canvas_display) {
196 delete canvas_display;
207 TimeAxisView::show_at (double y, int& nth, VBox *parent)
209 gdouble ix1, ix2, iy1, iy2;
210 effective_height = 0;
212 if (control_parent) {
213 control_parent->reorder_child (controls_hbox, nth);
215 control_parent = parent;
216 parent->pack_start (controls_hbox, false, false);
217 parent->reorder_child (controls_hbox, nth);
219 controls_hbox.show ();
220 controls_ebox.show ();
222 /* the coordinates used here are in the system of the
226 canvas_display->get_bounds (ix1, iy1, ix2, iy2);
227 Group* pg = canvas_display->property_parent();
234 canvas_display->move (0.0, y - iy1);
235 canvas_display->show();/* XXX not necessary */
240 /* height in pixels depends on _order, so update it now we've changed _order */
241 set_height (height_style);
243 effective_height = height;
245 /* now show children */
247 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
249 if ((*i)->marked_for_display()) {
250 (*i)->canvas_display->show();
253 if (canvas_item_visible ((*i)->canvas_display)) {
255 effective_height += (*i)->show_at (y + effective_height, nth, parent);
259 return effective_height;
263 TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
265 switch (ev->direction) {
267 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
273 case GDK_SCROLL_DOWN:
274 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
281 /* no handling for left/right, yet */
289 TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
291 switch (ev->button) {
293 selection_click (ev);
297 popup_display_menu (ev->time);
305 TimeAxisView::selection_click (GdkEventButton* ev)
307 Selection::Operation op = Keyboard::selection_type (ev->state);
308 editor.set_selected_track (*this, op, false);
312 TimeAxisView::hide ()
318 canvas_display->hide();
319 controls_hbox.hide ();
321 if (control_parent) {
322 control_parent->remove (controls_hbox);
329 /* now hide children */
331 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
339 TimeAxisView::step_height (bool bigger)
342 if (height == hLargest) {
343 if (!bigger) set_height (Large);
346 if (height == hLarge) {
347 if (bigger) set_height (Largest);
348 else set_height (Larger);
351 if (height == hLarger) {
352 if (bigger) set_height (Large);
353 else set_height (Normal);
356 if (height == hNormal) {
357 if (bigger) set_height (Larger);
358 else set_height (Smaller);
361 if (height == hSmaller) {
362 if (bigger) set_height (Normal);
363 else set_height (Small);
366 if (height == hSmall) {
367 if (bigger) set_height (Smaller);
373 TimeAxisView::set_heights (TrackHeight h)
375 TrackSelection& ts (editor.get_selection().tracks);
377 for (TrackSelection::iterator i = ts.begin(); i != ts.end(); ++i) {
378 (*i)->set_height (h);
383 TimeAxisView::set_height (TrackHeight h)
386 set_height_pixels (height_to_pixels (h));
388 for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
394 TimeAxisView::set_height_pixels (uint32_t h)
397 controls_hbox.set_size_request (-1, height + ((order == 0) ? 1 : 0));
398 //cerr << "TimeAxisView::set_height_pixels() called h = " << h << endl;//DEBUG
399 if (canvas_item_visible (selection_group)) {
400 /* resize the selection rect */
401 show_selection (editor.get_selection().time);
407 TimeAxisView::name_entry_key_release (GdkEventKey* ev)
409 PublicEditor::TrackViewList *allviews = 0;
410 PublicEditor::TrackViewList::iterator i;
412 switch (ev->keyval) {
414 name_entry.select_region (0,0);
415 controls_ebox.grab_focus ();
416 name_entry_changed ();
419 /* Shift+Tab Keys Pressed. Note that for Shift+Tab, GDK actually
420 * generates a different ev->keyval, rather than setting
423 case GDK_ISO_Left_Tab:
425 name_entry_changed ();
426 allviews = editor.get_valid_views (0);
428 i = find (allviews->begin(), allviews->end(), this);
429 if (ev->keyval == GDK_Tab) {
430 if (i != allviews->end()) {
432 if (++i == allviews->end()) { return true; }
433 } while((*i)->hidden());
436 if (i != allviews->begin()) {
438 if (--i == allviews->begin()) { return true; }
439 } while ((*i)->hidden());
443 if ((*i)->height_style == Small) {
444 (*i)->set_height(Smaller);
447 (*i)->name_entry.grab_focus();
453 name_entry_changed ();
460 #ifdef TIMEOUT_NAME_EDIT
461 /* adapt the timeout to reflect the user's typing speed */
463 guint32 name_entry_timeout;
465 if (last_name_entry_key_press_event) {
466 /* timeout is 1/2 second or 5 times their current inter-char typing speed */
467 name_entry_timeout = std::max (500U, (5 * (ev->time - last_name_entry_key_press_event)));
469 /* start with a 1 second timeout */
470 name_entry_timeout = 1000;
473 last_name_entry_key_press_event = ev->time;
475 /* wait 1 seconds and if no more keys are pressed, act as if they pressed enter */
477 name_entry_key_timeout.disconnect();
478 name_entry_key_timeout = Glib::signal_timeout().connect (mem_fun (*this, &TimeAxisView::name_entry_key_timed_out), name_entry_timeout);
485 TimeAxisView::name_entry_focus_in (GdkEventFocus* ev)
487 name_entry.select_region (0, -1);
488 name_entry.set_name ("EditorActiveTrackNameDisplay");
493 TimeAxisView::name_entry_focus_out (GdkEventFocus* ev)
497 last_name_entry_key_press_event = 0;
498 name_entry_key_timeout.disconnect ();
499 name_entry.set_name ("EditorTrackNameDisplay");
500 name_entry.select_region (0,0);
502 /* do the real stuff */
504 name_entry_changed ();
510 TimeAxisView::name_entry_key_timed_out ()
512 name_entry_activated();
517 TimeAxisView::name_entry_activated ()
519 controls_ebox.grab_focus();
523 TimeAxisView::name_entry_changed ()
528 TimeAxisView::name_entry_button_press (GdkEventButton *ev)
530 if (ev->button == 3) {
537 TimeAxisView::name_entry_button_release (GdkEventButton *ev)
539 if (ev->button == 3) {
540 popup_display_menu (ev->time);
547 TimeAxisView::conditionally_add_to_selection ()
549 Selection& s (editor.get_selection());
551 if (!s.selected (this)) {
552 cerr << "set selected track\n";
553 editor.set_selected_track (*this, Selection::Set);
559 TimeAxisView::popup_display_menu (guint32 when)
561 if (display_menu == 0) {
562 build_display_menu ();
565 conditionally_add_to_selection ();
566 display_menu->popup (1, when);
570 TimeAxisView::size_click (GdkEventButton *ev)
572 conditionally_add_to_selection ();
573 popup_size_menu (ev->time);
578 TimeAxisView::popup_size_menu (guint32 when)
580 if (size_menu == 0) {
583 size_menu->popup (1, when);
587 TimeAxisView::set_selected (bool yn)
589 if (yn == _selected) {
593 Selectable::set_selected (yn);
596 controls_ebox.set_name (controls_base_selected_name);
597 controls_hbox.set_name (controls_base_selected_name);
598 controls_vbox.set_name (controls_base_selected_name);
599 /* propagate any existing selection, if the mode is right */
601 if (editor.current_mouse_mode() == Editing::MouseRange && !editor.get_selection().time.empty()) {
602 show_selection (editor.get_selection().time);
606 controls_ebox.set_name (controls_base_unselected_name);
607 controls_hbox.set_name (controls_base_unselected_name);
608 controls_vbox.set_name (controls_base_unselected_name);
611 /* children will be set for the yn=true case. but when deselecting
612 the editor only has a list of top-level trackviews, so we
613 have to do this here.
616 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
617 (*i)->set_selected (false);
623 TimeAxisView::build_size_menu ()
625 using namespace Menu_Helpers;
627 size_menu = new Menu;
628 size_menu->set_name ("ArdourContextMenu");
629 MenuList& items = size_menu->items();
631 items.push_back (MenuElem (_("Largest"), bind (mem_fun (*this, &TimeAxisView::set_heights), Largest)));
632 items.push_back (MenuElem (_("Large"), bind (mem_fun (*this, &TimeAxisView::set_heights), Large)));
633 items.push_back (MenuElem (_("Larger"), bind (mem_fun (*this, &TimeAxisView::set_heights), Larger)));
634 items.push_back (MenuElem (_("Normal"), bind (mem_fun (*this, &TimeAxisView::set_heights), Normal)));
635 items.push_back (MenuElem (_("Smaller"), bind (mem_fun (*this, &TimeAxisView::set_heights),Smaller)));
636 items.push_back (MenuElem (_("Small"), bind (mem_fun (*this, &TimeAxisView::set_heights), Small)));
640 TimeAxisView::build_display_menu ()
642 using namespace Menu_Helpers;
644 display_menu = new Menu;
645 display_menu->set_name ("ArdourContextMenu");
647 // Just let implementing classes define what goes into the manu
651 TimeAxisView::set_samples_per_unit (double spu)
653 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
654 (*i)->set_samples_per_unit (spu);
657 AnalysisFeatureList::const_iterator i;
658 list<ArdourCanvas::SimpleLine*>::iterator l;
660 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
661 (*l)->property_x1() = editor.frame_to_pixel (*i);
662 (*l)->property_x2() = editor.frame_to_pixel (*i);
667 TimeAxisView::show_timestretch (nframes_t start, nframes_t end)
669 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
670 (*i)->show_timestretch (start, end);
675 TimeAxisView::hide_timestretch ()
677 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
678 (*i)->hide_timestretch ();
683 TimeAxisView::show_selection (TimeSelection& ts)
690 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
691 (*i)->show_selection (ts);
694 if (canvas_item_visible (selection_group)) {
695 while (!used_selection_rects.empty()) {
696 free_selection_rects.push_front (used_selection_rects.front());
697 used_selection_rects.pop_front();
698 free_selection_rects.front()->rect->hide();
699 free_selection_rects.front()->start_trim->hide();
700 free_selection_rects.front()->end_trim->hide();
702 selection_group->hide();
705 selection_group->show();
706 selection_group->raise_to_top();
708 for (list<AudioRange>::iterator i = ts.begin(); i != ts.end(); ++i) {
709 nframes_t start, end, cnt;
713 cnt = end - start + 1;
715 rect = get_selection_rect ((*i).id);
717 x1 = editor.frame_to_unit (start);
718 x2 = editor.frame_to_unit (start + cnt - 1);
721 rect->rect->property_x1() = x1;
722 rect->rect->property_y1() = 1.0;
723 rect->rect->property_x2() = x2;
724 rect->rect->property_y2() = y2;
726 // trim boxes are at the top for selections
729 rect->start_trim->property_x1() = x1;
730 rect->start_trim->property_y1() = 1.0;
731 rect->start_trim->property_x2() = x1 + trim_handle_size;
732 rect->start_trim->property_y2() = 1.0 + trim_handle_size;
734 rect->end_trim->property_x1() = x2 - trim_handle_size;
735 rect->end_trim->property_y1() = 1.0;
736 rect->end_trim->property_x2() = x2;
737 rect->end_trim->property_y2() = 1.0 + trim_handle_size;
739 rect->start_trim->show();
740 rect->end_trim->show();
742 rect->start_trim->hide();
743 rect->end_trim->hide();
747 used_selection_rects.push_back (rect);
752 TimeAxisView::reshow_selection (TimeSelection& ts)
756 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
757 (*i)->show_selection (ts);
762 TimeAxisView::hide_selection ()
764 if (canvas_item_visible (selection_group)) {
765 while (!used_selection_rects.empty()) {
766 free_selection_rects.push_front (used_selection_rects.front());
767 used_selection_rects.pop_front();
768 free_selection_rects.front()->rect->hide();
769 free_selection_rects.front()->start_trim->hide();
770 free_selection_rects.front()->end_trim->hide();
772 selection_group->hide();
775 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
776 (*i)->hide_selection ();
781 TimeAxisView::order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top)
783 /* find the selection rect this is for. we have the item corresponding to one
787 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
788 if ((*i)->start_trim == item || (*i)->end_trim == item) {
790 /* make one trim handle be "above" the other so that if they overlap,
791 the top one is the one last used.
794 (*i)->rect->raise_to_top ();
795 (put_start_on_top ? (*i)->start_trim : (*i)->end_trim)->raise_to_top ();
796 (put_start_on_top ? (*i)->end_trim : (*i)->start_trim)->raise_to_top ();
804 TimeAxisView::get_selection_rect (uint32_t id)
808 /* check to see if we already have a visible rect for this particular selection ID */
810 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
811 if ((*i)->id == id) {
816 /* ditto for the free rect list */
818 for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
819 if ((*i)->id == id) {
820 SelectionRect* ret = (*i);
821 free_selection_rects.erase (i);
826 /* no existing matching rect, so go get a new one from the free list, or create one if there are none */
828 if (free_selection_rects.empty()) {
830 rect = new SelectionRect;
832 rect->rect = new SimpleRect (*selection_group);
833 rect->rect->property_x1() = 0.0;
834 rect->rect->property_y1() = 0.0;
835 rect->rect->property_x2() = 0.0;
836 rect->rect->property_y2() = 0.0;
837 rect->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
838 rect->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
840 rect->start_trim = new SimpleRect (*selection_group);
841 rect->start_trim->property_x1() = 0.0;
842 rect->start_trim->property_x2() = 0.0;
843 rect->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
844 rect->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
846 rect->end_trim = new SimpleRect (*selection_group);
847 rect->end_trim->property_x1() = 0.0;
848 rect->end_trim->property_x2() = 0.0;
849 rect->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
850 rect->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
852 free_selection_rects.push_front (rect);
854 rect->rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
855 rect->start_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
856 rect->end_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
859 rect = free_selection_rects.front();
861 free_selection_rects.pop_front();
865 struct null_deleter { void operator()(void const *) const {} };
868 TimeAxisView::is_child (TimeAxisView* tav)
870 return find (children.begin(), children.end(), boost::shared_ptr<TimeAxisView>(tav, null_deleter())) != children.end();
874 TimeAxisView::add_child (boost::shared_ptr<TimeAxisView> child)
876 children.push_back (child);
880 TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
882 Children::iterator i;
884 if ((i = find (children.begin(), children.end(), child)) != children.end()) {
890 TimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& result)
896 TimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result)
902 TimeAxisView::add_ghost (RegionView* rv) {
903 GhostRegion* gr = rv->add_ghost (*this);
906 ghosts.push_back(gr);
907 gr->GoingAway.connect (mem_fun(*this, &TimeAxisView::erase_ghost));
912 TimeAxisView::remove_ghost (RegionView* rv) {
913 rv->remove_ghost_in (*this);
917 TimeAxisView::erase_ghost (GhostRegion* gr) {
922 list<GhostRegion*>::iterator i;
924 for (i = ghosts.begin(); i != ghosts.end(); ++i) {
933 TimeAxisView::touched (double top, double bot)
935 /* remember: this is X Window - coordinate space starts in upper left and moves down.
936 y_position is the "origin" or "top" of the track.
939 double mybot = y_position + height;
941 return ((y_position <= bot && y_position >= top) ||
942 ((mybot <= bot) && (top < mybot)) ||
943 (mybot >= bot && y_position < top));
947 TimeAxisView::set_parent (TimeAxisView& p)
953 TimeAxisView::has_state () const
959 TimeAxisView::get_parent_with_state ()
965 if (parent->has_state()) {
969 return parent->get_parent_with_state ();
973 TimeAxisView::set_state (const XMLNode& node)
975 const XMLProperty *prop;
977 if ((prop = node.property ("track_height")) != 0) {
979 if (prop->value() == "largest") {
980 set_height (Largest);
981 } else if (prop->value() == "large") {
983 } else if (prop->value() == "larger") {
985 } else if (prop->value() == "normal") {
987 } else if (prop->value() == "smaller") {
988 set_height (Smaller);
989 } else if (prop->value() == "small") {
992 error << string_compose(_("unknown track height name \"%1\" in XML GUI information"), prop->value()) << endmsg;
1002 TimeAxisView::reset_height()
1004 set_height_pixels (height);
1006 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1007 (*i)->set_height_pixels ((TrackHeight)(*i)->height);
1012 TimeAxisView::height_to_pixels (TrackHeight h)
1029 // what is wrong with gcc ?
1035 TimeAxisView::compute_controls_size_info ()
1037 Gtk::Window window (Gtk::WINDOW_TOPLEVEL);
1038 Gtk::Table two_row_table (2, 8);
1039 Gtk::Table one_row_table (1, 8);
1041 const int border_width = 2;
1042 const int extra_height = (2 * border_width) + 2; // 2 pixels for the controls frame
1044 window.add (one_row_table);
1046 one_row_table.set_border_width (border_width);
1047 one_row_table.set_row_spacings (0);
1048 one_row_table.set_col_spacings (0);
1049 one_row_table.set_homogeneous (true);
1051 two_row_table.set_border_width (border_width);
1052 two_row_table.set_row_spacings (0);
1053 two_row_table.set_col_spacings (0);
1054 two_row_table.set_homogeneous (true);
1056 for (int i = 0; i < 5; ++i) {
1057 buttons[i] = manage (new Button (X_("f")));
1058 buttons[i]->set_name ("TrackMuteButton");
1061 one_row_table.attach (*buttons[0], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1063 one_row_table.show_all ();
1064 Gtk::Requisition req(one_row_table.size_request ());
1067 // height required to show 1 row of buttons
1069 hSmaller = req.height + extra_height;
1072 window.add (two_row_table);
1074 two_row_table.attach (*buttons[1], 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1075 two_row_table.attach (*buttons[2], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1076 two_row_table.attach (*buttons[3], 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1077 two_row_table.attach (*buttons[4], 8, 9, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1079 two_row_table.show_all ();
1080 req = two_row_table.size_request ();
1082 // height required to show all normal buttons
1084 hNormal = req.height + extra_height;
1086 // these heights are all just larger than normal. no more
1087 // elements are visible (yet).
1089 hLarger = hNormal + 50;
1090 hLarge = hNormal + 150;
1091 hLargest = hNormal + 250;
1093 // height required to show track name
1099 TimeAxisView::show_name_label ()
1101 if (!(name_packing & NameLabelPacked)) {
1102 name_hbox.pack_start (name_label, true, true);
1103 name_packing = NamePackingBits (name_packing | NameLabelPacked);
1110 TimeAxisView::show_name_entry ()
1112 if (!(name_packing & NameEntryPacked)) {
1113 name_hbox.pack_start (name_entry, true, true);
1114 name_packing = NamePackingBits (name_packing | NameEntryPacked);
1121 TimeAxisView::hide_name_label ()
1123 if (name_packing & NameLabelPacked) {
1124 name_hbox.remove (name_label);
1125 name_packing = NamePackingBits (name_packing & ~NameLabelPacked);
1130 TimeAxisView::hide_name_entry ()
1132 if (name_packing & NameEntryPacked) {
1133 name_hbox.remove (name_entry);
1134 name_packing = NamePackingBits (name_packing & ~NameEntryPacked);
1139 TimeAxisView::color_handler ()
1141 for (list<GhostRegion*>::iterator i=ghosts.begin(); i != ghosts.end(); i++ ) {
1145 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
1147 (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
1148 (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1150 (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1151 (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1153 (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1154 (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1157 for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
1159 (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
1160 (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1162 (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1163 (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1165 (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1166 (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1171 TimeAxisView::covers_y_position (double y)
1177 if (y_position <= y && y < (y_position + height)) {
1181 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1184 if ((tv = (*i)->covers_y_position (y)) != 0) {
1193 TimeAxisView::show_feature_lines (const AnalysisFeatureList& pos)
1195 analysis_features = pos;
1196 reshow_feature_lines ();
1201 TimeAxisView::hide_feature_lines ()
1203 list<ArdourCanvas::SimpleLine*>::iterator l;
1205 for (l = feature_lines.begin(); l != feature_lines.end(); ++l) {
1211 TimeAxisView::reshow_feature_lines ()
1213 while (feature_lines.size()< analysis_features.size()) {
1214 ArdourCanvas::SimpleLine* l = new ArdourCanvas::SimpleLine (*canvas_display);
1215 l->property_color_rgba() = (guint) ARDOUR_UI::config()->canvasvar_ZeroLine.get();
1216 l->property_y1() = 0;
1217 l->property_y2() = height;
1218 feature_lines.push_back (l);
1221 while (feature_lines.size() > analysis_features.size()) {
1222 ArdourCanvas::SimpleLine *line = feature_lines.back();
1223 feature_lines.pop_back ();
1227 AnalysisFeatureList::const_iterator i;
1228 list<ArdourCanvas::SimpleLine*>::iterator l;
1230 for (i = analysis_features.begin(), l = feature_lines.begin(); i != analysis_features.end() && l != feature_lines.end(); ++i, ++l) {
1231 (*l)->property_x1() = editor.frame_to_pixel (*i);
1232 (*l)->property_x2() = editor.frame_to_pixel (*i);