X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fautomation_time_axis.cc;h=c3f53d266c5740ea6d119a9ee1bda5852cad1c56;hb=691b0c10ac8089efa015e88513d309768fe0f44b;hp=424564f18bb297654ed31eca252c9a25c0501f6e;hpb=fd289ac9677d93f816038871440e52f20dd891fb;p=ardour.git diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 424564f18b..c3f53d266c 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 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 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 14) { - pname = pname.substr (0, 11); - pname += "..."; + string pname = fit_to_pixels (nomparent, 60, name_font, ignore_width, true); + if (pname != nomparent) { shortened = true; } @@ -153,10 +158,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptrname() << ") but found nothing\n"; - } + } /* make sure labels etc. are correct */ @@ -571,7 +573,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS case Cut: if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) { editor.get_cut_buffer().add (what_we_got); - _session.add_command (new MementoCommand(alist, &before, &alist.get_state())); + _session.add_command (new MementoCommand(alist, new XMLNode (before), &alist.get_state())); ret = true; } break; @@ -583,7 +585,7 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS case Clear: if ((what_we_got = alist.cut ((*i).start, (*i).end)) != 0) { - _session.add_command (new MementoCommand(alist, &before, &alist.get_state())); + _session.add_command (new MementoCommand(alist, new XMLNode (before), &alist.get_state())); delete what_we_got; what_we_got = 0; ret = true; @@ -591,7 +593,9 @@ AutomationTimeAxisView::cut_copy_clear_objects_one (AutomationLine& line, PointS break; } } - + + delete &before; + if (what_we_got) { for (AutomationList::iterator x = what_we_got->begin(); x != what_we_got->end(); ++x) { double foo = (*x)->value;