/*
- Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
return m;
}
+
wxStaticText *
#ifdef __WXOSX__
add_label_to_sizer (wxSizer* s, wxStaticText* t, bool left, int prop, int flags)
return t;
}
+
wxStaticText *
add_label_to_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, bool left, wxGBPosition pos, wxGBSpan span)
{
return m;
}
+
wxStaticText *
#ifdef __WXOSX__
add_label_to_sizer (wxGridBagSizer* s, wxStaticText* t, bool left, wxGBPosition pos, wxGBSpan span)
return t;
}
+
/** Pop up an error dialogue box.
* @param parent Parent.
* @param m Message.
d->Destroy ();
}
+
/** Pop up an error dialogue box.
* @param parent Parent.
* @param m Message.
d->Destroy ();
}
+
/** @return true if the user answered "yes" */
bool
confirm_dialog (wxWindow* parent, wxString m)
{
- wxMessageDialog* d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxYES_NO | wxICON_QUESTION);
+ auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxYES_NO | wxICON_QUESTION);
int const r = d->ShowModal ();
d->Destroy ();
return r == wxID_YES;
string
wx_to_std (wxString s)
{
- return string (s.ToUTF8 ());
+ return string (s.ToUTF8());
}
+
/** @param s STL string.
* @return Corresponding wxWidgets string.
*/
return wxString (s.c_str(), wxConvUTF8);
}
+
string
string_client_data (wxClientData* o)
{
return wx_to_std (dynamic_cast<wxStringClientData*>(o)->GetData());
}
+
void
checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
{
}
}
+
void
checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value)
{
}
}
+
void
checked_set (wxSpinCtrl* widget, int value)
{
}
}
+
void
checked_set (wxSpinCtrlDouble* widget, double value)
{
}
}
+
void
checked_set (wxChoice* widget, int value)
{
}
}
+
void
checked_set (wxChoice* widget, string value)
{
}
}
+
void
checked_set (wxChoice* widget, vector<pair<string, string> > items)
{
- vector<pair<string, string> > current;
+ vector<pair<string, string>> current;
for (unsigned int i = 0; i < widget->GetCount(); ++i) {
current.push_back (
- make_pair (
- wx_to_std (widget->GetString (i)),
- string_client_data (widget->GetClientObject (i))
+ make_pair(
+ wx_to_std(widget->GetString(i)),
+ string_client_data(widget->GetClientObject(i))
)
);
}
}
}
+
void
checked_set (wxTextCtrl* widget, string value)
{
}
}
+
void
checked_set (PasswordEntry* entry, string value)
{
}
}
+
void
checked_set (wxTextCtrl* widget, wxString value)
{
}
}
+
void
checked_set (wxStaticText* widget, string value)
{
}
}
+
void
checked_set (wxStaticText* widget, wxString value)
{
}
}
+
void
checked_set (wxCheckBox* widget, bool value)
{
}
}
+
void
checked_set (wxRadioButton* widget, bool value)
{
}
}
+
void
dcpomatic_setup_i18n ()
{
}
}
+
int
wx_get (wxSpinCtrl* w)
{
return w->GetValue ();
}
+
int
wx_get (wxChoice* w)
{
return w->GetSelection ();
}
+
double
wx_get (wxSpinCtrlDouble* w)
{
return w->GetValue ();
}
+
/** @param s String of the form Context|String
* @return translation, or String if no translation is available.
*/
return t;
}
+
wxString
time_to_timecode (DCPTime t, double fps)
{
return wxString::Format (wxT("%02d:%02d:%02d.%02d"), h, m, s, f);
}
+
void
setup_audio_channels_choice (wxChoice* choice, int minimum)
{
- vector<pair<string, string> > items;
+ vector<pair<string, string>> items;
for (int i = minimum; i <= 16; i += 2) {
if (i == 2) {
- items.push_back (make_pair (wx_to_std (_("2 - stereo")), locale_convert<string> (i)));
+ items.push_back (make_pair(wx_to_std(_("2 - stereo")), locale_convert<string>(i)));
} else if (i == 4) {
- items.push_back (make_pair (wx_to_std (_("4 - L/C/R/Lfe")), locale_convert<string> (i)));
+ items.push_back (make_pair(wx_to_std(_("4 - L/C/R/Lfe")), locale_convert<string>(i)));
} else if (i == 6) {
- items.push_back (make_pair (wx_to_std (_("6 - 5.1")), locale_convert<string> (i)));
+ items.push_back (make_pair(wx_to_std(_("6 - 5.1")), locale_convert<string>(i)));
} else if (i == 8) {
- items.push_back (make_pair (wx_to_std (_("8 - 5.1/HI/VI")), locale_convert<string> (i)));
+ items.push_back (make_pair(wx_to_std(_("8 - 5.1/HI/VI")), locale_convert<string>(i)));
} else if (i == 12) {
- items.push_back (make_pair (wx_to_std (_("12 - 7.1/HI/VI")), locale_convert<string> (i)));
+ items.push_back (make_pair(wx_to_std(_("12 - 7.1/HI/VI")), locale_convert<string>(i)));
} else {
- items.push_back (make_pair (locale_convert<string> (i), locale_convert<string> (i)));
+ items.push_back (make_pair(locale_convert<string> (i), locale_convert<string>(i)));
}
}
return splash;
}
+
double
calculate_mark_interval (double mark_interval)
{
base = resources_path();
#endif
- boost::filesystem::path p = base / String::compose("%1.png", name);
+ auto p = base / String::compose("%1.png", name);
return std_to_wx (p.string());
}
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
+