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, 4, 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_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
161 ColorsChanged.connect (mem_fun (*this, &TimeAxisView::color_handler));
164 TimeAxisView::~TimeAxisView()
166 in_destructor = true;
168 for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
172 for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
174 delete (*i)->start_trim;
175 delete (*i)->end_trim;
179 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
181 delete (*i)->start_trim;
182 delete (*i)->end_trim;
185 if (selection_group) {
186 delete selection_group;
190 if (canvas_display) {
191 delete canvas_display;
202 TimeAxisView::show_at (double y, int& nth, VBox *parent)
204 gdouble ix1, ix2, iy1, iy2;
205 effective_height = 0;
207 if (control_parent) {
208 control_parent->reorder_child (controls_hbox, nth);
210 control_parent = parent;
211 parent->pack_start (controls_hbox, false, false);
212 parent->reorder_child (controls_hbox, nth);
214 controls_hbox.show ();
215 controls_ebox.show ();
217 /* the coordinates used here are in the system of the
221 canvas_display->get_bounds (ix1, iy1, ix2, iy2);
222 Group* pg = canvas_display->property_parent();
229 canvas_display->move (0.0, y - iy1);
230 canvas_display->show();/* XXX not necessary */
235 /* height in pixels depends on _order, so update it now we've changed _order */
236 set_height (height_style);
238 effective_height = height;
240 /* now show children */
242 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
244 if ((*i)->marked_for_display()) {
245 (*i)->canvas_display->show();
248 if (canvas_item_visible ((*i)->canvas_display)) {
250 effective_height += (*i)->show_at (y + effective_height, nth, parent);
254 return effective_height;
258 TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
260 switch (ev->direction) {
262 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
268 case GDK_SCROLL_DOWN:
269 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
276 /* no handling for left/right, yet */
284 TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
286 switch (ev->button) {
288 selection_click (ev);
292 popup_display_menu (ev->time);
300 TimeAxisView::selection_click (GdkEventButton* ev)
302 Selection::Operation op = Keyboard::selection_type (ev->state);
303 editor.set_selected_track (*this, op, false);
307 TimeAxisView::hide ()
313 canvas_display->hide();
314 controls_hbox.hide ();
316 if (control_parent) {
317 control_parent->remove (controls_hbox);
324 /* now hide children */
326 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
334 TimeAxisView::step_height (bool bigger)
337 if (height == hLargest) {
338 if (!bigger) set_height (Large);
341 if (height == hLarge) {
342 if (bigger) set_height (Largest);
343 else set_height (Larger);
346 if (height == hLarger) {
347 if (bigger) set_height (Large);
348 else set_height (Normal);
351 if (height == hNormal) {
352 if (bigger) set_height (Larger);
353 else set_height (Smaller);
356 if (height == hSmaller) {
357 if (bigger) set_height (Normal);
358 else set_height (Small);
361 if (height == hSmall) {
362 if (bigger) set_height (Smaller);
368 TimeAxisView::set_height (TrackHeight h)
371 set_height_pixels (height_to_pixels (h));
373 for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
379 TimeAxisView::set_height_pixels (uint32_t h)
382 controls_hbox.set_size_request (-1, height + ((order == 0) ? 1 : 0));
383 //cerr << "TimeAxisView::set_height_pixels() called h = " << h << endl;//DEBUG
384 if (canvas_item_visible (selection_group)) {
385 /* resize the selection rect */
386 show_selection (editor.get_selection().time);
392 TimeAxisView::name_entry_key_release (GdkEventKey* ev)
394 PublicEditor::TrackViewList *allviews = 0;
395 PublicEditor::TrackViewList::iterator i;
397 switch (ev->keyval) {
399 name_entry.select_region (0,0);
400 controls_ebox.grab_focus ();
401 name_entry_changed ();
404 /* Shift+Tab Keys Pressed. Note that for Shift+Tab, GDK actually
405 * generates a different ev->keyval, rather than setting
408 case GDK_ISO_Left_Tab:
410 name_entry_changed ();
411 allviews = editor.get_valid_views (0);
413 i = find (allviews->begin(), allviews->end(), this);
414 if (ev->keyval == GDK_Tab) {
415 if (i != allviews->end()) {
417 if (++i == allviews->end()) { return true; }
418 } while((*i)->hidden());
421 if (i != allviews->begin()) {
423 if (--i == allviews->begin()) { return true; }
424 } while ((*i)->hidden());
428 if ((*i)->height_style == Small) {
429 (*i)->set_height(Smaller);
432 (*i)->name_entry.grab_focus();
438 name_entry_changed ();
445 #ifdef TIMEOUT_NAME_EDIT
446 /* adapt the timeout to reflect the user's typing speed */
448 guint32 name_entry_timeout;
450 if (last_name_entry_key_press_event) {
451 /* timeout is 1/2 second or 5 times their current inter-char typing speed */
452 name_entry_timeout = std::max (500U, (5 * (ev->time - last_name_entry_key_press_event)));
454 /* start with a 1 second timeout */
455 name_entry_timeout = 1000;
458 last_name_entry_key_press_event = ev->time;
460 /* wait 1 seconds and if no more keys are pressed, act as if they pressed enter */
462 name_entry_key_timeout.disconnect();
463 name_entry_key_timeout = Glib::signal_timeout().connect (mem_fun (*this, &TimeAxisView::name_entry_key_timed_out), name_entry_timeout);
470 TimeAxisView::name_entry_focus_in (GdkEventFocus* ev)
472 name_entry.select_region (0, -1);
473 name_entry.set_name ("EditorActiveTrackNameDisplay");
478 TimeAxisView::name_entry_focus_out (GdkEventFocus* ev)
482 last_name_entry_key_press_event = 0;
483 name_entry_key_timeout.disconnect ();
484 name_entry.set_name ("EditorTrackNameDisplay");
485 name_entry.select_region (0,0);
487 /* do the real stuff */
489 name_entry_changed ();
495 TimeAxisView::name_entry_key_timed_out ()
497 name_entry_activated();
502 TimeAxisView::name_entry_activated ()
504 controls_ebox.grab_focus();
508 TimeAxisView::name_entry_changed ()
513 TimeAxisView::name_entry_button_press (GdkEventButton *ev)
515 if (ev->button == 3) {
522 TimeAxisView::name_entry_button_release (GdkEventButton *ev)
524 if (ev->button == 3) {
525 popup_display_menu (ev->time);
532 TimeAxisView::popup_display_menu (guint32 when)
534 if (display_menu == 0) {
535 build_display_menu ();
538 editor.set_selected_track (*this, Selection::Add);
539 display_menu->popup (1, when);
543 TimeAxisView::size_click (GdkEventButton *ev)
545 editor.set_selected_track (*this, Selection::Add);
546 popup_size_menu (ev->time);
551 TimeAxisView::popup_size_menu (guint32 when)
553 if (size_menu == 0) {
556 size_menu->popup (1, when);
560 TimeAxisView::set_selected (bool yn)
562 if (yn == _selected) {
566 Selectable::set_selected (yn);
569 controls_ebox.set_name (controls_base_selected_name);
570 controls_hbox.set_name (controls_base_selected_name);
572 /* propagate any existing selection, if the mode is right */
574 if (editor.current_mouse_mode() == Editing::MouseRange && !editor.get_selection().time.empty()) {
575 show_selection (editor.get_selection().time);
579 controls_ebox.set_name (controls_base_unselected_name);
580 controls_hbox.set_name (controls_base_unselected_name);
584 /* children will be set for the yn=true case. but when deselecting
585 the editor only has a list of top-level trackviews, so we
586 have to do this here.
589 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
590 (*i)->set_selected (false);
596 TimeAxisView::build_size_menu ()
598 using namespace Menu_Helpers;
600 size_menu = new Menu;
601 size_menu->set_name ("ArdourContextMenu");
602 MenuList& items = size_menu->items();
604 items.push_back (MenuElem (_("Largest"), bind (mem_fun (*this, &TimeAxisView::set_height), Largest)));
605 items.push_back (MenuElem (_("Large"), bind (mem_fun (*this, &TimeAxisView::set_height), Large)));
606 items.push_back (MenuElem (_("Larger"), bind (mem_fun (*this, &TimeAxisView::set_height), Larger)));
607 items.push_back (MenuElem (_("Normal"), bind (mem_fun (*this, &TimeAxisView::set_height), Normal)));
608 items.push_back (MenuElem (_("Smaller"), bind (mem_fun (*this, &TimeAxisView::set_height),Smaller)));
609 items.push_back (MenuElem (_("Small"), bind (mem_fun (*this, &TimeAxisView::set_height), Small)));
613 TimeAxisView::build_display_menu ()
615 using namespace Menu_Helpers;
617 display_menu = new Menu;
618 display_menu->set_name ("ArdourContextMenu");
620 // Just let implementing classes define what goes into the manu
624 TimeAxisView::set_samples_per_unit (double spu)
626 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
627 (*i)->set_samples_per_unit (spu);
632 TimeAxisView::show_timestretch (nframes_t start, nframes_t end)
634 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
635 (*i)->show_timestretch (start, end);
640 TimeAxisView::hide_timestretch ()
642 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
643 (*i)->hide_timestretch ();
648 TimeAxisView::show_selection (TimeSelection& ts)
655 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
656 (*i)->show_selection (ts);
659 if (canvas_item_visible (selection_group)) {
660 while (!used_selection_rects.empty()) {
661 free_selection_rects.push_front (used_selection_rects.front());
662 used_selection_rects.pop_front();
663 free_selection_rects.front()->rect->hide();
664 free_selection_rects.front()->start_trim->hide();
665 free_selection_rects.front()->end_trim->hide();
667 selection_group->hide();
670 selection_group->show();
671 selection_group->raise_to_top();
673 for (list<AudioRange>::iterator i = ts.begin(); i != ts.end(); ++i) {
674 nframes_t start, end, cnt;
678 cnt = end - start + 1;
680 rect = get_selection_rect ((*i).id);
682 x1 = editor.frame_to_unit (start);
683 x2 = editor.frame_to_unit (start + cnt - 1);
686 rect->rect->property_x1() = x1;
687 rect->rect->property_y1() = 1.0;
688 rect->rect->property_x2() = x2;
689 rect->rect->property_y2() = y2;
691 // trim boxes are at the top for selections
694 rect->start_trim->property_x1() = x1;
695 rect->start_trim->property_y1() = 1.0;
696 rect->start_trim->property_x2() = x1 + trim_handle_size;
697 rect->start_trim->property_y2() = 1.0 + trim_handle_size;
699 rect->end_trim->property_x1() = x2 - trim_handle_size;
700 rect->end_trim->property_y1() = 1.0;
701 rect->end_trim->property_x2() = x2;
702 rect->end_trim->property_y2() = 1.0 + trim_handle_size;
704 rect->start_trim->show();
705 rect->end_trim->show();
707 rect->start_trim->hide();
708 rect->end_trim->hide();
712 used_selection_rects.push_back (rect);
717 TimeAxisView::reshow_selection (TimeSelection& ts)
721 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
722 (*i)->show_selection (ts);
727 TimeAxisView::hide_selection ()
729 if (canvas_item_visible (selection_group)) {
730 while (!used_selection_rects.empty()) {
731 free_selection_rects.push_front (used_selection_rects.front());
732 used_selection_rects.pop_front();
733 free_selection_rects.front()->rect->hide();
734 free_selection_rects.front()->start_trim->hide();
735 free_selection_rects.front()->end_trim->hide();
737 selection_group->hide();
740 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
741 (*i)->hide_selection ();
746 TimeAxisView::order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top)
748 /* find the selection rect this is for. we have the item corresponding to one
752 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
753 if ((*i)->start_trim == item || (*i)->end_trim == item) {
755 /* make one trim handle be "above" the other so that if they overlap,
756 the top one is the one last used.
759 (*i)->rect->raise_to_top ();
760 (put_start_on_top ? (*i)->start_trim : (*i)->end_trim)->raise_to_top ();
761 (put_start_on_top ? (*i)->end_trim : (*i)->start_trim)->raise_to_top ();
769 TimeAxisView::get_selection_rect (uint32_t id)
773 /* check to see if we already have a visible rect for this particular selection ID */
775 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
776 if ((*i)->id == id) {
781 /* ditto for the free rect list */
783 for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
784 if ((*i)->id == id) {
785 SelectionRect* ret = (*i);
786 free_selection_rects.erase (i);
791 /* no existing matching rect, so go get a new one from the free list, or create one if there are none */
793 if (free_selection_rects.empty()) {
795 rect = new SelectionRect;
797 rect->rect = new SimpleRect (*selection_group);
798 rect->rect->property_x1() = 0.0;
799 rect->rect->property_y1() = 0.0;
800 rect->rect->property_x2() = 0.0;
801 rect->rect->property_y2() = 0.0;
802 rect->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
803 rect->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
805 rect->start_trim = new SimpleRect (*selection_group);
806 rect->start_trim->property_x1() = 0.0;
807 rect->start_trim->property_x2() = 0.0;
808 rect->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
809 rect->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
811 rect->end_trim = new SimpleRect (*selection_group);
812 rect->end_trim->property_x1() = 0.0;
813 rect->end_trim->property_x2() = 0.0;
814 rect->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
815 rect->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
817 free_selection_rects.push_front (rect);
819 rect->rect->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_rect_event), rect->rect, rect));
820 rect->start_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_start_trim_event), rect->rect, rect));
821 rect->end_trim->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_selection_end_trim_event), rect->rect, rect));
824 rect = free_selection_rects.front();
826 free_selection_rects.pop_front();
830 struct null_deleter { void operator()(void const *) const {} };
833 TimeAxisView::is_child (TimeAxisView* tav)
835 return find (children.begin(), children.end(), boost::shared_ptr<TimeAxisView>(tav, null_deleter())) != children.end();
839 TimeAxisView::add_child (boost::shared_ptr<TimeAxisView> child)
841 children.push_back (child);
845 TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
847 Children::iterator i;
849 if ((i = find (children.begin(), children.end(), child)) != children.end()) {
855 TimeAxisView::get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& result)
861 TimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& result)
867 TimeAxisView::add_ghost (RegionView* rv) {
868 GhostRegion* gr = rv->add_ghost (*this);
871 ghosts.push_back(gr);
872 gr->GoingAway.connect (mem_fun(*this, &TimeAxisView::erase_ghost));
877 TimeAxisView::remove_ghost (RegionView* rv) {
878 rv->remove_ghost_in (*this);
882 TimeAxisView::erase_ghost (GhostRegion* gr) {
887 list<GhostRegion*>::iterator i;
889 for (i = ghosts.begin(); i != ghosts.end(); ++i) {
898 TimeAxisView::touched (double top, double bot)
900 /* remember: this is X Window - coordinate space starts in upper left and moves down.
901 y_position is the "origin" or "top" of the track.
904 double mybot = y_position + height;
906 return ((y_position <= bot && y_position >= top) ||
907 ((mybot <= bot) && (top < mybot)) ||
908 (mybot >= bot && y_position < top));
912 TimeAxisView::set_parent (TimeAxisView& p)
918 TimeAxisView::has_state () const
924 TimeAxisView::get_parent_with_state ()
930 if (parent->has_state()) {
934 return parent->get_parent_with_state ();
938 TimeAxisView::set_state (const XMLNode& node)
940 const XMLProperty *prop;
942 if ((prop = node.property ("track_height")) != 0) {
944 if (prop->value() == "largest") {
945 set_height (Largest);
946 } else if (prop->value() == "large") {
948 } else if (prop->value() == "larger") {
950 } else if (prop->value() == "normal") {
952 } else if (prop->value() == "smaller") {
953 set_height (Smaller);
954 } else if (prop->value() == "small") {
957 error << string_compose(_("unknown track height name \"%1\" in XML GUI information"), prop->value()) << endmsg;
967 TimeAxisView::reset_height()
969 set_height_pixels (height);
971 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
972 (*i)->set_height_pixels ((TrackHeight)(*i)->height);
977 TimeAxisView::height_to_pixels (TrackHeight h)
994 // what is wrong with gcc ?
1000 TimeAxisView::compute_controls_size_info ()
1002 Gtk::Window window (Gtk::WINDOW_TOPLEVEL);
1003 Gtk::Table two_row_table (2, 8);
1004 Gtk::Table one_row_table (1, 8);
1006 const int border_width = 2;
1007 const int extra_height = (2 * border_width) + 2; // 2 pixels for the controls frame
1009 window.add (one_row_table);
1011 one_row_table.set_border_width (border_width);
1012 one_row_table.set_row_spacings (0);
1013 one_row_table.set_col_spacings (0);
1014 one_row_table.set_homogeneous (true);
1016 two_row_table.set_border_width (border_width);
1017 two_row_table.set_row_spacings (0);
1018 two_row_table.set_col_spacings (0);
1019 two_row_table.set_homogeneous (true);
1021 for (int i = 0; i < 5; ++i) {
1022 buttons[i] = manage (new Button (X_("f")));
1023 buttons[i]->set_name ("TrackMuteButton");
1026 one_row_table.attach (*buttons[0], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1028 one_row_table.show_all ();
1029 Gtk::Requisition req(one_row_table.size_request ());
1032 // height required to show 1 row of buttons
1034 hSmaller = req.height + extra_height;
1037 window.add (two_row_table);
1039 two_row_table.attach (*buttons[1], 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1040 two_row_table.attach (*buttons[2], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1041 two_row_table.attach (*buttons[3], 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1042 two_row_table.attach (*buttons[4], 8, 9, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
1044 two_row_table.show_all ();
1045 req = two_row_table.size_request ();
1047 // height required to show all normal buttons
1049 hNormal = req.height + extra_height;
1051 // these heights are all just larger than normal. no more
1052 // elements are visible (yet).
1054 hLarger = hNormal + 50;
1055 hLarge = hNormal + 150;
1056 hLargest = hNormal + 250;
1058 // height required to show track name
1064 TimeAxisView::show_name_label ()
1066 if (!(name_packing & NameLabelPacked)) {
1067 name_hbox.pack_start (name_label, true, true);
1068 name_packing = NamePackingBits (name_packing | NameLabelPacked);
1075 TimeAxisView::show_name_entry ()
1077 if (!(name_packing & NameEntryPacked)) {
1078 name_hbox.pack_start (name_entry, true, true);
1079 name_packing = NamePackingBits (name_packing | NameEntryPacked);
1086 TimeAxisView::hide_name_label ()
1088 if (name_packing & NameLabelPacked) {
1089 name_hbox.remove (name_label);
1090 name_packing = NamePackingBits (name_packing & ~NameLabelPacked);
1095 TimeAxisView::hide_name_entry ()
1097 if (name_packing & NameEntryPacked) {
1098 name_hbox.remove (name_entry);
1099 name_packing = NamePackingBits (name_packing & ~NameEntryPacked);
1104 TimeAxisView::color_handler ()
1106 for (list<GhostRegion*>::iterator i=ghosts.begin(); i != ghosts.end(); i++ ) {
1110 for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
1112 (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
1113 (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1115 (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1116 (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1118 (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1119 (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1122 for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i) {
1124 (*i)->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
1125 (*i)->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1127 (*i)->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1128 (*i)->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1130 (*i)->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1131 (*i)->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
1136 TimeAxisView::covers_y_position (double y)
1142 if (y_position <= y && y < (y_position + height)) {
1146 for (Children::iterator i = children.begin(); i != children.end(); ++i) {
1149 if ((tv = (*i)->covers_y_position (y)) != 0) {
1158 TimeAxisView::show_temporary_lines (const AnalysisFeatureList& pos)
1160 while (temp_lines.size()< pos.size()) {
1161 ArdourCanvas::SimpleLine* l = new ArdourCanvas::SimpleLine (*canvas_display);
1162 l->property_color_rgba() = (guint) ARDOUR_UI::config()->canvasvar_ZeroLine.get();
1163 l->property_y1() = 0;
1164 l->property_y2() = height;
1165 temp_lines.push_back (l);
1168 while (temp_lines.size() > pos.size()) {
1169 ArdourCanvas::SimpleLine *line = temp_lines.back();
1170 temp_lines.pop_back ();
1174 AnalysisFeatureList::const_iterator i;
1175 list<ArdourCanvas::SimpleLine*>::iterator l;
1177 for (i = pos.begin(), l = temp_lines.begin(); i != pos.end() && l != temp_lines.end(); ++i, ++l) {
1178 (*l)->property_x1() = editor.frame_to_pixel (*i);
1179 (*l)->property_x2() = editor.frame_to_pixel (*i);
1184 TimeAxisView::hide_temporary_lines ()
1186 for (list<ArdourCanvas::SimpleLine*>::iterator l = temp_lines.begin(); l != temp_lines.end(); ++l) {