/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
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
}
}
+void
+checked_set (wxSpinCtrlDouble* widget, double value)
+{
+ /* XXX: completely arbitrary epsilon */
+ if (fabs (widget->GetValue() - value) > 1e-16) {
+ widget->SetValue (value);
+ }
+}
+
void
checked_set (wxChoice* widget, int value)
{
locale->AddCatalogLookupPathPrefix (POSIX_LOCALE_PREFIX);
#endif
+#ifdef DCPOMATIC_LINUX
+ /* We have to include the wxWidgets .mo in our distribution,
+ so we rename it to avoid clashes with any other installation
+ of wxWidgets.
+ */
+ locale->AddCatalog (wxT ("dcpomatic-wxstd"));
+#endif
+
locale->AddCatalog (wxT ("libdcpomatic-wx"));
locale->AddCatalog (wxT ("dcpomatic"));
return w->GetSelection ();
}
-void
-run_gui_loop ()
+double
+wx_get (wxSpinCtrlDouble* w)
{
- while (wxTheApp->Pending ()) {
- wxTheApp->Dispatch ();
+ return w->GetValue ();
+}
+
+/** @param s String of the form Context|String
+ * @return translation, or String if no translation is available.
+ */
+wxString
+context_translation (wxString s)
+{
+ wxString t = wxGetTranslation (s);
+ if (t == s) {
+ /* No translation; strip the context */
+ int c = t.Find (wxT ("|"));
+ if (c != wxNOT_FOUND) {
+ t = t.Mid (c + 1);
+ }
}
+
+ return t;
}