#include "password_entry.h"
#include "region_subtag_widget.h"
#include "static_text.h"
+#include "wx_ptr.h"
#include "wx_util.h"
#include "lib/config.h"
#include "lib/cross.h"
wxStaticText *
-add_label_to_sizer (wxGridBagSizer* s, wxWindow* p, wxString t, bool left, wxGBPosition pos, wxGBSpan span)
+add_label_to_sizer(wxGridBagSizer* s, wxWindow* p, wxString t, bool left, wxGBPosition pos, wxGBSpan span, bool indent)
{
- int flags = wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT;
+ int flags = wxALIGN_CENTER_VERTICAL | wxLEFT;
#ifdef __WXOSX__
setup_osx_flags (s, left, flags);
#endif
auto m = create_label (p, t, left);
- s->Add (m, pos, span, flags);
+ s->Add(m, pos, span, flags, indent ? DCPOMATIC_SIZER_X_GAP : 0);
return m;
}
void
error_dialog (wxWindow* parent, wxString m, optional<wxString> e)
{
- auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_ERROR);
+ auto d = make_wx<wxMessageDialog>(parent, m, _("DCP-o-matic"), wxOK | wxICON_ERROR);
if (e) {
wxString em = *e;
em[0] = wxToupper (em[0]);
d->SetExtendedMessage (em);
}
d->ShowModal ();
- d->Destroy ();
}
void
message_dialog (wxWindow* parent, wxString m)
{
- auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxOK | wxICON_INFORMATION);
+ auto d = make_wx<wxMessageDialog>(parent, m, _("DCP-o-matic"), wxOK | wxICON_INFORMATION);
d->ShowModal ();
- d->Destroy ();
}
bool
confirm_dialog (wxWindow* parent, wxString m)
{
- auto d = new wxMessageDialog (parent, m, _("DCP-o-matic"), wxYES_NO | wxICON_QUESTION);
- int const r = d->ShowModal ();
- d->Destroy ();
- return r == wxID_YES;
+ auto d = make_wx<wxMessageDialog>(parent, m, _("DCP-o-matic"), wxYES_NO | wxICON_QUESTION);
+ return d->ShowModal() == wxID_YES;
}
void
checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
{
- if (widget->GetPath() != std_to_wx (value.string())) {
+ if (widget->path() != value) {
if (value.empty()) {
/* Hack to make wxWidgets clear the control when we are passed
an empty value.
*/
value = " ";
}
- widget->SetPath (std_to_wx (value.string()));
+ widget->set_path(value);
}
}
locale->AddCatalog (wxT ("wxstd3"));
#endif
- locale->AddCatalog (wxT ("libdcpomatic2-wx"));
- locale->AddCatalog (wxT ("dcpomatic2"));
+ locale->AddCatalog(wxT("wxstd"));
+ locale->AddCatalog(wxT("libdcpomatic2-wx"));
+ locale->AddCatalog(wxT("dcpomatic2"));
if (!locale->IsOk()) {
delete locale;
}
-wxSplashScreen *
+wxSplashScreen*
maybe_show_splash ()
{
wxSplashScreen* splash = nullptr;
+
try {
wxBitmap bitmap;
if (bitmap.LoadFile(bitmap_path("splash.png"), wxBITMAP_TYPE_PNG)) {
}
#ifdef DCPOMATIC_WINDOWS
/* Having wxSTAY_ON_TOP means error dialogues hide behind the splash screen on Windows, no matter what I try */
- splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE | wxFRAME_NO_TASKBAR);
+ splash = new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, nullptr, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE | wxFRAME_NO_TASKBAR);
#else
- splash = new wxSplashScreen (bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, 0, -1);
+ splash = new wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_NO_TIMEOUT, 0, nullptr, -1);
#endif
wxYield ();
}
} else {
base = resources_path();
}
+
+ if (!boost::filesystem::exists(base / name)) {
+ base = path / boost::filesystem::path("osx/preferences");
+ }
#else
base = resources_path();
#endif