Use labs() for long instead of abs()
[ardour.git] / gtk2_ardour / save_template_dialog.cc
index 5d23006926194dad7255ebb71ef0ff7f116c01ff..5200a36d38cd2591985b0fe90c27c8a6f974f390 100644 (file)
@@ -1,40 +1,40 @@
 /*
-    Copyright (C) 2017 Paul Davis
-    Author: Johannes Mueller
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2017-2018 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2017 Johannes Mueller <github@johannes-mueller.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include <gtkmm/box.h>
 #include <gtkmm/frame.h>
 #include <gtkmm/label.h>
 #include <gtkmm/stock.h>
 
-#include "pbd/i18n.h"
 #include "ardour/session.h"
 
 #include "save_template_dialog.h"
 
+#include "pbd/i18n.h"
+
 using namespace Gtk;
 using namespace ARDOUR;
 
 SaveTemplateDialog::SaveTemplateDialog (const std::string& name, const std::string& desc)
        : ArdourDialog (_("Save as template"))
 {
-       _name_entry.get_buffer()->set_text (name + _("-template"));
+       _name_entry.get_buffer()->set_text (name);
        _description_editor.get_buffer()->set_text (desc);
        _description_editor.set_wrap_mode (Gtk::WRAP_WORD);
        _description_editor.set_size_request(400, 300);
@@ -68,5 +68,11 @@ SaveTemplateDialog::get_template_name () const
 std::string
 SaveTemplateDialog::get_description () const
 {
-       return _description_editor.get_buffer()->get_text();
+       std::string desc_txt = _description_editor.get_buffer()->get_text ();
+       std::string::reverse_iterator wss = desc_txt.rbegin();
+       while (wss != desc_txt.rend() && isspace (*wss)) {
+               desc_txt.erase (--(wss++).base());
+       }
+
+       return desc_txt;
 }