projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
da79e55
)
Fix incorrect ordering when adding cinemas.
author
Carl Hetherington
<cth@carlh.net>
Tue, 30 Aug 2022 22:33:12 +0000
(
00:33
+0200)
committer
Carl Hetherington
<cth@carlh.net>
Tue, 30 Aug 2022 22:33:12 +0000
(
00:33
+0200)
src/wx/screens_panel.cc
patch
|
blob
|
history
diff --git
a/src/wx/screens_panel.cc
b/src/wx/screens_panel.cc
index 10adad7e53b78cc44839704beac00104529fbc35..562ea8f3895d0d67423ee135ae8b76bf4ef35900 100644
(file)
--- a/
src/wx/screens_panel.cc
+++ b/
src/wx/screens_panel.cc
@@
-251,18
+251,20
@@
ScreensPanel::add_cinema_clicked ()
return;
}
return;
}
- optional<wxTreeListItem> item;
+ wxTreeListItem previous = wxTLI_FIRST;
+ bool found = false;
for (auto existing_cinema: cinemas) {
for (auto existing_cinema: cinemas) {
- if (
!item &&
compare(dialog->name(), existing_cinema->name) < 0) {
- if (auto existing_item = cinema_to_item(existing_cinema)) {
-
item = add_cinema (cinema, *existing_item)
;
- }
+ if (compare(dialog->name(), existing_cinema->name) < 0) {
+ /* existing_cinema should be after the one we're inserting */
+
found = true
;
+ break;
}
}
+ auto item = cinema_to_item(existing_cinema);
+ DCPOMATIC_ASSERT(item);
+ previous = *item;
}
}
- if (!item) {
- item = add_cinema (cinema, wxTLI_LAST);
- }
+ auto item = add_cinema(cinema, found ? previous : wxTLI_LAST);
if (item) {
_targets->UnselectAll ();
if (item) {
_targets->UnselectAll ();