2 * Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef _ardour_gtk_simpple_progress_dialog_h_
20 #define _ardour_gtk_simpple_progress_dialog_h_
22 #include <gtkmm/button.h>
23 #include <gtkmm/messagedialog.h>
24 #include <gtkmm/progressbar.h>
25 #include <gtkmm/stock.h>
27 #include "ardour/types.h"
29 class SimpleProgressDialog : public Gtk::MessageDialog
32 SimpleProgressDialog (std::string title, const Glib::SignalProxy0< void >::SlotType & cancel)
33 : MessageDialog (title, false, MESSAGE_OTHER, BUTTONS_NONE, true)
35 get_vbox()->set_size_request(400,-1);
37 pbar = manage (new Gtk::ProgressBar());
39 get_vbox()->pack_start (*pbar, PACK_SHRINK, 4);
41 Gtk::Button *cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
42 cancel_button->signal_clicked().connect (cancel);
43 cancel_button->show();
44 get_vbox()->pack_start (*cancel_button, PACK_SHRINK);
47 void update_progress (samplecnt_t c, samplecnt_t t) {
48 pbar->set_fraction ((float) c / (float) t);
49 // see also ARDOUR_UI::gui_idle_handler();
51 while (gtk_events_pending() && --timeout) {
52 gtk_main_iteration ();
56 Gtk::ProgressBar *pbar;