summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/ardour2_ui.rc6
-rw-r--r--gtk2_ardour/audio_time_axis.cc2
-rw-r--r--gtk2_ardour/automation_time_axis.cc29
-rw-r--r--gtk2_ardour/automation_time_axis.h3
-rw-r--r--gtk2_ardour/route_time_axis.cc34
-rw-r--r--gtk2_ardour/route_time_axis.h2
-rw-r--r--gtk2_ardour/utils.cc20
-rw-r--r--gtk2_ardour/utils.h2
8 files changed, 67 insertions, 31 deletions
diff --git a/gtk2_ardour/ardour2_ui.rc b/gtk2_ardour/ardour2_ui.rc
index d28b6622e7..81abce1830 100644
--- a/gtk2_ardour/ardour2_ui.rc
+++ b/gtk2_ardour/ardour2_ui.rc
@@ -58,6 +58,11 @@ style "plugin_maker_text"
fg[NORMAL] = { 0.80, 0.80, 0.80 }
}
+style "automation_track_name"
+{
+ font_name = "sans italic 8"
+}
+
style "first_action_message"
{
font_name = "sans medium 34"
@@ -1157,6 +1162,7 @@ widget "*EditorMainCanvas" style "main_canvas_area"
widget "*AudioTrackControlsBaseInactiveUnselected" style "track_controls_inactive"
widget "*BusControlsBaseInactiveUnselected" style "track_controls_inactive"
widget "*AutomationTrackControlsBaseInactiveUnselected" style "track_controls_inactive"
+widget "*AutomationTrackName" style "automation_track_name"
widget "*AudioTrackControlsBaseInactiveSelected" style "track_controls_inactive"
widget "*BusControlsBaseInactiveSelected" style "track_controls_inactive"
widget "*AutomationTrackControlsBaseInactiveSelected" style "track_controls_inactive"
diff --git a/gtk2_ardour/audio_time_axis.cc b/gtk2_ardour/audio_time_axis.cc
index 4ab0428a51..45c8700a6a 100644
--- a/gtk2_ardour/audio_time_axis.cc
+++ b/gtk2_ardour/audio_time_axis.cc
@@ -124,6 +124,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
controls_base_selected_name = "AudioBusControlsBaseSelected";
controls_base_unselected_name = "AudioBusControlsBaseUnselected";
}
+
+ post_construct ();
}
AudioTimeAxisView::~AudioTimeAxisView ()
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index e99d755615..776dff37f2 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -21,6 +21,9 @@ using namespace PBD;
using namespace Gtk;
using namespace Editing;
+Pango::FontDescription AutomationTimeAxisView::name_font;
+bool AutomationTimeAxisView::have_name_font = false;
+
AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Route> r, PublicEditor& e, TimeAxisView& rent,
ArdourCanvas::Canvas& canvas, const string & nom,
const string & state_name, const string & nomparent)
@@ -34,6 +37,11 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
clear_button (_("clear")),
auto_button (X_("")) /* force addition of a label */
{
+ if (!have_name_font) {
+ name_font = get_font_for_style (X_("AutomationTrackName"));
+ have_name_font = true;
+ }
+
automation_menu = 0;
in_destructor = false;
auto_off_item = 0;
@@ -84,14 +92,14 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
string shortpname = _name;
bool shortened = false;
-
- if (_name.length()) {
- if (shortpname.length() > 18) {
- shortpname = shortpname.substr (0, 16);
- shortpname += "...";
- shortened = true;
- }
+
+ int ignore_width;
+ shortpname = fit_to_pixels (_name, 60, name_font, ignore_width, true);
+
+ if (shortpname != _name ){
+ shortened = true;
}
+
name_label.set_text (shortpname);
name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
@@ -99,11 +107,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
/* limit the plug name string */
- string pname = nomparent;
-
- if (pname.length() > 14) {
- pname = pname.substr (0, 11);
- pname += "...";
+ string pname = fit_to_pixels (nomparent, 60, name_font, ignore_width, true);
+ if (pname != nomparent) {
shortened = true;
}
diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h
index 30fa71bea9..0eb525f6c1 100644
--- a/gtk2_ardour/automation_time_axis.h
+++ b/gtk2_ardour/automation_time_axis.h
@@ -121,6 +121,9 @@ class AutomationTimeAxisView : public TimeAxisView {
void entered ();
void exited ();
+
+ static Pango::FontDescription name_font;
+ static bool have_name_font;
};
#endif /* __ardour_gtk_automation_time_axis_h__ */
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index bacd9e23f4..b3a95711f1 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -186,11 +186,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
hide_button.unset_flags (Gtk::CAN_FOCUS);
visual_button.unset_flags (Gtk::CAN_FOCUS);
- /* map current state of the route */
-
- update_diskstream_display ();
- redirects_changed (0);
- reset_redirect_automation_curves ();
y_position = -1;
_route->redirects_changed.connect (mem_fun(*this, &RouteTimeAxisView::redirects_changed));
@@ -203,11 +198,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
track()->DiskstreamChanged.connect (mem_fun(*this, &RouteTimeAxisView::diskstream_changed));
get_diskstream()->SpeedChanged.connect (mem_fun(*this, &RouteTimeAxisView::speed_changed));
- /* ask for notifications of any new RegionViews */
- // FIXME: _view is NULL, but it would be nice to attach this here :/
- //_view->RegionViewAdded.connect (mem_fun(*this, &RouteTimeAxisView::region_view_added));
- //_view->attach ();
-
/* pick up the correct freeze state */
map_frozen ();
@@ -215,7 +205,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
ColorChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
-
}
RouteTimeAxisView::~RouteTimeAxisView ()
@@ -245,6 +234,17 @@ RouteTimeAxisView::~RouteTimeAxisView ()
}
void
+RouteTimeAxisView::post_construct ()
+{
+ /* map current state of the route */
+
+ update_diskstream_display ();
+ _route->foreach_redirect (this, &RouteTimeAxisView::add_redirect_to_subplugin_menu);
+ _route->foreach_redirect (this, &RouteTimeAxisView::add_existing_redirect_automation_curves);
+ reset_redirect_automation_curves ();
+}
+
+void
RouteTimeAxisView::set_playlist (boost::shared_ptr<Playlist> newplaylist)
{
boost::shared_ptr<Playlist> pl = playlist();
@@ -663,7 +663,9 @@ RouteTimeAxisView::set_height (TrackHeight h)
ensure_xml_node ();
- _view->set_height ((double) height);
+ if (_view) {
+ _view->set_height ((double) height);
+ }
switch (height_style) {
case Largest:
@@ -1032,7 +1034,9 @@ RouteTimeAxisView::set_selected_points (PointSelection& points)
void
RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
{
- _view->set_selected_regionviews (regions);
+ if (_view) {
+ _view->set_selected_regionviews (regions);
+ }
}
void
@@ -1549,7 +1553,9 @@ RouteTimeAxisView::add_redirect_automation_curve (boost::shared_ptr<Redirect> re
add_child (ran->view);
- _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_redirect), ran->view));
+ if (_view) {
+ _view->foreach_regionview (bind (mem_fun(*this, &RouteTimeAxisView::add_ghost_to_redirect), ran->view));
+ }
redirect->mark_automation_visible (what, true);
}
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 1e28a790a6..c597f2893c 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -241,6 +241,8 @@ protected:
vector<RedirectAutomationLine*> redirect_automation_curves;
sigc::connection modified_connection;
+
+ void post_construct ();
};
#endif /* __ardour_route_time_axis_h__ */
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 389d43d2f2..887494829e 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -46,11 +46,13 @@ using namespace Glib;
using namespace PBD;
ustring
-fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font, int& actual_width)
+fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font, int& actual_width, bool with_ellipses)
{
Label foo;
Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout ("");
-
+ ustring::size_type shorter_by = 0;
+ ustring txt;
+
layout->set_font_description (font);
actual_width = 0;
@@ -59,9 +61,11 @@ fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font
ustring::iterator last = ustr.end();
--last; /* now points at final entry */
+ txt = ustr;
+
while (!ustr.empty()) {
- layout->set_text (ustr);
+ layout->set_text (txt);
int width, height;
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
@@ -72,9 +76,17 @@ fit_to_pixels (const ustring& str, int pixel_width, Pango::FontDescription& font
}
ustr.erase (last--);
+ shorter_by++;
+
+ if (with_ellipses && shorter_by > 3) {
+ txt = ustr;
+ txt += "...";
+ } else {
+ txt = ustr;
+ }
}
- return ustr;
+ return txt;
}
gint
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index 244e45d260..6d5ff0702d 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -53,7 +53,7 @@ slider_position_to_gain (double pos)
return pow (2.0,(sqrt(sqrt(sqrt(pos)))*198.0-192.0)/6.0);
}
-Glib::ustring fit_to_pixels (const Glib::ustring&, int pixel_width, Pango::FontDescription& font, int& actual_width);
+Glib::ustring fit_to_pixels (const Glib::ustring&, int pixel_width, Pango::FontDescription& font, int& actual_width, bool with_ellipses = false);
gint just_hide_it (GdkEventAny*, Gtk::Window*);
void allow_keyboard_focus (bool);