2 Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "lib/subtitle_content.h"
22 #include "fonts_dialog.h"
27 using boost::shared_ptr;
29 FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
30 : wxDialog (parent, wxID_ANY, _("Fonts"))
32 _fonts = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize (400, 200), wxLC_REPORT | wxLC_SINGLE_SEL);
39 _fonts->InsertColumn (0, ip);
45 ip.SetText (_("Font file"));
47 _fonts->InsertColumn (1, ip);
50 wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL);
51 sizer->Add (_fonts, 1, wxEXPAND);
54 wxSizer* s = new wxBoxSizer (wxVERTICAL);
55 _edit = new wxButton (this, wxID_ANY, _("Edit..."));
56 s->Add (_edit, 0, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
57 sizer->Add (s, 0, wxLEFT, DCPOMATIC_SIZER_X_GAP);
60 wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
61 overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP);
63 wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
65 overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
68 SetSizerAndFit (overall_sizer);
70 list<shared_ptr<Font> > fonts = content->fonts ();
72 for (list<shared_ptr<Font> >::const_iterator i = fonts.begin(); i != fonts.end(); ++i) {
75 _fonts->InsertItem (item);
76 _fonts->SetItem (n, 0, (*i)->id.get_value_or (wx_to_std (_("[Default]"))));
78 _fonts->SetItem (n, 1, (*i)->file.get().leaf().string ());