diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 146aabd136..92c02c07f4 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2971,6 +2971,14 @@ ARDOUR_UI::close_session() int ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, std::string mix_template) { + ProgressDialog::instance()->set_top_label ("Loading session: "+path); + ProgressDialog::instance()->update_info (0.0, NULL, NULL, "Loading audio..."); + ProgressDialog::instance()->show (); + /* Make sure the progress dialog is drawn */ + while (Glib::MainContext::get_default()->iteration (false)) { + /* do nothing */ + } + Session *new_session; int unload_status; int retval = -1; @@ -2988,10 +2996,10 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, session_loaded = false; - loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME)); - + ProgressDialog::instance()->set_progress (0.1); try { new_session = new Session (*AudioEngine::instance(), path, snap_name, 0, mix_template); + ProgressDialog::instance()->update_info (0.4, NULL, NULL, "Loading elements..."); } /* this one is special */ @@ -3072,6 +3080,8 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, retval = 0; out: + ProgressDialog::instance()->set_progress (1); + ProgressDialog::instance()->hide (); return retval; } diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 829519e293..83ccb00721 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -89,6 +89,7 @@ #include "global_port_matrix.h" #include "keyeditor.h" #include "location_ui.h" +#include "progress_dialog.h" #include "rc_option_editor.h" #include "route_params_ui.h" #include "session_option_editor.h" diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 938ed19cba..cea6fc0779 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1375,20 +1375,32 @@ Editor::set_session (Session *t) return; } + ProgressDialog::instance()->set_progress (0.4); _playlist_selector->set_session (_session); nudge_clock->set_session (_session); _summary->set_session (_session); + ProgressDialog::instance()->set_progress (0.45); _group_tabs->set_session (_session); _route_groups->set_session (_session); + ProgressDialog::instance()->set_progress (0.5); _regions->set_session (_session); + ProgressDialog::instance()->set_progress (0.55); _snapshots->set_session (_session); + ProgressDialog::instance()->set_progress (0.6); _routes->set_session (_session); + ProgressDialog::instance()->set_progress (0.65); _locations->set_session (_session); + ProgressDialog::instance()->set_progress (0.7); _compact_meter_bridge.set_session (_session); + ProgressDialog::instance()->set_progress (0.75); _mixer_bridge_view.set_max_name_size(mixer_bridge_strip_max_name_size); + ProgressDialog::instance()->set_progress (0.8); _mixer_bridge_view.set_session (_session); + ProgressDialog::instance()->set_progress (0.85); _meter_bridge_view.set_max_name_size(meter_bridge_strip_max_name_size); + ProgressDialog::instance()->set_progress (0.9); _meter_bridge_view.set_session (_session); + ProgressDialog::instance()->set_progress (0.95); if (rhythm_ferret) { rhythm_ferret->set_session (_session); diff --git a/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj b/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj index 75af5132f3..0f2d116f48 100644 --- a/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj +++ b/gtk2_ardour/macosx/tracks.xcodeproj/project.pbxproj @@ -269,6 +269,8 @@ 43279460194F0062003C9FEA /* tracks_preferences.xml in Resources */ = {isa = PBXBuildFile; fileRef = 43279430194F0062003C9FEA /* tracks_preferences.xml */; }; 4327947F194F009E003C9FEA /* tracks.menus.in in Resources */ = {isa = PBXBuildFile; fileRef = 43279475194F009E003C9FEA /* tracks.menus.in */; }; 43B351ED194F04E00038C140 /* step_editing.bindings in Resources */ = {isa = PBXBuildFile; fileRef = 43B351C0194F04E00038C140 /* step_editing.bindings */; }; + 5BC67E591A408FCE00F29ABA /* progress_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 5BC67E581A408FCE00F29ABA /* progress_dialog.xml */; }; + 5BC67E5F1A4090BD00F29ABA /* progress_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 5BC67E5E1A4090BD00F29ABA /* progress_dialog.cc */; }; 95176F7A1A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc in Sources */ = {isa = PBXBuildFile; fileRef = 95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */; }; 95176F7E1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95176F7D1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml */; }; 95176F871A092A2900E32046 /* yes_no_dialog.xml in Resources */ = {isa = PBXBuildFile; fileRef = 95176F851A092A2900E32046 /* yes_no_dialog.xml */; }; @@ -1124,6 +1126,9 @@ 43B351EE194F12FB0038C140 /* waves_audiobackend.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = waves_audiobackend.xcodeproj; path = ../../libs/backends/wavesaudio/macosx/waves_audiobackend.xcodeproj; sourceTree = ""; }; 43B351F4194F130C0038C140 /* libardour.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libardour.xcodeproj; path = ../../libs/ardour/macosx/libardour.xcodeproj; sourceTree = ""; }; 43B351FA194F131D0038C140 /* pbd.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = pbd.xcodeproj; path = ../../libs/pbd/macosx/pbd.xcodeproj; sourceTree = ""; }; + 5BC67E581A408FCE00F29ABA /* progress_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = progress_dialog.xml; sourceTree = ""; }; + 5BC67E5D1A4090AA00F29ABA /* progress_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = progress_dialog.h; path = ../progress_dialog.h; sourceTree = ""; }; + 5BC67E5E1A4090BD00F29ABA /* progress_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = progress_dialog.cc; path = ../progress_dialog.cc; sourceTree = ""; }; 95176F781A08E6D800E32046 /* file_sample_rate_mismatch_dialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = file_sample_rate_mismatch_dialog.h; path = ../file_sample_rate_mismatch_dialog.h; sourceTree = ""; }; 95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = file_sample_rate_mismatch_dialog.cc; path = ../file_sample_rate_mismatch_dialog.cc; sourceTree = ""; }; 95176F7D1A08E76F00E32046 /* file_sample_rate_mismatch_dialog.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = file_sample_rate_mismatch_dialog.xml; sourceTree = ""; }; @@ -1235,6 +1240,7 @@ 43279040194EFF38003C9FEA /* source */ = { isa = PBXGroup; children = ( + 5BC67E5E1A4090BD00F29ABA /* progress_dialog.cc */, 957EF44A1A30BFB300F1500E /* waves_message_dialog.cc */, 95176F8E1A092A5B00E32046 /* yes_no_dialog.cc */, 95176F791A08E6E800E32046 /* file_sample_rate_mismatch_dialog.cc */, @@ -1837,6 +1843,7 @@ 43279429194F0062003C9FEA /* ui */ = { isa = PBXGroup; children = ( + 5BC67E581A408FCE00F29ABA /* progress_dialog.xml */, 95F9DFD81A35F3310007E953 /* waves_clean_up_dialog.xml */, 95F9DFD91A35F3310007E953 /* waves_connect_to_backend_error_dialog.xml */, 95F9DFDA1A35F3310007E953 /* waves_excessive_split_dialog.xml */, @@ -1892,6 +1899,7 @@ 43279480194F00CB003C9FEA /* headers */ = { isa = PBXGroup; children = ( + 5BC67E5D1A4090AA00F29ABA /* progress_dialog.h */, 957EF44F1A30BFBF00F1500E /* waves_message_dialog.h */, 95176F8C1A092A4700E32046 /* yes_no_dialog.h */, 95176F781A08E6D800E32046 /* file_sample_rate_mismatch_dialog.h */, @@ -2575,6 +2583,7 @@ 952E0B3C1A0A1D7000F375D0 /* buildlog.txt in Resources */, 95F9DFD71A35A8BD0007E953 /* waves_message_dialog.xml in Resources */, CEB9D794197516BE00B21780 /* inspector_gain_meter.xml in Resources */, + 5BC67E591A408FCE00F29ABA /* progress_dialog.xml in Resources */, CEB9D795197516BE00B21780 /* master_ui_gain_meter.xml in Resources */, CEB9D796197516BE00B21780 /* master_ui.xml in Resources */, CEB9D797197516BE00B21780 /* meter_strip.xml in Resources */, @@ -2617,6 +2626,7 @@ CE294C7619CAD54500D12768 /* mixer_bridge_view.cc in Sources */, CE294C7719CAD54500D12768 /* open_file_dialog_nix.cc in Sources */, CE294C7819CAD54500D12768 /* open_file_dialog_windows.cc in Sources */, + 5BC67E5F1A4090BD00F29ABA /* progress_dialog.cc in Sources */, CE294C7919CAD54500D12768 /* ruler_dialog.cc in Sources */, CE294C7A19CAD54500D12768 /* soundcloud_export_selector.cc in Sources */, CE294C7B19CAD54500D12768 /* waves_dropdown.cc in Sources */, diff --git a/gtk2_ardour/progress_dialog.cc b/gtk2_ardour/progress_dialog.cc new file mode 100644 index 0000000000..ba301550a5 --- /dev/null +++ b/gtk2_ardour/progress_dialog.cc @@ -0,0 +1,99 @@ +/* + 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 +#include +#include "progress_dialog.h" +#include "i18n.h" + +using namespace Gtk; +//ProgressDialog *ProgressDialog::theProgressDialog = 0; + +ProgressDialog::ProgressDialog (const std::string& title, + const std::string& top_message, + const std::string& progress_message, + const std::string& bottom_message) +: WavesDialog ( _("progress_dialog.xml"), true, false ) +, _top_label ( get_label ("top_label") ) +, _bottom_label ( get_label ("bottom_label") ) +, _progress_bar (get_progressbar ("progress_bar")) +{ + init (title, top_message, progress_message, bottom_message); +} + +ProgressDialog* +ProgressDialog::instance () +{ + static ProgressDialog theProgressDialog; + return &theProgressDialog; +} + +void +ProgressDialog::init (const std::string& title, + const std::string& top_message, + const std::string& progress_message, + const std::string& bottom_message) +{ + set_modal (true); + set_resizable (false); + set_position (Gtk::WIN_POS_CENTER_ALWAYS); + set_type_hint (Gdk::WINDOW_TYPE_HINT_NORMAL); + + + set_title (title); + set_top_label (top_message); + set_progress_label (progress_message); + set_bottom_label (bottom_message); +} + +void +ProgressDialog::set_top_label (std::string message) +{ + _top_label.set_text (message); +} + +void +ProgressDialog::set_progress_label (std::string message) +{ + _progress_bar.set_text (message); +} + +void +ProgressDialog::set_bottom_label (std::string message) +{ + _bottom_label.set_text (message); +} + +void +ProgressDialog::update_info (double new_progress, const char* top_message, const char* progress_message, const char* bottom_message) +{ + update_progress_gui (new_progress); + if (top_message) + set_top_label (top_message); + if (progress_message) + set_progress_label (progress_message); + if (bottom_message) + set_bottom_label (bottom_message); +} + +void +ProgressDialog::update_progress_gui (float p) +{ + _progress_bar.set_fraction (p); +} \ No newline at end of file diff --git a/gtk2_ardour/progress_dialog.h b/gtk2_ardour/progress_dialog.h new file mode 100644 index 0000000000..f7c825330e --- /dev/null +++ b/gtk2_ardour/progress_dialog.h @@ -0,0 +1,57 @@ +/* + 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 __progress_dialog_h__ +#define __progress_dialog_h__ + +#include "waves_dialog.h" +#include "progress_reporter.h" + +namespace Gtk { + class Label; + class ProgressBar; +} + +class ProgressDialog : public WavesDialog, public ProgressReporter +{ +public: + static ProgressDialog *instance (); + void set_top_label (std::string message); + void set_progress_label (std::string message); + void set_bottom_label (std::string message); + void update_info (double new_progress, const char* top_message, const char* progress_message, const char* bottom_message); + +private: + ProgressDialog (const std::string& title="", + const std::string& top_message="", + const std::string& progress_message="", + const std::string& bottom_message=""); + ~ProgressDialog () {} + void update_progress_gui (float); + void init (const std::string& title, + const std::string& top_message, + const std::string& progress_message, + const std::string& bottom_message); + + + Gtk::Label& _top_label; + Gtk::Label& _bottom_label; + Gtk::ProgressBar& _progress_bar; +}; + +#endif /* __progress_dialog_h__ */ \ No newline at end of file diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index 317764e0db..b2d88c06f4 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -225,8 +225,6 @@ Splash::message (const string& msg) str += Glib::Markup::escape_text (msg); str += ""; - show (); - layout->set_markup (str); Glib::RefPtr win = darea.get_window(); diff --git a/gtk2_ardour/ui/progress_dialog.xml b/gtk2_ardour/ui/progress_dialog.xml new file mode 100644 index 0000000000..df00d63e3a --- /dev/null +++ b/gtk2_ardour/ui/progress_dialog.xml @@ -0,0 +1,68 @@ + + + +