#include "canvas/rectangle.h"
#include "canvas/debug.h"
+#include "ardour/profile.h"
+
#include "ardour_ui.h"
#include "ardour_dialog.h"
#include "global_signals.h"
using namespace Gtk;
using namespace Gdk;
using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Editing;
using namespace ArdourCanvas;
uint32_t TimeAxisView::button_height = 0;
uint32_t TimeAxisView::extra_height = 0;
int const TimeAxisView::_max_order = 512;
+unsigned int TimeAxisView::name_width_px = 100; // TODO adjust with font-scaling on style-change
PBD::Signal1<void,TimeAxisView*> TimeAxisView::CatchDeletion;
+Glib::RefPtr<Gtk::SizeGroup> TimeAxisView::controls_meters_size_group = Glib::RefPtr<Gtk::SizeGroup>();
TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
: AxisView (sess)
- , controls_table (2, 8)
+ , controls_table (3, 3)
+ , controls_button_size_group (Gtk::SizeGroup::create (Gtk::SIZE_GROUP_BOTH))
, _name_editing (false)
, height (0)
, display_menu (0)
, _have_preresize_cursor (false)
, _ebox_release_can_act (true)
{
+ if (!controls_meters_size_group) {
+ controls_meters_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
+ }
if (extra_height == 0) {
compute_heights ();
}
name_label.set_name ("TrackLabel");
name_label.set_alignment (0.0, 0.5);
+ name_label.set_width_chars (12);
ARDOUR_UI::instance()->set_tip (name_label, _("Track/Bus name (double click to edit)"));
Gtk::Entry* an_entry = new Gtk::Entry;
Gtk::Requisition req;
an_entry->size_request (req);
name_label.set_size_request (-1, req.height);
+ name_label.set_ellipsize (Pango::ELLIPSIZE_MIDDLE);
delete an_entry;
- name_hbox.pack_start (name_label, true, true);
+ name_hbox.pack_end (name_label, true, true);
+
+ // set min. track-header width if fader is not visible
+ name_hbox.set_size_request(name_width_px, 0);
+
name_hbox.show ();
name_label.show ();
-
- controls_table.set_size_request (200);
+
controls_table.set_row_spacings (2);
controls_table.set_col_spacings (2);
controls_table.set_border_width (2);
- controls_table.set_homogeneous (true);
- controls_table.attach (name_hbox, 0, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0);
+ if (ARDOUR::Profile->get_mixbus() ) {
+ controls_table.attach (name_hbox, 4, 5, 0, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ } else {
+ controls_table.attach (name_hbox, 1, 2, 0, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ }
controls_table.show_all ();
controls_table.set_no_show_all ();
- HSeparator* separator = manage (new HSeparator());
- separator->set_name("TrackSeparator");
- separator->set_size_request(-1, 1);
- separator->show();
-
controls_vbox.pack_start (controls_table, false, false);
controls_vbox.show ();
- controls_hbox.pack_start (controls_vbox, true, true);
- controls_hbox.show ();
+ top_hbox.pack_start (controls_vbox, true, true);
+ top_hbox.show ();
- //controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
- controls_ebox.add (controls_hbox);
+ controls_ebox.add (top_hbox);
controls_ebox.add_events (Gdk::BUTTON_PRESS_MASK|
Gdk::BUTTON_RELEASE_MASK|
Gdk::POINTER_MOTION_MASK|
controls_ebox.signal_leave_notify_event().connect (sigc::mem_fun (*this, &TimeAxisView::controls_ebox_leave));
controls_ebox.show ();
- time_axis_vbox.pack_start (controls_ebox, true, true, 0);
+ time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE);
+ time_axis_frame.add(controls_ebox);
+ time_axis_frame.show();
+
+ HSeparator* separator = manage (new HSeparator());
+ separator->set_name("TrackSeparator");
+ separator->set_size_request(-1, 1);
+ separator->show();
+
+ time_axis_vbox.pack_start (time_axis_frame, true, true);
time_axis_vbox.pack_end (*separator, false, false);
time_axis_vbox.show();
name_entry = manage (new Gtkmm2ext::FocusEntry);
+ name_entry->set_width_chars(8); // min width, entry expands
+
name_entry->set_name ("EditorTrackNameDisplay");
name_entry->signal_key_press_event().connect (sigc::mem_fun (*this, &TimeAxisView::name_entry_key_press), false);
name_entry->signal_key_release_event().connect (sigc::mem_fun (*this, &TimeAxisView::name_entry_key_release), false);
name_hbox.remove (name_label);
}
- name_hbox.pack_start (*name_entry);
+ name_hbox.pack_end (*name_entry, true, true);
name_entry->show ();
name_entry->select_region (0, -1);
/* put the name label back */
- name_hbox.pack_start (name_label);
+ name_hbox.pack_end (name_label);
name_label.show ();
if (edit_next) {
}
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
- _editor.ensure_time_axis_view_is_visible (**i);
+ _editor.ensure_time_axis_view_is_visible (**i, false);
(*i)->begin_name_edit ();
}
}
if ((i != allviews.end()) && (*i != this) && !(*i)->hidden()) {
- _editor.ensure_time_axis_view_is_visible (**i);
+ _editor.ensure_time_axis_view_is_visible (**i, false);
(*i)->begin_name_edit ();
}
}
Selectable::set_selected (yn);
if (_selected) {
+ time_axis_frame.set_shadow_type (Gtk::SHADOW_IN);
+ time_axis_frame.set_name ("MixerStripSelectedFrame");
controls_ebox.set_name (controls_base_selected_name);
- time_axis_vbox.set_name (controls_base_selected_name);
controls_vbox.set_name (controls_base_selected_name);
+ time_axis_vbox.set_name (controls_base_selected_name);
} else {
+ time_axis_frame.set_shadow_type (Gtk::SHADOW_NONE);
+ time_axis_frame.set_name (controls_base_unselected_name);
controls_ebox.set_name (controls_base_unselected_name);
- time_axis_vbox.set_name (controls_base_unselected_name);
controls_vbox.set_name (controls_base_unselected_name);
+ time_axis_vbox.set_name (controls_base_unselected_name);
+
hide_selection ();
/* children will be set for the yn=true case. but when deselecting
(*i)->set_selected (false);
}
}
+
+ time_axis_frame.show();
+
}
void
double x1;
double x2;
double y2;
- SelectionRect *rect;
+ SelectionRect *rect; time_axis_frame.show();
+
for (Children::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->show_selection (ts);
x1 = _editor.sample_to_pixel (start);
x2 = _editor.sample_to_pixel (start + cnt - 1);
- y2 = current_height();
+ y2 = current_height() - 1;
- rect->rect->set (ArdourCanvas::Rect (x1, 1, x2, y2));
+ rect->rect->set (ArdourCanvas::Rect (x1, 0, x2, y2));
// trim boxes are at the top for selections
void
TimeAxisView::compute_heights ()
{
+ // TODO this function should be re-evaluated when font-scaling changes (!)
Gtk::Window window (Gtk::WINDOW_TOPLEVEL);
- Gtk::Table two_row_table (2, 8);
- Gtk::Table one_row_table (1, 8);
- Button* buttons[5];
+ Gtk::Table one_row_table (1, 1);
+ ArdourButton* test_button = manage (new ArdourButton);
const int border_width = 2;
-
- const int separator_height = 2;
- extra_height = (2 * border_width) + separator_height;
+ const int frame_height = 2;
+ extra_height = (2 * border_width) + frame_height;
window.add (one_row_table);
+ test_button->set_name ("mute button");
+ test_button->set_text (_("M"));
one_row_table.set_border_width (border_width);
- one_row_table.set_row_spacings (0);
- one_row_table.set_col_spacings (0);
- one_row_table.set_homogeneous (true);
-
- two_row_table.set_border_width (border_width);
- two_row_table.set_row_spacings (0);
- two_row_table.set_col_spacings (0);
- two_row_table.set_homogeneous (true);
-
- for (int i = 0; i < 5; ++i) {
- buttons[i] = manage (new Button (X_("f")));
- buttons[i]->set_name ("TrackMuteButton");
- }
-
- one_row_table.attach (*buttons[0], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
+ one_row_table.set_row_spacings (2);
+ one_row_table.set_col_spacings (2);
+ one_row_table.attach (*test_button, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
one_row_table.show_all ();
- Gtk::Requisition req(one_row_table.size_request ());
- // height required to show 1 row of buttons
+ Gtk::Requisition req(one_row_table.size_request ());
button_height = req.height;
}