summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-01-27 00:25:40 +0000
committerCarl Hetherington <cth@carlh.net>2019-01-27 00:25:40 +0000
commitf77ec143719c86ddbf098bff6d19fe2a159b8c3e (patch)
tree0eef7caeaff253a5d6b4c8f65cb5a0fc327d2f7c /src/wx
parent731eb4282fc1dd8e2ac054879db16647757a766a (diff)
Remove specification of italic/bold fonts (#1451); synthesis will be used instead.v2.13.110
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/font_files_dialog.h49
-rw-r--r--src/wx/fonts_dialog.cc53
-rw-r--r--src/wx/wscript3
3 files changed, 28 insertions, 77 deletions
diff --git a/src/wx/font_files_dialog.h b/src/wx/font_files_dialog.h
deleted file mode 100644
index c9db20e9a..000000000
--- a/src/wx/font_files_dialog.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
-
- This file is part of DCP-o-matic.
-
- DCP-o-matic is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- DCP-o-matic is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#include "table_dialog.h"
-#include "wx_util.h"
-#include "lib/font_files.h"
-
-class FontFilesDialog : public TableDialog
-{
-public:
- FontFilesDialog (wxWindow* parent, FontFiles files);
-
- FontFiles get () const {
- return _files;
- }
-
-private:
- void set_from_file_clicked (FontFiles::Variant variant);
-#ifdef DCPOMATIC_WINDOWS
- void set_from_system_clicked (FontFiles::Variant variant);
-#endif
- void set (FontFiles::Variant variant, boost::filesystem::path path);
-
- FontFiles _files;
-
- wxStaticText* _name[FontFiles::VARIANTS];
- wxButton* _set_file[FontFiles::VARIANTS];
-
-#ifdef DCPOMATIC_WINDOWS
- wxButton* _set_system[FontFiles::VARIANTS];
-#endif
-};
diff --git a/src/wx/fonts_dialog.cc b/src/wx/fonts_dialog.cc
index 0660eea39..4ad118262 100644
--- a/src/wx/fonts_dialog.cc
+++ b/src/wx/fonts_dialog.cc
@@ -21,7 +21,6 @@
#include "fonts_dialog.h"
#include "wx_util.h"
#include "system_font_dialog.h"
-#include "font_files_dialog.h"
#include "dcpomatic_button.h"
#include "lib/font.h"
#include "lib/content.h"
@@ -53,27 +52,11 @@ FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<Content> content, shared_
{
wxListItem ip;
ip.SetId (1);
- ip.SetText (_("Normal file"));
- ip.SetWidth (150);
+ ip.SetText (_("File"));
+ ip.SetWidth (450);
_fonts->InsertColumn (1, ip);
}
- {
- wxListItem ip;
- ip.SetId (2);
- ip.SetText (_("Italic file"));
- ip.SetWidth (150);
- _fonts->InsertColumn (2, ip);
- }
-
- {
- wxListItem ip;
- ip.SetId (3);
- ip.SetText (_("Bold file"));
- ip.SetWidth (150);
- _fonts->InsertColumn (3, ip);
- }
-
wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL);
sizer->Add (_fonts, 1, wxEXPAND | wxLEFT | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
@@ -113,10 +96,8 @@ FontsDialog::setup ()
item.SetId (n);
_fonts->InsertItem (item);
_fonts->SetItem (n, 0, std_to_wx (i->id ()));
- for (int j = 0; j < FontFiles::VARIANTS; ++j) {
- if (i->file(static_cast<FontFiles::Variant>(j))) {
- _fonts->SetItem (n, j + 1, i->file(static_cast<FontFiles::Variant>(j)).get().leaf().string ());
- }
+ if (i->file()) {
+ _fonts->SetItem (n, 1, i->file()->leaf().string ());
}
++n;
}
@@ -159,10 +140,30 @@ FontsDialog::edit_clicked ()
return;
}
- FontFilesDialog* d = new FontFilesDialog (this, font->files ());
- if (d->ShowModal () == wxID_OK) {
- font->set_files (d->get ());
+ /* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
+ non-Latin filenames or paths.
+ */
+ wxString default_dir = "";
+#ifdef DCPOMATIC_LINUX
+ if (boost::filesystem::exists ("/usr/share/fonts/truetype")) {
+ default_dir = "/usr/share/fonts/truetype";
+ } else {
+ default_dir = "/usr/share/fonts";
+ }
+#endif
+#ifdef DCPOMATIC_OSX
+ default_dir = "/System/Library/Fonts";
+#endif
+
+ wxFileDialog* d = new wxFileDialog (this, _("Choose a font file"), default_dir, wxT (""), wxT ("*.ttf"), wxFD_CHANGE_DIR);
+ int const r = d->ShowModal ();
+
+ if (r != wxID_OK) {
+ d->Destroy ();
+ return;
}
+
+ font->set_file (wx_to_std(d->GetPath()));
d->Destroy ();
setup ();
diff --git a/src/wx/wscript b/src/wx/wscript
index 1b29b057b..183466106 100644
--- a/src/wx/wscript
+++ b/src/wx/wscript
@@ -67,7 +67,6 @@ sources = """
filter_editor.cc
focus_manager.cc
fonts_dialog.cc
- font_files_dialog.cc
full_config_dialog.cc
gain_calculator_dialog.cc
gdc_certificate_panel.cc
@@ -144,7 +143,7 @@ sources = """
def configure(conf):
wx_libs = 'core,richtext,adv,html,xml'
-
+
try:
wx_config = '/usr/lib64/wx/config/gtk2-unicode-3.0'
conf.check_cfg(msg='Checking for wxWidgets using gtk2-unicode-3.0',