X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fhtml_dialog.cc;h=c8138c8cd51cf65b7ca7ac06b9827f32ed4d816a;hb=c7044a1b444c2e5e7659bf5d34ed5ac73f5a6271;hp=57038f77f6d533301bd77450c4b157b141cb40a6;hpb=c04fec82d25127fafa73c3daff87bece9aa8c8e8;p=dcpomatic.git diff --git a/src/wx/html_dialog.cc b/src/wx/html_dialog.cc index 57038f77f..c8138c8cd 100644 --- a/src/wx/html_dialog.cc +++ b/src/wx/html_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,38 +18,44 @@ */ + #include "html_dialog.h" #include "wx_util.h" #include "lib/cross.h" -#include "lib/warnings.h" -#include -DCPOMATIC_DISABLE_WARNINGS -#include +#include +LIBDCP_DISABLE_WARNINGS #include -DCPOMATIC_ENABLE_WARNINGS -#include +#include +LIBDCP_ENABLE_WARNINGS +#include + #if BOOST_VERSION >= 106100 using namespace boost::placeholders; #endif -HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html) + +HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html, bool ok) : wxDialog (parent, wxID_ANY, title) { - wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); + auto sizer = new wxBoxSizer (wxVERTICAL); wxFileSystem::AddHandler(new wxMemoryFSHandler); /* Add some resources that are used by HTML passed into this dialog */ wxMemoryFSHandler::AddFile( "me.jpg", - wxBitmap(std_to_wx(boost::filesystem::path(shared_path() / "me.jpg").string()), wxBITMAP_TYPE_JPEG), wxBITMAP_TYPE_JPEG + wxBitmap(bitmap_path("me.jpg"), wxBITMAP_TYPE_JPEG), wxBITMAP_TYPE_JPEG ); - wxHtmlWindow* h = new wxHtmlWindow (this); + auto h = new wxHtmlWindow (this); h->SetPage (html); sizer->Add (h, 1, wxEXPAND | wxALL, 6); + if (gui_is_dark()) { + h->SetHTMLBackgroundColour(*wxBLACK); + } + h->Bind (wxEVT_HTML_LINK_CLICKED, boost::bind(&HTMLDialog::link_clicked, this, _1)); SetSizer (sizer); @@ -59,9 +65,17 @@ HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html) SetSize (800, -1); /* Set height */ - SetSize (h->GetInternalRepresentation()->GetWidth(), h->GetInternalRepresentation()->GetHeight() + 64); + SetSize (h->GetInternalRepresentation()->GetWidth(), h->GetInternalRepresentation()->GetHeight() + 256); + + if (ok) { + auto buttons = CreateSeparatedButtonSizer(wxOK); + if (buttons) { + sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder()); + } + } } + void HTMLDialog::link_clicked (wxHtmlLinkEvent& ev) {