- add (_("Name"), true);
- _name = add (new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (320, -1)));
-
- add (_("Server manufacturer"), true);
- _manufacturer = add (new wxChoice (this, wxID_ANY));
-
- add (_("Certificate"), true);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _load_certificate = new wxButton (this, wxID_ANY, _("Load from file..."));
- _download_certificate = new wxButton (this, wxID_ANY, _("Download"));
- s->Add (_load_certificate, 1, wxEXPAND);
- s->Add (_download_certificate, 1, wxEXPAND);
- add (s);
-
- add_spacer ();
- _certificate_text = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxSize (320, 256), wxTE_MULTILINE | wxTE_READONLY);
- if (certificate) {
- _certificate_text->SetValue (certificate->certificate ());
+ auto overall_sizer = new wxBoxSizer (wxVERTICAL);
+ SetSizer (overall_sizer);
+
+ _sizer = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ int r = 0;
+
+ wxFont subheading_font(*wxNORMAL_FONT);
+ subheading_font.SetWeight(wxFONTWEIGHT_BOLD);
+
+ auto subheading = new StaticText(this, _("Details"));
+ subheading->SetFont(subheading_font);
+ _sizer->Add(subheading, wxGBPosition(r, 0), wxGBSpan(1, 2));
+ ++r;
+
+ add_label_to_sizer(_sizer, this, _("Name"), true, wxGBPosition(r, 0), wxDefaultSpan, true);
+ _name = new wxTextCtrl (this, wxID_ANY, std_to_wx (name), wxDefaultPosition, wxSize (320, -1));
+ _sizer->Add (_name, wxGBPosition (r, 1));
+ ++r;
+
+ add_label_to_sizer(_sizer, this, _("Notes"), true, wxGBPosition(r, 0), wxDefaultSpan, true);
+ _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx(notes), wxDefaultPosition, wxSize(320, -1));
+ _sizer->Add (_notes, wxGBPosition(r, 1));
+ ++r;
+
+ subheading = new StaticText(this, _("Recipient"));
+ subheading->SetFont(subheading_font);
+ _sizer->Add(subheading, wxGBPosition(r, 0), wxGBSpan(1, 2), wxTOP, DCPOMATIC_SUBHEADING_TOP_PAD);
+ ++r;
+
+ _get_recipient_from_file = new Button (this, _("Get from file..."));
+ _download_recipient = new Button (this, _("Download..."));
+ auto s = new wxBoxSizer (wxHORIZONTAL);
+ s->Add (_get_recipient_from_file, 0, wxLEFT | wxRIGHT | wxEXPAND, DCPOMATIC_SIZER_X_GAP);
+ s->Add (_download_recipient, 0, wxLEFT | wxRIGHT | wxEXPAND, DCPOMATIC_SIZER_X_GAP);
+ _sizer->Add(s, wxGBPosition(r, 0), wxGBSpan(1, 2));
+ ++r;
+
+ auto add_certificate_detail = [&r, this](wxString name, wxStaticText** value, wxSize size = wxDefaultSize) {
+ add_label_to_sizer(_sizer, this, name, true, wxGBPosition(r, 0), wxDefaultSpan, true);
+ *value = new StaticText(this, wxT (""), wxDefaultPosition, size);
+ _sizer->Add(*value, wxGBPosition(r, 1));
+ ++r;
+ };
+
+ wxClientDC dc (this);
+ wxFont teletype_font = _name->GetFont();
+ teletype_font.SetFamily(wxFONTFAMILY_TELETYPE);
+ dc.SetFont(teletype_font);
+ wxSize size = dc.GetTextExtent (wxT("1234567890123456789012345678"));
+ size.SetHeight (-1);
+
+ add_certificate_detail(_("Thumbprint"), &_recipient_thumbprint, size);
+ _recipient_thumbprint->SetFont(teletype_font);
+
+ add_label_to_sizer(_sizer, this, _("Filename"), true, wxGBPosition(r, 0), wxDefaultSpan, true);
+ _recipient_file = new wxStaticText(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(600, -1), wxST_ELLIPSIZE_MIDDLE | wxST_NO_AUTORESIZE);
+ set_recipient_file(recipient_file.get_value_or(""));
+ _sizer->Add (_recipient_file, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP);
+ ++r;
+
+ add_certificate_detail(_("Subject common name"), &_subject_common_name);
+ add_certificate_detail(_("Subject organization name"), &_subject_organization_name);
+ add_certificate_detail(_("Issuer common name"), &_issuer_common_name);
+ add_certificate_detail(_("Issuer organization name"), &_issuer_organization_name);
+
+ set_recipient (recipient);
+
+ {
+ int flags = wxALIGN_CENTER_VERTICAL | wxTOP;
+#ifdef __WXOSX__
+ flags |= wxALIGN_RIGHT;
+ auto m = new StaticText (this, _("Other trusted devices") + wxT(":"));
+#else
+ auto m = new StaticText (this, _("Other trusted devices"));
+#endif
+ m->SetFont(subheading_font);
+ _sizer->Add(m, wxGBPosition(r, 0), wxDefaultSpan, flags, DCPOMATIC_SUBHEADING_TOP_PAD);