Merge pull request #195 from garakmon/merge-tabs

Merges The Event and Map Views
This commit is contained in:
huderlem 2020-04-28 19:11:40 -05:00 committed by GitHub
commit f6cdd700b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 2369 additions and 2431 deletions

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,7 @@ public:
void setRecentMap(QString map);
void setMapSortOrder(MapSortOrder order);
void setPrettyCursors(bool enabled);
void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray, QByteArray);
void setGeometry(QByteArray, QByteArray, QByteArray, QByteArray);
void setCollisionOpacity(int opacity);
void setMetatilesZoom(int zoom);
void setShowPlayerView(bool enabled);

View file

@ -70,6 +70,7 @@ public:
void setEditingCollision();
void setEditingObjects();
void setEditingConnections();
void setMapEditingButtonsEnabled(bool enabled);
void clearWildMonTabWidgets();
void setCurrentConnectionDirection(QString curDirection);
void updateCurrentConnectionDirection(QString curDirection);
@ -127,7 +128,6 @@ public:
QList<DraggablePixmapItem*> *selected_events = nullptr;
QString map_edit_mode;
QString prev_edit_mode;
int scale_exp = 0;
double scale_base = sqrt(2); // adjust scale factor with this

View file

@ -78,7 +78,7 @@ private slots:
void on_actionMonitor_Project_Files_triggered(bool checked);
void on_actionUse_Poryscript_triggered(bool checked);
void on_tabWidget_currentChanged(int index);
void on_mainTabBar_tabBarClicked(int index);
void on_actionUndo_triggered();
void on_actionRedo_triggered();
@ -211,6 +211,7 @@ private:
void displayMapProperties();
void checkToolButtons();
void clickToolButtonFromEditMode(QString editMode);
void initWindow();
void initCustomUI();

View file

@ -1,6 +1,8 @@
#ifndef EVENTPROPERTIESFRAME_H
#define EVENTPROPERTIESFRAME_H
#include "event.h"
#include <QFrame>
namespace Ui {
@ -12,11 +14,16 @@ class EventPropertiesFrame : public QFrame
Q_OBJECT
public:
explicit EventPropertiesFrame(QWidget *parent = nullptr);
explicit EventPropertiesFrame(Event *event, QWidget *parent = nullptr);
~EventPropertiesFrame();
void paintEvent(QPaintEvent*);
public:
Ui::EventPropertiesFrame *ui;
private:
Event *event;
bool firstShow = true;
};
#endif // EVENTPROPERTIESFRAME_H

View file

@ -13,14 +13,19 @@ private:
using QGraphicsPixmapItem::paint;
public:
enum class PaintMode {
Disabled,
Metatiles,
EventObjects
};
MapPixmapItem(Map *map_, MetatileSelector *metatileSelector, Settings *settings) {
this->map = map_;
this->metatileSelector = metatileSelector;
this->settings = settings;
this->paintingEnabled = true;
this->paintingMode = PaintMode::Metatiles;
setAcceptHoverEvents(true);
}
bool paintingEnabled;
MapPixmapItem::PaintMode paintingMode;
Map *map;
MetatileSelector *metatileSelector;
Settings *settings;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -17,7 +17,7 @@ QWidget {
}
QWidget::disabled {
background: #272822;
background: #31332b;
color: #75715E;
}

View file

@ -127,8 +127,6 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
this->windowState = bytesFromString(value);
} else if (key == "map_splitter_state") {
this->mapSplitterState = bytesFromString(value);
} else if (key == "events_splitter_state") {
this->eventsSlpitterState = bytesFromString(value);
} else if (key == "main_splitter_state") {
this->mainSplitterState = bytesFromString(value);
} else if (key == "collision_opacity") {
@ -190,7 +188,6 @@ QMap<QString, QString> PorymapConfig::getKeyValueMap() {
map.insert("window_geometry", stringFromByteArray(this->windowGeometry));
map.insert("window_state", stringFromByteArray(this->windowState));
map.insert("map_splitter_state", stringFromByteArray(this->mapSplitterState));
map.insert("events_splitter_state", stringFromByteArray(this->eventsSlpitterState));
map.insert("main_splitter_state", stringFromByteArray(this->mainSplitterState));
map.insert("collision_opacity", QString("%1").arg(this->collisionOpacity));
map.insert("metatiles_zoom", QString("%1").arg(this->metatilesZoom));
@ -245,12 +242,11 @@ void PorymapConfig::setMonitorFiles(bool monitor) {
this->save();
}
void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowState_, QByteArray mapSplitterState_,
QByteArray eventsSlpitterState_, QByteArray mainSplitterState_) {
void PorymapConfig::setGeometry(QByteArray windowGeometry_, QByteArray windowState_,
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
this->windowGeometry = windowGeometry_;
this->windowState = windowState_;
this->mapSplitterState = mapSplitterState_;
this->eventsSlpitterState = eventsSlpitterState_;
this->mainSplitterState = mainSplitterState_;
this->save();
}
@ -305,7 +301,6 @@ QMap<QString, QByteArray> PorymapConfig::getGeometry() {
geometry.insert("window_geometry", this->windowGeometry);
geometry.insert("window_state", this->windowState);
geometry.insert("map_splitter_state", this->mapSplitterState);
geometry.insert("events_splitter_state", this->eventsSlpitterState);
geometry.insert("main_splitter_state", this->mainSplitterState);
return geometry;

View file

@ -54,7 +54,7 @@ void Editor::saveUiFields() {
}
void Editor::undo() {
if (current_view && map_item->paintingEnabled) {
if (current_view && map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) {
map->undo();
map_item->draw();
collision_item->draw();
@ -64,7 +64,7 @@ void Editor::undo() {
}
void Editor::redo() {
if (current_view && map_item->paintingEnabled) {
if (current_view && map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) {
map->redo();
map_item->draw();
collision_item->draw();
@ -83,7 +83,7 @@ void Editor::closeProject() {
void Editor::setEditingMap() {
current_view = map_item;
if (map_item) {
map_item->paintingEnabled = true;
map_item->paintingMode = MapPixmapItem::PaintMode::Metatiles;
displayMapConnections();
map_item->draw();
map_item->setVisible(true);
@ -99,6 +99,8 @@ void Editor::setEditingMap() {
setConnectionItemsVisible(false);
this->cursorMapTileRect->stopSingleTileMode();
this->cursorMapTileRect->setVisibility(true);
setMapEditingButtonsEnabled(true);
}
void Editor::setEditingCollision() {
@ -110,7 +112,7 @@ void Editor::setEditingCollision() {
setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked());
}
if (map_item) {
map_item->paintingEnabled = true;
map_item->paintingMode = MapPixmapItem::PaintMode::Metatiles;
map_item->setVisible(false);
}
if (events_group) {
@ -120,6 +122,8 @@ void Editor::setEditingCollision() {
setConnectionItemsVisible(false);
this->cursorMapTileRect->setSingleTileMode();
this->cursorMapTileRect->setVisibility(true);
setMapEditingButtonsEnabled(true);
}
void Editor::setEditingObjects() {
@ -128,7 +132,9 @@ void Editor::setEditingObjects() {
events_group->setVisible(true);
}
if (map_item) {
map_item->paintingEnabled = false;
map_item->paintingMode = MapPixmapItem::PaintMode::EventObjects;
displayMapConnections();
map_item->draw();
map_item->setVisible(true);
setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked());
}
@ -139,12 +145,30 @@ void Editor::setEditingObjects() {
setConnectionItemsVisible(false);
this->cursorMapTileRect->setSingleTileMode();
this->cursorMapTileRect->setVisibility(false);
setMapEditingButtonsEnabled(false);
}
void Editor::setMapEditingButtonsEnabled(bool enabled) {
this->ui->toolButton_Fill->setEnabled(enabled);
this->ui->toolButton_Dropper->setEnabled(enabled);
this->ui->pushButton_ChangeDimensions->setEnabled(enabled);
// If the fill button is pressed, unpress it and select the pointer.
if (!enabled && (this->ui->toolButton_Fill->isChecked() || this->ui->toolButton_Dropper->isChecked())) {
this->map_edit_mode = "select";
this->settings->mapCursor = QCursor();
this->cursorMapTileRect->setSingleTileMode();
this->ui->toolButton_Fill->setChecked(false);
this->ui->toolButton_Dropper->setChecked(false);
this->ui->toolButton_Select->setChecked(true);
}
this->ui->checkBox_smartPaths->setEnabled(enabled);
}
void Editor::setEditingConnections() {
current_view = map_item;
if (map_item) {
map_item->paintingEnabled = false;
map_item->paintingMode = MapPixmapItem::PaintMode::Disabled;
map_item->draw();
map_item->setVisible(true);
populateConnectionMapPickers();
@ -866,7 +890,8 @@ void Editor::onSelectedMetatilesChanged() {
void Editor::onHoveredMapMetatileChanged(int x, int y) {
this->playerViewRect->updateLocation(x, y);
this->cursorMapTileRect->updateLocation(x, y);
if (map_item->paintingEnabled && x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) {
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles
&& x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) {
int blockIndex = y * map->getWidth() + x;
int tile = map->layout->blockdata->blocks->at(blockIndex).tile;
this->ui->statusBar->showMessage(QString("X: %1, Y: %2, Metatile: 0x%3, Scale = %4x")
@ -880,7 +905,7 @@ void Editor::onHoveredMapMetatileChanged(int x, int y) {
void Editor::onHoveredMapMetatileCleared() {
this->playerViewRect->setVisible(false);
this->cursorMapTileRect->setVisible(false);
if (map_item->paintingEnabled) {
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) {
this->ui->statusBar->clearMessage();
}
}
@ -888,7 +913,8 @@ void Editor::onHoveredMapMetatileCleared() {
void Editor::onHoveredMapMovementPermissionChanged(int x, int y) {
this->playerViewRect->updateLocation(x, y);
this->cursorMapTileRect->updateLocation(x, y);
if (map_item->paintingEnabled && x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) {
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles
&& x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) {
int blockIndex = y * map->getWidth() + x;
uint16_t collision = map->layout->blockdata->blocks->at(blockIndex).collision;
uint16_t elevation = map->layout->blockdata->blocks->at(blockIndex).elevation;
@ -903,7 +929,7 @@ void Editor::onHoveredMapMovementPermissionChanged(int x, int y) {
void Editor::onHoveredMapMovementPermissionCleared() {
this->playerViewRect->setVisible(false);
this->cursorMapTileRect->setVisible(false);
if (map_item->paintingEnabled) {
if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles) {
this->ui->statusBar->clearMessage();
}
}
@ -954,7 +980,7 @@ bool Editor::setMap(QString map_name) {
}
void Editor::onMapStartPaint(QGraphicsSceneMouseEvent *event, MapPixmapItem *item) {
if (!item->paintingEnabled) {
if (!(item->paintingMode == MapPixmapItem::PaintMode::Metatiles)) {
return;
}
@ -969,7 +995,7 @@ void Editor::onMapStartPaint(QGraphicsSceneMouseEvent *event, MapPixmapItem *ite
}
void Editor::onMapEndPaint(QGraphicsSceneMouseEvent *, MapPixmapItem *item) {
if (!item->paintingEnabled) {
if (!(item->paintingMode == MapPixmapItem::PaintMode::Metatiles)) {
return;
}
this->cursorMapTileRect->stopRightClickSelectionAnchor();
@ -987,10 +1013,16 @@ void Editor::setSmartPathCursorMode(QGraphicsSceneMouseEvent *event)
}
void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item) {
if (!item->paintingEnabled) {
// TODO: add event tab object painting tool buttons stuff here
if (item->paintingMode == MapPixmapItem::PaintMode::Disabled) {
return;
}
QPointF pos = event->pos();
int x = static_cast<int>(pos.x()) / 16;
int y = static_cast<int>(pos.y()) / 16;
if (item->paintingMode == MapPixmapItem::PaintMode::Metatiles) {
if (map_edit_mode == "paint") {
if (event->buttons() & Qt::RightButton) {
item->updateMetatileSelection(event);
@ -1015,7 +1047,6 @@ void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item
item->floodFill(event);
}
} else if (map_edit_mode == "pick") {
if (event->buttons() & Qt::RightButton) {
item->updateMetatileSelection(event);
} else {
@ -1024,16 +1055,54 @@ void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item
} else if (map_edit_mode == "shift") {
item->shift(event);
}
} else if (item->paintingMode == MapPixmapItem::PaintMode::EventObjects) {
if (map_edit_mode == "paint" && event->type() == QEvent::GraphicsSceneMousePress) {
// Right-clicking while in paint mode will change mode to select.
if (event->buttons() & Qt::RightButton) {
this->map_edit_mode = "select";
this->settings->mapCursor = QCursor();
this->cursorMapTileRect->setSingleTileMode();
this->ui->toolButton_Paint->setChecked(false);
this->ui->toolButton_Select->setChecked(true);
} else {
// Left-clicking while in paint mode will add a new event of the
// type of the first currently selected events.
DraggablePixmapItem * newEvent = addNewEvent(this->selected_events->first()->event->get("event_type"));
if (newEvent) {
newEvent->move(x, y);
selectMapEvent(newEvent, false);
}
}
} else if (map_edit_mode == "select") {
// do nothing here, at least for now
} else if (map_edit_mode == "shift" && item->map) {
static QPoint selection_origin;
QPointF pos = event->pos();
int x = static_cast<int>(pos.x()) / 16;
int y = static_cast<int>(pos.y()) / 16;
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
// TODO: commit / update history here
} else {
if (event->type() == QEvent::GraphicsSceneMousePress) {
selection_origin = QPoint(x, y);
} else if (event->type() == QEvent::GraphicsSceneMouseMove) {
if (x != selection_origin.x() || y != selection_origin.y()) {
int xDelta = x - selection_origin.x();
int yDelta = y - selection_origin.y();
for (DraggablePixmapItem *item : *(getObjects())) {
item->move(xDelta, yDelta);
}
selection_origin = QPoint(x, y);
}
}
}
}
}
this->playerViewRect->updateLocation(x, y);
this->cursorMapTileRect->updateLocation(x, y);
}
void Editor::mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item) {
if (!item->paintingEnabled) {
if (item->paintingMode != MapPixmapItem::PaintMode::Metatiles) {
return;
}
@ -1771,7 +1840,7 @@ void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) {
}
DraggablePixmapItem* Editor::addNewEvent(QString event_type) {
if (project && map) {
if (project && map && !event_type.isEmpty()) {
Event *event = Event::createNewEvent(event_type, map->name, project);
event->put("map_name", map->name);
if (event_type == "event_heal_location") {
@ -1802,6 +1871,17 @@ void Editor::deleteEvent(Event *event) {
// variable "selectingEvent" so that we can detect whether or not the user
// is clicking on the background instead of an event.
void Editor::objectsView_onMousePress(QMouseEvent *event) {
// make sure we are in object editing mode
if (map_item && map_item->paintingMode != MapPixmapItem::PaintMode::EventObjects) {
return;
}
if (this->map_edit_mode == "paint" && event->buttons() & Qt::RightButton) {
this->map_edit_mode = "select";
this->settings->mapCursor = QCursor();
this->cursorMapTileRect->setSingleTileMode();
this->ui->toolButton_Paint->setChecked(false);
this->ui->toolButton_Select->setChecked(true);
}
bool multiSelect = event->modifiers() & Qt::ControlModifier;
if (!selectingEvent && !multiSelect && selected_events->length() > 1) {
DraggablePixmapItem *first = selected_events->first();

View file

@ -8,7 +8,6 @@
#include "ui_eventpropertiesframe.h"
#include "bordermetatilespixmapitem.h"
#include "currentselectedmetatilespixmapitem.h"
#include "customattributestable.h"
#include <QFileDialog>
#include <QDirIterator>
@ -79,6 +78,15 @@ void MainWindow::initExtraShortcuts() {
}
void MainWindow::initCustomUI() {
// Set up the tab bar
ui->mainTabBar->addTab("Map");
ui->mainTabBar->setTabIcon(0, QIcon(QStringLiteral(":/icons/map.ico")));
ui->mainTabBar->addTab("Events");
ui->mainTabBar->addTab("Header");
ui->mainTabBar->addTab("Connections");
ui->mainTabBar->addTab("Wild Pokemon");
ui->mainTabBar->setTabIcon(4, QIcon(QStringLiteral(":/icons/tall_grass.ico")));
// Right-clicking on items in the map list tree view brings up a context menu.
ui->mapList->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->mapList, SIGNAL(customContextMenuRequested(const QPoint &)),
@ -152,11 +160,11 @@ void MainWindow::initMapSortOrder() {
void MainWindow::setProjectSpecificUIVisibility()
{
ui->tabWidget->setTabEnabled(4, projectConfig.getEncounterJsonActive());
ui->actionUse_Encounter_Json->setChecked(projectConfig.getEncounterJsonActive());
ui->actionUse_Poryscript->setChecked(projectConfig.getUsePoryScript());
ui->mainTabBar->setTabEnabled(4, projectConfig.getEncounterJsonActive());
switch (projectConfig.getBaseGameVersion())
{
case BaseGameVersion::pokeruby:
@ -264,7 +272,6 @@ void MainWindow::restoreWindowState() {
this->restoreGeometry(geometry.value("window_geometry"));
this->restoreState(geometry.value("window_state"));
this->ui->splitter_map->restoreState(geometry.value("map_splitter_state"));
this->ui->splitter_events->restoreState(geometry.value("events_splitter_state"));
this->ui->splitter_main->restoreState(geometry.value("main_splitter_state"));
}
@ -444,7 +451,7 @@ void MainWindow::redrawMapScene()
if (!editor->displayMap())
return;
on_tabWidget_currentChanged(ui->tabWidget->currentIndex());
on_mainTabBar_tabBarClicked(ui->mainTabBar->currentIndex());
double base = editor->scale_base;
double exp = editor->scale_exp;
@ -455,11 +462,7 @@ void MainWindow::redrawMapScene()
ui->graphicsView_Map->setScene(editor->scene);
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
ui->graphicsView_Map->setFixedSize(width, height);
ui->graphicsView_Objects_Map->setScene(editor->scene);
ui->graphicsView_Objects_Map->setSceneRect(editor->scene->sceneRect());
ui->graphicsView_Objects_Map->setFixedSize(width, height);
ui->graphicsView_Objects_Map->editor = editor;
ui->graphicsView_Map->editor = editor;
ui->graphicsView_Connections->setScene(editor->scene);
ui->graphicsView_Connections->setSceneRect(editor->scene->sceneRect());
@ -1203,16 +1206,27 @@ void MainWindow::on_action_Exit_triggered()
QApplication::quit();
}
void MainWindow::on_tabWidget_currentChanged(int index)
void MainWindow::on_mainTabBar_tabBarClicked(int index)
{
ui->mainTabBar->setCurrentIndex(index);
int tabIndexToStackIndex[5] = {0, 0, 1, 2, 3};
ui->mainStackedWidget->setCurrentIndex(tabIndexToStackIndex[index]);
if (index == 0) {
ui->stackedWidget_MapEvents->setCurrentIndex(0);
on_tabWidget_2_currentChanged(ui->tabWidget_2->currentIndex());
} else if (index == 1) {
ui->stackedWidget_MapEvents->setCurrentIndex(1);
editor->setEditingObjects();
QStringList validOptions = {"select", "move", "paint", "shift"};
QString newEditMode = validOptions.contains(editor->map_edit_mode) ? editor->map_edit_mode : "select";
clickToolButtonFromEditMode(newEditMode);
} else if (index == 3) {
editor->setEditingConnections();
}
if (index != 4) {
if (projectConfig.getEncounterJsonActive())
editor->saveEncounterTabData();
}
}
@ -1318,13 +1332,11 @@ void MainWindow::scaleMapView(int s) {
double sfactor = pow(base,s);
ui->graphicsView_Map->scale(sfactor,sfactor);
ui->graphicsView_Objects_Map->scale(sfactor,sfactor);
ui->graphicsView_Connections->scale(sfactor,sfactor);
int width = static_cast<int>(ceil((editor->scene->width()) * pow(base,exp))) + 2;
int height = static_cast<int>(ceil((editor->scene->height()) * pow(base,exp))) + 2;
ui->graphicsView_Map->setFixedSize(width, height);
ui->graphicsView_Objects_Map->setFixedSize(width, height);
ui->graphicsView_Connections->setFixedSize(width, height);
}
}
@ -1430,7 +1442,7 @@ void MainWindow::updateSelectedObjects() {
bool pokefirered = projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered;
for (DraggablePixmapItem *item : *events) {
EventPropertiesFrame *frame = new EventPropertiesFrame;
EventPropertiesFrame *frame = new EventPropertiesFrame(item->event);
// frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
QSpinBox *x = frame->ui->spinBox_x;
@ -1736,13 +1748,6 @@ void MainWindow::updateSelectedObjects() {
item->bind(combo, key);
}
}
// Custom fields table.
if (event_type != EventType::HealLocation) {
CustomAttributesTable *customAttributes = new CustomAttributesTable(item->event, frame);
frame->layout()->addWidget(customAttributes);
}
frames.append(frame);
}
@ -2044,7 +2049,7 @@ void MainWindow::on_toolButton_Paint_clicked()
void MainWindow::on_toolButton_Select_clicked()
{
editor->map_edit_mode = "select";
editor->settings->mapCursor = QCursor(QPixmap(":/icons/cursor.ico"), 0, 0);
editor->settings->mapCursor = QCursor();
editor->cursorMapTileRect->setSingleTileMode();
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
@ -2115,6 +2120,22 @@ void MainWindow::checkToolButtons() {
ui->toolButton_Shift->setChecked(editor->map_edit_mode == "shift");
}
void MainWindow::clickToolButtonFromEditMode(QString editMode) {
if (editMode == "paint") {
on_toolButton_Paint_clicked();
} else if (editMode == "select") {
on_toolButton_Select_clicked();
} else if (editMode == "fill") {
on_toolButton_Fill_clicked();
} else if (editMode == "pick") {
on_toolButton_Dropper_clicked();
} else if (editMode == "move") {
on_toolButton_Move_clicked();
} else if (editMode == "shift") {
on_toolButton_Shift_clicked();
}
}
void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) {
if (!setMap(mapName, true)) {
QMessageBox msgBox(this);
@ -2512,7 +2533,6 @@ void MainWindow::closeEvent(QCloseEvent *event) {
this->saveGeometry(),
this->saveState(),
this->ui->splitter_map->saveState(),
this->ui->splitter_events->saveState(),
this->ui->splitter_main->saveState()
);
porymapConfig.save();

View file

@ -4,13 +4,13 @@ void CollisionPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
int x = static_cast<int>(event->pos().x()) / 16;
int y = static_cast<int>(event->pos().y()) / 16;
emit this->hoveredMapMovementPermissionChanged(x, y);
if (this->settings->betterCursors && this->paintingEnabled) {
if (this->settings->betterCursors && this->paintingMode == MapPixmapItem::PaintMode::Metatiles) {
setCursor(this->settings->mapCursor);
}
}
void CollisionPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
emit this->hoveredMapMovementPermissionCleared();
if (this->settings->betterCursors && this->paintingEnabled){
if (this->settings->betterCursors && this->paintingMode == MapPixmapItem::PaintMode::Metatiles){
unsetCursor();
}
}

View file

@ -1,14 +1,28 @@
#include "eventpropertiesframe.h"
#include "customattributestable.h"
#include "ui_eventpropertiesframe.h"
EventPropertiesFrame::EventPropertiesFrame(QWidget *parent) :
EventPropertiesFrame::EventPropertiesFrame(Event *event, QWidget *parent) :
QFrame(parent),
ui(new Ui::EventPropertiesFrame)
{
ui->setupUi(this);
this->event = event;
this->firstShow = true;
}
EventPropertiesFrame::~EventPropertiesFrame()
{
delete ui;
}
void EventPropertiesFrame::paintEvent(QPaintEvent *painter) {
// Custom fields table.
if (firstShow && event->get("event_type") != EventType::HealLocation) {
CustomAttributesTable *customAttributes = new CustomAttributesTable(event, this);
this->layout()->addWidget(customAttributes);
}
QFrame::paintEvent(painter);
firstShow = false;
}

View file

@ -558,13 +558,13 @@ void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
int x = static_cast<int>(event->pos().x()) / 16;
int y = static_cast<int>(event->pos().y()) / 16;
emit this->hoveredMapMetatileChanged(x, y);
if (this->settings->betterCursors && this->paintingEnabled) {
if (this->settings->betterCursors && this->paintingMode != MapPixmapItem::PaintMode::Disabled) {
setCursor(this->settings->mapCursor);
}
}
void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
emit this->hoveredMapMetatileCleared();
if (this->settings->betterCursors && this->paintingEnabled) {
if (this->settings->betterCursors && this->paintingMode != MapPixmapItem::PaintMode::Disabled) {
unsetCursor();
}
}