forked from mia/Aegisub
Fix gcc build errors
Originally committed to SVN as r4610.
This commit is contained in:
parent
c5c306f90c
commit
5598b787c7
2 changed files with 24 additions and 17 deletions
|
@ -41,6 +41,7 @@
|
|||
|
||||
#ifndef AGI_PRE
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <wx/sizer.h>
|
||||
#endif
|
||||
|
||||
|
@ -1273,31 +1274,33 @@ void BaseGrid::AnnounceActiveLineChanged(AssDialogue *new_line) {
|
|||
if (batch_level > 0)
|
||||
batch_active_line_changed = true;
|
||||
else
|
||||
BaseSelectionController::AnnounceActiveLineChanged(new_line);
|
||||
BaseSelectionController<AssDialogue>::AnnounceActiveLineChanged(new_line);
|
||||
}
|
||||
|
||||
void BaseGrid::AnnounceSelectedSetChanged(const Selection &lines_added, const Selection &lines_removed) {
|
||||
if (batch_level > 0) {
|
||||
// Remove all previously added lines that are now removed
|
||||
for (Selection::iterator it = batch_selection_added.begin(); it != batch_selection_added.end();) {
|
||||
if (lines_removed.find(*it) != lines_removed.end())
|
||||
it = batch_selection_added.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
Selection temp;
|
||||
std::set_difference(
|
||||
batch_selection_added.begin(), batch_selection_added.end(),
|
||||
lines_removed.begin(), lines_removed.end(),
|
||||
std::inserter(temp, temp.begin()));
|
||||
std::swap(temp, batch_selection_added);
|
||||
temp.clear();
|
||||
|
||||
// Remove all previously removed lines that are now added
|
||||
for (Selection::iterator it = batch_selection_removed.begin(); it != batch_selection_removed.end();) {
|
||||
if (lines_added.find(*it) != lines_added.end())
|
||||
it = batch_selection_removed.erase(it);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
std::set_difference(
|
||||
batch_selection_removed.begin(), batch_selection_removed.end(),
|
||||
lines_added.begin(), lines_added.end(),
|
||||
std::inserter(temp, temp.begin()));
|
||||
std::swap(temp, batch_selection_removed);
|
||||
|
||||
// Add new stuff to batch sets
|
||||
batch_selection_added.insert(lines_added.begin(), lines_added.end());
|
||||
batch_selection_removed.insert(lines_removed.begin(), lines_removed.end());
|
||||
}
|
||||
else {
|
||||
BaseSelectionController::AnnounceSelectedSetChanged(lines_added, lines_removed);
|
||||
BaseSelectionController<AssDialogue>::AnnounceSelectedSetChanged(lines_added, lines_removed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,14 +165,17 @@ public:
|
|||
/// be desirable in some special cases such as test drivers.
|
||||
template <typename ItemDataType>
|
||||
class BaseSelectionController : public SelectionController<ItemDataType> {
|
||||
public:
|
||||
typedef typename SelectionController<ItemDataType>::Selection Selection;
|
||||
private:
|
||||
typedef std::set<SelectionListener<ItemDataType> *> SelectionListenerSet;
|
||||
std::set<SelectionListener<ItemDataType> *> listeners;
|
||||
SelectionListenerSet listeners;
|
||||
|
||||
protected:
|
||||
/// Call OnActiveLineChanged on all listeners
|
||||
void AnnounceActiveLineChanged(ItemDataType *new_line)
|
||||
{
|
||||
for (SelectionListenerSet::iterator listener = listeners.begin(); listener != listeners.end(); ++listener)
|
||||
for (typename SelectionListenerSet::iterator listener = listeners.begin(); listener != listeners.end(); ++listener)
|
||||
{
|
||||
(*listener)->OnActiveLineChanged(new_line);
|
||||
}
|
||||
|
@ -181,7 +184,7 @@ protected:
|
|||
/// Call OnSelectedSetChangedon all listeners
|
||||
void AnnounceSelectedSetChanged(const Selection &lines_added, const Selection &lines_removed)
|
||||
{
|
||||
for (SelectionListenerSet::iterator listener = listeners.begin(); listener != listeners.end(); ++listener)
|
||||
for (typename SelectionListenerSet::iterator listener = listeners.begin(); listener != listeners.end(); ++listener)
|
||||
{
|
||||
(*listener)->OnSelectedSetChanged(lines_added, lines_removed);
|
||||
}
|
||||
|
@ -207,6 +210,7 @@ public:
|
|||
template <typename ItemDataType>
|
||||
class DummySelectionController : public SelectionController<ItemDataType> {
|
||||
public:
|
||||
typedef typename SelectionController<ItemDataType>::Selection Selection;
|
||||
virtual ~DummySelectionController() { }
|
||||
virtual void SetActiveLine(ItemDataType *new_line) { }
|
||||
virtual ItemDataType * GetActiveLine() const { return 0; }
|
||||
|
|
Loading…
Reference in a new issue