diff --git a/forms/mainwindow.ui b/forms/mainwindow.ui
index fc2237cd..61aaa45a 100644
--- a/forms/mainwindow.ui
+++ b/forms/mainwindow.ui
@@ -2693,839 +2693,6 @@
-
-
- Region Map
-
-
-
-
- 460
- 420
- 301
- 181
-
-
-
-
- 0
- 0
-
-
-
- Qt::ScrollBarAlwaysOn
-
-
- Qt::ScrollBarAsNeeded
-
-
- QAbstractScrollArea::AdjustIgnored
-
-
- true
-
-
- Qt::AlignHCenter|Qt::AlignTop
-
-
-
- true
-
-
-
- 8
- 0
- 283
- 179
-
-
-
-
- 0
- 0
-
-
-
-
- QLayout::SetDefaultConstraint
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAlwaysOff
-
-
- QAbstractScrollArea::AdjustIgnored
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
-
- 19
- 9
- 381
- 291
-
-
-
- 0
-
-
-
- Background Image
-
-
-
-
- 0
- 0
- 371
- 261
-
-
-
-
- 1
- 0
-
-
-
- true
-
-
-
-
- 0
- 0
- 369
- 259
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
- 0
- 0
-
-
-
- false
-
-
- false
-
-
- QAbstractScrollArea::AdjustIgnored
-
-
- QGraphicsView::NoDrag
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 166
- 16
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 16
- 166
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 166
- 16
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 16
- 166
-
-
-
-
-
-
-
-
-
-
- Map Layout
-
-
-
-
- 0
- 0
- 371
- 261
-
-
-
-
- 1
- 0
-
-
-
- true
-
-
-
-
- 0
- 0
- 369
- 259
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
- 0
- 0
-
-
-
- false
-
-
- false
-
-
- QAbstractScrollArea::AdjustIgnored
-
-
- QGraphicsView::NoDrag
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 166
- 16
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 16
- 166
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 166
- 16
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 16
- 166
-
-
-
-
-
-
-
-
-
-
-
-
- 440
- 20
- 351
- 291
-
-
-
- 0
-
-
-
-
-
- 30
- 20
- 281
- 261
-
-
-
-
- 0
- 0
-
-
-
- Qt::ScrollBarAlwaysOn
-
-
- Qt::ScrollBarAsNeeded
-
-
- QAbstractScrollArea::AdjustIgnored
-
-
- true
-
-
- Qt::AlignHCenter|Qt::AlignTop
-
-
-
- true
-
-
-
- 8
- 0
- 263
- 259
-
-
-
-
- 0
- 0
-
-
-
-
- QLayout::SetDefaultConstraint
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
- true
-
-
-
- 0
- 0
-
-
-
- Qt::ScrollBarAlwaysOff
-
-
- Qt::ScrollBarAlwaysOff
-
-
- QAbstractScrollArea::AdjustIgnored
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
-
-
-
- false
-
-
-
- 10
- 30
- 331
- 211
-
-
-
-
- 0
- 0
-
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
-
- 210
- 170
- 107
- 32
-
-
-
- Set Values
-
-
-
-
-
- 13
- 11
- 301
- 111
-
-
-
- -
-
-
- Map Section
-
-
-
- -
-
-
- <html><head/><body><p>The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.</p></body></html>
-
-
- true
-
-
-
- -
-
-
- Map Name
-
-
-
- -
-
-
- -
-
-
- City Map
-
-
-
- -
-
-
- <html><head/><body><p>The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.</p></body></html>
-
-
- true
-
-
-
-
-
-
-
-
- 20
- 130
- 121
- 26
-
-
-
- -
-
-
- x
-
-
-
- -
-
-
- -
-
-
- y
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
- 40
- 350
- 341
- 281
-
-
-
- -
-
-
-
-
-
- City Map:
-
-
-
- -
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- save
-
-
-
-
-
- -
-
-
-
- 1
- 0
-
-
-
- true
-
-
-
-
- 0
- 0
- 337
- 235
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- false
-
-
- false
-
-
- QAbstractScrollArea::AdjustIgnored
-
-
- QGraphicsView::NoDrag
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 166
- 16
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 16
- 166
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 166
- 16
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 16
- 166
-
-
-
-
-
-
-
-
-
-
-
@@ -3582,6 +2749,7 @@
+
diff --git a/forms/regionmapeditor.ui b/forms/regionmapeditor.ui
new file mode 100644
index 00000000..5b9e193d
--- /dev/null
+++ b/forms/regionmapeditor.ui
@@ -0,0 +1,875 @@
+
+
+ RegionMapEditor
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ MainWindow
+
+
+
+
+
+ 450
+ 250
+ 301
+ 181
+
+
+
+
+ 0
+ 0
+
+
+
+ Qt::ScrollBarAlwaysOn
+
+
+ Qt::ScrollBarAsNeeded
+
+
+ QAbstractScrollArea::AdjustIgnored
+
+
+ true
+
+
+ Qt::AlignHCenter|Qt::AlignTop
+
+
+
+ true
+
+
+
+ 8
+ 0
+ 283
+ 179
+
+
+
+
+ 0
+ 0
+
+
+
+
+ QLayout::SetDefaultConstraint
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ QAbstractScrollArea::AdjustIgnored
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+ 19
+ 9
+ 321
+ 221
+
+
+
+ 0
+
+
+
+ Background Image
+
+
+
+
+ -10
+ -10
+ 331
+ 211
+
+
+
+
+ 1
+ 0
+
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 329
+ 209
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ false
+
+
+ false
+
+
+ QAbstractScrollArea::AdjustIgnored
+
+
+ QGraphicsView::NoDrag
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 166
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 16
+ 166
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 166
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 16
+ 166
+
+
+
+
+
+
+
+
+
+
+ Map Layout
+
+
+
+
+ -10
+ -10
+ 331
+ 211
+
+
+
+
+ 1
+ 0
+
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 329
+ 209
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ false
+
+
+ false
+
+
+ QAbstractScrollArea::AdjustIgnored
+
+
+ QGraphicsView::NoDrag
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 166
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 16
+ 166
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 166
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 16
+ 166
+
+
+
+
+
+
+
+
+
+
+
+
+ 440
+ 20
+ 351
+ 221
+
+
+
+ 0
+
+
+
+
+
+ 30
+ 20
+ 281
+ 171
+
+
+
+
+ 0
+ 0
+
+
+
+ Qt::ScrollBarAlwaysOn
+
+
+ Qt::ScrollBarAsNeeded
+
+
+ QAbstractScrollArea::AdjustIgnored
+
+
+ true
+
+
+ Qt::AlignHCenter|Qt::AlignTop
+
+
+
+ true
+
+
+
+ 8
+ 0
+ 263
+ 169
+
+
+
+
+ 0
+ 0
+
+
+
+
+ QLayout::SetDefaultConstraint
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ QAbstractScrollArea::AdjustIgnored
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ 10
+ 0
+ 331
+ 211
+
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
+
+ 210
+ 170
+ 107
+ 32
+
+
+
+ Set Values
+
+
+
+
+
+ 13
+ 11
+ 301
+ 111
+
+
+
+ -
+
+
+ Map Section
+
+
+
+ -
+
+
+ <html><head/><body><p>The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.</p></body></html>
+
+
+ true
+
+
+
+ -
+
+
+ Map Name
+
+
+
+ -
+
+
+ -
+
+
+ City Map
+
+
+
+ -
+
+
+ <html><head/><body><p>The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.</p></body></html>
+
+
+ true
+
+
+
+
+
+
+
+
+ 20
+ 130
+ 138
+ 26
+
+
+
+ -
+
+
+ x
+
+
+
+ -
+
+
+ -
+
+
+ y
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ 10
+ 250
+ 341
+ 281
+
+
+
+ -
+
+
-
+
+
+ City Map:
+
+
+
+ -
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ save
+
+
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 337
+ 235
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ false
+
+
+ false
+
+
+ QAbstractScrollArea::AdjustIgnored
+
+
+ QGraphicsView::NoDrag
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 166
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 16
+ 166
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 166
+ 16
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 16
+ 166
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Save
+
+
+ Ctrl+S
+
+
+
+
+
+
diff --git a/include/core/regionmapeditor.h b/include/core/regionmap.h
similarity index 100%
rename from include/core/regionmapeditor.h
rename to include/core/regionmap.h
diff --git a/include/editor.h b/include/editor.h
index 5f10a979..3f022388 100644
--- a/include/editor.h
+++ b/include/editor.h
@@ -19,10 +19,6 @@
#include "currentselectedmetatilespixmapitem.h"
#include "collisionpixmapitem.h"
#include "mappixmapitem.h"
-#include "regionmappixmapitem.h"
-#include "citymappixmapitem.h"
-#include "regionmaplayoutpixmapitem.h"
-#include "regionmapeditor.h"
#include "settings.h"
#include "movablerect.h"
#include "cursortilerect.h"
@@ -81,49 +77,6 @@ public:
void updateCustomMapHeaderValues(QTableWidget *);
Tileset *getCurrentMapPrimaryTileset();
-// TODO: move these to appropriate place
- RegionMap *region_map;
- void loadRegionMapData();
-
- QGraphicsScene *scene_region_map_image = nullptr;
- QGraphicsScene *scene_city_map_image = nullptr;
- QGraphicsScene *scene_region_map_layout = nullptr;
- QGraphicsScene *scene_region_map_tiles = nullptr;
- QGraphicsScene *scene_city_map_tiles = nullptr;
- TilemapTileSelector *mapsquare_selector_item = nullptr;
- TilemapTileSelector *city_map_selector_item = nullptr;
- RegionMapPixmapItem *region_map_item = nullptr;
- CityMapPixmapItem *city_map_item = nullptr;
- RegionMapLayoutPixmapItem *region_map_layout_item = nullptr;
-
- void displayRegionMap();
- void displayRegionMapImage();
- void displayRegionMapLayout();
- void displayRegionMapLayoutOptions();
- void updateRegionMapLayoutOptions(int);
- void displayRegionMapTileSelector();
- void displayCityMapTileSelector();
- void displayCityMap(QString);
- void loadCityMaps();
-
- void onRegionMapTileSelectorSelectedTileChanged();
- void onRegionMapTileSelectorHoveredTileChanged(unsigned);
- void onRegionMapTileSelectorHoveredTileCleared();
-
- void onRegionMapLayoutSelectedTileChanged(int);
- void onRegionMapLayoutHoveredTileChanged(int);
- void onRegionMapLayoutHoveredTileCleared();
-
-private slots:
- void onHoveredRegionMapTileChanged(int, int);
- void onHoveredRegionMapTileCleared();
- void mouseEvent_region_map(QGraphicsSceneMouseEvent *, RegionMapPixmapItem *);
- void mouseEvent_city_map(QGraphicsSceneMouseEvent *, CityMapPixmapItem *);
-
-public:
- QString rmStatusbarMessage;
-//
-
DraggablePixmapItem *addMapEvent(Event *event);
void selectMapEvent(DraggablePixmapItem *object);
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
@@ -152,7 +105,6 @@ public:
QGraphicsScene *scene_selected_border_metatiles = nullptr;
QGraphicsScene *scene_collision_metatiles = nullptr;
QGraphicsScene *scene_elevation_metatiles = nullptr;
-
MetatileSelector *metatile_selector_item = nullptr;
BorderMetatilesPixmapItem *selected_border_metatiles_item = nullptr;
@@ -164,7 +116,7 @@ public:
QString map_edit_mode;
QString prev_edit_mode;
-
+
int scale_exp = 0;
double scale_base = sqrt(2); // adjust scale factor with this
qreal collisionOpacity = 0.5;
diff --git a/include/mainwindow.h b/include/mainwindow.h
index c875091b..b437f879 100644
--- a/include/mainwindow.h
+++ b/include/mainwindow.h
@@ -15,6 +15,7 @@
#include "map.h"
#include "editor.h"
#include "tileseteditor.h"
+#include "regionmapeditor.h"
#include "filterchildrenproxymodel.h"
#include "newmappopup.h"
@@ -65,10 +66,7 @@ private slots:
void on_checkBox_AllowBiking_clicked(bool checked);
void on_checkBox_AllowEscapeRope_clicked(bool checked);
- void on_tabWidget_Region_Map_currentChanged(int);
-
void on_tabWidget_currentChanged(int index);
- void on_pushButton_RM_Options_save_clicked();
void on_actionUndo_triggered();
@@ -134,9 +132,6 @@ private slots:
void on_pushButton_clicked();
- void on_pushButton_CityMap_save_clicked();
- void on_comboBox_CityMap_picker_currentTextChanged(const QString &);
-
void on_checkBox_smartPaths_stateChanged(int selected);
void on_checkBox_Visibility_clicked(bool checked);
@@ -166,9 +161,12 @@ private slots:
void on_tableWidget_CustomHeaderFields_cellChanged(int row, int column);
void on_horizontalSlider_MetatileZoom_valueChanged(int value);
+ void on_actionRegion_Map_Editor_triggered();
+
private:
Ui::MainWindow *ui;
TilesetEditor *tilesetEditor = nullptr;
+ RegionMapEditor *regionMapEditor = nullptr;
FilterChildrenProxyModel *mapListProxyModel;
NewMapPopup *newmapprompt = nullptr;
QStandardItemModel *mapListModel;
diff --git a/include/ui/regionmapeditor.h b/include/ui/regionmapeditor.h
new file mode 100644
index 00000000..62bef62d
--- /dev/null
+++ b/include/ui/regionmapeditor.h
@@ -0,0 +1,76 @@
+#ifndef REGIONMAPEDITOR_H
+#define REGIONMAPEDITOR_H
+
+#include "regionmappixmapitem.h"
+#include "citymappixmapitem.h"
+#include "regionmaplayoutpixmapitem.h"
+#include "regionmap.h"
+
+#include
+#include
+#include
+
+namespace Ui {
+class RegionMapEditor;
+}
+
+class RegionMapEditor : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ explicit RegionMapEditor(QWidget *parent = 0, Project *pro = nullptr);
+ ~RegionMapEditor();
+
+// TODO: make members that are not called outside of this private
+ RegionMap *region_map;
+
+ QGraphicsScene *scene_region_map_image = nullptr;
+ QGraphicsScene *scene_city_map_image = nullptr;
+ QGraphicsScene *scene_region_map_layout = nullptr;
+ QGraphicsScene *scene_region_map_tiles = nullptr;
+ QGraphicsScene *scene_city_map_tiles = nullptr;
+ TilemapTileSelector *mapsquare_selector_item = nullptr;
+ TilemapTileSelector *city_map_selector_item = nullptr;
+ RegionMapPixmapItem *region_map_item = nullptr;
+ CityMapPixmapItem *city_map_item = nullptr;
+ RegionMapLayoutPixmapItem *region_map_layout_item = nullptr;
+
+ void loadRegionMapData();
+ void displayRegionMap();
+ void displayRegionMapImage();
+ void displayRegionMapLayout();
+ void displayRegionMapLayoutOptions();
+ void updateRegionMapLayoutOptions(int);
+ void displayRegionMapTileSelector();
+ void displayCityMapTileSelector();
+ void displayCityMap(QString);
+ void loadCityMaps();
+
+ void onRegionMapTileSelectorSelectedTileChanged();
+ void onRegionMapTileSelectorHoveredTileChanged(unsigned);
+ void onRegionMapTileSelectorHoveredTileCleared();
+
+ void onRegionMapLayoutSelectedTileChanged(int);
+ void onRegionMapLayoutHoveredTileChanged(int);
+ void onRegionMapLayoutHoveredTileCleared();
+
+private:
+ Ui::RegionMapEditor *ui;
+ Project *project;
+
+ QString rmStatusbarMessage;
+
+private slots:
+ void on_action_RegionMap_Save_triggered();
+ void on_tabWidget_Region_Map_currentChanged(int);
+ void on_pushButton_RM_Options_save_clicked();
+ void on_pushButton_CityMap_save_clicked();
+ void on_comboBox_CityMap_picker_currentTextChanged(const QString &);
+ void onHoveredRegionMapTileChanged(int, int);
+ void onHoveredRegionMapTileCleared();
+ void mouseEvent_region_map(QGraphicsSceneMouseEvent *, RegionMapPixmapItem *);
+ void mouseEvent_city_map(QGraphicsSceneMouseEvent *, CityMapPixmapItem *);
+};
+
+#endif // REGIONMAPEDITOR_H
diff --git a/include/ui/regionmaplayoutpixmapitem.h b/include/ui/regionmaplayoutpixmapitem.h
index 1fca1581..8031f475 100644
--- a/include/ui/regionmaplayoutpixmapitem.h
+++ b/include/ui/regionmaplayoutpixmapitem.h
@@ -2,8 +2,7 @@
#define REGIONMAPLAYOUTPIXMAPITEM_H
#include "tilemaptileselector.h"
-//#include "regionmappixmapitem.h"
-#include "regionmapeditor.h"
+#include "regionmap.h"
class RegionMapLayoutPixmapItem : public SelectablePixmapItem {
Q_OBJECT
diff --git a/include/ui/regionmappixmapitem.h b/include/ui/regionmappixmapitem.h
index 12de3385..0fc11b8c 100644
--- a/include/ui/regionmappixmapitem.h
+++ b/include/ui/regionmappixmapitem.h
@@ -1,7 +1,7 @@
#ifndef REGIONMAPPIXMAPITEM_H
#define REGIONMAPPIXMAPITEM_H
-#include "regionmapeditor.h"
+#include "regionmap.h"
#include "tilemaptileselector.h"
#include
diff --git a/porymap.pro b/porymap.pro
index e7d84510..d2101b98 100644
--- a/porymap.pro
+++ b/porymap.pro
@@ -29,6 +29,7 @@ SOURCES += src/core/block.cpp \
src/core/tile.cpp \
src/core/tileset.cpp \
src/core/regionmapeditor.cpp \
+ src/core/regionmap.cpp \
src/ui/aboutporymap.cpp \
src/ui/bordermetatilespixmapitem.cpp \
src/ui/collisionpixmapitem.cpp \
@@ -58,6 +59,7 @@ SOURCES += src/core/block.cpp \
src/ui/tileseteditormetatileselector.cpp \
src/ui/tileseteditortileselector.cpp \
src/ui/tilemaptileselector.cpp \
+ src/ui/regionmapeditor.cpp \
src/ui/newmappopup.cpp \
src/config.cpp \
src/editor.cpp \
@@ -84,7 +86,8 @@ HEADERS += include/core/block.h \
include/core/tile.h \
include/core/tileset.h \
include/core/regionmapeditor.h \
- include/ui/aboutporymap.h \
+ include/core/regionmap.h \
+ include/ui/aboutporymap.h \
include/ui/bordermetatilespixmapitem.h \
include/ui/collisionpixmapitem.h \
include/ui/connectionpixmapitem.h \
@@ -113,6 +116,7 @@ HEADERS += include/core/block.h \
include/ui/tileseteditormetatileselector.h \
include/ui/tileseteditortileselector.h \
include/ui/tilemaptileselector.h \
+ include/ui/regionmapeditor.h \
include/ui/newmappopup.h \
include/config.h \
include/editor.h \
@@ -125,6 +129,7 @@ FORMS += forms/mainwindow.ui \
forms/eventpropertiesframe.ui \
forms/tileseteditor.ui \
forms/paletteeditor.ui \
+ forms/regionmapeditor.ui \
forms/newmappopup.ui \
forms/aboutporymap.ui
diff --git a/src/core/regionmapeditor.cpp b/src/core/regionmap.cpp
similarity index 99%
rename from src/core/regionmapeditor.cpp
rename to src/core/regionmap.cpp
index a4912852..061f1550 100644
--- a/src/core/regionmapeditor.cpp
+++ b/src/core/regionmap.cpp
@@ -1,4 +1,4 @@
-#include "regionmapeditor.h"
+#include "regionmap.h"
#include
#include
@@ -108,13 +108,6 @@ void RegionMap::init(Project *pro) {
readBkgImgBin();
readLayout();
readCityMaps();
-
- //tryGetMap();
-
- //saveBkgImgBin();
- //saveLayout();
-
- //test();
}
// as of now, this needs to be called first because it initializes all the
diff --git a/src/editor.cpp b/src/editor.cpp
index 2de3a84b..692370e0 100644
--- a/src/editor.cpp
+++ b/src/editor.cpp
@@ -20,17 +20,12 @@ Editor::Editor(Ui::MainWindow* ui)
this->settings = new Settings();
this->playerViewRect = new MovableRect(&this->settings->playerViewRectEnabled, 30 * 8, 20 * 8, qRgb(255, 255, 255));
this->cursorMapTileRect = new CursorTileRect(&this->settings->cursorTileRectEnabled, qRgb(255, 255, 255));
- this->region_map = new RegionMap;// TODO: why is this here?
}
void Editor::saveProject() {
if (project) {
project->saveAllMaps();
project->saveAllDataStructures();
- if (region_map) {
- region_map->save();
- displayRegionMap();
- }
}
}
@@ -39,10 +34,6 @@ void Editor::save() {
project->saveMap(map);
project->saveAllDataStructures();
}
- if (project && region_map) {
- region_map->save();
- displayRegionMap();
- }
}
void Editor::undo() {
@@ -456,17 +447,6 @@ bool Editor::setMap(QString map_name) {
selected_events->clear();
displayMap();
updateSelectedEvents();
-
- if (region_map) {
- for (auto square : region_map->map_squares) {
- if (square.mapsec == map->location) {
- int img_x = square.x + 1;
- int img_y = square.y + 2;
- this->region_map_layout_item->select(img_x, img_y);
- break;
- }
- }
- }
}
return true;
@@ -616,17 +596,11 @@ void Editor::displayMap() {
displayMapBorder();
displayMapGrid();
-<<<<<<< abc873464dc736dcfdda4a20df61516f45478844
this->playerViewRect->setZValue(1000);
this->cursorMapTileRect->setZValue(1001);
scene->addItem(this->playerViewRect);
scene->addItem(this->cursorMapTileRect);
- displayRegionMapTileSelector();//?
- displayRegionMap();
-
-=======
->>>>>>> add layout view to region map editor
if (map_item) {
map_item->setVisible(false);
}
@@ -638,14 +612,6 @@ void Editor::displayMap() {
}
}
-void Editor::displayRegionMap() {
- displayRegionMapTileSelector();
- displayCityMapTileSelector();
- displayRegionMapImage();
- displayRegionMapLayout();
- displayRegionMapLayoutOptions();
-}
-
void Editor::displayMetatileSelector() {
if (metatile_selector_item && metatile_selector_item->scene()) {
metatile_selector_item->scene()->removeItem(metatile_selector_item);
@@ -1296,264 +1262,6 @@ void Editor::deleteEvent(Event *event) {
//updateSelectedObjects();
}
-void Editor::loadCityMaps() {
- //
- QDir directory(project->root + "/graphics/pokenav/city_maps");
- QStringList files = directory.entryList(QStringList() << "*.bin", QDir::Files);
- QStringList without_bin;
- for (QString file : files) {
- without_bin.append(file.remove(".bin"));
- }
- this->ui->comboBox_CityMap_picker->addItems(without_bin);
-}
-
-void Editor::loadRegionMapData() {
- //
- this->region_map->init(project);
- displayRegionMap();
-}
-
-// TODO: get this to display on a decent scale
-void Editor::displayRegionMapTileSelector() {
- //
- this->mapsquare_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_png_path));
- this->mapsquare_selector_item->draw();
-
- this->scene_region_map_tiles = new QGraphicsScene;
- this->scene_region_map_tiles->addItem(this->mapsquare_selector_item);
-
- connect(this->mapsquare_selector_item, &TilemapTileSelector::selectedTileChanged,
- this, &Editor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
- connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileChanged,
- this, &Editor::onRegionMapTileSelectorHoveredTileChanged);
- connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileCleared,
- this, &Editor::onRegionMapTileSelectorHoveredTileCleared);
-
- this->ui->graphicsView_RegionMap_Tiles->setScene(this->scene_region_map_tiles);
- this->ui->graphicsView_RegionMap_Tiles->setFixedSize(this->mapsquare_selector_item->pixelWidth + 2,
- this->mapsquare_selector_item->pixelHeight + 2);
-}
-
-void Editor::displayCityMapTileSelector() {
- // city_map_selector_item
- this->city_map_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_city_map_tiles_path));
- this->city_map_selector_item->draw();
-
- this->scene_city_map_tiles = new QGraphicsScene;
- this->scene_city_map_tiles->addItem(this->city_map_selector_item);
-
- /*connect(this->city_map_selector_item, &TilemapTileSelector::selectedTileChanged,
- this, &Editor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
- connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileChanged,
- this, &Editor::onRegionMapTileSelectorHoveredTileChanged);
- connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileCleared,
- this, &Editor::onRegionMapTileSelectorHoveredTileCleared);*/
-
- this->ui->graphicsView_City_Map_Tiles->setScene(this->scene_city_map_tiles);
- this->ui->graphicsView_City_Map_Tiles->setFixedSize(this->city_map_selector_item->pixelWidth + 2,
- this->city_map_selector_item->pixelHeight + 2);
-}
-
-// TODO: change the signal slot to new syntax
-// TODO: add scalability?
-void Editor::displayRegionMapImage() {
- //
- this->region_map_item = new RegionMapPixmapItem(this->region_map, this->mapsquare_selector_item);
- connect(region_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)),
- this, SLOT(mouseEvent_region_map(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)));
- connect(region_map_item, SIGNAL(hoveredRegionMapTileChanged(int, int)),
- this, SLOT(onHoveredRegionMapTileChanged(int, int)));
- connect(region_map_item, SIGNAL(hoveredRegionMapTileCleared()),
- this, SLOT(onHoveredRegionMapTileCleared()));
- this->region_map_item->draw();
-
- this->scene_region_map_image = new QGraphicsScene;
- this->scene_region_map_image->addItem(this->region_map_item);
- this->scene_region_map_image->setSceneRect(this->scene_region_map_image->sceneRect());
-
- this->ui->graphicsView_Region_Map_BkgImg->setScene(this->scene_region_map_image);
- this->ui->graphicsView_Region_Map_BkgImg->setFixedSize(this->region_map->imgSize());
-}
-
-/*
-if (!scene) {
- scene = new QGraphicsScene;
- MapSceneEventFilter *filter = new MapSceneEventFilter();
- scene->installEventFilter(filter);
- connect(filter, &MapSceneEventFilter::wheelZoom, this, &Editor::wheelZoom);
- }
-
- if (map_item && scene) {
- scene->removeItem(map_item);
- delete map_item;
- }
-*/
-void Editor::displayCityMap(QString f) {
- //
- QString file = this->project->root + "/graphics/pokenav/city_maps/" + f + ".bin";
-
- if (!scene_city_map_image) {
- scene_city_map_image = new QGraphicsScene;
- }
- if (city_map_item && scene_city_map_image) {
- scene_city_map_image->removeItem(city_map_item);
- delete city_map_item;
- }
-
- city_map_item = new CityMapPixmapItem(file, this->city_map_selector_item);
- city_map_item->draw();
-
- connect(city_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)),
- this, SLOT(mouseEvent_city_map(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)));
-
- scene_city_map_image->addItem(city_map_item);
- scene_city_map_image->setSceneRect(this->scene_city_map_image->sceneRect());
-
- this->ui->graphicsView_City_Map->setScene(scene_city_map_image);
- this->ui->graphicsView_City_Map->setFixedSize(QSize(82,82));
- // set fixed size?
-}
-
-// TODO: add if (item) and if(scene) checks because called more than once per instance
-void Editor::displayRegionMapLayout() {
- //
- this->region_map_layout_item = new RegionMapLayoutPixmapItem(this->region_map, this->mapsquare_selector_item);
- //*
- connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::selectedTileChanged,
- this, &Editor::onRegionMapLayoutSelectedTileChanged);// TODO: remove this?
- connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileChanged,
- this, &Editor::onRegionMapLayoutHoveredTileChanged);
- connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileCleared,
- this, &Editor::onRegionMapLayoutHoveredTileCleared);
- //*/
- this->region_map_layout_item->draw();
- this->region_map_layout_item->setDefaultSelection();
-
- this->scene_region_map_layout = new QGraphicsScene;
- this->scene_region_map_layout->addItem(region_map_layout_item);
- this->scene_region_map_layout->setSceneRect(this->scene_region_map_layout->sceneRect());
-
- this->ui->graphicsView_Region_Map_Layout->setScene(this->scene_region_map_layout);
- this->ui->graphicsView_Region_Map_Layout->setFixedSize(this->region_map->imgSize());
-}
-
-void Editor::displayRegionMapLayoutOptions() {
- //
- this->ui->comboBox_RM_ConnectedMap->addItems(*(this->project->regionMapSections));
-
- this->ui->frame_RM_Options->setEnabled(true);
-
- // TODO: change these values to variables
- this->ui->spinBox_RM_Options_x->setMaximum(27);
- this->ui->spinBox_RM_Options_y->setMaximum(14);
-
- updateRegionMapLayoutOptions(65);
-}
-
-void Editor::updateRegionMapLayoutOptions(int index) {
- //
- this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName->value(this->region_map->map_squares[index].mapsec));//this->region_map->map_squares[index].map_name);
- this->ui->comboBox_RM_ConnectedMap->setCurrentText(this->region_map->map_squares[index].mapsec);
- this->ui->spinBox_RM_Options_x->setValue(this->region_map->map_squares[index].x);
- this->ui->spinBox_RM_Options_y->setValue(this->region_map->map_squares[index].y);
-}
-
-void Editor::onRegionMapTileSelectorSelectedTileChanged() {
- //
-}
-
-void Editor::onRegionMapTileSelectorHoveredTileChanged(unsigned tileId) {
- QString message = QString("Tile: 0x") + QString("%1").arg(tileId, 4, 16, QChar('0')).toUpper();
- this->ui->statusBar->showMessage(message);
-}
-
-void Editor::onRegionMapTileSelectorHoveredTileCleared() {
- //
- //QString message = QString("Selected Tile: 0x") + QString("%1").arg(this->region_map_layout_item->selectedTile, 4, 16, QChar('0')).toUpper();
- //this->ui->statusBar->showMessage(message);
-}
-
-void Editor::onRegionMapLayoutSelectedTileChanged(int index) {
- //
- QString message = QString();
- if (this->region_map->map_squares[index].has_map) {
- //
- message = QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
- this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");//.remove("{NAME_END}")
- }
- this->ui->statusBar->showMessage(message);
-
- updateRegionMapLayoutOptions(index);
-}
-
-void Editor::onRegionMapLayoutHoveredTileChanged(int index) {
- // TODO: change to x, y coords not index
- QString message = QString();
- int x = this->region_map->map_squares[index].x;
- int y = this->region_map->map_squares[index].y;
- if (x >= 0 && y >= 0) {
- message = QString("(%1, %2)").arg(x).arg(y);
- if (this->region_map->map_squares[index].has_map) {
- //
- message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
- this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
- }
- }
- this->ui->statusBar->showMessage(message);
-}
-
-void Editor::onRegionMapLayoutHoveredTileCleared() {
- //
- int index = this->region_map_layout_item->selectedTile;
- QString message = QString();
- int x = this->region_map->map_squares[index].x;
- int y = this->region_map->map_squares[index].y;
- if (x >= 0 && y >= 0) {
- message = QString("(%1, %2)").arg(x).arg(y);
- if (this->region_map->map_squares[index].has_map) {
- //
- message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
- this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
- }
- }
- this->ui->statusBar->showMessage(message);
-}
-
-void Editor::onHoveredRegionMapTileChanged(int x, int y) {
- rmStatusbarMessage = QString("x: %1, y: %2 Tile: 0x").arg(x).arg(y) + QString("%1").arg(this->region_map->getTileId(x, y), 4, 16, QChar('0')).toUpper();
- this->ui->statusBar->showMessage(rmStatusbarMessage);
-}
-
-void Editor::onHoveredRegionMapTileCleared() {
- this->ui->statusBar->clearMessage();
-}
-
-void Editor::mouseEvent_region_map(QGraphicsSceneMouseEvent *event, RegionMapPixmapItem *item) {
- //
- if (event->buttons() & Qt::RightButton) {
- //
- item->select(event);
- } else if (event->buttons() & Qt::MiddleButton) {
- // TODO: add functionality here? replace or?
- } else {
- //
- item->paint(event);
- }
-}
-
-void Editor::mouseEvent_city_map(QGraphicsSceneMouseEvent *event, CityMapPixmapItem *item) {
- //
- if (event->buttons() & Qt::RightButton) {
- //
- //item->select(event);
- } else if (event->buttons() & Qt::MiddleButton) {
- // TODO: add functionality here? replace or?
- } else {
- //
- item->paint(event);
- }
-}
-
// It doesn't seem to be possible to prevent the mousePress event
// from triggering both event's DraggablePixmapItem and the background mousePress.
// Since the DraggablePixmapItem's event fires first, we can set a temp
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 7e236504..0c3d3304 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -263,14 +263,11 @@ bool MainWindow::openProject(QString dir) {
setWindowTitle(editor->project->getProjectTitle());
loadDataStructures();
populateMapList();
- editor->loadRegionMapData();
- editor->loadCityMaps();
success = setMap(getDefaultMap(), true);
} else {
setWindowTitle(editor->project->getProjectTitle());
loadDataStructures();
populateMapList();
- editor->loadRegionMapData();
}
if (success) {
@@ -599,11 +596,6 @@ void MainWindow::on_checkBox_AllowEscapeRope_clicked(bool checked)
}
}
-void MainWindow::on_tabWidget_Region_Map_currentChanged(int index) {
- //
- ui->stackedWidget_RM_Options->setCurrentIndex(index);
-}
-
void MainWindow::loadDataStructures() {
Project *project = editor->project;
project->readMapLayouts();
@@ -2004,8 +1996,22 @@ void MainWindow::on_pushButton_CityMap_save_clicked() {
this->editor->city_map_item->save();
}
-void MainWindow::on_comboBox_CityMap_picker_currentTextChanged(const QString &file) {
- this->editor->displayCityMap(file);
+void MainWindow::on_actionRegion_Map_Editor_triggered() {
+ if (!this->regionMapEditor) {
+ this->regionMapEditor = new RegionMapEditor(this, this->editor->project);
+ this->regionMapEditor->loadRegionMapData();
+ this->regionMapEditor->loadCityMaps();
+ connect(this->regionMapEditor, &QObject::destroyed, [=](QObject *) { this->regionMapEditor = nullptr; });
+ this->regionMapEditor->setAttribute(Qt::WA_DeleteOnClose);
+ }
+
+ if (!this->regionMapEditor->isVisible()) {
+ this->regionMapEditor->show();
+ } else if (this->regionMapEditor->isMinimized()) {
+ this->regionMapEditor->showNormal();
+ } else {
+ this->regionMapEditor->activateWindow();
+ }
}
void MainWindow::closeEvent(QCloseEvent *event) {
diff --git a/src/ui/regionmapeditor.cpp b/src/ui/regionmapeditor.cpp
new file mode 100644
index 00000000..f3298832
--- /dev/null
+++ b/src/ui/regionmapeditor.cpp
@@ -0,0 +1,353 @@
+#include "regionmapeditor.h"
+#include "ui_regionmapeditor.h"
+
+#include
+
+RegionMapEditor::RegionMapEditor(QWidget *parent, Project *pro) :
+ QMainWindow(parent),
+ ui(new Ui::RegionMapEditor)
+{
+ ui->setupUi(this);
+ this->project = pro;
+ this->region_map = new RegionMap;
+}
+
+RegionMapEditor::~RegionMapEditor()
+{
+ delete ui;
+}
+
+
+
+void RegionMapEditor::on_action_RegionMap_Save_triggered() {
+ qDebug() << "Region Map Save Triggered";
+ if (project && region_map) {
+ qDebug() << "actually saving";
+ region_map->save();
+ displayRegionMap();
+ }
+}
+
+
+void RegionMapEditor::loadRegionMapData() {
+ //
+ this->region_map->init(project);
+ displayRegionMap();
+}
+
+void RegionMapEditor::loadCityMaps() {
+ //
+ QDir directory(project->root + "/graphics/pokenav/city_maps");
+ QStringList files = directory.entryList(QStringList() << "*.bin", QDir::Files);
+ QStringList without_bin;
+ for (QString file : files) {
+ without_bin.append(file.remove(".bin"));
+ }
+ this->ui->comboBox_CityMap_picker->addItems(without_bin);
+}
+
+void RegionMapEditor::displayRegionMap() {
+ displayRegionMapTileSelector();
+ displayCityMapTileSelector();
+ displayRegionMapImage();
+ displayRegionMapLayout();
+ displayRegionMapLayoutOptions();
+}
+
+// TODO: change the signal slot to new syntax
+// TODO: add scalability?
+void RegionMapEditor::displayRegionMapImage() {
+ //
+ this->region_map_item = new RegionMapPixmapItem(this->region_map, this->mapsquare_selector_item);
+ connect(region_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)),
+ this, SLOT(mouseEvent_region_map(QGraphicsSceneMouseEvent*, RegionMapPixmapItem*)));
+ connect(region_map_item, SIGNAL(hoveredRegionMapTileChanged(int, int)),
+ this, SLOT(onHoveredRegionMapTileChanged(int, int)));
+ connect(region_map_item, SIGNAL(hoveredRegionMapTileCleared()),
+ this, SLOT(onHoveredRegionMapTileCleared()));
+ this->region_map_item->draw();
+
+ this->scene_region_map_image = new QGraphicsScene;
+ this->scene_region_map_image->addItem(this->region_map_item);
+ this->scene_region_map_image->setSceneRect(this->scene_region_map_image->sceneRect());
+
+ this->ui->graphicsView_Region_Map_BkgImg->setScene(this->scene_region_map_image);
+ this->ui->graphicsView_Region_Map_BkgImg->setFixedSize(this->region_map->imgSize());
+}
+
+// TODO: add if (item) and if(scene) checks because called more than once per instance
+void RegionMapEditor::displayRegionMapLayout() {
+ //
+ this->region_map_layout_item = new RegionMapLayoutPixmapItem(this->region_map, this->mapsquare_selector_item);
+ //*
+ connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::selectedTileChanged,
+ this, &RegionMapEditor::onRegionMapLayoutSelectedTileChanged);// TODO: remove this?
+ connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileChanged,
+ this, &RegionMapEditor::onRegionMapLayoutHoveredTileChanged);
+ connect(this->region_map_layout_item, &RegionMapLayoutPixmapItem::hoveredTileCleared,
+ this, &RegionMapEditor::onRegionMapLayoutHoveredTileCleared);
+ //*/
+ this->region_map_layout_item->draw();
+ this->region_map_layout_item->setDefaultSelection();
+
+ this->scene_region_map_layout = new QGraphicsScene;
+ this->scene_region_map_layout->addItem(region_map_layout_item);
+ this->scene_region_map_layout->setSceneRect(this->scene_region_map_layout->sceneRect());
+
+ this->ui->graphicsView_Region_Map_Layout->setScene(this->scene_region_map_layout);
+ this->ui->graphicsView_Region_Map_Layout->setFixedSize(this->region_map->imgSize());
+}
+
+void RegionMapEditor::displayRegionMapLayoutOptions() {
+ //
+ this->ui->comboBox_RM_ConnectedMap->addItems(*(this->project->regionMapSections));
+
+ this->ui->frame_RM_Options->setEnabled(true);
+
+ // TODO: change these values to variables
+ this->ui->spinBox_RM_Options_x->setMaximum(27);
+ this->ui->spinBox_RM_Options_y->setMaximum(14);
+
+ updateRegionMapLayoutOptions(65);
+}
+
+void RegionMapEditor::updateRegionMapLayoutOptions(int index) {
+ //
+ this->ui->lineEdit_RM_MapName->setText(this->project->mapSecToMapHoverName->value(this->region_map->map_squares[index].mapsec));//this->region_map->map_squares[index].map_name);
+ this->ui->comboBox_RM_ConnectedMap->setCurrentText(this->region_map->map_squares[index].mapsec);
+ this->ui->spinBox_RM_Options_x->setValue(this->region_map->map_squares[index].x);
+ this->ui->spinBox_RM_Options_y->setValue(this->region_map->map_squares[index].y);
+}
+
+// TODO: get this to display on a decent scale
+void RegionMapEditor::displayRegionMapTileSelector() {
+ //
+ this->mapsquare_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_png_path));
+ this->mapsquare_selector_item->draw();
+
+ this->scene_region_map_tiles = new QGraphicsScene;
+ this->scene_region_map_tiles->addItem(this->mapsquare_selector_item);
+
+ connect(this->mapsquare_selector_item, &TilemapTileSelector::selectedTileChanged,
+ this, &RegionMapEditor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
+ connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileChanged,
+ this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileChanged);
+ connect(this->mapsquare_selector_item, &TilemapTileSelector::hoveredTileCleared,
+ this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileCleared);
+
+ this->ui->graphicsView_RegionMap_Tiles->setScene(this->scene_region_map_tiles);
+ this->ui->graphicsView_RegionMap_Tiles->setFixedSize(this->mapsquare_selector_item->pixelWidth + 2,
+ this->mapsquare_selector_item->pixelHeight + 2);
+}
+
+void RegionMapEditor::displayCityMapTileSelector() {
+ // city_map_selector_item
+ this->city_map_selector_item = new TilemapTileSelector(QPixmap(this->region_map->region_map_city_map_tiles_path));
+ this->city_map_selector_item->draw();
+
+ this->scene_city_map_tiles = new QGraphicsScene;
+ this->scene_city_map_tiles->addItem(this->city_map_selector_item);
+
+ /*connect(this->city_map_selector_item, &TilemapTileSelector::selectedTileChanged,
+ this, &RegionMapEditor::onRegionMapTileSelectorSelectedTileChanged);// TODO: remove this?
+ connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileChanged,
+ this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileChanged);
+ connect(this->city_map_selector_item, &TilemapTileSelector::hoveredTileCleared,
+ this, &RegionMapEditor::onRegionMapTileSelectorHoveredTileCleared);*/
+
+ this->ui->graphicsView_City_Map_Tiles->setScene(this->scene_city_map_tiles);
+ this->ui->graphicsView_City_Map_Tiles->setFixedSize(this->city_map_selector_item->pixelWidth + 2,
+ this->city_map_selector_item->pixelHeight + 2);
+}
+
+void RegionMapEditor::displayCityMap(QString f) {
+ //
+ QString file = this->project->root + "/graphics/pokenav/city_maps/" + f + ".bin";
+
+ if (!scene_city_map_image) {
+ scene_city_map_image = new QGraphicsScene;
+ }
+ if (city_map_item && scene_city_map_image) {
+ scene_city_map_image->removeItem(city_map_item);
+ delete city_map_item;
+ }
+
+ city_map_item = new CityMapPixmapItem(file, this->city_map_selector_item);
+ city_map_item->draw();
+
+ connect(city_map_item, SIGNAL(mouseEvent(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)),
+ this, SLOT(mouseEvent_city_map(QGraphicsSceneMouseEvent*, CityMapPixmapItem*)));
+
+ scene_city_map_image->addItem(city_map_item);
+ scene_city_map_image->setSceneRect(this->scene_city_map_image->sceneRect());
+
+ this->ui->graphicsView_City_Map->setScene(scene_city_map_image);
+ this->ui->graphicsView_City_Map->setFixedSize(QSize(82,82));
+ // set fixed size?
+}
+
+
+
+
+////
+
+void RegionMapEditor::onRegionMapTileSelectorSelectedTileChanged() {
+ //
+}
+
+void RegionMapEditor::onRegionMapTileSelectorHoveredTileChanged(unsigned tileId) {
+ QString message = QString("Tile: 0x") + QString("%1").arg(tileId, 4, 16, QChar('0')).toUpper();
+ this->ui->statusbar->showMessage(message);
+}
+
+void RegionMapEditor::onRegionMapTileSelectorHoveredTileCleared() {
+ //
+ //QString message = QString("Selected Tile: 0x") + QString("%1").arg(this->region_map_layout_item->selectedTile, 4, 16, QChar('0')).toUpper();
+ //this->ui->statusbar->showMessage(message);
+}
+
+void RegionMapEditor::onRegionMapLayoutSelectedTileChanged(int index) {
+ //
+ QString message = QString();
+ if (this->region_map->map_squares[index].has_map) {
+ //
+ message = QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
+ this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");//.remove("{NAME_END}")
+ }
+ this->ui->statusbar->showMessage(message);
+
+ updateRegionMapLayoutOptions(index);
+}
+
+void RegionMapEditor::onRegionMapLayoutHoveredTileChanged(int index) {
+ // TODO: change to x, y coords not index
+ QString message = QString();
+ int x = this->region_map->map_squares[index].x;
+ int y = this->region_map->map_squares[index].y;
+ if (x >= 0 && y >= 0) {
+ message = QString("(%1, %2)").arg(x).arg(y);
+ if (this->region_map->map_squares[index].has_map) {
+ //
+ message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
+ this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
+ }
+ }
+ this->ui->statusbar->showMessage(message);
+}
+
+void RegionMapEditor::onRegionMapLayoutHoveredTileCleared() {
+ //
+ int index = this->region_map_layout_item->selectedTile;
+ QString message = QString();
+ int x = this->region_map->map_squares[index].x;
+ int y = this->region_map->map_squares[index].y;
+ if (x >= 0 && y >= 0) {
+ message = QString("(%1, %2)").arg(x).arg(y);
+ if (this->region_map->map_squares[index].has_map) {
+ //
+ message += QString("Map: %1").arg(this->project->mapSecToMapHoverName->value(
+ this->region_map->map_squares[index].mapsec)).remove("{NAME_END}");
+ }
+ }
+ this->ui->statusbar->showMessage(message);
+}
+
+void RegionMapEditor::onHoveredRegionMapTileChanged(int x, int y) {
+ rmStatusbarMessage = QString("x: %1, y: %2 Tile: 0x").arg(x).arg(y) + QString("%1").arg(this->region_map->getTileId(x, y), 4, 16, QChar('0')).toUpper();
+ this->ui->statusbar->showMessage(rmStatusbarMessage);
+}
+
+void RegionMapEditor::onHoveredRegionMapTileCleared() {
+ this->ui->statusbar->clearMessage();
+}
+
+void RegionMapEditor::mouseEvent_region_map(QGraphicsSceneMouseEvent *event, RegionMapPixmapItem *item) {
+ //
+ if (event->buttons() & Qt::RightButton) {
+ //
+ item->select(event);
+ } else if (event->buttons() & Qt::MiddleButton) {
+ // TODO: add functionality here? replace or?
+ } else {
+ //
+ item->paint(event);
+ }
+}
+
+void RegionMapEditor::mouseEvent_city_map(QGraphicsSceneMouseEvent *event, CityMapPixmapItem *item) {
+ //
+ if (event->buttons() & Qt::RightButton) {
+ //
+ //item->select(event);
+ } else if (event->buttons() & Qt::MiddleButton) {
+ // TODO: add functionality here? replace or?
+ } else {
+ //
+ item->paint(event);
+ }
+}
+
+
+
+
+
+
+
+
+////
+
+void RegionMapEditor::on_tabWidget_Region_Map_currentChanged(int index) {
+ //
+ this->ui->stackedWidget_RM_Options->setCurrentIndex(index);
+}
+
+void RegionMapEditor::on_pushButton_RM_Options_save_clicked() {
+ //
+ this->region_map->saveOptions(
+ //
+ this->region_map_layout_item->selectedTile,
+ this->ui->comboBox_RM_ConnectedMap->currentText(),
+ this->ui->lineEdit_RM_MapName->text(),
+ this->ui->spinBox_RM_Options_x->value(),
+ this->ui->spinBox_RM_Options_y->value()
+ );
+ this->region_map_layout_item->draw();
+}
+
+void RegionMapEditor::on_pushButton_CityMap_save_clicked() {
+ this->city_map_item->save();
+}
+
+void RegionMapEditor::on_comboBox_CityMap_picker_currentTextChanged(const QString &file) {
+ this->displayCityMap(file);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+