projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stop Ctrl+A working when the content panel is not visible (#577).
[dcpomatic.git]
/
src
/
wx
/
fonts_dialog.cc
diff --git
a/src/wx/fonts_dialog.cc
b/src/wx/fonts_dialog.cc
index 99d570263c12a88dcccb486a3fea70e23890b5a6..092faf9e6c0e96cb2de50daf41aabd56696b9deb 100644
(file)
--- a/
src/wx/fonts_dialog.cc
+++ b/
src/wx/fonts_dialog.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014
-2015
Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-25,6
+25,7
@@
using std::list;
using std::string;
using std::list;
using std::string;
+using std::cout;
using boost::shared_ptr;
FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
using boost::shared_ptr;
FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
@@
-40,7
+41,7
@@
FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
ip.SetWidth (100);
_fonts->InsertColumn (0, ip);
}
ip.SetWidth (100);
_fonts->InsertColumn (0, ip);
}
-
+
{
wxListItem ip;
ip.SetId (1);
{
wxListItem ip;
ip.SetId (1);
@@
-70,8
+71,11
@@
FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
SetSizerAndFit (overall_sizer);
_set_file->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FontsDialog::set_file_clicked, this));
SetSizerAndFit (overall_sizer);
_set_file->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FontsDialog::set_file_clicked, this));
+ _fonts->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&FontsDialog::selection_changed, this));
+ _fonts->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&FontsDialog::selection_changed, this));
setup ();
setup ();
+ update_sensitivity ();
}
void
}
void
@@
-81,7
+85,7
@@
FontsDialog::setup ()
if (!content) {
return;
}
if (!content) {
return;
}
-
+
_fonts->DeleteAllItems ();
list<shared_ptr<Font> > fonts = content->fonts ();
size_t n = 0;
_fonts->DeleteAllItems ();
list<shared_ptr<Font> > fonts = content->fonts ();
size_t n = 0;
@@
-89,9
+93,9
@@
FontsDialog::setup ()
wxListItem item;
item.SetId (n);
_fonts->InsertItem (item);
wxListItem item;
item.SetId (n);
_fonts->InsertItem (item);
- _fonts->SetItem (n, 0, std_to_wx ((*i)->id));
- if ((*i)->file) {
- _fonts->SetItem (n, 1, (*i)->file.get().leaf().string ());
+ _fonts->SetItem (n, 0, std_to_wx ((*i)->id
()
));
+ if ((*i)->file
()
) {
+ _fonts->SetItem (n, 1, (*i)->file
()
.get().leaf().string ());
}
++n;
}
}
++n;
}
@@
-109,7
+113,7
@@
FontsDialog::set_file_clicked ()
if (item == -1) {
return;
}
if (item == -1) {
return;
}
-
+
/* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
non-Latin filenames or paths.
*/
/* The wxFD_CHANGE_DIR here prevents a `could not set working directory' error 123 on Windows when using
non-Latin filenames or paths.
*/
@@
-125,8
+129,8
@@
FontsDialog::set_file_clicked ()
list<shared_ptr<Font> > fonts = content->fonts ();
for (list<shared_ptr<Font> >::iterator i = fonts.begin(); i != fonts.end(); ++i) {
list<shared_ptr<Font> > fonts = content->fonts ();
for (list<shared_ptr<Font> >::iterator i = fonts.begin(); i != fonts.end(); ++i) {
- if ((*i)->id == id) {
- (*i)->
file = wx_to_std (d->GetPath (
));
+ if ((*i)->id
()
== id) {
+ (*i)->
set_file (wx_to_std (d->GetPath ()
));
}
}
}
}
@@
-134,3
+138,16
@@
FontsDialog::set_file_clicked ()
setup ();
}
setup ();
}
+
+void
+FontsDialog::selection_changed ()
+{
+ update_sensitivity ();
+}
+
+void
+FontsDialog::update_sensitivity ()
+{
+ int const item = _fonts->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ _set_file->Enable (item != -1);
+}