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"
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"
controls_base_selected_name = "AudioBusControlsBaseSelected";
controls_base_unselected_name = "AudioBusControlsBaseUnselected";
}
+
+ post_construct ();
}
AudioTimeAxisView::~AudioTimeAxisView ()
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)
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;
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);
/* 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;
}
void entered ();
void exited ();
+
+ static Pango::FontDescription name_font;
+ static bool have_name_font;
};
#endif /* __ardour_gtk_automation_time_axis_h__ */
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));
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 ();
editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
ColorChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
-
}
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)
{
ensure_xml_node ();
- _view->set_height ((double) height);
+ if (_view) {
+ _view->set_height ((double) height);
+ }
switch (height_style) {
case Largest:
void
RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
{
- _view->set_selected_regionviews (regions);
+ if (_view) {
+ _view->set_selected_regionviews (regions);
+ }
}
void
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);
}
vector<RedirectAutomationLine*> redirect_automation_curves;
sigc::connection modified_connection;
+
+ void post_construct ();
};
#endif /* __ardour_route_time_axis_h__ */
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;
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);
}
ustr.erase (last--);
+ shorter_by++;
+
+ if (with_ellipses && shorter_by > 3) {
+ txt = ustr;
+ txt += "...";
+ } else {
+ txt = ustr;
+ }
}
- return ustr;
+ return txt;
}
gint
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);