Fix group Event selections not clearing
This commit is contained in:
parent
2f24d45ca4
commit
baaf9c8c9d
4 changed files with 36 additions and 55 deletions
|
@ -22,6 +22,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
- Fix config files being written before the project is opened successfully.
|
- Fix config files being written before the project is opened successfully.
|
||||||
- Fix the map and other project info still displaying if a new project fails to open.
|
- Fix the map and other project info still displaying if a new project fails to open.
|
||||||
- Fix unsaved changes being ignored when quitting (such as with Cmd+Q on macOS).
|
- Fix unsaved changes being ignored when quitting (such as with Cmd+Q on macOS).
|
||||||
|
- Fix selections with multiple Events not always clearing when making a new selection.
|
||||||
- Fix `About porymap` opening a new window each time it's activated.
|
- Fix `About porymap` opening a new window each time it's activated.
|
||||||
- Fix the `Edit History` window not raising to the front when reactivated.
|
- Fix the `Edit History` window not raising to the front when reactivated.
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ private slots:
|
||||||
void on_toolButton_deleteObject_clicked();
|
void on_toolButton_deleteObject_clicked();
|
||||||
|
|
||||||
void addNewEvent(Event::Type type);
|
void addNewEvent(Event::Type type);
|
||||||
void tryAddEventTab(QWidget * tab, Event::Group group);
|
void tryAddEventTab(QWidget * tab);
|
||||||
void displayEventTabs();
|
void displayEventTabs();
|
||||||
void updateSelectedObjects();
|
void updateSelectedObjects();
|
||||||
void updateObjects();
|
void updateObjects();
|
||||||
|
@ -328,12 +328,6 @@ private:
|
||||||
QAction *copyAction = nullptr;
|
QAction *copyAction = nullptr;
|
||||||
QAction *pasteAction = nullptr;
|
QAction *pasteAction = nullptr;
|
||||||
|
|
||||||
QWidget *eventTabObjectWidget;
|
|
||||||
QWidget *eventTabWarpWidget;
|
|
||||||
QWidget *eventTabTriggerWidget;
|
|
||||||
QWidget *eventTabBGWidget;
|
|
||||||
QWidget *eventTabHealspotWidget;
|
|
||||||
QWidget *eventTabMultipleWidget;
|
|
||||||
QMap<Event::Group, DraggablePixmapItem*> lastSelectedEvent;
|
QMap<Event::Group, DraggablePixmapItem*> lastSelectedEvent;
|
||||||
|
|
||||||
bool isProgrammaticEventTabChange;
|
bool isProgrammaticEventTabChange;
|
||||||
|
|
|
@ -2116,19 +2116,25 @@ void Editor::selectMapEvent(DraggablePixmapItem *object) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) {
|
void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) {
|
||||||
if (selected_events && object) {
|
if (!selected_events || !object)
|
||||||
if (selected_events->contains(object)) {
|
return;
|
||||||
if (toggle) {
|
|
||||||
selected_events->removeOne(object);
|
if (!toggle) {
|
||||||
}
|
// Selecting just this event
|
||||||
} else {
|
selected_events->clear();
|
||||||
if (!toggle) {
|
selected_events->append(object);
|
||||||
selected_events->clear();
|
} else if (!selected_events->contains(object)) {
|
||||||
}
|
// Adding event to selection
|
||||||
selected_events->append(object);
|
selected_events->append(object);
|
||||||
}
|
} else if (selected_events->length() > 1) {
|
||||||
updateSelectedEvents();
|
// Removing from group selection
|
||||||
|
selected_events->removeOne(object);
|
||||||
|
} else {
|
||||||
|
// Attempting to toggle the only currently-selected event.
|
||||||
|
// Unselecting an event this way would be unexpected, so we ignore it.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
updateSelectedEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::selectedEventIndexChanged(int index, Event::Group eventGroup) {
|
void Editor::selectedEventIndexChanged(int index, Event::Group eventGroup) {
|
||||||
|
|
|
@ -366,12 +366,6 @@ void MainWindow::initMiscHeapObjects() {
|
||||||
mapListProxyModel->setSourceModel(mapListModel);
|
mapListProxyModel->setSourceModel(mapListModel);
|
||||||
ui->mapList->setModel(mapListProxyModel);
|
ui->mapList->setModel(mapListProxyModel);
|
||||||
|
|
||||||
eventTabObjectWidget = ui->tab_Objects;
|
|
||||||
eventTabWarpWidget = ui->tab_Warps;
|
|
||||||
eventTabTriggerWidget = ui->tab_Triggers;
|
|
||||||
eventTabBGWidget = ui->tab_BGs;
|
|
||||||
eventTabHealspotWidget = ui->tab_Healspots;
|
|
||||||
eventTabMultipleWidget = ui->tab_Multiple;
|
|
||||||
ui->tabWidget_EventType->clear();
|
ui->tabWidget_EventType->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1977,7 +1971,8 @@ void MainWindow::addNewEvent(Event::Type type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::tryAddEventTab(QWidget * tab, Event::Group group) {
|
void MainWindow::tryAddEventTab(QWidget * tab) {
|
||||||
|
auto group = getEventGroupFromTabWidget(tab);
|
||||||
if (editor->map->events.value(group).length())
|
if (editor->map->events.value(group).length())
|
||||||
ui->tabWidget_EventType->addTab(tab, QString("%1s").arg(Event::eventGroupToString(group)));
|
ui->tabWidget_EventType->addTab(tab, QString("%1s").arg(Event::eventGroupToString(group)));
|
||||||
}
|
}
|
||||||
|
@ -1986,11 +1981,11 @@ void MainWindow::displayEventTabs() {
|
||||||
const QSignalBlocker blocker(ui->tabWidget_EventType);
|
const QSignalBlocker blocker(ui->tabWidget_EventType);
|
||||||
|
|
||||||
ui->tabWidget_EventType->clear();
|
ui->tabWidget_EventType->clear();
|
||||||
tryAddEventTab(eventTabObjectWidget, Event::Group::Object);
|
tryAddEventTab(ui->tab_Objects);
|
||||||
tryAddEventTab(eventTabWarpWidget, Event::Group::Warp);
|
tryAddEventTab(ui->tab_Warps);
|
||||||
tryAddEventTab(eventTabTriggerWidget, Event::Group::Coord);
|
tryAddEventTab(ui->tab_Triggers);
|
||||||
tryAddEventTab(eventTabBGWidget, Event::Group::Bg);
|
tryAddEventTab(ui->tab_BGs);
|
||||||
tryAddEventTab(eventTabHealspotWidget, Event::Group::Heal);
|
tryAddEventTab(ui->tab_Healspots);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateObjects() {
|
void MainWindow::updateObjects() {
|
||||||
|
@ -2150,30 +2145,15 @@ void MainWindow::updateSelectedObjects() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Event::Group MainWindow::getEventGroupFromTabWidget(QWidget *tab)
|
Event::Group MainWindow::getEventGroupFromTabWidget(QWidget *tab) {
|
||||||
{
|
static const QMap<QWidget*,Event::Group> tabToGroup = {
|
||||||
Event::Group ret = Event::Group::None;
|
{ui->tab_Objects, Event::Group::Object},
|
||||||
if (tab == eventTabObjectWidget)
|
{ui->tab_Warps, Event::Group::Warp},
|
||||||
{
|
{ui->tab_Triggers, Event::Group::Coord},
|
||||||
ret = Event::Group::Object;
|
{ui->tab_BGs, Event::Group::Bg},
|
||||||
}
|
{ui->tab_Healspots, Event::Group::Heal},
|
||||||
else if (tab == eventTabWarpWidget)
|
};
|
||||||
{
|
return tabToGroup.value(tab, Event::Group::None);
|
||||||
ret = Event::Group::Warp;
|
|
||||||
}
|
|
||||||
else if (tab == eventTabTriggerWidget)
|
|
||||||
{
|
|
||||||
ret = Event::Group::Coord;
|
|
||||||
}
|
|
||||||
else if (tab == eventTabBGWidget)
|
|
||||||
{
|
|
||||||
ret = Event::Group::Bg;
|
|
||||||
}
|
|
||||||
else if (tab == eventTabHealspotWidget)
|
|
||||||
{
|
|
||||||
ret = Event::Group::Heal;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::eventTabChanged(int index) {
|
void MainWindow::eventTabChanged(int index) {
|
||||||
|
|
Loading…
Reference in a new issue