diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index ededd0584c..71c6d4a8cd 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1078,12 +1078,8 @@ ARDOUR_UI::ask_about_saving_session (const vector& actions) if (_session->snap_name() == _session->name()) { prompt = string_compose(_("Do you want to save changes to \"%1\"?\n"), _session->snap_name()); bottom_prompt = _("Changes will be lost if you choose \"don't save\"\n"); - - session_close_dialog._top_label.set_text(prompt); - - - session_close_dialog._bottom_label.set_text(bottom_prompt); - session_close_dialog._bottom_label.set_alignment(ALIGN_CENTER); + session_close_dialog.set_top_label (prompt); + session_close_dialog.set_bottom_label (bottom_prompt); } else { prompt = string_compose(_("The snapshot \"%1\"\nhas not been saved.\n\nAny changes made this time\nwill be lost unless you save it.\n\nWhat do you want to do?"), _session->snap_name()); diff --git a/gtk2_ardour/session_close_dialog.cc b/gtk2_ardour/session_close_dialog.cc index 8093049970..ae7bab6fa2 100644 --- a/gtk2_ardour/session_close_dialog.cc +++ b/gtk2_ardour/session_close_dialog.cc @@ -1,10 +1,20 @@ -// -// session_close_dialog.cpp -// Tracks -// -// Created by User on 6/12/14. -// -// +/* + Copyright (C) 2014 Waves Audio Ltd. + + 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. + */ #include "session_close_dialog.h" @@ -20,6 +30,7 @@ #include #include "dbg_msg.h" +#include "utils.h" #include "i18n.h" @@ -68,3 +79,16 @@ SessionCloseDialog::on_save (WavesButton*) response (Gtk::RESPONSE_YES); } +void +SessionCloseDialog::set_top_label (std::string message) +{ + const size_t n_characters_in_line = 400 / 7; // 400 - size of the label, see session_close_dialog.xml, 7 - average width of the one character + _top_label.set_text ( ARDOUR_UI_UTILS::split_on_lines (message, n_characters_in_line) ); +} + +void +SessionCloseDialog::set_bottom_label (std::string message) +{ + const size_t n_characters_in_line = 400 / 6; // 400 - size of the label, see session_close_dialog.xml, 6 - average width of the one character + _bottom_label.set_text ( ARDOUR_UI_UTILS::split_on_lines (message, n_characters_in_line) ); +} diff --git a/gtk2_ardour/session_close_dialog.h b/gtk2_ardour/session_close_dialog.h index 29b5ee2981..b9b64babb7 100644 --- a/gtk2_ardour/session_close_dialog.h +++ b/gtk2_ardour/session_close_dialog.h @@ -1,10 +1,20 @@ -// -// session_close_dialog.h -// Tracks -// -// Created by User on 6/12/14. -// -// +/* + Copyright (C) 2014 Waves Audio Ltd. + + 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. + */ #ifndef __Tracks__session_close_dialog__ #define __Tracks__session_close_dialog__ @@ -18,6 +28,8 @@ class SessionCloseDialog : public WavesDialog { public: SessionCloseDialog (); + void set_top_label (std::string message); + void set_bottom_label (std::string message); private: WavesButton& _cancel_button; @@ -28,7 +40,6 @@ private: void on_dont_save(WavesButton*); void on_save(WavesButton*); -public: Gtk::Label& _top_label; Gtk::Label& _bottom_label; }; diff --git a/gtk2_ardour/ui/session_close_dialog.xml b/gtk2_ardour/ui/session_close_dialog.xml index ad4e308f1d..12b69bee2f 100755 --- a/gtk2_ardour/ui/session_close_dialog.xml +++ b/gtk2_ardour/ui/session_close_dialog.xml @@ -1,5 +1,7 @@ - +