#include "gtkmm2ext/actions.h"
#include "gtkmm2ext/gui_thread.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace Gtkmm2ext;
using namespace Gtk;
using std::map;
UI* UI::theGtkUI = 0;
-float UI::ui_scale = 1.0;
BaseUI::RequestType Gtkmm2ext::NullMessage = BaseUI::new_request_type();
BaseUI::RequestType Gtkmm2ext::ErrorMessage = BaseUI::new_request_type();
if (!bindings) {
bindings = global_bindings;
}
-
+
if (bindings) {
Bindings::Operation op;
KeyboardKey kb = bindings->get_binding_for_action (action, op);
}
void
-UI::flush_pending ()
+UI::flush_pending (float timeout)
{
if (!caller_is_ui_thread()) {
error << "non-UI threads cannot call UI::flush_pending()"
return;
}
+ int64_t end = g_get_monotonic_time () + timeout * 1e6;
+
gtk_main_iteration();
while (gtk_events_pending()) {
+ if (timeout > 0 && end < g_get_monotonic_time ()) {
+ cerr << "UI::flush_pending timed out after " << timeout << "s.\n";
+ break;
+ }
gtk_main_iteration();
}
}
return true;
}
-Gdk::Color
-UI::get_color (const string& prompt, bool& picked, const Gdk::Color* initial)
-{
- Gdk::Color color;
-
- ColorSelectionDialog color_dialog (prompt);
-
- color_dialog.set_modal (true);
- color_dialog.get_cancel_button()->signal_clicked().connect (bind (mem_fun (*this, &UI::color_selection_done), false));
- color_dialog.get_ok_button()->signal_clicked().connect (bind (mem_fun (*this, &UI::color_selection_done), true));
- color_dialog.signal_delete_event().connect (mem_fun (*this, &UI::color_selection_deleted));
-
- if (initial) {
- color_dialog.get_colorsel()->set_current_color (*initial);
- }
-
- color_dialog.show_all ();
- color_picked = false;
- picked = false;
-
- Main::run();
-
- color_dialog.hide_all ();
-
- if (color_picked) {
- Gdk::Color f_rgba = color_dialog.get_colorsel()->get_current_color ();
- color.set_red(f_rgba.get_red());
- color.set_green(f_rgba.get_green());
- color.set_blue(f_rgba.get_blue());
-
- picked = true;
- }
-
- return color;
-}
-
void
UI::color_selection_done (bool status)
{