+
+
+int
+get_offsets (vector<Offset>& offsets)
+{
+ offsets.push_back (Offset(_("UTC-11"), -11, 0));
+ offsets.push_back (Offset(_("UTC-10"), -10, 0));
+ offsets.push_back (Offset(_("UTC-9"), -9, 0));
+ offsets.push_back (Offset(_("UTC-8"), -8, 0));
+ offsets.push_back (Offset(_("UTC-7"), -7, 0));
+ offsets.push_back (Offset(_("UTC-6"), -6, 0));
+ offsets.push_back (Offset(_("UTC-5"), -5, 0));
+ offsets.push_back (Offset(_("UTC-4:30"), -4, 30));
+ offsets.push_back (Offset(_("UTC-4"), -4, 0));
+ offsets.push_back (Offset(_("UTC-3:30"), -3, 30));
+ offsets.push_back (Offset(_("UTC-3"), -3, 0));
+ offsets.push_back (Offset(_("UTC-2"), -2, 0));
+ offsets.push_back (Offset(_("UTC-1"), -1, 0));
+ int utc = offsets.size();
+ offsets.push_back (Offset(_("UTC") , 0, 0));
+ offsets.push_back (Offset(_("UTC+1"), 1, 0));
+ offsets.push_back (Offset(_("UTC+2"), 2, 0));
+ offsets.push_back (Offset(_("UTC+3"), 3, 0));
+ offsets.push_back (Offset(_("UTC+4"), 4, 0));
+ offsets.push_back (Offset(_("UTC+5"), 5, 0));
+ offsets.push_back (Offset(_("UTC+5:30"), 5, 30));
+ offsets.push_back (Offset(_("UTC+6"), 6, 0));
+ offsets.push_back (Offset(_("UTC+7"), 7, 0));
+ offsets.push_back (Offset(_("UTC+8"), 8, 0));
+ offsets.push_back (Offset(_("UTC+9"), 9, 0));
+ offsets.push_back (Offset(_("UTC+9:30"), 9, 30));
+ offsets.push_back (Offset(_("UTC+10"), 10, 0));
+ offsets.push_back (Offset(_("UTC+11"), 11, 0));
+ offsets.push_back (Offset(_("UTC+12"), 12, 0));
+
+ return utc;
+}
+
+
+wxString
+bitmap_path (string name)
+{
+ boost::filesystem::path base;
+
+#ifdef DCPOMATIC_DEBUG
+ /* Hack to allow Linux and OS X to find icons when running from the source tree */
+ char* path = getenv ("DCPOMATIC_GRAPHICS");
+ if (path) {
+ base = path;
+ } else {
+ base = resources_path();
+ }
+#else
+ base = resources_path();
+#endif
+
+ auto p = base / name;
+ return std_to_wx (p.string());
+}
+
+
+wxString
+icon_path(string name)
+{
+ return gui_is_dark() ? bitmap_path(String::compose("%1_white.png", name)) : bitmap_path(String::compose("%1_black.png", name));
+}
+
+
+wxSize
+small_button_size (wxWindow* parent, wxString text)
+{
+ wxClientDC dc (parent);
+ auto size = dc.GetTextExtent (text);
+ size.SetHeight (-1);
+ size.IncBy (32, 0);
+ return size;
+}
+
+
+bool
+gui_is_dark ()
+{
+#if defined(DCPOMATIC_OSX) && wxCHECK_VERSION(3, 1, 0)
+ auto appearance = wxSystemSettings::GetAppearance();
+ return appearance.IsDark();
+#else
+ return false;
+#endif
+}
+
+
+#if wxCHECK_VERSION(3,1,0)
+double
+dpi_scale_factor (wxWindow* window)
+{
+ return window->GetDPIScaleFactor();
+}
+#else
+double
+dpi_scale_factor (wxWindow*)
+{
+ return 1;
+}
+#endif
+
+
+
+int
+search_ctrl_height ()
+{
+#ifdef __WXGTK3__
+ return 30;
+#else
+ return -1;
+#endif
+}
+
+
+void
+report_config_load_failure(wxWindow* parent, Config::LoadFailure what)
+{
+ switch (what) {
+ case Config::LoadFailure::CONFIG:
+ message_dialog(parent, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create."));
+ break;
+ case Config::LoadFailure::CINEMAS:
+ message_dialog(
+ parent,
+ _(wxString::Format("The cinemas list for creating KDMs (cinemas.xml) failed to load. Please check the numbered backup files in %s",
+ std_to_wx(Config::instance()->cinemas_file().parent_path().string())))
+ );
+ break;
+ case Config::LoadFailure::DKDM_RECIPIENTS:
+ message_dialog(
+ parent,
+ _(wxString::Format("The recipients list for creating DKDMs (dkdm_recipients.xml) failed to load. Please check the numbered backup files in %s",
+ std_to_wx(Config::instance()->dkdm_recipients_file().parent_path().string())))
+ );
+ break;
+ }
+}
+