Merge pull request #40 from Diegoisawesome/master

Various improvements and bugfixes
This commit is contained in:
Marcus Huderle 2018-09-29 09:24:19 -05:00 committed by GitHub
commit 866926daa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
65 changed files with 224 additions and 132 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ObjectPropertiesFrame</class> <class>EventPropertiesFrame</class>
<widget class="QFrame" name="ObjectPropertiesFrame"> <widget class="QFrame" name="EventPropertiesFrame">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View file

@ -2195,7 +2195,7 @@
<string>Zoom In</string> <string>Zoom In</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>+</string> <string>Ctrl++</string>
</property> </property>
</action> </action>
<action name="actionZoom_Out"> <action name="actionZoom_Out">
@ -2203,7 +2203,7 @@
<string>Zoom Out</string> <string>Zoom Out</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>-</string> <string>Ctrl+-</string>
</property> </property>
</action> </action>
<action name="actionBetter_Cursors"> <action name="actionBetter_Cursors">

View file

@ -40,8 +40,6 @@ public:
QString show_location; QString show_location;
QString battle_scene; QString battle_scene;
MapLayout *layout; MapLayout *layout;
int scale_exp = 0;
double scale_base = sqrt(2); // adjust scale factor with this
bool isPersistedToFile = true; bool isPersistedToFile = true;
QImage collision_image; QImage collision_image;
QPixmap collision_pixmap; QPixmap collision_pixmap;

View file

@ -110,6 +110,9 @@ public:
QString map_edit_mode; QString map_edit_mode;
QString prev_edit_mode; QString prev_edit_mode;
int scale_exp = 0;
double scale_base = sqrt(2); // adjust scale factor with this
void objectsView_onMousePress(QMouseEvent *event); void objectsView_onMousePress(QMouseEvent *event);
void objectsView_onMouseMove(QMouseEvent *event); void objectsView_onMouseMove(QMouseEvent *event);
void objectsView_onMouseRelease(QMouseEvent *event); void objectsView_onMouseRelease(QMouseEvent *event);
@ -164,6 +167,7 @@ signals:
void tilesetChanged(QString); void tilesetChanged(QString);
void warpEventDoubleClicked(QString mapName, QString warpNum); void warpEventDoubleClicked(QString mapName, QString warpNum);
void currentMetatilesSelectionChanged(); void currentMetatilesSelectionChanged();
void wheelZoom(int delta);
}; };

View file

@ -25,6 +25,9 @@ public:
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
public slots:
void scaleMapView(int);
private slots: private slots:
void on_action_Open_Project_triggered(); void on_action_Open_Project_triggered();
void on_mapList_activated(const QModelIndex &index); void on_mapList_activated(const QModelIndex &index);
@ -118,13 +121,16 @@ private slots:
void on_checkBox_ToggleBorder_stateChanged(int arg1); void on_checkBox_ToggleBorder_stateChanged(int arg1);
void resetMapViewScale();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QStandardItemModel *mapListModel; QStandardItemModel *mapListModel;
QList<QStandardItem*> *mapGroupsModel; QList<QStandardItem*> *mapGroupsModel;
QMap<QString, QModelIndex> mapListIndexes;
Editor *editor = nullptr; Editor *editor = nullptr;
QIcon* mapIcon; QIcon* mapIcon;
void setMap(QString); void setMap(QString, bool scrollTreeView = false);
void redrawMapScene(); void redrawMapScene();
void loadDataStructures(); void loadDataStructures();
void populateMapList(); void populateMapList();
@ -141,7 +147,6 @@ private:
void displayMapProperties(); void displayMapProperties();
void checkToolButtons(); void checkToolButtons();
void scaleMapView(int);
void initExtraShortcuts(); void initExtraShortcuts();
void initExtraSignals(); void initExtraSignals();
void initEditor(); void initEditor();

View file

@ -1,10 +1,10 @@
#ifndef OBJECTPROPERTIESFRAME_H #ifndef EVENTPROPERTIESFRAME_H
#define OBJECTPROPERTIESFRAME_H #define EVENTPROPERTIESFRAME_H
#include <QFrame> #include <QFrame>
namespace Ui { namespace Ui {
class ObjectPropertiesFrame; class EventPropertiesFrame;
} }
class EventPropertiesFrame : public QFrame class EventPropertiesFrame : public QFrame
@ -16,7 +16,7 @@ public:
~EventPropertiesFrame(); ~EventPropertiesFrame();
public: public:
Ui::ObjectPropertiesFrame *ui; Ui::EventPropertiesFrame *ui;
}; };
#endif // OBJECTPROPERTIESFRAME_H #endif // EVENTPROPERTIESFRAME_H

View file

@ -0,0 +1,19 @@
#ifndef MAPSCENEEVENTFILTER_H
#define MAPSCENEEVENTFILTER_H
#include <QObject>
class MapSceneEventFilter : public QObject
{
Q_OBJECT
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
public:
explicit MapSceneEventFilter(QObject *parent = nullptr);
signals:
void wheelZoom(int delta);
public slots:
};
#endif // MAPSCENEEVENTFILTER_H

90
porymap.pro Normal file
View file

@ -0,0 +1,90 @@
#-------------------------------------------------
#
# Project created by QtCreator 2016-08-31T15:19:13
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = porymap
TEMPLATE = app
RC_ICONS = resources/icons/porymap-icon-1.ico
ICON = resources/icons/porymap-icon-1.ico
SOURCES += src/core/block.cpp \
src/core/blockdata.cpp \
src/core/event.cpp \
src/core/heallocation.cpp \
src/core/historyitem.cpp \
src/core/map.cpp \
src/core/maplayout.cpp \
src/core/metatile.cpp \
src/core/parseutil.cpp \
src/core/tile.cpp \
src/core/tileset.cpp \
src/ui/bordermetatilespixmapitem.cpp \
src/ui/collisionpixmapitem.cpp \
src/ui/connectionpixmapitem.cpp \
src/ui/currentselectedmetatilespixmapitem.cpp \
src/ui/eventpropertiesframe.cpp \
src/ui/graphicsview.cpp \
src/ui/imageproviders.cpp \
src/ui/mappixmapitem.cpp \
src/ui/mapsceneeventfilter.cpp \
src/ui/metatileselector.cpp \
src/ui/movementpermissionsselector.cpp \
src/ui/neweventtoolbutton.cpp \
src/ui/noscrollcombobox.cpp \
src/ui/noscrollspinbox.cpp \
src/ui/selectablepixmapitem.cpp \
src/editor.cpp \
src/main.cpp \
src/mainwindow.cpp \
src/project.cpp \
src/settings.cpp
HEADERS += include/core/block.h \
include/core/blockdata.h \
include/core/event.h \
include/core/heallocation.h \
include/core/history.h \
include/core/historyitem.h \
include/core/map.h \
include/core/mapconnection.h \
include/core/maplayout.h \
include/core/metatile.h \
include/core/parseutil.h \
include/core/tile.h \
include/core/tileset.h \
include/ui/bordermetatilespixmapitem.h \
include/ui/collisionpixmapitem.h \
include/ui/connectionpixmapitem.h \
include/ui/currentselectedmetatilespixmapitem.h \
include/ui/eventpropertiesframe.h \
include/ui/graphicsview.h \
include/ui/imageproviders.h \
include/ui/mappixmapitem.h \
include/ui/mapsceneeventfilter.h \
include/ui/metatileselector.h \
include/ui/movementpermissionsselector.h \
include/ui/neweventtoolbutton.h \
include/ui/noscrollcombobox.h \
include/ui/noscrollspinbox.h \
include/ui/selectablepixmapitem.h \
include/editor.h \
include/mainwindow.h \
include/project.h \
include/settings.h
FORMS += forms/mainwindow.ui \
forms/eventpropertiesframe.ui
RESOURCES += \
resources/images.qrc
INCLUDEPATH += include
INCLUDEPATH += include/core
INCLUDEPATH += include/ui

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View file

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 490 B

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -3,6 +3,7 @@
#include "imageproviders.h" #include "imageproviders.h"
#include "mapconnection.h" #include "mapconnection.h"
#include "currentselectedmetatilespixmapitem.h" #include "currentselectedmetatilespixmapitem.h"
#include "mapsceneeventfilter.h"
#include <QCheckBox> #include <QCheckBox>
#include <QPainter> #include <QPainter>
#include <QMouseEvent> #include <QMouseEvent>
@ -348,7 +349,7 @@ void Editor::onHoveredMapMetatileChanged(int x, int y) {
.arg(x) .arg(x)
.arg(y) .arg(y)
.arg(QString("%1").arg(tile, 3, 16, QChar('0')).toUpper()) .arg(QString("%1").arg(tile, 3, 16, QChar('0')).toUpper())
.arg(QString::number(pow(map->scale_base, map->scale_exp)))); .arg(QString::number(pow(scale_base, scale_exp), 'g', 2)));
} }
} }
@ -461,8 +462,12 @@ void Editor::mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixm
} }
void Editor::displayMap() { void Editor::displayMap() {
if (!scene) if (!scene) {
scene = new QGraphicsScene; scene = new QGraphicsScene;
MapSceneEventFilter *filter = new MapSceneEventFilter();
scene->installEventFilter(filter);
connect(filter, &MapSceneEventFilter::wheelZoom, this, &Editor::wheelZoom);
}
if (map_item && scene) { if (map_item && scene) {
scene->removeItem(map_item); scene->removeItem(map_item);

View file

@ -3,7 +3,7 @@
#include "project.h" #include "project.h"
#include "editor.h" #include "editor.h"
#include "eventpropertiesframe.h" #include "eventpropertiesframe.h"
#include "ui_objectpropertiesframe.h" #include "ui_eventpropertiesframe.h"
#include "bordermetatilespixmapitem.h" #include "bordermetatilespixmapitem.h"
#include "currentselectedmetatilespixmapitem.h" #include "currentselectedmetatilespixmapitem.h"
@ -32,6 +32,7 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
QCoreApplication::setOrganizationName("pret"); QCoreApplication::setOrganizationName("pret");
QCoreApplication::setApplicationName("porymap"); QCoreApplication::setApplicationName("porymap");
QApplication::setApplicationDisplayName("porymap");
QApplication::setWindowIcon(QIcon(":/icons/porymap-icon-1.ico")); QApplication::setWindowIcon(QIcon(":/icons/porymap-icon-1.ico"));
ui->setupUi(this); ui->setupUi(this);
@ -50,6 +51,8 @@ MainWindow::~MainWindow()
void MainWindow::initExtraShortcuts() { void MainWindow::initExtraShortcuts() {
new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z), this, SLOT(redo())); new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z), this, SLOT(redo()));
new QShortcut(QKeySequence("Ctrl+0"), this, SLOT(resetMapViewScale()));
ui->actionZoom_In->setShortcuts({QKeySequence("Ctrl++"), QKeySequence("Ctrl+=")});
} }
void MainWindow::initExtraSignals() { void MainWindow::initExtraSignals() {
@ -64,6 +67,7 @@ void MainWindow::initEditor() {
connect(this->editor, SIGNAL(tilesetChanged(QString)), this, SLOT(onTilesetChanged(QString))); connect(this->editor, SIGNAL(tilesetChanged(QString)), this, SLOT(onTilesetChanged(QString)));
connect(this->editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString))); connect(this->editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
connect(this->editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged())); connect(this->editor, SIGNAL(currentMetatilesSelectionChanged()), this, SLOT(currentMetatilesSelectionChanged()));
connect(this->editor, &Editor::wheelZoom, this, &MainWindow::scaleMapView);
this->loadUserSettings(); this->loadUserSettings();
} }
@ -103,12 +107,12 @@ void MainWindow::openProject(QString dir) {
if (!already_open) { if (!already_open) {
editor->project = new Project; editor->project = new Project;
editor->project->root = dir; editor->project->root = dir;
setWindowTitle(editor->project->getProjectTitle() + " - porymap"); setWindowTitle(editor->project->getProjectTitle());
loadDataStructures(); loadDataStructures();
populateMapList(); populateMapList();
setMap(getDefaultMap()); setMap(getDefaultMap(), true);
} else { } else {
setWindowTitle(editor->project->getProjectTitle() + " - porymap"); setWindowTitle(editor->project->getProjectTitle());
loadDataStructures(); loadDataStructures();
populateMapList(); populateMapList();
} }
@ -171,7 +175,7 @@ void MainWindow::on_action_Open_Project_triggered()
} }
} }
void MainWindow::setMap(QString map_name) { void MainWindow::setMap(QString map_name, bool scrollTreeView) {
qDebug() << QString("setMap(%1)").arg(map_name); qDebug() << QString("setMap(%1)").arg(map_name);
if (map_name.isNull()) { if (map_name.isNull()) {
return; return;
@ -180,7 +184,12 @@ void MainWindow::setMap(QString map_name) {
redrawMapScene(); redrawMapScene();
displayMapProperties(); displayMapProperties();
setWindowTitle(map_name + " - " + editor->project->getProjectTitle() + " - porymap"); if (scrollTreeView) {
ui->mapList->setCurrentIndex(mapListIndexes.value(map_name));
ui->mapList->scrollTo(ui->mapList->currentIndex(), QAbstractItemView::PositionAtCenter);
}
setWindowTitle(map_name + " - " + editor->project->getProjectTitle());
connect(editor->map, SIGNAL(mapChanged(Map*)), this, SLOT(onMapChanged(Map *))); connect(editor->map, SIGNAL(mapChanged(Map*)), this, SLOT(onMapChanged(Map *)));
connect(editor->map, SIGNAL(mapNeedsRedrawing()), this, SLOT(onMapNeedsRedrawing())); connect(editor->map, SIGNAL(mapNeedsRedrawing()), this, SLOT(onMapNeedsRedrawing()));
@ -194,18 +203,24 @@ void MainWindow::redrawMapScene()
editor->displayMap(); editor->displayMap();
on_tabWidget_currentChanged(ui->tabWidget->currentIndex()); on_tabWidget_currentChanged(ui->tabWidget->currentIndex());
double base = editor->scale_base;
double exp = editor->scale_exp;
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->setScene(editor->scene); ui->graphicsView_Map->setScene(editor->scene);
ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect()); ui->graphicsView_Map->setSceneRect(editor->scene->sceneRect());
ui->graphicsView_Map->setFixedSize(static_cast<int>(editor->scene->width()) + 2, static_cast<int>(editor->scene->height()) + 2); ui->graphicsView_Map->setFixedSize(width, height);
ui->graphicsView_Objects_Map->setScene(editor->scene); ui->graphicsView_Objects_Map->setScene(editor->scene);
ui->graphicsView_Objects_Map->setSceneRect(editor->scene->sceneRect()); ui->graphicsView_Objects_Map->setSceneRect(editor->scene->sceneRect());
ui->graphicsView_Objects_Map->setFixedSize(static_cast<int>(editor->scene->width()) + 2, static_cast<int>(editor->scene->height()) + 2); ui->graphicsView_Objects_Map->setFixedSize(width, height);
ui->graphicsView_Objects_Map->editor = editor; ui->graphicsView_Objects_Map->editor = editor;
ui->graphicsView_Connections->setScene(editor->scene); ui->graphicsView_Connections->setScene(editor->scene);
ui->graphicsView_Connections->setSceneRect(editor->scene->sceneRect()); ui->graphicsView_Connections->setSceneRect(editor->scene->sceneRect());
ui->graphicsView_Connections->setFixedSize(static_cast<int>(editor->scene->width()) + 2, static_cast<int>(editor->scene->height()) + 2); ui->graphicsView_Connections->setFixedSize(width, height);
ui->graphicsView_Metatiles->setScene(editor->scene_metatiles); ui->graphicsView_Metatiles->setScene(editor->scene_metatiles);
//ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect()); //ui->graphicsView_Metatiles->setSceneRect(editor->scene_metatiles->sceneRect());
@ -238,7 +253,7 @@ void MainWindow::openWarpMap(QString map_name, QString warp_num) {
} }
// Open the destination map, and select the target warp event. // Open the destination map, and select the target warp event.
setMap(map_name); setMap(map_name, true);
QList<Event*> warp_events = editor->map->events["warp_event_group"]; QList<Event*> warp_events = editor->map->events["warp_event_group"];
if (warp_events.length() > warpNum) { if (warp_events.length() > warpNum) {
Event *warp_event = warp_events.at(warpNum); Event *warp_event = warp_events.at(warpNum);
@ -440,6 +455,7 @@ void MainWindow::populateMapList() {
QString map_name = names.value(j); QString map_name = names.value(j);
QStandardItem *map = createMapItem(map_name, i, j); QStandardItem *map = createMapItem(map_name, i, j);
group->appendRow(map); group->appendRow(map);
mapListIndexes.insert(map_name, map->index());
} }
} }
@ -502,6 +518,7 @@ void MainWindow::onAddNewMapToGroupClick(QAction* triggeredAction)
int numMapsInGroup = groupItem->rowCount(); int numMapsInGroup = groupItem->rowCount();
QStandardItem *newMapItem = createMapItem(newMapName, groupNum, numMapsInGroup); QStandardItem *newMapItem = createMapItem(newMapName, groupNum, numMapsInGroup);
groupItem->appendRow(newMapItem); groupItem->appendRow(newMapItem);
mapListIndexes.insert(newMapName, newMapItem->index());
setMap(newMapName); setMap(newMapName);
} }
@ -520,7 +537,7 @@ void MainWindow::currentMetatilesSelectionChanged()
void MainWindow::on_mapList_activated(const QModelIndex &index) void MainWindow::on_mapList_activated(const QModelIndex &index)
{ {
QVariant data = index.data(Qt::UserRole); QVariant data = index.data(Qt::UserRole);
if (!data.isNull()) { if (index.data(MapListUserRoles::TypeRole) == "map_name" && !data.isNull()) {
setMap(data.toString()); setMap(data.toString());
} }
} }
@ -665,19 +682,33 @@ void MainWindow::on_actionMap_Shift_triggered()
} }
void MainWindow::scaleMapView(int s) { void MainWindow::scaleMapView(int s) {
editor->map->scale_exp += s; if ((editor->scale_exp + s) <= 5 && (editor->scale_exp + s) >= -2) // sane limits
{
if (s == 0)
{
s = -editor->scale_exp;
}
double base = editor->map->scale_base; editor->scale_exp += s;
double exp = editor->map->scale_exp;
double sfactor = pow(base,s);
ui->graphicsView_Map->scale(sfactor,sfactor); double base = editor->scale_base;
ui->graphicsView_Objects_Map->scale(sfactor,sfactor); double exp = editor->scale_exp;
double sfactor = pow(base,s);
int width = static_cast<int>((editor->scene->width() + 2) * pow(base,exp)); ui->graphicsView_Map->scale(sfactor,sfactor);
int height = static_cast<int>((editor->scene->height() + 2) * pow(base,exp)); ui->graphicsView_Objects_Map->scale(sfactor,sfactor);
ui->graphicsView_Map->setFixedSize(width, height); ui->graphicsView_Connections->scale(sfactor,sfactor);
ui->graphicsView_Objects_Map->setFixedSize(width, height);
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);
}
}
void MainWindow::resetMapViewScale() {
scaleMapView(0);
} }
void MainWindow::addNewEvent(QString event_type) void MainWindow::addNewEvent(QString event_type)
@ -1059,7 +1090,7 @@ void MainWindow::checkToolButtons() {
} }
void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) { void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) {
setMap(mapName); setMap(mapName, true);
editor->setSelectedConnectionFromMap(fromMapName); editor->setSelectedConnectionFromMap(fromMapName);
} }

View file

@ -1,87 +0,0 @@
#-------------------------------------------------
#
# Project created by QtCreator 2016-08-31T15:19:13
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = porymap
TEMPLATE = app
RC_ICONS = resources/icons/porymap-icon-1.ico
ICON = resources/icons/porymap-icon-1.ico
SOURCES += core/block.cpp \
core/blockdata.cpp \
core/event.cpp \
core/heallocation.cpp \
core/historyitem.cpp \
core/map.cpp \
core/maplayout.cpp \
core/metatile.cpp \
core/parseutil.cpp \
core/tile.cpp \
core/tileset.cpp \
ui/bordermetatilespixmapitem.cpp \
ui/collisionpixmapitem.cpp \
ui/connectionpixmapitem.cpp \
ui/currentselectedmetatilespixmapitem.cpp \
ui/eventpropertiesframe.cpp \
ui/graphicsview.cpp \
ui/imageproviders.cpp \
ui/mappixmapitem.cpp \
ui/metatileselector.cpp \
ui/movementpermissionsselector.cpp \
ui/neweventtoolbutton.cpp \
ui/noscrollcombobox.cpp \
ui/noscrollspinbox.cpp \
ui/selectablepixmapitem.cpp \
editor.cpp \
main.cpp \
mainwindow.cpp \
project.cpp \
settings.cpp
HEADERS += core/block.h \
core/blockdata.h \
core/event.h \
core/heallocation.h \
core/history.h \
core/historyitem.h \
core/map.h \
core/mapconnection.h \
core/maplayout.h \
core/metatile.h \
core/parseutil.h \
core/tile.h \
core/tileset.h \
ui/bordermetatilespixmapitem.h \
ui/collisionpixmapitem.h \
ui/connectionpixmapitem.h \
ui/currentselectedmetatilespixmapitem.h \
ui/eventpropertiesframe.h \
ui/graphicsview.h \
ui/imageproviders.h \
ui/mappixmapitem.h \
ui/metatileselector.h \
ui/movementpermissionsselector.h \
ui/neweventtoolbutton.h \
ui/noscrollcombobox.h \
ui/noscrollspinbox.h \
ui/selectablepixmapitem.h \
editor.h \
mainwindow.h \
project.h \
settings.h
FORMS += mainwindow.ui \
eventpropertiesframe.ui
RESOURCES += \
resources/images.qrc
INCLUDEPATH += core
INCLUDEPATH += ui

View file

@ -1,9 +1,9 @@
#include "eventpropertiesframe.h" #include "eventpropertiesframe.h"
#include "ui_objectpropertiesframe.h" #include "ui_eventpropertiesframe.h"
EventPropertiesFrame::EventPropertiesFrame(QWidget *parent) : EventPropertiesFrame::EventPropertiesFrame(QWidget *parent) :
QFrame(parent), QFrame(parent),
ui(new Ui::ObjectPropertiesFrame) ui(new Ui::EventPropertiesFrame)
{ {
ui->setupUi(this); ui->setupUi(this);
} }

View file

@ -38,7 +38,11 @@ QImage getMetatileImage(int tile, Tileset *primaryTileset, Tileset *secondaryTil
if (tile_image.isNull()) { if (tile_image.isNull()) {
// Some metatiles specify tiles that are outside the valid range. // Some metatiles specify tiles that are outside the valid range.
// These are treated as completely transparent, so they can be skipped without // These are treated as completely transparent, so they can be skipped without
// being drawn. // being drawn unless they're on the bottom layer, in which case we need
// a placeholder because garbage will be drawn otherwise.
if (layer == 0) {
metatile_painter.fillRect(x * 8, y * 8, 8, 8, palettes.value(0).value(0));
}
continue; continue;
} }

View file

@ -0,0 +1,23 @@
#include "mapsceneeventfilter.h"
#include <QEvent>
#include <QGraphicsSceneWheelEvent>
MapSceneEventFilter::MapSceneEventFilter(QObject *parent) : QObject(parent)
{
}
bool MapSceneEventFilter::eventFilter(QObject*, QEvent *event)
{
if (event->type() == QEvent::GraphicsSceneWheel)
{
QGraphicsSceneWheelEvent *wheelEvent = static_cast<QGraphicsSceneWheelEvent *>(event);
if (wheelEvent->modifiers() & Qt::ControlModifier)
{
emit wheelZoom(wheelEvent->delta() > 0 ? 1 : -1);
event->accept();
return true;
}
}
return false;
}