- 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;
+
+ add_label_to_sizer (_sizer, this, _("Name"), true, wxGBPosition(r, 0));
+ _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));
+ _notes = new wxTextCtrl (this, wxID_ANY, std_to_wx(notes), wxDefaultPosition, wxSize(320, -1));
+ _sizer->Add (_notes, wxGBPosition(r, 1));
+ ++r;
+
+ wxClientDC dc (this);
+ wxFont font = _name->GetFont ();
+ font.SetFamily (wxFONTFAMILY_TELETYPE);
+ dc.SetFont (font);
+ wxSize size = dc.GetTextExtent (wxT("1234567890123456789012345678"));
+ size.SetHeight (-1);
+
+ add_label_to_sizer (_sizer, this, _("Recipient certificate"), true, wxGBPosition(r, 0));
+ auto s = new wxBoxSizer (wxHORIZONTAL);
+ _recipient_thumbprint = new StaticText (this, wxT (""), wxDefaultPosition, size);
+ _recipient_thumbprint->SetFont (font);
+ set_recipient (recipient);
+
+ _get_recipient_from_file = new Button (this, _("Get from file..."));
+ _download_recipient = new Button (this, _("Download..."));
+ s->Add (_recipient_thumbprint, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, DCPOMATIC_SIZER_X_GAP);
+ 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, 1));
+ ++r;
+
+ add_label_to_sizer (_sizer, this, _("Filename"), true, wxGBPosition(r, 0));
+ _recipient_file = new wxStaticText (this, wxID_ANY, wxT(""));
+ checked_set (_recipient_file, recipient_file.get_value_or(""));
+ _sizer->Add (_recipient_file, wxGBPosition(r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP);
+ ++r;
+
+ {
+ 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
+ _sizer->Add (m, wxGBPosition(r, 0), wxDefaultSpan, flags, DCPOMATIC_SIZER_Y_GAP);