projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use collator to search for screens (#2426).
[dcpomatic.git]
/
src
/
wx
/
language_tag_dialog.cc
diff --git
a/src/wx/language_tag_dialog.cc
b/src/wx/language_tag_dialog.cc
index c72c64b313c07f0465553d297a5ac0973fe0d816..a3ad847d52b9c98d6bb375d3b69811f15ee47859 100644
(file)
--- a/
src/wx/language_tag_dialog.cc
+++ b/
src/wx/language_tag_dialog.cc
@@
-23,9
+23,12
@@
#include "language_tag_dialog.h"
#include "wx_util.h"
#include "lib/config.h"
#include "language_tag_dialog.h"
#include "wx_util.h"
#include "lib/config.h"
+#include <dcp/language_tag.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
#include <wx/listctrl.h>
#include <wx/wx.h>
#include <wx/listctrl.h>
#include <wx/wx.h>
-#include <dcp/language_tag.h>
+LIBDCP_ENABLE_WARNINGS
using std::vector;
using std::vector;
@@
-43,7
+46,7
@@
LanguageTagDialog::LanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag)
overall_sizer->Add (_list, 0, wxALL, DCPOMATIC_SIZER_GAP);
overall_sizer->Add (add, 0, wxALL, DCPOMATIC_SIZER_GAP);
overall_sizer->Add (_list, 0, wxALL, DCPOMATIC_SIZER_GAP);
overall_sizer->Add (add, 0, wxALL, DCPOMATIC_SIZER_GAP);
- auto buttons = CreateSeparatedButtonSizer
(wxOK
);
+ auto buttons = CreateSeparatedButtonSizer
(wxOK | wxCANCEL
);
if (buttons) {
overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
}
if (buttons) {
overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
}
@@
-65,6
+68,7
@@
LanguageTagDialog::LanguageTagDialog (wxWindow* parent, dcp::LanguageTag tag)
set (tag);
add->Bind (wxEVT_BUTTON, boost::bind(&LanguageTagDialog::add_language, this));
set (tag);
add->Bind (wxEVT_BUTTON, boost::bind(&LanguageTagDialog::add_language, this));
+ _list->Bind(wxEVT_LIST_ITEM_ACTIVATED, boost::bind(&LanguageTagDialog::EndModal, this, wxID_OK));
}
}
@@
-116,7
+120,9
@@
LanguageTagDialog::set (dcp::LanguageTag tag)
_custom.push_back (tag);
selection = _presets.size() + _custom.size() - 1;
populate_list ();
_custom.push_back (tag);
selection = _presets.size() + _custom.size() - 1;
populate_list ();
- _list->EnsureVisible (_list->GetItemCount() - 1);
+ if (_list->GetItemCount() > 0) {
+ _list->EnsureVisible (_list->GetItemCount() - 1);
+ }
} else {
selection = _presets.size() + std::distance(_custom.begin(), iter);
}
} else {
selection = _presets.size() + std::distance(_custom.begin(), iter);
}
@@
-125,7
+131,9
@@
LanguageTagDialog::set (dcp::LanguageTag tag)
}
_list->SetItemState (selection, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
}
_list->SetItemState (selection, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
- _list->EnsureVisible (selection);
+ if (static_cast<int>(selection) < _list->GetItemCount()) {
+ _list->EnsureVisible (selection);
+ }
}
}